Re: [PATCH 2/6] KVM: use kvm_{test,clear}_request instead of {test,clear}_bit

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

 



On 04/06/2017 10:20 PM, Radim Krčmář wrote:
> Users were expected to use kvm_check_request() for testing and clearing,
> but request have expanded their use since then and some users want to
> only test or do a faster clear.
> 
> Make sure that requests are not directly accessed with bit operations, because
> we'll be clearing them later.
> 
> Signed-off-by: Radim Krčmář <rkrcmar@xxxxxxxxxx>

Patch itself looks sane
Reviewed-by: Christian Borntraeger <borntraeger@xxxxxxxxxx>


one question:
>  static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
>  {
> -	if (test_bit(req, &vcpu->requests)) {
> -		clear_bit(req, &vcpu->requests);
> +	if (kvm_test_request(req, vcpu)) {
> +		kvm_clear_request(req, vcpu);

This looks fine. I am just asking myself why we do not use
test_and_clear_bit? Do we expect gcc to merge all test bits as
a fast path? This does not seem to work as far as I can tell and
almost everybody does a fast path like in



arch/s390/kvm/kvm-s390.c:
        if (!vcpu->requests)
                return 0;

arch/x86/kvm/x86.c:
    if (vcpu->requests) {

> 
>  		/*
>  		 * Ensure the rest of the request is visible to kvm_check_request's
> 




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux