From: Tariq Toukan <tariqt@nvidia.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Johan Hovold <johan@kernel.org>
Cc: <driver-core@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>, <linux-rdma@vger.kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>, Mark Bloch <mbloch@nvidia.com>,
Amir Tzin <amirtz@nvidia.com>, Moshe Shemesh <moshe@nvidia.com>,
Shay Drory <shayd@nvidia.com>, Parav Pandit <parav@nvidia.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Jacob Keller <jacob.e.keller@intel.com>,
"Gal Pressman" <gal@nvidia.com>, Tariq Toukan <tariqt@nvidia.com>,
Leon Romanovsky <leonro@nvidia.com>
Subject: [PATCH V3] driver core: auxiliary bus: Fix IRQ sysfs directory cleanup
Date: Thu, 12 Nov 2026 10:13:19 +0200 [thread overview]
Message-ID: <20261112081319.3466442-1-tariqt@nvidia.com> (raw)
From: Amir Tzin <amirtz@nvidia.com>
In case an auxiliary device with IRQs directory is unbound, the
directory is released, but auxdev->sysfs.irq_dir_exists remains true.
This leads to a failure recreating the directory on bind.
[] mlx5_core.sf mlx5_core.sf.2: mlx5_irq_affinity_request:167:(pid 1939):
Failed to create sysfs entry for irq 56, ret = -2
[] mlx5_core.sf mlx5_core.sf.2: mlx5_eq_table_create:1195:(pid 1939):
Failed to create async EQs
[] mlx5_core.sf mlx5_core.sf.2: mlx5_load:1362:(pid 1939):
Failed to create EQs
The irqs directory state is described by three pieces: the sysfs group,
the irq_dir_exists flag and the irqs xarray. Currently, only the sysfs
group removal is managed by the devres API, and on unbind the group is
removed while the flag and xarray are left intact. Thus, a subsequent
bind sees irq_dir_exists still set and skips recreating the directory.
Manage all three under a single release function passed to
devm_add_action_or_reset(), so the whole directory state is created and
destroyed as a unit.
Fixes: a808878308a8 ("driver core: auxiliary bus: show auxiliary device IRQs")
Suggested-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Amir Tzin <amirtz@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/base/auxiliary_sysfs.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
V3:
- New approach.
- Retitle, and add Danilo's Suggested-by.
- Drop Jacob's Reviewed-by, as the approach changed.
V2:
https://lore.kernel.org/all/20260219210435.1769394-1-tariqt@nvidia.com/
V1:
https://lore.kernel.org/all/1761200367-922346-1-git-send-email-tariqt@nvidia.com/
diff --git a/drivers/base/auxiliary_sysfs.c b/drivers/base/auxiliary_sysfs.c
index dea7f46f7dd0..656ba057dc98 100644
--- a/drivers/base/auxiliary_sysfs.c
+++ b/drivers/base/auxiliary_sysfs.c
@@ -22,21 +22,32 @@ static const struct attribute_group auxiliary_irqs_group = {
.attrs = auxiliary_irq_attrs,
};
+static void auxiliary_irq_dir_release(void *data)
+{
+ struct auxiliary_device *auxdev = data;
+
+ xa_destroy(&auxdev->sysfs.irqs);
+ auxdev->sysfs.irq_dir_exists = false;
+ sysfs_remove_group(&auxdev->dev.kobj, &auxiliary_irqs_group);
+}
+
static int auxiliary_irq_dir_prepare(struct auxiliary_device *auxdev)
{
- int ret = 0;
+ int ret;
guard(mutex)(&auxdev->sysfs.lock);
if (auxdev->sysfs.irq_dir_exists)
return 0;
- ret = devm_device_add_group(&auxdev->dev, &auxiliary_irqs_group);
+ ret = sysfs_create_group(&auxdev->dev.kobj, &auxiliary_irqs_group);
if (ret)
return ret;
auxdev->sysfs.irq_dir_exists = true;
xa_init(&auxdev->sysfs.irqs);
- return 0;
+
+ return devm_add_action_or_reset(&auxdev->dev,
+ auxiliary_irq_dir_release, auxdev);
}
/**
base-commit: b71c101bbb9814d163c00234d43c41f0a17907d4
--
2.44.0
reply other threads:[~2026-11-12 8:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261112081319.3466442-1-tariqt@nvidia.com \
--to=tariqt@nvidia.com \
--cc=amirtz@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=dakr@kernel.org \
--cc=davem@davemloft.net \
--cc=driver-core@lists.linux.dev \
--cc=edumazet@kernel.org \
--cc=gal@nvidia.com \
--cc=gregkh@linuxfoundation.org \
--cc=jacob.e.keller@intel.com \
--cc=johan@kernel.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=parav@nvidia.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=rafael@kernel.org \
--cc=saeedm@nvidia.com \
--cc=shayd@nvidia.com \
/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®