# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Date 1171867951 -32400 # Node ID 4fa9b86d41b8faeeb4338dabe62956ecb359b475 # Parent b5fc88aad1b0eb35d12e503982c70fdc27f0544a acm catch up for expandable grant table. only compile-test is done. PATCHNAME: grow_granttable_acm Signed-off-by: Isaku Yamahata diff -r b5fc88aad1b0 -r 4fa9b86d41b8 xen/acm/acm_simple_type_enforcement_hooks.c --- a/xen/acm/acm_simple_type_enforcement_hooks.c Sun Feb 18 15:29:40 2007 +0000 +++ b/xen/acm/acm_simple_type_enforcement_hooks.c Mon Feb 19 15:52:31 2007 +0900 @@ -234,18 +234,16 @@ ste_init_state(struct acm_ste_policy_buf } } /* b) check for grant table conflicts on shared pages */ - if ((*pd)->grant_table->shared == NULL) { - printkd("%s: Grant ... sharing for domain %x not setup!\n", __func__, (*pd)->domain_id); - continue; - } - for ( i = 0; i < NR_GRANT_ENTRIES; i++ ) { - sha_copy = (*pd)->grant_table->shared[i]; + spin_lock(&(*pd)->grant_table->lock); + for ( i = 0; i < nr_grant_entries((*pd)->grant_table); i++ ) { + sha_copy = shared_entry((*pd)->grant_table, i); if ( sha_copy.flags ) { printkd("%s: grant dom (%hu) SHARED (%d) flags:(%hx) dom:(%hu) frame:(%lx)\n", __func__, (*pd)->domain_id, i, sha_copy.flags, sha_copy.domid, (unsigned long)sha_copy.frame); rdomid = sha_copy.domid; if ((rdom = get_domain_by_id(rdomid)) == NULL) { + spin_unlock(&(*pd)->grant_table->lock); printkd("%s: domain not found ERROR!\n", __func__); goto out; }; @@ -253,14 +251,17 @@ ste_init_state(struct acm_ste_policy_buf ste_rssid = GET_SSIDP(ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY, (struct acm_ssid_domain *)(rdom->ssid)); ste_rssidref = ste_rssid->ste_ssidref; - put_domain(rdom); if (!have_common_type(ste_ssidref, ste_rssidref)) { + spin_unlock(&(*pd)->grant_table->lock); printkd("%s: Policy violation in grant table sharing domain %x -> domain %x.\n", __func__, (*pd)->domain_id, rdomid); + put_domain(rdom); goto out; } + put_domain(rdom); } } + spin_unlock(&(*pd)->grant_table->lock); } violation = 0; out: diff -r b5fc88aad1b0 -r 4fa9b86d41b8 xen/common/grant_table.c --- a/xen/common/grant_table.c Sun Feb 18 15:29:40 2007 +0000 +++ b/xen/common/grant_table.c Mon Feb 19 15:52:31 2007 +0900 @@ -100,9 +100,6 @@ nr_active_grant_frames(struct grant_tabl return num_act_frames_from_sha_frames(nr_grant_frames(gt)); } -#define SHGNT_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_t)) -#define shared_entry(t, e) \ - ((t)->shared[(e)/SHGNT_PER_PAGE][(e)%SHGNT_PER_PAGE]) #define ACGNT_PER_PAGE (PAGE_SIZE / sizeof(struct active_grant_entry)) #define active_entry(t, e) \ ((t)->active[(e)/ACGNT_PER_PAGE][(e)%ACGNT_PER_PAGE]) diff -r b5fc88aad1b0 -r 4fa9b86d41b8 xen/include/xen/grant_table.h --- a/xen/include/xen/grant_table.h Sun Feb 18 15:29:40 2007 +0000 +++ b/xen/include/xen/grant_table.h Mon Feb 19 15:52:31 2007 +0900 @@ -120,4 +120,9 @@ static inline unsigned int nr_grant_entr return (nr_grant_frames(gt) << PAGE_SHIFT) / sizeof(grant_entry_t); } +/* for acm_cimple_type_enforcement_hooks.c */ +#define SHGNT_PER_PAGE (PAGE_SIZE / sizeof(grant_entry_t)) +#define shared_entry(t, e) \ + ((t)->shared[(e)/SHGNT_PER_PAGE][(e)%SHGNT_PER_PAGE]) + #endif /* __XEN_GRANT_TABLE_H__ */