From: Marc Zyngier <marc.zyngier@arm.com>
To: Julien Grall <julien.grall@arm.com>,
Andre Przywara <andre.przywara@arm.com>,
Christoffer Dall <christoffer.dall@arm.com>
Cc: Dave Martin <dave.martin@arm.com>,
linux-arm-kernel@lists.infradead.org,
kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH v3] KVM: arm: VGIC: properly initialise private IRQ affinity
Date: Fri, 23 Aug 2019 17:37:29 +0100 [thread overview]
Message-ID: <8a5e67de-bf0a-675a-3ba9-b95fea12f70f@arm.com> (raw)
In-Reply-To: <bdb1426b-1c00-fce3-5e42-25c97d4311e1@arm.com>
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@arm.com>
>> Reported-by: Dave Martin <dave.martin@arm.com>
>
> 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@arm.com>
Applied, and pull request sent.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2019-08-23 16:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 10:34 [PATCH v3] KVM: arm: VGIC: properly initialise private IRQ affinity Andre Przywara
2019-08-23 13:54 ` Julien Grall
2019-08-23 16:37 ` Marc Zyngier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8a5e67de-bf0a-675a-3ba9-b95fea12f70f@arm.com \
--to=marc.zyngier@arm.com \
--cc=andre.przywara@arm.com \
--cc=christoffer.dall@arm.com \
--cc=dave.martin@arm.com \
--cc=julien.grall@arm.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox