Re: [PATCH 3/3] KVM: s390: clear kicked_mask if not idle after set

From: Christian Borntraeger
Date: Tue Oct 26 2021 - 04:52:52 EST




Am 20.10.21 um 09:52 schrieb Halil Pasic:
On Tue, 19 Oct 2021 23:35:25 +0200
Christian Borntraeger <borntraeger@xxxxxxxxxx> wrote:

@@ -426,6 +426,7 @@ static void __unset_cpu_idle(struct kvm_vcpu *vcpu)
{
kvm_s390_clear_cpuflags(vcpu, CPUSTAT_WAIT);
clear_bit(vcpu->vcpu_idx, vcpu->kvm->arch.idle_mask);
+ clear_bit(vcpu->vcpu_idx, vcpu->kvm->arch.gisa_int.kicked_mask);

BTW, do you know are bit-ops garanteed to be serialized as seen by
another cpu even when acting on a different byte? I mean
could the kick_single_vcpu() set the clear of the kicked_mask bit but
not see the clear of the idle mask?

clear_bit explicitely says.
* This is a relaxed atomic operation (no implied memory barriers).

so if we really need the ordering, then we need to add a barrier.


If that is not true we may need some barriers, or possibly merging the
two bitmasks like idle bit, kick bit alterating to ensure there
absolutely ain't no race.