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

Re: [Xen-devel] [PATCH v4 07/16] xen/mem_event: Abstract architecture specific sanity checks






On Fri, Sep 5, 2014 at 11:44 AM, Jan Beulich <JBeulich@xxxxxxxx> wrote:
>>> On 05.09.14 at 11:35, <tamas.lengyel@xxxxxxxxxxxx> wrote:
> On Fri, Sep 5, 2014 at 11:28 AM, Jan Beulich <JBeulich@xxxxxxxx> wrote:
>
>> >>> On 05.09.14 at 10:58, <tklengyel@xxxxxxxxxxxxx> wrote:
>> > --- a/xen/include/asm-x86/p2m.h
>> > +++ b/xen/include/asm-x86/p2m.h
>> > @@ -611,6 +611,20 @@ long p2m_set_mem_access(struct domain *d, unsigned
>> long start_pfn, uint32_t nr,
>> >  int p2m_get_mem_access(struct domain *d, unsigned long pfn,
>> >                         xenmem_access_t *access);
>> >
>> > +/* Sanity check for mem_event hardware support */
>> > +static inline bool_t p2m_mem_event_sanity_check(struct domain *d)
>> > +{
>> > +    /* Only HAP is supported */
>> > +    if ( !hap_enabled(d) )
>> > +        return 0;
>> > +
>> > +    /* Currently only EPT is supported */
>> > +    if ( !cpu_has_vmx )
>> > +        return 0;
>> > +
>> > +    return 1;
>> > +}
>>
>> For simple inline functions like this, may I suggest have them a use
>> simple return statement:
>>
>>     return hap_enabled(d) && cpu_has_vmx;
>>
>>
> Surely, my aim here really was just to minimize look&feel changes compared
> to existing code. The current approach might be a tiny bit faster on
> domains without hap,

Why would that be?

Jan


Never mind, rethinking it the compact one-liner version doesn't evaluate the part after && if the first half already failed, same as it is now.

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