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

Re: [PATCH v2 2/3] xen/events: Return -EEXIST for bound VIRQs


  • To: Jürgen Groß <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Wed, 27 Aug 2025 18:11:23 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com 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=/yL0cWFAwGnZZOy5icEJM/ssMktP7OZmP1v5umEmd1s=; b=BUX+e8b3gxjVEZRwq8uLUF6dzpBUpsORxdwsQE/3HPQTOn/hnsX6iDe6Zx8En5WSXJUSWEvk6+t+Xisc3OEweWoeWldR/CZIFPCdA2SxFNnweEm3Bq3pn8at2Qn4jX4OXjRFYN0aLWiyycnHBYXerfdQsbm2G1qG7RqR/ow8jh5h3EiEcil2aKgg+U5zW5zApx0Ikd91ION7hg53Xs32lhpYTbpjmnaeQseOlTDwRoHkEaOu5aQq+BpN9kzrGHi9Qlqu3ftQiFmPhOAJz7YfSWIedPtVrOC1GCcqd+sJ12lCgaj2AVjEaDcoOZWtfreKvKm8pJbSWIXjk8kEpprOXg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ocG/bWZ1cyl1GdFkzFI4hCaMVv5j/YPsXE2hSvO8SG7VNd/UW+rs9srsXBiZsGPzV45H1OljjuT7WFzuDdYMQSTV+QmYqLkDSSnw8+Gclmmuo5BE3Pa84HYwjJNeH8jKxjBlY0ewQEwqOG/Y4dkScGLWR7T4dl2znzvWCEe/aAksWBd2bk3LsfWo2lYsnVQttEO/54eROL68F/JKuBtG58VWRYHFf5ZP2yjna68ReI8OnKQ3Tr9e6AOZRRLA2k4MIzBfrLxKEMO/DdFJukT3rs1I3VCw9zsbRr3evcEzwG+IP8qCF+UqukziP+0o0TDDuhFQKxqz2+kajERwE82s+w==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 28 Aug 2025 00:32:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-08-27 11:21, Jürgen Groß wrote:
On 26.08.25 02:55, Jason Andryuk wrote:
Change find_virq() to return -EEXIST when a VIRQ is bound to a
different CPU than the one passed in.  With that, remove the BUG_ON()
from bind_virq_to_irq() to propogate the error upwards.

Some VIRQs are per-cpu, but others are per-domain or global.  Those must
be bound to CPU0 and can then migrate elsewhere.  The lookup for
per-domain and global will probably fail when migrated off CPU 0,
especially when the current CPU is tracked.  This now returns -EEXIST
instead of BUG_ON().

A second call to bind a per-domain or global VIRQ is not expected, but
make it non-fatal to avoid trying to look up the irq, since we don't
know which per_cpu(virq_to_irq) it will be in.

Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>

@@ -1381,8 +1387,9 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu, bool percpu)
              evtchn = bind_virq.port;
          else {
              if (ret == -EEXIST)
-                ret = find_virq(virq, cpu, &evtchn);
-            BUG_ON(ret < 0);
+                ret = find_virq(virq, cpu, &evtchn, percpu);
+            if (ret)
+                goto out;

I think you are leaking info here. I guess a call of __unbind_from_irq() is
wanted like in the error case below (note that the case of no valid evtchn is
handled there just fine).

Ok, thanks for catching that.

I'm going to add Cc: stable to the next version of this. While it doesn't have a Fixes associated, we want this as a prerequisite for patch 3.

Regards,
Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.