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


Groups > linux.kernel > #1681503

Re: [PATCH] kvm: avoid unused variable warning for UP builds

From David Hildenbrand <david@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] kvm: avoid unused variable warning for UP builds
Date 2017-07-05 14:30 +0200
Message-ID <tZRBo-6aJ-17@gated-at.bofh.it> (permalink)
References <tZPSX-537-45@gated-at.bofh.it> <tZRBo-6aJ-19@gated-at.bofh.it> <tZRBo-6aJ-21@gated-at.bofh.it>
Organization Red Hat GmbH

Show all headers | View raw


On 05.07.2017 14:24, Paolo Bonzini wrote:
> 
> 
> On 05/07/2017 14:22, David Hildenbrand wrote:
>>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>>> index f0fe9d02f6bb..09368501d9cf 100644
>>> --- a/virt/kvm/kvm_main.c
>>> +++ b/virt/kvm/kvm_main.c
>>> @@ -187,12 +187,23 @@ static void ack_flush(void *_completed)
>>>  {
>>>  }
>>>  
>>> +static inline bool kvm_kick_many_cpus(const struct cpumask *cpus, bool wait)
>>> +{
>>> +	if (unlikely(!cpus))
>>> +		cpus = cpu_online_mask;
>>> +
>>> +	if (cpumask_empty(cpus))
>>> +		return false;
>>> +
>>> +	smp_call_function_many(cpus, ack_flush, NULL, wait);
>>> +	return true;
>>> +}
>>
>> wonder if the !cpus case would be worth moving into smp_call_function_many.
>>
>> smp_call_function_many() might also not kick any cpu, so we could make
>> it return if it actually kicked/called this on any cpu. Then you could
>> even get rid of the special handling of cpumask_empty(cpus) here and
>> simply return the result of smp_call_function_many.
> 
> Separate patch of course. :)

Sure, for now take my

Reviewed-by: David Hildenbrand <david@redhat.com>

:)

>>
>> Is the !! really needed here? I think not.
> 
> I prefer having it.  There are corner cases (e.g. isolating bit 32 or
> higher and the function accepting an unsigned int instead of a bool)
> where it can save your butt, and it's idiomatic C.

Ah, I remember again why using booleans was once considered bad :)

Makes sense.

> 
> Paolo


-- 

Thanks,

David

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


Thread

[PATCH] kvm: avoid unused variable warning for UP builds Paolo Bonzini <pbonzini@redhat.com> - 2017-07-05 12:40 +0200
  Re: [PATCH] kvm: avoid unused variable warning for UP builds David Hildenbrand <david@redhat.com> - 2017-07-05 14:30 +0200
  Re: [PATCH] kvm: avoid unused variable warning for UP builds Paolo Bonzini <pbonzini@redhat.com> - 2017-07-05 14:30 +0200
  Re: [PATCH] kvm: avoid unused variable warning for UP builds David Hildenbrand <david@redhat.com> - 2017-07-05 14:30 +0200

csiph-web