Commit ec6de20
drm/v3d: Appease lockdep while updating GPU stats
[ Upstream commit 06c3c40 ]
Lockdep thinks our seqcount_t usage is unsafe because the update path can
be both from irq and worker context:
[ ] ================================
[ ] WARNING: inconsistent lock state
[ ] 6.10.3-v8-16k-numa #159 Tainted: G WC
[ ] --------------------------------
[ ] inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
[ ] swapper/0/0 [HC1[1]:SC0[0]:HE0:SE1] takes:
[ ] ffff80003d7c08d0 (&v3d_priv->stats[i].lock){?.+.}-{0:0}, at: v3d_irq+0xc8/0x660 [v3d]
[ ] {HARDIRQ-ON-W} state was registered at:
[ ] lock_acquire+0x1f8/0x328
[ ] v3d_job_start_stats.isra.0+0xd8/0x218 [v3d]
[ ] v3d_bin_job_run+0x23c/0x388 [v3d]
[ ] drm_sched_run_job_work+0x520/0x6d0 [gpu_sched]
[ ] process_one_work+0x62c/0xb48
[ ] worker_thread+0x468/0x5b0
[ ] kthread+0x1c4/0x1e0
[ ] ret_from_fork+0x10/0x20
[ ] irq event stamp: 337094
[ ] hardirqs last enabled at (337093): [<ffffc0008144ce7c>] default_idle_call+0x11c/0x140
[ ] hardirqs last disabled at (337094): [<ffffc0008144a354>] el1_interrupt+0x24/0x58
[ ] softirqs last enabled at (337082): [<ffffc00080061d90>] handle_softirqs+0x4e0/0x538
[ ] softirqs last disabled at (337073): [<ffffc00080010364>] __do_softirq+0x1c/0x28
[ ]
other info that might help us debug this:
[ ] Possible unsafe locking scenario:
[ ] CPU0
[ ] ----
[ ] lock(&v3d_priv->stats[i].lock);
[ ] <Interrupt>
[ ] lock(&v3d_priv->stats[i].lock);
[ ]
*** DEADLOCK ***
[ ] no locks held by swapper/0/0.
[ ]
stack backtrace:
[ ] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G WC 6.10.3-v8-16k-numa #159
[ ] Hardware name: Raspberry Pi 5 Model B Rev 1.0 (DT)
[ ] Call trace:
[ ] dump_backtrace+0x170/0x1b8
[ ] show_stack+0x20/0x38
[ ] dump_stack_lvl+0xb4/0xd0
[ ] dump_stack+0x18/0x28
[ ] print_usage_bug+0x3cc/0x3f0
[ ] mark_lock+0x4d0/0x968
[ ] __lock_acquire+0x784/0x18c8
[ ] lock_acquire+0x1f8/0x328
[ ] v3d_job_update_stats+0xec/0x2e0 [v3d]
[ ] v3d_irq+0xc8/0x660 [v3d]
[ ] __handle_irq_event_percpu+0x1f8/0x488
[ ] handle_irq_event+0x88/0x128
[ ] handle_fasteoi_irq+0x298/0x408
[ ] generic_handle_domain_irq+0x50/0x78
But it is a false positive because all the queue-stats pairs have their
own lock and jobs are also one at a time.
Nevertheless we can appease lockdep by disabling local interrupts to make
it see lock usage is consistent.
Cc: Maíra Canal <mcanal@igalia.com>
Fixes: 6abe93b ("drm/v3d: Fix race-condition between sysfs/fdinfo and interrupt handler")
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240813102505.80512-2-tursulin@igalia.com
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent fd8488e commit ec6de20
1 file changed
+41
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
139 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
140 | 163 | | |
141 | 164 | | |
142 | 165 | | |
| |||
146 | 169 | | |
147 | 170 | | |
148 | 171 | | |
149 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
150 | 176 | | |
151 | 177 | | |
152 | 178 | | |
| |||
167 | 193 | | |
168 | 194 | | |
169 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
170 | 203 | | |
171 | | - | |
172 | 204 | | |
173 | 205 | | |
174 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
175 | 211 | | |
176 | 212 | | |
177 | 213 | | |
| |||
0 commit comments