[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen/arm: vpl011: reserve the virq before setting up the backend
- To: Stefano Stabellini <stefano.stabellini@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: "Orzel, Michal" <michal.orzel@xxxxxxx>
- Date: Mon, 23 Nov 2026 09:32:22 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QvamFQ5eV+yr43xoo5z3AO95niQk382iyecJEZRbPE8=; b=lCGnTfPsqKYWFqgr6nyjNxKsDY4VMS9I4ygbDFwDFJ6FlCay8KVgd0wis4qjGSzx+giciMh/NNFEJSt4xBtqy0GNHe4fsPEDXsUPja5q5u7ICY6ozXTPaog8UPaFvBZbj3+YSLlil1AcNFJXSCVWYVQ4kpAjIwrPdCy0pvEMo6jphHm5gjOij6Yp6m2zdKqpr1e+bljUZfyGKhqYh9E05oQLfw/xBNkNjxcTu8eqSVDHXxzimGJ/zdY9sfRxxunt0y/ktMJ/ko0yRBY3AqIfjY/4gxITPpV7/UumEYzsFixDEqSANWqVBAdMJHDvIVK29uwxXNdTUod1VANopmsIjw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=o5VIjc7mGNiMkjtjVMkVb0QW3ekyFYVcFK2ZpcXZGkypipE3s5HvMAIyqb5/FyB4DXIYO1z3YJFBp84ofgluVhvK83XeSOEBkFWnoEQcd1WJK7kQRGGt2Nc2P/664TPrdAazyV0Lc5AdlqRmj/3MM68XwkZjRzEYfoQ9MBkAOOvzNDhDT5v3j/3zO/jMEpE92KFj3SLAXDe6IK0putp64gnTODSJuTwrTK+t/HtXxLwEHL+PCkq/Bpyc2OK+xZgyGJ9kA9U7Hn86IJ5FCXg5wdl0fYBrxOpWSRDAKJAIwsBgmzgfQdi9eruJB2JIRh0rkOY7UuVyWuS+rR7HFAQMxA==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
- Cc: Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Mon, 23 Nov 2026 08:32:48 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 19-Nov-26 22:37, Stefano Stabellini wrote:
> domain_vpl011_init() allocates the backend event channel before it
> reserves the virq and records it in vpl011->virq. A notification sent
> on that port in between runs vpl011_update_interrupt_status() with
> vpl011->virq still 0. With CONFIG_NEW_VGIC this calls
> vgic_inject_irq(d, NULL, 0, ...), and vgic_get_irq() dereferences the
> NULL vcpu to look up the private interrupt 0. The same notification
> also takes vpl011->lock and updates vpl011->uartfr before either is
> initialised, and both are then reset under it.
I struggle to understand how this could work in practice (in theory, yes). The
evtchn port is returned by the hypercall which at this point has not yet
returned to the caller. So the caller (console domain) would need to predicate
the port that Xen is going to return and send something on that port via a
different pCPU. xenconsoled never does that which is worth saying in the commit
msg.
>
> Reserve and record the virq, set the initial flags and initialise the
> lock first, before any backend is set up, so that they are valid by the
> time the event channel exists. All the failures after the reservation
> now go through domain_vpl011_deinit(), which releases the virq.
>
> Fixes: ca0637a147af ("xen/arm: vpl011: Add SBSA UART emulation in Xen")
> Fixes: 85da01b71312 ("xen/arm: vpl011: record the virq only once it is
> reserved")
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
~Michal
|