summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgarypen <none@none>2008-04-11 04:29:29 -0700
committergarypen <none@none>2008-04-11 04:29:29 -0700
commit1213c83ce2fb532568bfa425dbbf54fef3414387 (patch)
tree332a261f48b784a26f4f2071341ed35b680994a0
parent2b3ecdeb32aab9a01194518a0459b6515b9da9bb (diff)
downloadillumos-gate-1213c83ce2fb532568bfa425dbbf54fef3414387.tar.gz
6683894 grant tables and free list don't have the same number of entries
-rw-r--r--usr/src/uts/common/xen/os/gnttab.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/usr/src/uts/common/xen/os/gnttab.c b/usr/src/uts/common/xen/os/gnttab.c
index 3722152b6c..c496d0947c 100644
--- a/usr/src/uts/common/xen/os/gnttab.c
+++ b/usr/src/uts/common/xen/os/gnttab.c
@@ -167,13 +167,18 @@ static int
grow_gnttab_list(uint_t more_frames)
{
uint_t new_nr_grant_frames, extra_entries, i;
+ uint_t nr_glist_frames, new_nr_glist_frames;
ASSERT(MUTEX_HELD(&gnttab_list_lock));
new_nr_grant_frames = nr_grant_frames + more_frames;
extra_entries = more_frames * GREFS_PER_GRANT_FRAME;
- for (i = nr_grant_frames; i < new_nr_grant_frames; i++)
+ nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1)
+ / RPP;
+ new_nr_glist_frames = (new_nr_grant_frames * GREFS_PER_GRANT_FRAME
+ + RPP - 1) / RPP;
+ for (i = nr_glist_frames; i < new_nr_glist_frames; i++)
gnttab_list[i] = kmem_alloc(PAGESIZE, KM_SLEEP);
for (i = GREFS_PER_GRANT_FRAME * nr_grant_frames;
@@ -565,7 +570,7 @@ gnttab_init(void)
{
gnttab_setup_table_t set;
int i;
- uint_t nr_init_grefs, max_nr_glist_frames;
+ uint_t nr_init_grefs, max_nr_glist_frames, nr_glist_frames;
gnttab_frame_t *frames;
/*
@@ -577,7 +582,7 @@ gnttab_init(void)
mutex_exit(&gnttab_list_lock);
max_nr_glist_frames = (max_nr_grant_frames() *
- GREFS_PER_GRANT_FRAME / (PAGESIZE / sizeof (grant_ref_t)));
+ GREFS_PER_GRANT_FRAME / RPP);
set.dom = DOMID_SELF;
set.nr_frames = max_nr_grant_frames();
@@ -601,7 +606,9 @@ gnttab_init(void)
gnttab_list = kmem_alloc(max_nr_glist_frames * sizeof (grant_ref_t *),
KM_SLEEP);
- for (i = 0; i < nr_grant_frames; i++) {
+ nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1)
+ / RPP;
+ for (i = 0; i < nr_glist_frames; i++) {
gnttab_list[i] = kmem_alloc(PAGESIZE, KM_SLEEP);
}