From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 11/15] drm/i915: Exercise request cancellation using a mock selftest
Date: Wed, 22 Feb 2017 14:05:35 +0000 [thread overview]
Message-ID: <b83a421c-73f0-a586-da20-4e2e437ab79e@linux.intel.com> (raw)
In-Reply-To: <20170222135913.GV10557@nuc-i3427.alporthouse.com>
On 22/02/2017 13:59, Chris Wilson wrote:
> On Wed, Feb 22, 2017 at 01:46:10PM +0000, Tvrtko Ursulin wrote:
>>
>> On 22/02/2017 11:46, Chris Wilson wrote:
>>> Add a mock selftest to preempt a request and check that we cancel it,
>>> requeue the request and then complete its execution.
>>>
>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>>> ---
>>> drivers/gpu/drm/i915/selftests/i915_gem_request.c | 59 +++++++++++++++++++++++
>>> drivers/gpu/drm/i915/selftests/mock_request.c | 19 ++++++++
>>> drivers/gpu/drm/i915/selftests/mock_request.h | 2 +
>>> 3 files changed, 80 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_request.c b/drivers/gpu/drm/i915/selftests/i915_gem_request.c
>>> index 9d056a86723d..c803ef60a127 100644
>>> --- a/drivers/gpu/drm/i915/selftests/i915_gem_request.c
>>> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_request.c
>>> @@ -26,6 +26,7 @@
>>>
>>> #include "../i915_selftest.h"
>>>
>>> +#include "mock_context.h"
>>> #include "mock_gem_device.h"
>>>
>>> static int igt_add_request(void *arg)
>>> @@ -181,12 +182,70 @@ static int igt_fence_wait(void *arg)
>>> return err;
>>> }
>>>
>>> +static int igt_request_rewind(void *arg)
>>> +{
>>> + struct drm_i915_private *i915 = arg;
>>> + struct drm_i915_gem_request *request, *vip;
>>> + struct i915_gem_context *ctx[2];
>>> + int err = -EINVAL;
>>> +
>>> + mutex_lock(&i915->drm.struct_mutex);
>>> + ctx[0] = mock_context(i915, "A");
>>> + request = mock_request(i915->engine[RCS], ctx[0], 2 * HZ);
>>> + if (!request) {
>>> + err = -ENOMEM;
>>> + goto err_device;
>>
>> Leaks ctx[0].
>>
>>> + }
>>> + i915_add_request(request);
>>> +
>>> + ctx[1] = mock_context(i915, "B");
>>> + vip = mock_request(i915->engine[RCS], ctx[1], 0);
>>> + if (!vip) {
>>> + err = -ENOMEM;
>>> + goto err_locked;
>>
>> Leaks the request.
>
> That's been handed over to the device.
>
>>> +bool mock_cancel_request(struct drm_i915_gem_request *request)
>>> +{
>>> + struct mock_request *mock = container_of(request, typeof(*mock), base);
>>> + struct mock_engine *engine =
>>> + container_of(request->engine, typeof(*engine), base);
>>> + bool was_queued;
>>> +
>>> + spin_lock_irq(&engine->hw_lock);
>>> + was_queued = !list_empty(&mock->link);
>>
>> I suggest a better name for the mock request. Even just req would be
>> better IMO.
>
> A bit late, the pattern has been set for the file. Currently
> request for drm_i915_gem_request and mock for mock_request. I definitely
> don't like the idea of req and request in the same function.
Pattern? Try grep "mock_request *" on selftests/* ! :)
Okay.. I r-b'ed some of those so I'll shut up.
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:[~2017-02-22 14:05 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-22 11:45 Pre-emption pre-enablement Chris Wilson
2017-02-22 11:45 ` [PATCH v2 01/15] drm/i915: Keep a global seqno per-engine Chris Wilson
2017-02-22 12:24 ` Tvrtko Ursulin
2017-02-22 11:45 ` [PATCH v2 02/15] drm/i915: Move reeerve_seqno() next to unreserve_seqno() Chris Wilson
2017-02-22 12:23 ` Joonas Lahtinen
2017-02-22 11:45 ` [PATCH v2 03/15] drm/i915: Use a local to shorten req->i915->gpu_error.wait_queue Chris Wilson
2017-02-22 11:45 ` [PATCH v2 04/15] drm/i915: Add ourselves to the gpu error waitqueue for the entire wait Chris Wilson
2017-02-22 11:46 ` [PATCH v2 05/15] drm/i915: Inline __i915_gem_request_wait_for_execute() Chris Wilson
2017-02-22 11:46 ` [PATCH v2 06/15] drm/i915: Deconstruct execute fence Chris Wilson
2017-02-22 11:46 ` [PATCH v2 07/15] drm/i915: Protect the request->global_seqno with the engine->timeline lock Chris Wilson
2017-02-22 12:29 ` Tvrtko Ursulin
2017-02-22 12:45 ` Chris Wilson
2017-02-22 13:13 ` Tvrtko Ursulin
2017-02-22 11:46 ` [PATCH v2 08/15] drm/i915: Take a reference whilst processing the signaler request Chris Wilson
2017-02-22 12:35 ` Tvrtko Ursulin
2017-02-22 11:46 ` [PATCH v2 09/15] drm/i915: Allow an request to be cancelled Chris Wilson
2017-02-22 13:08 ` Tvrtko Ursulin
2017-02-22 11:46 ` [PATCH v2 10/15] drm/i915: Remove the preempted request from the execution queue Chris Wilson
2017-02-22 13:33 ` Tvrtko Ursulin
2017-02-22 13:40 ` Chris Wilson
2017-02-22 13:50 ` Tvrtko Ursulin
2017-02-22 18:53 ` [PATCH v3] " Chris Wilson
2017-02-22 11:46 ` [PATCH v2 11/15] drm/i915: Exercise request cancellation using a mock selftest Chris Wilson
2017-02-22 13:46 ` Tvrtko Ursulin
2017-02-22 13:59 ` Chris Wilson
2017-02-22 14:03 ` Chris Wilson
2017-02-22 14:05 ` Tvrtko Ursulin [this message]
2017-02-22 11:46 ` [PATCH v2 12/15] drm/i915: Replace reset_wait_queue with default_wake_function Chris Wilson
2017-02-22 14:13 ` Tvrtko Ursulin
2017-02-22 11:46 ` [PATCH v2 13/15] drm/i915: Refactor direct GPU reset from request waiters Chris Wilson
2017-02-22 14:16 ` Tvrtko Ursulin
2017-02-22 14:26 ` Chris Wilson
2017-02-22 15:07 ` Tvrtko Ursulin
2017-02-22 11:46 ` [PATCH v2 14/15] drm/i915: Immediately process a reset before starting waiting Chris Wilson
2017-02-22 11:46 ` [PATCH v2 15/15] drm/i915: Remove one level of indention from wait-for-execute Chris Wilson
2017-02-22 14:22 ` Tvrtko Ursulin
2017-02-22 13:22 ` ✗ Fi.CI.BAT: failure for series starting with [v2,01/15] drm/i915: Keep a global seqno per-engine Patchwork
2017-02-22 20:52 ` ✗ Fi.CI.BAT: warning for series starting with [v2,01/15] drm/i915: Keep a global seqno per-engine (rev2) Patchwork
2017-02-22 20:56 ` 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=b83a421c-73f0-a586-da20-4e2e437ab79e@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.