Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1618725

Re: [PATCH RFC 5/6] KVM: mark requests that do not need a wakeup

From Radim Krčmář <rkrcmar@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH RFC 5/6] KVM: mark requests that do not need a wakeup
Date 2017-04-07 14:30 +0200
Message-ID <ttBbA-70Z-5@gated-at.bofh.it> (permalink)
References <ttmcx-5J2-7@gated-at.bofh.it> <ttmcx-5J2-5@gated-at.bofh.it> <ttxrj-4E7-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


2017-04-07 09:27+0100, Marc Zyngier:
> On 06/04/17 21:20, Radim Krčmář wrote:
>> Some operations must ensure that the guest is not running with stale
>> data, but if the guest is halted, then the update can wait until another
>> event happens.  kvm_make_all_requests() currently doesn't wake up, so we
>> can mark all requests used with it.
>> 
>> First 8 bits were arbitrarily reserved for request numbers.
>> 
>> Most uses of requests have the request type as a constant, so a compiler
>> will optimize the '&'.
>> 
>> An alternative would be to have an inline function that would return
>> whether the request needs a wake-up or not, but I like this one better
>> even though it might produce worse assembly.
>> 
>> Suggested-by: Christoffer Dall <cdall@linaro.org>
>> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
>> ---
>>   Btw. do you recall which macro allowed to define bitmasks?  (It has
>>   two arguments, FROM and TO.)
> 
> GENMASK (and its _ULL variant), defined in include/linux/bitops.h.

Thank you, it is under BIT() ... I am blind.

> +#define KVM_REQUEST_MASK           0xff

The 0xff should be "GENMASK(7,0)".

First 8 bits is plenty and should be fast even if the compiler doesn't
optimize the masking because request is not constant.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH RFC 5/6] KVM: mark requests that do not need a wakeup Radim Krčmář <rkrcmar@redhat.com> - 2017-04-06 22:30 +0200
  Re: [PATCH RFC 5/6] KVM: mark requests that do not need a wakeup Marc Zyngier <marc.zyngier@arm.com> - 2017-04-07 10:30 +0200
    Re: [PATCH RFC 5/6] KVM: mark requests that do not need a wakeup Radim Krčmář <rkrcmar@redhat.com> - 2017-04-07 14:30 +0200

csiph-web