[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 7/8] x86/mm: handle foreign mappings in p2m_entry_modify



On Thu, Feb 07, 2019 at 06:05:24PM +0000, George Dunlap wrote:
> On 2/7/19 5:57 PM, Roger Pau Monné wrote:
> > On Thu, Feb 07, 2019 at 05:49:16PM +0000, George Dunlap wrote:
> >> On 1/30/19 10:36 AM, Roger Pau Monne wrote:
> >>> diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
> >>> index 834d49d2d4..1cc8acb3fe 100644
> >>> --- a/xen/include/asm-x86/p2m.h
> >>> +++ b/xen/include/asm-x86/p2m.h
> >>> @@ -933,9 +933,12 @@ struct hvm_ioreq_server *p2m_get_ioreq_server(struct 
> >>> domain *d,
> >>>                                                unsigned int *flags);
> >>>  
> >>>  static inline void p2m_entry_modify(struct p2m_domain *p2m, p2m_type_t 
> >>> nt,
> >>> -                                    p2m_type_t ot, unsigned int level)
> >>> +                                    p2m_type_t ot, mfn_t nfn, mfn_t ofn,
> >>> +                                    unsigned int level)
> >>>  {
> >>> -    if ( level != 1 || nt == ot )
> >>> +    struct page_info *pg;
> >>> +
> >>> +    if ( level != 1 || (nt == ot && mfn_eq(nfn, ofn)) )
> >>>          return;
> >>
> >> Are you sure that foreign mappings (or ioreq server pages, for that
> >> matter) can never be level > 1?
> > 
> > Not given the current Xen interface, see
> > XENMEM_add_to_physmap{_batch}. This will have to change if the
> > interface is expanded to allow 2M or 1G mappings.
> 
> Right; but the question really meant to say: If such an interface
> expansion happened, are you sure the person who did it would remember to
> handle larger pages down here?

I've added:

BUG_ON(level > 1 && (nt == p2m_ioreq_server || nt == p2m_map_foreign));

At the top of the function. This will catch any attempt to add any of
such mappings with an order different than 4K.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.