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

Re: [Xen-devel] [V9 PATCH 6/8] pvh dom0: Add and remove foreign pages



At 12:13 -0400 on 23 Apr (1398251599), Andres Lagar-Cavilla wrote:
> 
> On Apr 23, 2014, at 5:03 AM, "Jan Beulich" <JBeulich@xxxxxxxx> wrote:
> 
> >>>> On 23.04.14 at 02:28, <mukesh.rathor@xxxxxxxxxx> wrote:
> >> On Tue, 22 Apr 2014 08:28:45 +0100
> >> "Jan Beulich" <JBeulich@xxxxxxxx> wrote:
> >> 
> >>>>>> On 22.04.14 at 02:19, <mukesh.rathor@xxxxxxxxxx> wrote:
> >>>> On Wed, 16 Apr 2014 18:37:42 -0700
> >>>> Mukesh Rathor <mukesh.rathor@xxxxxxxxxx> wrote:
> >>>> 
> >>>>> On Wed, 16 Apr 2014 17:00:35 +0100
> >>>>> "Jan Beulich" <JBeulich@xxxxxxxx> wrote:
> >>>>> 
> >> ............
> >> 
> >>>>     /* following will take a refcnt on the mfn */
> >>>>     page = get_page_from_gfn(fdom, fgfn, &p2mt, P2M_ALLOC);
> >>>> -    if ( !page || !p2m_is_valid(p2mt) )
> >>>> +    if ( !page || !p2m_is_strict_ram(p2mt) )
> >>>>     {
> >>>>         if ( page )
> >>>>             put_page(page);
> >>>> diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
> >>>> index 47604da..e0bf6dc 100644
> >>>> --- a/xen/include/asm-x86/p2m.h
> >>>> +++ b/xen/include/asm-x86/p2m.h
> >>>> @@ -165,6 +165,7 @@ typedef unsigned int p2m_query_t;
> >>>> 
> >>>> /* Useful predicates */
> >>>> +#define p2m_is_strict_ram(_t) (p2m_to_mask(_t) &
> >>>> p2m_to_mask(p2m_ram_rw))
> >>> 
> >>> Not sure - this now precludes mapping log-dirty or r/o pages, i.e. I
> >>> think you went from too relaxed to too strict. I think the question
> >>> needs answering in a more abstract fashion first, i.e. without code
> >>> written immediately: Which pages absolutely need to be foreign-
> >>> mappable and which ones can safely get foreign-mapped. My first
> >>> thought would be P2M_RAM_TYPES & ~P2M_HOLE_TYPES, with
> >>> P2M_HOLE_TYPES contained in P2M_RAM_TYPES generating a kind
> >>> of -EAGAIN notification while triggering the re-creation of the page
> >>> (which already is an indication that instead of P2M_HOLE_TYPES it
> >>> might well need to be P2M_PAGING_TYPES).
> >> 
> >> The current use case is p2m_ram_rw, my approach would be start with 
> >> minimum and add more as needed when features like migration, passthru, etc
> >> are added. My understanding of the various p2m types is limited, so I
> >> am at your mercy here to advise what types to anticipate. IMO, just
> >> checking for P2M_RAM_TYPES might suffice, I can additionally add check
> >> to make sure it's not P2M_HOLE_TYPES. Please lmk.
> > 
> > It's clear that p2m_ram_rw is too narrow: p2m_ram_ro and
> > p2m_ram_logdirty will minimally also need accepting here. As for the
> > paging/paged and shared types, I have to defer to the respective
> > maintainers - Andres, Tim?
> Not entirely sure on the context, Hence:
> 
> If you need types that represent p2m backed by actual host pages with 
> up-to-date contents, although possibly with limited permissions:
> _ram_rw | _ram_ro | _ram_logdiry | _ram_paging_out | _ram_shared

That looks OK to me, but with the caveat that you must be very careful
about mapping shared pages!  Needs to be mapped read-only or else
unshared first.

> Consider also the _grant_map_r[w|o] types (they also fall under the first 
> category).

I think we can disallow those, on the grounds that the equivalent PV
operation doesn't handle them either.

Tim.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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