[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DG72N8GDQ9E0.2FUX560O3I19X@garyguo.net>
Date: Thu, 05 Feb 2026 13:44:27 +0000
From: "Gary Guo" <gary@...yguo.net>
To: "John Hubbard" <jhubbard@...dia.com>, "Danilo Krummrich"
<dakr@...nel.org>, "Alexandre Courbot" <acourbot@...dia.com>
Cc: "Matthew Wilcox" <willy@...radead.org>, "Joel Fernandes"
<joelagnelf@...dia.com>, "Timur Tabi" <ttabi@...dia.com>, "Alistair Popple"
<apopple@...dia.com>, "Eliot Courtney" <ecourtney@...dia.com>, "Zhi Wang"
<zhiw@...dia.com>, "David Airlie" <airlied@...il.com>, "Simona Vetter"
<simona@...ll.ch>, "Bjorn Helgaas" <bhelgaas@...gle.com>, "Miguel Ojeda"
<ojeda@...nel.org>, "Alex Gaynor" <alex.gaynor@...il.com>, "Boqun Feng"
<boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Benno Lossin"
<lossin@...nel.org>, "Andreas Hindborg" <a.hindborg@...nel.org>, "Alice
Ryhl" <aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>,
<nouveau@...ts.freedesktop.org>, <rust-for-linux@...r.kernel.org>, "LKML"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpu: nova-core: fix aux device registration for
multi-GPU systems
On Thu Feb 5, 2026 at 4:11 AM GMT, John Hubbard wrote:
> The auxiliary device registration was using a hardcoded ID of 0, which
> caused probe() to fail on multi-GPU systems with:
>
> sysfs: cannot create duplicate filename '/bus/auxiliary/devices/NovaCore.nova-drm.0'
>
> Fix this by using an atomic counter to generate unique IDs for each
> GPU's aux device registration. The TODO item to eventually use XArray
> for recycling aux device IDs is retained, but for now, this works very
> nicely.
>
> This has the side effect of making debugfs[1] work on multi-GPU systems.
Hi John,
Looks like this is something that should be achieved via IDA?
Cc: Matthew Wilcox <willy@...radead.org>
>
> [1] https://lore.kernel.org/20260203224757.871729-1-ttabi@nvidia.com
>
> Signed-off-by: John Hubbard <jhubbard@...dia.com>
> ---
> drivers/gpu/nova-core/driver.rs | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> Hi,
>
> This is based on today's (Feb 4, 2026) linux-next/master branch.
>
> thanks,
> John Hubbard
>
> diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs
> index 5a4cc047bcfc..a542ec0b40fa 100644
> --- a/drivers/gpu/nova-core/driver.rs
> +++ b/drivers/gpu/nova-core/driver.rs
> @@ -1,5 +1,7 @@
> // SPDX-License-Identifier: GPL-2.0
>
> +use core::sync::atomic::{AtomicU32, Ordering};
We're stopping the use of Rust atomics. Please use LKMM atomics available from
`kernel::sync::atomic`.
Best,
Gary
> +
> use kernel::{
> auxiliary,
> device::Core,
> @@ -19,6 +21,9 @@
>
> use crate::gpu::Gpu;
>
> +/// Counter for generating unique auxiliary device IDs.
> +static AUXILIARY_ID_COUNTER: AtomicU32 = AtomicU32::new(0);
> +
> #[pin_data]
> pub(crate) struct NovaCore {
> #[pin]
> @@ -85,12 +90,17 @@ fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, E
> GFP_KERNEL,
> )?;
>
> + // TODO[XARR]: Use XArray for proper ID allocation/recycling; for now we use a simple
> + // atomic counter which never recycles IDs. A unique ID is required for multi-GPU
> + // systems; without it, probe() fails for all but the first GPU.
> + let aux_id = AUXILIARY_ID_COUNTER.fetch_add(1, Ordering::Relaxed);
> +
> Ok(try_pin_init!(Self {
> gpu <- Gpu::new(pdev, bar.clone(), bar.access(pdev.as_ref())?),
> _reg <- auxiliary::Registration::new(
> pdev.as_ref(),
> c"nova-drm",
> - 0, // TODO[XARR]: Once it lands, use XArray; for now we don't use the ID.
> + aux_id,
> crate::MODULE_NAME
> ),
> }))
>
> base-commit: 0f8a890c4524d6e4013ff225e70de2aed7e6d726
Powered by blists - more mailing lists