Skip to contentSkip to conversation

Traverse event channels and use active grant tables instead of shared ones

PATCH New Stefan Berger 1 participant 1 message Feb 28, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Traverse event channels and use active grant tables instead of shared ones

This patch fixes the traversal of the event channel buckets and makes the function use the active grant table entries instead of the shared ones. I had to move some functions from grant_table.c into grant_table.h to make them usable by the ACM module.

xen-unstable.hg/xen/common/grant_table.c +0 -21
Index: root/xen-unstable.hg/xen/common/grant_table.c
===================================================================
@@ -78,27 +78,6 @@ static unsigned inline int max_nr_maptra
     return (max_nr_grant_frames * MAX_MAPTRACK_TO_GRANTS_RATIO);
 }
 
-static inline unsigned int
-num_act_frames_from_sha_frames(const unsigned int num)
-{
-    /* How many frames are needed for the active grant table,
-     * given the size of the shared grant table?
-     *
-     * act_per_page = PAGE_SIZE / sizeof(active_grant_entry_t);
-     * sha_per_page = PAGE_SIZE / sizeof(grant_entry_t);
-     * num_sha_entries = num * sha_per_page;
-     * num_act_frames = (num_sha_entries + (act_per_page-1)) / act_per_page;
-     */
-    return ((num * (PAGE_SIZE / sizeof(grant_entry_t))) +
-            ((PAGE_SIZE / sizeof(struct active_grant_entry))-1))
-           / (PAGE_SIZE / sizeof(struct active_grant_entry));
-}
-
-static inline unsigned int
-nr_active_grant_frames(struct grant_table *gt)
-{
-    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) \
xen-unstable.hg/xen/include/xen/grant_table.h +22 -0
Index: root/xen-unstable.hg/xen/include/xen/grant_table.h
===================================================================
@@ -120,4 +120,26 @@ static inline unsigned int nr_grant_entr
     return (nr_grant_frames(gt) << PAGE_SHIFT) / sizeof(grant_entry_t);
 }
 
+static inline unsigned int
+num_act_frames_from_sha_frames(const unsigned int num)
+{
+    /* How many frames are needed for the active grant table,
+     * given the size of the shared grant table?
+     *
+     * act_per_page = PAGE_SIZE / sizeof(active_grant_entry_t);
+     * sha_per_page = PAGE_SIZE / sizeof(grant_entry_t);
+     * num_sha_entries = num * sha_per_page;
+     * num_act_frames = (num_sha_entries + (act_per_page-1)) / act_per_page;
+     */
+    return ((num * (PAGE_SIZE / sizeof(grant_entry_t))) +
+            ((PAGE_SIZE / sizeof(struct active_grant_entry))-1))
+           / (PAGE_SIZE / sizeof(struct active_grant_entry));
+}
+
+static inline unsigned int
+nr_active_grant_frames(struct grant_table *gt)
+{
+    return num_act_frames_from_sha_frames(nr_grant_frames(gt));
+}
+
 #endif /* __XEN_GRANT_TABLE_H__ */
xen-unstable.hg/xen/acm/acm_simple_type_enforcement_hooks.c +46 -35

117 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel