diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-03-21 07:33:20 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-03-21 10:14:55 -0400 |
commit | 899f6204c0f8117d33226e586d3a630b3cf9bce0 (patch) | |
tree | 366786612877abc5581dfec13a8ed18e6f26677e | |
parent | 272bce17cc3ef4629e28c38324d81ca72a862115 (diff) |
drm/i915/execlists: Split the atomic test_and_clear_bit for irq handler
Rather than impose the cost of a locked test before queuing a new
request, reduce it to a simple test_bit() with a following clear_bit()
prior to doing the CSB check. This ensure that if an interrupt does
occur whilst reading from the CSB, we still detect it (the interrupt
would trigger a rescheduling of the tasklet anyway).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170321113320.2603-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/intel_lrc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index dab73e7d9a6b..a88380876ce9 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c | |||
@@ -530,13 +530,18 @@ static void intel_lrc_irq_handler(unsigned long data) | |||
530 | 530 | ||
531 | intel_uncore_forcewake_get(dev_priv, engine->fw_domains); | 531 | intel_uncore_forcewake_get(dev_priv, engine->fw_domains); |
532 | 532 | ||
533 | while (test_and_clear_bit(ENGINE_IRQ_EXECLIST, &engine->irq_posted)) { | 533 | /* Prefer doing test_and_clear_bit() as a two stage operation to avoid |
534 | * imposing the cost of a locked atomic transaction when submitting a | ||
535 | * new request (outside of the context-switch interrupt). | ||
536 | */ | ||
537 | while (test_bit(ENGINE_IRQ_EXECLIST, &engine->irq_posted)) { | ||
534 | u32 __iomem *csb_mmio = | 538 | u32 __iomem *csb_mmio = |
535 | dev_priv->regs + i915_mmio_reg_offset(RING_CONTEXT_STATUS_PTR(engine)); | 539 | dev_priv->regs + i915_mmio_reg_offset(RING_CONTEXT_STATUS_PTR(engine)); |
536 | u32 __iomem *buf = | 540 | u32 __iomem *buf = |
537 | dev_priv->regs + i915_mmio_reg_offset(RING_CONTEXT_STATUS_BUF_LO(engine, 0)); | 541 | dev_priv->regs + i915_mmio_reg_offset(RING_CONTEXT_STATUS_BUF_LO(engine, 0)); |
538 | unsigned int csb, head, tail; | 542 | unsigned int csb, head, tail; |
539 | 543 | ||
544 | clear_bit(ENGINE_IRQ_EXECLIST, &engine->irq_posted); | ||
540 | csb = readl(csb_mmio); | 545 | csb = readl(csb_mmio); |
541 | head = GEN8_CSB_READ_PTR(csb); | 546 | head = GEN8_CSB_READ_PTR(csb); |
542 | tail = GEN8_CSB_WRITE_PTR(csb); | 547 | tail = GEN8_CSB_WRITE_PTR(csb); |