mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jürgen Groß" <jgross@suse.com>
To: Jason Andryuk <jason.andryuk@amd.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,
	Chris Wright <chrisw@sous-sol.org>,
	Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: stable@vger.kernel.org, xen-devel@lists.xenproject.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xen/events: Fix Global and Domain VIRQ tracking
Date: Fri, 15 Aug 2025 07:12:36 +0200	[thread overview]
Message-ID: <3823aae9-34cd-430f-8cf5-873d354c52ac@suse.com> (raw)
In-Reply-To: <238b2fd0-33ab-4279-9205-de58332fa944@amd.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 1694 bytes --]

On 14.08.25 23:04, Jason Andryuk wrote:
> On 2025-08-14 03:05, Jürgen Groß wrote:
>> On 13.08.25 17:03, Jason Andryuk wrote:
>>> On 2025-08-12 15:00, Jason Andryuk wrote:
>>>> VIRQs come in 3 flavors, per-VPU, per-domain, and global.  The existing
>>>> tracking of VIRQs is handled by per-cpu variables virq_to_irq.
>>>>
>>>> The issue is that bind_virq_to_irq() sets the per_cpu virq_to_irq at
>>>> registration time - typically CPU 0.  Later, the interrupt can migrate,
>>>> and info->cpu is updated.  When calling unbind_from_irq(), the per-cpu
>>>> virq_to_irq is cleared for a different cpu.  If bind_virq_to_irq() is
>>
>> This is what needs to be fixed. At migration the per_cpu virq_to_irq of the
>> source and the target cpu need to be updated to reflect that migration.
> 
> I considered this, and even implemented it, before changing my approach.  My 
> concern was that the single VIRQ is now in one of the N per_cpu virq_to_irq 
> arrays.  A second attempt to register on CPU 0 will probably find -1 and 
> continue and issue the hypercall.

The hypervisor would reject the attempt, right? So in the end no problem.

> It looks like Xen tracks virq on the bind_virq vcpu, so per-domain/global stays 
> on vcpu0.  Binding again would return -EEXISTS. find_virq() would not match the 
> virq if it was re-bound to a different vcpu.

We probably would want to modify find_virq() and bind_virq_to_irq() to not
result in a BUG() if a non-percpu virq is bound to another cpu. This could
be done by passing the percpu flag to find_virq() and let find_virq() return
e.g. -EEXIST if a non-percpu virq is found to be bound to another cpu.


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

      reply	other threads:[~2025-08-15  5:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-12 19:00 Jason Andryuk
2025-08-12 19:10 ` Andrew Cooper
2025-08-12 19:36   ` Jason Andryuk
2025-08-13 15:03 ` Jason Andryuk
2025-08-14  7:05   ` Jürgen Groß
2025-08-14 21:04     ` Jason Andryuk
2025-08-15  5:12       ` Jürgen Groß [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=3823aae9-34cd-430f-8cf5-873d354c52ac@suse.com \
    --to=jgross@suse.com \
    --cc=chrisw@sous-sol.org \
    --cc=jason.andryuk@amd.com \
    --cc=jeremy@xensource.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=sstabellini@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.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

all inboxes | Powered by JetHome®