Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/5] drm/i915: Wrap tasklet_struct for abuse
Date: Thu, 10 May 2018 17:15:46 +0100	[thread overview]
Message-ID: <86122f1b-7022-5dfd-9bed-fcd8fab4e0c1@linux.intel.com> (raw)
In-Reply-To: <152596818655.19716.15751108971734864320@mail.alporthouse.com>


On 10/05/2018 17:03, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2018-05-10 16:49:03)
>>
>> On 09/05/2018 15:27, Chris Wilson wrote:
>>> In the next few patches, we want to abuse tasklet to avoid ksoftirqd
>>> latency along critical paths. To make that abuse easily to swallow,
>>> first coat the tasklet in a little syntactic sugar.
>>>
>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>>> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>> ---
>>> +static inline void i915_tasklet_unlock(struct i915_tasklet *t)
>>> +{
>>> +     tasklet_enable(&t->base);
>>> +}
>>
>> I agree keeping the original naming for kill/enable/disable would be better.
>>
>>> +
>>> +static inline void i915_tasklet_set_func(struct i915_tasklet *t,
>>> +                                      void (*func)(unsigned long data),
>>> +                                      unsigned long data)
>>> +{
>>> +     i915_tasklet_lock(t);
>>> +
>>> +     t->base.func = func;
>>> +     t->base.data = data;
>>> +
>>> +     i915_tasklet_unlock(t);
>>
>> I kind of remember something about issues we had with placing
>> tasklet_disable placed in some contexts. Hm.. if only I could recall the
>> details. It's probably fine. I cannot come up with ideas on how to
>> protect against that. GEM_BUG_ON(in_irq() || in_softirq())? Too far
>> fetched probably.
> 
> When we get it wrong, CI complains with a lock up. It cannot be used in
> atomic context as it uses yield() to kick the tasklet (as it may be on
> the local cpu).
> 
>>> @@ -2209,7 +2208,10 @@ static void execlists_set_default_submission(struct intel_engine_cs *engine)
>>>        engine->submit_request = execlists_submit_request;
>>>        engine->cancel_requests = execlists_cancel_requests;
>>>        engine->schedule = execlists_schedule;
>>> -     engine->execlists.tasklet.func = execlists_submission_tasklet;
>>> +
>>> +     i915_tasklet_set_func(&engine->execlists.tasklet,
>>> +                           execlists_submission_tasklet,
>>> +                           (unsigned long)engine);
>>
>> Or eliminate the above dilemma by removing the data parameter from
>> i915_tasklet_set_func since it looks it is not needed at the moment?
> 
> It doesn't eliminate the dilemma, updating the func itself raises the
> question of what if the tasklet is running at that time, what was the
> caller thinking would happen?

Well same as it can do now so you could drop tasklet_disable/enable 
then. At least I assumed the purpose is for atomicity of func/data updates.

> I expect tasklets will start passing themselves to the func and
> eliminate the data parameters themselves at some point in the mid term.

Needs to be tasklet_disable_nosync then, or it will hang. But then it 
loses its purpose anyway. So I am confused.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-05-10 16:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09 14:27 [PATCH 1/5] drm/i915: Remove tasklet flush before disable Chris Wilson
2018-05-09 14:27 ` [PATCH 2/5] drm/i915: Wrap tasklet_struct for abuse Chris Wilson
2018-05-09 14:58   ` Chris Wilson
2018-05-10 15:49   ` Tvrtko Ursulin
2018-05-10 16:03     ` Chris Wilson
2018-05-10 16:15       ` Tvrtko Ursulin [this message]
2018-05-10 16:19         ` Chris Wilson
2018-05-10 17:08           ` Tvrtko Ursulin
2018-05-09 14:27 ` [PATCH 3/5] drm/i915/execlists: Direct submit onto idle engines Chris Wilson
2018-05-10 16:09   ` Tvrtko Ursulin
2018-05-10 16:25     ` Chris Wilson
2018-05-10 17:26       ` Tvrtko Ursulin
2018-05-10 17:40         ` Chris Wilson
2018-05-11  8:25           ` Tvrtko Ursulin
2018-05-11  8:31             ` Chris Wilson
2018-05-11  8:48               ` Tvrtko Ursulin
2018-05-09 14:28 ` [PATCH 4/5] drm/i915/execlists: Direct submission from irq handler Chris Wilson
2018-05-10 12:02   ` Chris Wilson
2018-05-09 14:28 ` [PATCH 5/5] drm/i915: Speed up idle detection by kicking the tasklets Chris Wilson
2018-05-09 14:57 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/5] drm/i915: Remove tasklet flush before disable Patchwork
2018-05-09 14:59 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-05-09 15:14 ` ✓ Fi.CI.BAT: success " Patchwork
2018-05-09 17:50 ` ✓ Fi.CI.IGT: " Patchwork

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=86122f1b-7022-5dfd-9bed-fcd8fab4e0c1@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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