public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] gpu: nova-core: bitfield: fix broken Default implementation
@ 2026-04-01  1:42 Eliot Courtney
  2026-04-01  4:26 ` Alexandre Courbot
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Eliot Courtney @ 2026-04-01  1:42 UTC (permalink / raw)
  To: Danilo Krummrich, Alexandre Courbot, Alice Ryhl, David Airlie,
	Simona Vetter, Daniel Almeida, Lyude Paul
  Cc: John Hubbard, Alistair Popple, Joel Fernandes, Timur Tabi,
	rust-for-linux, dri-devel, linux-kernel, Eliot Courtney

The current implementation does not actually set the default values for
the fields in the bitfield.

Fixes: 3fa145bef533 ("gpu: nova-core: register: generate correct `Default` implementation")
Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
---
It doesn't actually set the default values for each field. I know that
bitfields are being moved soon, so maybe this fix is unnecessary but I
saw it and it's a simple fix.
---
Changes in v2:
- add "Fixes"
- remove test
- Link to v1: https://patch.msgid.link/20260331-fix-bitfield-v1-1-ebe1a72b4fae@nvidia.com
---
 drivers/gpu/nova-core/bitfield.rs | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/nova-core/bitfield.rs b/drivers/gpu/nova-core/bitfield.rs
index 16e143658c51..02efdcf78d89 100644
--- a/drivers/gpu/nova-core/bitfield.rs
+++ b/drivers/gpu/nova-core/bitfield.rs
@@ -314,12 +314,11 @@ fn fmt(&self, f: &mut ::kernel::fmt::Formatter<'_>) -> ::kernel::fmt::Result {
         /// Returns a value for the bitfield where all fields are set to their default value.
         impl ::core::default::Default for $name {
             fn default() -> Self {
-                #[allow(unused_mut)]
-                let mut value = Self(Default::default());
+                let value = Self(Default::default());
 
                 ::kernel::macros::paste!(
                 $(
-                value.[<set_ $field>](Default::default());
+                let value = value.[<set_ $field>](Default::default());
                 )*
                 );
 

---
base-commit: 7c50d748b4a635bc39802ea3f6b120e66b1b9067
change-id: 20260331-fix-bitfield-a03f6d1b9e00

Best regards,
--  
Eliot Courtney <ecourtney@nvidia.com>


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] gpu: nova-core: bitfield: fix broken Default implementation
  2026-04-01  1:42 [PATCH v2] gpu: nova-core: bitfield: fix broken Default implementation Eliot Courtney
@ 2026-04-01  4:26 ` Alexandre Courbot
  2026-04-01 15:35   ` Gary Guo
  2026-04-03 17:37 ` Danilo Krummrich
  2026-04-04  0:09 ` Danilo Krummrich
  2 siblings, 1 reply; 7+ messages in thread
From: Alexandre Courbot @ 2026-04-01  4:26 UTC (permalink / raw)
  To: Eliot Courtney
  Cc: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Daniel Almeida, Lyude Paul, John Hubbard, Alistair Popple,
	Joel Fernandes, Timur Tabi, rust-for-linux, dri-devel,
	linux-kernel

On Wed Apr 1, 2026 at 10:42 AM JST, Eliot Courtney wrote:
> The current implementation does not actually set the default values for
> the fields in the bitfield.
>
> Fixes: 3fa145bef533 ("gpu: nova-core: register: generate correct `Default` implementation")
> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>

Don't forget to collect the tags you received on v1 (I use b4 which will
do it anyway so no biggie, but not everybody does).

> ---
> It doesn't actually set the default values for each field. I know that
> bitfields are being moved soon, so maybe this fix is unnecessary but I
> saw it and it's a simple fix.

Fixing it is the correct course imho - the common bitfield macro still
needs to undergo extensive review, and we might hit some hard-to-debug
issue in Nova because of this bug. I'll apply it as soon as
drm-rust-next reopens, thanks!


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] gpu: nova-core: bitfield: fix broken Default implementation
  2026-04-01  4:26 ` Alexandre Courbot
@ 2026-04-01 15:35   ` Gary Guo
  2026-04-01 15:44     ` Danilo Krummrich
  0 siblings, 1 reply; 7+ messages in thread
From: Gary Guo @ 2026-04-01 15:35 UTC (permalink / raw)
  To: Alexandre Courbot, Eliot Courtney
  Cc: Danilo Krummrich, Alice Ryhl, David Airlie, Simona Vetter,
	Daniel Almeida, Lyude Paul, John Hubbard, Alistair Popple,
	Joel Fernandes, Timur Tabi, rust-for-linux, dri-devel,
	linux-kernel

On Wed Apr 1, 2026 at 5:26 AM BST, Alexandre Courbot wrote:
> On Wed Apr 1, 2026 at 10:42 AM JST, Eliot Courtney wrote:
>> The current implementation does not actually set the default values for
>> the fields in the bitfield.
>>
>> Fixes: 3fa145bef533 ("gpu: nova-core: register: generate correct `Default` implementation")
>> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
>
> Don't forget to collect the tags you received on v1 (I use b4 which will
> do it anyway so no biggie, but not everybody does).
>
>> ---
>> It doesn't actually set the default values for each field. I know that
>> bitfields are being moved soon, so maybe this fix is unnecessary but I
>> saw it and it's a simple fix.
>
> Fixing it is the correct course imho - the common bitfield macro still
> needs to undergo extensive review, and we might hit some hard-to-debug
> issue in Nova because of this bug. I'll apply it as soon as
> drm-rust-next reopens, thanks!

