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

Re: [Xen-devel] [PATCH] passthrough/pci: properly qualify the mem_sharing_enabled check...



> -----Original Message-----
> From: Jan Beulich <JBeulich@xxxxxxxx>
> Sent: 03 July 2019 14:30
> To: Paul Durrant <Paul.Durrant@xxxxxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>; George Dunlap 
> <George.Dunlap@xxxxxxxxxx>; Roger Pau
> Monne <roger.pau@xxxxxxxxxx>; Tamas KLengyel <tamas@xxxxxxxxxxxxx>; WeiLiu 
> <wl@xxxxxxx>
> Subject: Re: [PATCH] passthrough/pci: properly qualify the 
> mem_sharing_enabled check...
> 
> On 03.07.2019 15:25, Paul Durrant wrote:
> >> -----Original Message-----
> >> From: Jan Beulich <JBeulich@xxxxxxxx>
> >> Sent: 03 July 2019 14:20
> >> To: Paul Durrant <Paul.Durrant@xxxxxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
> >> Cc: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>; Roger Pau Monne 
> >> <roger.pau@xxxxxxxxxx>; George
> Dunlap
> >> <George.Dunlap@xxxxxxxxxx>; Tamas K Lengyel <tamas@xxxxxxxxxxxxx>; WeiLiu 
> >> <wl@xxxxxxx>
> >> Subject: Re: [PATCH] passthrough/pci: properly qualify the 
> >> mem_sharing_enabled check...
> >>
> >> On 01.07.2019 15:17, Paul Durrant wrote:
> >>> --- a/xen/drivers/passthrough/pci.c
> >>> +++ b/xen/drivers/passthrough/pci.c
> >>> @@ -1450,7 +1450,7 @@ static int assign_device(struct domain *d, u16 seg, 
> >>> u8 bus, u8 devfn, u32
> >> flag)
> >>>
> >>>        /* Prevent device assign if mem paging or mem sharing have been
> >>>         * enabled for this domain */
> >>> -    if ( unlikely(d->arch.hvm.mem_sharing_enabled ||
> >>> +    if ( unlikely(mem_sharing_enabled(d) ||
> >>>                      vm_event_check_ring(d->vm_event_paging) ||
> >>>                      p2m_get_hostp2m(d)->global_logdirty) )
> >>>            return -EXDEV;
> >>
> >> This change is redundant with the more extensive one by
> >> "x86/HVM: p2m_ram_ro is incompatible with device pass-through",
> >> of which I've sent v2 earlier today, and v1 of which has been
> >> pending for quite some time without having heard back from
> >> other than you.
> >
> > Agreed, but I still think it's a good idea to move the
> > mem_sharing_enabled() macro into domain.h, so maybe incorporate
> > that into your patch?
> 
> Hmm, that would actually have been a question of mine if I hadn't
> recognized the redundancy: Why domain.h rather than mem_sharing.h?
> Furthermore I'd rather not use it here anyway, to avoid two
> consecutive is_hvm_*() checks (which have become slightly more
> expensive with the LFENCE addition).

Maybe mem_sharing.h is a more logical location, but I think providing a macro 
to make sure the is_hvm_domain() protection is there is a good thing. As for 
using it here, yes I guess the addition of the speculation barrier makes it 
more expensive but then is not really performance critical code so I'd go for 
tidiness.

  Paul


> 
> Jan
_______________________________________________
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®.