Re: [PATCH] KVM: x86: use assign_bit() where applicable
From: Peng Fan
Date: Mon Sep 28 2026 - 21:08:17 EST
Hi Sean,
On Mon, Sep 28, 2026 at 05:58:57PM -0700, Sean Christopherson wrote:
>On Sun, Sep 20, 2026, Peng Fan (OSS) wrote:
>> From: Peng Fan <peng.fan@xxxxxxx>
>>
>> Convert open-coded if/else with set_bit/clear_bit and their
>> non-atomic __set_bit/__clear_bit variants to the assign_bit/__assign_bit
>> API.
>
>...
>
...
>>
>> - if (synic_has_vector_auto_eoi(synic, vector))
>> - __set_bit(vector, synic->auto_eoi_bitmap);
>> - else
>> - __clear_bit(vector, synic->auto_eoi_bitmap);
>> + __assign_bit(vector, synic->auto_eoi_bitmap,
>> + synic_has_vector_auto_eoi(synic, vector));
>
>Am I the only one that finds the assign_bit() code signficantly harder to follow?
No :) S390 maintainers also not like this.
>Maybe it's just that I haven't seen assign_bit() much, but I've come back to this
>patch several times, and I've had the same reaction every time. IMO, this is a
>solution looking for a problem.
>
It might be easy to read if the test condition is just a simple value, not
a function call.
Free to drop this patch.
Thanks
Peng
>