Re: [PATCH][v3] KVM: x86: refine kvm_vcpu_is_preempted

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

 



On Wed, Feb 02, 2022 at 04:48:52PM +0000, Sean Christopherson wrote:

> > > +"movb	" __stringify(KVM_STEAL_TIME_preempted) "+steal_time(%rax), %al;"
> > > +"andl	$" __stringify(KVM_VCPU_PREEMPTED) ", %eax;"
> > > +"setnz	%al;"
> > 
> > Isn't the below the simpler way of writing that same?
> 
> The AND is needed to clear RAX[63:8], e.g. to avoid breakage if the return value
> is changed from a bool to something larger, or the compiler uses more than a byte
> for _Bool.

While C doesn't specify _Bool the arch ABI most certainly does, and
x86_64 ABI guarantees a byte there, changing the return type is the only
possible option here.

Anyway, I don't mind the patch and the proposed Changelog does clarify
that this is an exercise in paranoia.



[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