NVIDIA / NVIDIA/open-gpu-kernel-modules

soc_isr_lock is missing a NV_SPIN_LOCK_INIT

Open
#641 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C
Stars
17.4k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

NVIDIA Open GPU Kernel Modules Version

535.54.03

Please confirm this issue does not happen with the proprietary driver (of the same version). This issue tracker is only for bugs specific to the open kernel driver.
  • I confirm that this does not happen with the proprietary driver package.
Operating System and Version

Linux (custom distribution)

Kernel Release

5.15 customized in house

Please confirm you are running a stable release kernel (e.g. not a -rc). We do not accept bug reports for unreleased kernels.
  • I am running on a stable kernel release.
Hardware: GPU

Irrelevant

Describe the bug

In kernel-open/nvidia/nv.c we initialize the lock of an nv_linux_state_t. However, one of the locks (sock_isr_lock) is not initialized. This can be fixed with the following patch:

diff --git a/kernel-open/nvidia/nv.c b/kernel-open/nvidia/nv.c
index d81122d..3c7912d 100644
--- a/kernel-open/nvidia/nv.c
+++ b/kernel-open/nvidia/nv.c
@@ -3580,6 +3580,7 @@ NvBool nv_lock_init_locks
 
     NV_INIT_MUTEX(&nvl->ldata_lock);
     NV_INIT_MUTEX(&nvl->mmap_lock);
+    NV_SPIN_LOCK_INIT(&nvl->soc_isr_lock);
 
     NV_ATOMIC_SET(nvl->usage_count, 0);

This issue was discovered via the linux lockdep tool. It likely has no user facing consequences, but it does interfere with the lockdep tool's ability to run, causing it to fail and remove itself from the kernel at boot time if these drivers are inserted in the kernel.

To Reproduce

Boot a machine with lockdep instrumentation enabled, and observe dmesg log.

[   45.559931] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:8a:00.0 on minor 3
[   47.312278] INFO: trying to register non-static key.
[   47.312280] The code is fine but needs lockdep annotation, or maybe
[   47.312281] you didn't initialize this object before use?
[   47.312282] turning off the locking correctness validator.
Bug Incidence

Always

nvidia-bug-report.log.gz

N/A as this bug only affects kernel instrumentation.

More Info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in kernel-open/nvidia/nv.c at nv_lock_init_locks and compare the initialization of the nv_linux_state_t locks, noting the issue's soc_isr_lock name and the body’s sock_isr_lock reference. Boot or run a kernel with lockdep instrumentation enabled and inspect dmesg. Done means the relevant lock is initialized and the non-static-key warning no longer appears.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
operating-systems
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.