This could go via drm-rust-fixes?

Best,
Gary

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] gpu: nova-core: bitfield: fix broken Default implementation
  2026-04-01 15:35   ` Gary Guo
@ 2026-04-01 15:44     ` Danilo Krummrich
  2026-04-02  1:02       ` Eliot Courtney
  0 siblings, 1 reply; 7+ messages in thread
From: Danilo Krummrich @ 2026-04-01 15:44 UTC (permalink / raw)
  To: Gary Guo
  Cc: Alexandre Courbot, Eliot Courtney, Alice Ryhl, David Airlie,
	Simona Vetter, Daniel Almeida, Lyude Paul, John Hubbard,
	Alistair Popple, Joel Fernandes, Timur Tabi, rust-for-linux,
	dri-devel, linux-kernel

On 4/1/26 5:35 PM, Gary Guo wrote:
> This could go via drm-rust-fixes?

It seems there's nothing actually broken due to that, so no need to take it
through -fixes. But we can pick it up before drm-rust-next opens for new
features as I will send another -next PR for the unsoundness fix anyways.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] gpu: nova-core: bitfield: fix broken Default implementation
  2026-04-01 15:44     ` Danilo Krummrich
@ 2026-04-02  1:02       ` Eliot Courtney
  0 siblings, 0 replies; 7+ messages in thread
From: Eliot Courtney @ 2026-04-02  1:02 UTC (permalink / raw)
  To: Danilo Krummrich, Gary Guo
  Cc: Alexandre Courbot, Eliot Courtney, Alice Ryhl, David Airlie,
	Simona Vetter, Daniel Almeida, Lyude Paul, John Hubbard,
	Alistair Popple, Joel Fernandes, Timur Tabi, rust-for-linux,
	dri-devel, linux-kernel

On Thu Apr 2, 2026 at 12:44 AM JST, Danilo Krummrich wrote:
> On 4/1/26 5:35 PM, Gary Guo wrote:
>> This could go via drm-rust-fixes?
>
> It seems there's nothing actually broken due to that, so no need to take it
> through -fixes. But we can pick it up before drm-rust-next opens for new
> features as I will send another -next PR for the unsoundness fix anyways.

Yes, nothing actually broken from this right now.

Thanks all

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] gpu: nova-core: bitfield: fix broken Default implementation
  2026-04-01  1:42 [PATCH v2] gpu: nova-core: bitfield: fix broken Default implementation Eliot Courtney
  2026-04-01  4:26 ` Alexandre Courbot
@ 2026-04-03 17:37 ` Danilo Krummrich
  2026-04-04  0:09 ` Danilo Krummrich
  2 siblings, 0 replies; 7+ messages in thread
From: Danilo Krummrich @ 2026-04-03 17:37 UTC (permalink / raw)
  To: Eliot Courtney
  Cc: Alexandre Courbot, Alice Ryhl, David Airlie, Simona Vetter,
	Daniel Almeida, Lyude Paul, John Hubbard, Alistair Popple,
	Joel Fernandes, Timur Tabi, rust-for-linux, dri-devel,
	linux-kernel

On Wed Apr 1, 2026 at 3:42 AM CEST, Eliot Courtney wrote:
> The current implementation does not actually set the default values for
> the fields in the bitfield.
>
> Fixes: 3fa145bef533 ("gpu: nova-core: register: generate correct `Default` implementation")
> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>

Applied to drm-rust-next, thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] gpu: nova-core: bitfield: fix broken Default implementation
  2026-04-01  1:42 [PATCH v2] gpu: nova-core: bitfield: fix broken Default implementation Eliot Courtney
  2026-04-01  4:26 ` Alexandre Courbot
  2026-04-03 17:37 ` Danilo Krummrich
@ 2026-04-04  0:09 ` Danilo Krummrich
  2 siblings, 0 replies; 7+ messages in thread
From: Danilo Krummrich @ 2026-04-04  0:09 UTC (permalink / raw)
  To: Eliot Courtney
  Cc: Alexandre Courbot, Alice Ryhl, David Airlie, Simona Vetter,
	Daniel Almeida, Lyude Paul, John Hubbard, Alistair Popple,
	Joel Fernandes, Timur Tabi, rust-for-linux, dri-devel,
	linux-kernel

On Wed Apr 1, 2026 at 3:42 AM CEST, Eliot Courtney wrote:
> The current implementation does not actually set the default values for
> the fields in the bitfield.
>
> Fixes: 3fa145bef533 ("gpu: nova-core: register: generate correct `Default` implementation")
> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>

Due to [1] I dropped this one as well for now; I will pick it up once -rc1 is
out.

Thanks,
Danilo

[1] https://lore.kernel.org/all/DHJXK4PAD7V0.3UYK35FDHRNIK@kernel.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-04-04  0:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01  1:42 [PATCH v2] gpu: nova-core: bitfield: fix broken Default implementation Eliot Courtney
2026-04-01  4:26 ` Alexandre Courbot
2026-04-01 15:35   ` Gary Guo
2026-04-01 15:44     ` Danilo Krummrich
2026-04-02  1:02       ` Eliot Courtney
2026-04-03 17:37 ` Danilo Krummrich
2026-04-04  0:09 ` Danilo Krummrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox