Re: [PATCH v3] KVM: arm: VGIC: properly initialise private IRQ affinity

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

 



On 23/08/2019 14:54, Julien Grall wrote:
> Hi Andre,
> 
> On 23/08/2019 11:34, Andre Przywara wrote:
>> At the moment we initialise the target *mask* of a virtual IRQ to the
>> VCPU it belongs to, even though this mask is only defined for GICv2 and
>> quickly runs out of bits for many GICv3 guests.
>> This behaviour triggers an UBSAN complaint for more than 32 VCPUs:
>> ------
>> [ 5659.462377] UBSAN: Undefined behaviour in virt/kvm/arm/vgic/vgic-init.c:223:21
>> [ 5659.471689] shift exponent 32 is too large for 32-bit type 'unsigned int'
>> ------
>> Also for GICv3 guests the reporting of TARGET in the "vgic-state" debugfs
>> dump is wrong, due to this very same problem.
>>
>> Because there is no requirement to create the VGIC device before the
>> VCPUs (and QEMU actually does it the other way round), we can't safely
>> initialise mpidr or targets in kvm_vgic_vcpu_init(). But since we touch
>> every private IRQ for each VCPU anyway later (in vgic_init()), we can
>> just move the initialisation of those fields into there, where we
>> definitely know the VGIC type.
>>
>> On the way make sure we really have either a VGICv2 or a VGICv3 device,
>> since the existing code is just checking for "VGICv3 or not", silently
>> ignoring the uninitialised case.
>>
>> Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>
>> Reported-by: Dave Martin <dave.martin@xxxxxxx>
> 
> I have tested with both a combination of GICv2/GICv3 and kvmtools/QEMU. I can 
> confirm the UBSAN warning is not present anymore. Feel free to add my tested-by:
> 
> Tested-by: Julien Grall <julien.grall@xxxxxxx>

Applied, and pull request sent.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux