From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
Tvrtko Ursulin <tursulin@ursulin.net>,
Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Use seqlock in engine stats
Date: Thu, 15 Feb 2018 11:59:06 +0000 [thread overview]
Message-ID: <dd0b158c-6685-afd0-357b-a4da29a37881@linux.intel.com> (raw)
In-Reply-To: <151869524750.15373.15889138699397410312@mail.alporthouse.com>
On 15/02/2018 11:47, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2018-02-15 11:13:33)
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> We can convert engine stats from a spinlock to seqlock to ensure interrupt
>> processing is never even a tiny bit delayed by parallel readers.
>>
>> There is a smidgen bit more cost on the write lock side, and an extremely
>> unlikely chance that readers will have to retry a few times in face of
>> heavy interrupt load.Bbut it should be extremely unlikely given how
>> lightweight read side section is compared to the interrupt processing side,
>> and also compared to the rest of the code paths which can lead into it.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> ---
>> @@ -2028,12 +2028,13 @@ static ktime_t __intel_engine_get_busy_time(struct intel_engine_cs *engine)
>> */
>> ktime_t intel_engine_get_busy_time(struct intel_engine_cs *engine)
>> {
>> + unsigned int seq;
>> ktime_t total;
>> - unsigned long flags;
>>
>> - spin_lock_irqsave(&engine->stats.lock, flags);
>> - total = __intel_engine_get_busy_time(engine);
>> - spin_unlock_irqrestore(&engine->stats.lock, flags);
>> + do {
>> + seq = read_seqbegin(&engine->stats.lock);
>> + total = __intel_engine_get_busy_time(engine);
>> + } while (read_seqretry(&engine->stats.lock, seq));
>
> Hmm, only the reader is inside a hard-irq context right? (Thanks perf!)
>
> I was hoping we could avoid disabling irqs around the writer. Now that
> requires some coffee...
Oh yeah.. it was irqsave only because of perf. I am pretty sure you're
right and I can downgrade write locking to _bh - after the recent
changes we got a writer in process context (enable/disable), and a
writer in tasklet context (context in/out).
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-02-15 11:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 11:13 [PATCH] drm/i915: Use seqlock in engine stats Tvrtko Ursulin
2018-02-15 11:47 ` Chris Wilson
2018-02-15 11:59 ` Tvrtko Ursulin [this message]
2018-02-15 12:04 ` Chris Wilson
2018-02-15 13:45 ` [PATCH v2] " Tvrtko Ursulin
2018-02-15 11:47 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-02-15 14:50 ` ✓ Fi.CI.BAT: success for drm/i915: Use seqlock in engine stats (rev2) Patchwork
2018-02-15 23:50 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-02-16 10:13 ` Chris Wilson
2018-02-19 9:25 ` Tvrtko Ursulin
2018-02-19 9:29 ` Chris Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd0b158c-6685-afd0-357b-a4da29a37881@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=chris@chris-wilson.co.uk \
--cc=tursulin@ursulin.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox