ia64/xen-unstable

changeset 14009:184db7a674d9

acm: Further fixes after grant-table changes.
Based on a patch from Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Mon Feb 19 16:05:34 2007 +0000 (2007-02-19)
parents 3b7bdb7bd130
children 01476c7804b2
files xen/acm/acm_simple_type_enforcement_hooks.c
line diff
     1.1 --- a/xen/acm/acm_simple_type_enforcement_hooks.c	Mon Feb 19 15:52:51 2007 +0000
     1.2 +++ b/xen/acm/acm_simple_type_enforcement_hooks.c	Mon Feb 19 16:05:34 2007 +0000
     1.3 @@ -177,7 +177,7 @@ ste_init_state(struct acm_ste_policy_buf
     1.4      ssidref_t ste_ssidref, ste_rssidref;
     1.5      struct domain **pd, *rdom;
     1.6      domid_t rdomid;
     1.7 -    struct grant_entry *sha_copy;
     1.8 +    struct grant_entry sha_copy;
     1.9      int port, i;
    1.10  
    1.11      read_lock(&domlist_lock); /* go by domain? or directly by global? event/grant list */
    1.12 @@ -234,20 +234,18 @@ ste_init_state(struct acm_ste_policy_buf
    1.13              }
    1.14          } 
    1.15          /* b) check for grant table conflicts on shared pages */
    1.16 -        if ((*pd)->grant_table->shared == NULL) {
    1.17 -            printkd("%s: Grant ... sharing for domain %x not setup!\n", __func__, (*pd)->domain_id);
    1.18 -            continue;
    1.19 -        }
    1.20 +        spin_lock(&(*pd)->grant_table->lock);
    1.21          for ( i = 0; i < nr_grant_frames((*pd)->grant_table); i++ ) {
    1.22 -            sha_copy =  (*pd)->grant_table->shared[i];
    1.23 -            if ( sha_copy->flags ) {
    1.24 +#define SPP (PAGE_SIZE / sizeof(struct grant_entry))
    1.25 +            sha_copy = (*pd)->grant_table->shared[i/SPP][i%SPP];
    1.26 +            if ( sha_copy.flags ) {
    1.27                  printkd("%s: grant dom (%hu) SHARED (%d) flags:(%hx) dom:(%hu) frame:(%lx)\n",
    1.28                          __func__, (*pd)->domain_id, i, sha_copy.flags, sha_copy.domid, 
    1.29                          (unsigned long)sha_copy.frame);
    1.30 -                rdomid = sha_copy->domid;
    1.31 +                rdomid = sha_copy.domid;
    1.32                  if ((rdom = get_domain_by_id(rdomid)) == NULL) {
    1.33                      printkd("%s: domain not found ERROR!\n", __func__);
    1.34 -                    goto out;
    1.35 +                    goto out_gnttab;
    1.36                  };
    1.37                  /* rdom now has remote domain */
    1.38                  ste_rssid = GET_SSIDP(ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY, 
    1.39 @@ -257,12 +255,14 @@ ste_init_state(struct acm_ste_policy_buf
    1.40                  if (!have_common_type(ste_ssidref, ste_rssidref)) {
    1.41                      printkd("%s: Policy violation in grant table sharing domain %x -> domain %x.\n",
    1.42                              __func__, (*pd)->domain_id, rdomid);
    1.43 -                    goto out;
    1.44 +                    goto out_gnttab;
    1.45                  }
    1.46              }
    1.47          }
    1.48      }
    1.49      violation = 0;
    1.50 + out_gnttab:
    1.51 +    spin_unlock(&(*pd)->grant_table->lock);
    1.52   out:
    1.53      read_unlock(&domlist_lock);
    1.54      return violation;