[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH RESEND v5 4/6] xen/arm: Implement virtual-linear page table for guest p2m mapping in live migration
> > > + > > > + second_lvl_page = alloc_domheap_pages(NULL, 1, 0); > > > > There'd be no harm in allocating the two pages separately I think, and > > avoiding the possiblilty of an order 1 allocation failing. > > > > But if you do allocate them contiguously then d->arch.dirty.second_lvl > > can be a simple lpae_t * and you can just access offsets 0..1023 > > without worrying about managing the array of two pointers. > > > > As it stands I think you have the worst of both worlds. > > > > We could also just consider allocating all firstlevel p2m pages from > > the xenheap instead of the domheap. > > OK. xenheap allocation sounds good. I was not sure if I can use xenheap > for the one that looks like 'domain-specific' purpose. If it's OK, it > would be much better code readability. > > > > > > + if ( second_lvl_page == NULL ) > > > + return -ENOMEM; > > > + > > > + /* First level p2m is 2 consecutive pages */ > > > + d->arch.dirty.second_lvl[0] = map_domain_page_global( > > > + page_to_mfn(second_lvl_page) ); > > > + d->arch.dirty.second_lvl[1] = map_domain_page_global( > > > + > > > + page_to_mfn(second_lvl_page+1) ); > > > + > > > + first[0] = __map_domain_page(p2m->first_level); > > > + first[1] = __map_domain_page(p2m->first_level+1); > > > + for ( i = gp2m_start_index; i < gp2m_end_index; ++i ) > > > > Can't this just be a loop over 0..1023 and avoid all this modular > > arithmetic: > > Sure. CTTOI, since p2m->first_level consists of 2 pages, we can't just loop over 0..1023, unless we have an improved map_domain_page that can map consecutive pages. One way to avoid the modular arithmetic is to use nested loop; loop over first_level and then loop inside a first_level page. I think this one (nested loop) is better than modular arithmetic. Jaeyong _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |