Skip to content

Commit 1e975e5

Browse files
committed
drm/i915: Do not disable preemption for resets
Commit ade8a0f ("drm/i915: Make all GPU resets atomic") added a preempt disable section over the hardware reset callback to prepare the driver for being able to reset from atomic contexts. In retrospect I can see that the work item at a time was about removing the struct mutex from the reset path. Code base also briefly entertained the idea of doing the reset under stop_machine in order to serialize userspace mmap and temporary glitch in the fence registers (see eb8d0f5 ("drm/i915: Remove GPU reset dependence on struct_mutex"), but that never materialized and was soon removed in 2caffbf ("drm/i915: Revoke mmaps and prevent access to fence registers across reset") and replaced with a SRCU based solution. As such, as far as I can see, today we still have a requirement that resets must not sleep (invoked from submission tasklets), but no need to support invoking them from a truly atomic context. Given that the preemption section is problematic on RT kernels, since the uncore lock becomes a sleeping lock and so is invalid in such section, lets try and remove it. Potential downside is that our short waits on GPU to complete the reset may get extended if CPU scheduling interferes, but in practice that probably isn't a deal breaker. In terms of mechanics, since the preemption disabled block is being removed we just need to replace a few of the wait_for_atomic macros into busy looping versions which will work (and not complain) when called from non-atomic sections. v2: * Fix timeouts which are now in us. (Andi) * Update one comment as a drive by. (Andi) Signed-off-by: Tvrtko Ursulin <[email protected]> Cc: Chris Wilson <[email protected]> Cc: Paul Gortmaker <[email protected]> Cc: Sebastian Andrzej Siewior <[email protected]> Cc: Andi Shyti <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent e2f99b7 commit 1e975e5

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/gpu/drm/i915/gt/intel_reset.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,16 @@ static int i915_do_reset(struct intel_gt *gt,
161161
struct pci_dev *pdev = to_pci_dev(gt->i915->drm.dev);
162162
int err;
163163

164-
/* Assert reset for at least 20 usec, and wait for acknowledgement. */
164+
/* Assert reset for at least 50 usec, and wait for acknowledgement. */
165165
pci_write_config_byte(pdev, I915_GDRST, GRDOM_RESET_ENABLE);
166166
udelay(50);
167-
err = wait_for_atomic(i915_in_reset(pdev), 50);
167+
err = _wait_for_atomic(i915_in_reset(pdev), 50000, 0);
168168

169169
/* Clear the reset request. */
170170
pci_write_config_byte(pdev, I915_GDRST, 0);
171171
udelay(50);
172172
if (!err)
173-
err = wait_for_atomic(!i915_in_reset(pdev), 50);
173+
err = _wait_for_atomic(!i915_in_reset(pdev), 50000, 0);
174174

175175
return err;
176176
}
@@ -190,7 +190,7 @@ static int g33_do_reset(struct intel_gt *gt,
190190
struct pci_dev *pdev = to_pci_dev(gt->i915->drm.dev);
191191

192192
pci_write_config_byte(pdev, I915_GDRST, GRDOM_RESET_ENABLE);
193-
return wait_for_atomic(g4x_reset_complete(pdev), 50);
193+
return _wait_for_atomic(g4x_reset_complete(pdev), 50000, 0);
194194
}
195195

196196
static int g4x_do_reset(struct intel_gt *gt,
@@ -207,15 +207,15 @@ static int g4x_do_reset(struct intel_gt *gt,
207207

208208
pci_write_config_byte(pdev, I915_GDRST,
209209
GRDOM_MEDIA | GRDOM_RESET_ENABLE);
210-
ret = wait_for_atomic(g4x_reset_complete(pdev), 50);
210+
ret = _wait_for_atomic(g4x_reset_complete(pdev), 50000, 0);
211211
if (ret) {
212212
GT_TRACE(gt, "Wait for media reset failed\n");
213213
goto out;
214214
}
215215

216216
pci_write_config_byte(pdev, I915_GDRST,
217217
GRDOM_RENDER | GRDOM_RESET_ENABLE);
218-
ret = wait_for_atomic(g4x_reset_complete(pdev), 50);
218+
ret = _wait_for_atomic(g4x_reset_complete(pdev), 50000, 0);
219219
if (ret) {
220220
GT_TRACE(gt, "Wait for render reset failed\n");
221221
goto out;
@@ -785,9 +785,7 @@ int __intel_gt_reset(struct intel_gt *gt, intel_engine_mask_t engine_mask)
785785
reset_mask = wa_14015076503_start(gt, engine_mask, !retry);
786786

787787
GT_TRACE(gt, "engine_mask=%x\n", reset_mask);
788-
preempt_disable();
789788
ret = reset(gt, reset_mask, retry);
790-
preempt_enable();
791789

792790
wa_14015076503_end(gt, reset_mask);
793791
}

0 commit comments

Comments
 (0)