From patchwork Wed Aug 10 12:41:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9272977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3C2DF60231 for ; Wed, 10 Aug 2016 12:41:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CCEA28401 for ; Wed, 10 Aug 2016 12:41:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 217DC28407; Wed, 10 Aug 2016 12:41:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B607D28401 for ; Wed, 10 Aug 2016 12:41:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E74B6E755; Wed, 10 Aug 2016 12:41:56 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3E18B6E755 for ; Wed, 10 Aug 2016 12:41:54 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id o80so9308828wme.0 for ; Wed, 10 Aug 2016 05:41:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=y7XRi7sRSCgEh5yoWjdF8hpfGWNShy3XG4MEdn4D+9E=; b=gC67qUb/S5tRuQ6yJr6eYWh6GocuvbK7dhVzUkSOj1tfJt7rmj9iV54XRkJShKLXQ2 9oCsxQpaQNHqVxdCdPwVNBOD/rfOn6my/PkegkPG+zLJ7ztE8XIPKB77Ye2+UgTtfh8e RTBMJ+IouNYd9ELsI6+GHZ4Uq4X8b/LLR0QzNsEtA7VY2xvB51QQ1aKLHUn3oIj6JK0B ZqDHj8mU+mRWT+Ul19NXo6gwZtgA1zOxveuZj7znhlsbiXco9le8ppFliBO/2maNifR/ WDaO7dZt/4/HAT3+uoBqX6VG987ye8E0YBXXhHPDJhX7Drb29iSkoigFnqJ5qNqYMpsC QxXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=y7XRi7sRSCgEh5yoWjdF8hpfGWNShy3XG4MEdn4D+9E=; b=H6h/0FiRRsnBiVSNHINzX4OJl2FmqnGt7rZtQ2g/iSHjLhSgfsr4PECLWBsc67N6/y +UIMB64/QAq3TO7CBEuanC2dQOW7FrcwsfFOsHSeGptG3Ex7J84CgEeaxnYxg49I+I35 TIOoEHAmFrW1/cpY/YlyT+DGpAFD2Qd6f1jhIGHOIC95KEE5rQNxYt1brXKJe5EUM4ix Apya5VGqMdQLktQCMYQy/Z7zkXnZzibFm2LcmGhzlSJxygwNp4gytA7NfM+K4oHJtUJM JdI6Kvt/IUBFLxUHWgPIfrHzoBo0i90ZYeLhvQQTd9BXjY5ekO0S4o/NjJ7iVLe1ac3Q jceg== X-Gm-Message-State: AEkooutCLvbA4D0fZiSV1UXxCK+DgTe2hd5Wsa+hdaDaJgLpP//WavtpWp4eHhHHmtklJQ== X-Received: by 10.28.176.5 with SMTP id z5mr2978992wme.47.1470832912650; Wed, 10 Aug 2016 05:41:52 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id a194sm8200481wmd.24.2016.08.10.05.41.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Aug 2016 05:41:51 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Wed, 10 Aug 2016 13:41:46 +0100 Message-Id: <1470832906-13972-2-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1470832906-13972-1-git-send-email-chris@chris-wilson.co.uk> References: <1470832906-13972-1-git-send-email-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [CI 2/2] drm/i915: Move setting of request->batch into its single callsite X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP request->batch_obj is only set by execbuffer for the convenience of debugging hangs. By moving that operation to the callsite, we can simplify all other callers and future patches. We also move the complications of reference handling of the request->batch_obj next to where the active tracking is set up for the request. Signed-off-by: Chris Wilson Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 10 +++++++++- drivers/gpu/drm/i915/i915_gem_request.c | 12 +----------- drivers/gpu/drm/i915/i915_gem_request.h | 8 +++----- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index c494b79ded20..c8d13fea4b25 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -1702,6 +1702,14 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, goto err_batch_unpin; } + /* Whilst this request exists, batch_obj will be on the + * active_list, and so will hold the active reference. Only when this + * request is retired will the the batch_obj be moved onto the + * inactive_list and lose its active reference. Hence we do not need + * to explicitly hold another reference here. + */ + params->request->batch_obj = params->batch->obj; + ret = i915_gem_request_add_to_client(params->request, file); if (ret) goto err_request; @@ -1720,7 +1728,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, ret = execbuf_submit(params, args, &eb->vmas); err_request: - __i915_add_request(params->request, params->batch->obj, ret == 0); + __i915_add_request(params->request, ret == 0); err_batch_unpin: /* diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c index 76314e527cfd..b764c1d440c8 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.c +++ b/drivers/gpu/drm/i915/i915_gem_request.c @@ -461,9 +461,7 @@ static void i915_gem_mark_busy(const struct intel_engine_cs *engine) * request is not being tracked for completion but the work itself is * going to happen on the hardware. This would be a Bad Thing(tm). */ -void __i915_add_request(struct drm_i915_gem_request *request, - struct drm_i915_gem_object *obj, - bool flush_caches) +void __i915_add_request(struct drm_i915_gem_request *request, bool flush_caches) { struct intel_engine_cs *engine; struct intel_ring *ring; @@ -504,14 +502,6 @@ void __i915_add_request(struct drm_i915_gem_request *request, request->head = request_start; - /* Whilst this request exists, batch_obj will be on the - * active_list, and so will hold the active reference. Only when this - * request is retired will the the batch_obj be moved onto the - * inactive_list and lose its active reference. Hence we do not need - * to explicitly hold another reference here. - */ - request->batch_obj = obj; - /* Seal the request and mark it as pending execution. Note that * we may inspect this state, without holding any locks, during * hangcheck. Hence we apply the barrier to ensure that we do not diff --git a/drivers/gpu/drm/i915/i915_gem_request.h b/drivers/gpu/drm/i915/i915_gem_request.h index 4e91d4912443..85393be09c27 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.h +++ b/drivers/gpu/drm/i915/i915_gem_request.h @@ -225,13 +225,11 @@ static inline void i915_gem_request_assign(struct drm_i915_gem_request **pdst, *pdst = src; } -void __i915_add_request(struct drm_i915_gem_request *req, - struct drm_i915_gem_object *batch_obj, - bool flush_caches); +void __i915_add_request(struct drm_i915_gem_request *req, bool flush_caches); #define i915_add_request(req) \ - __i915_add_request(req, NULL, true) + __i915_add_request(req, true) #define i915_add_request_no_flush(req) \ - __i915_add_request(req, NULL, false) + __i915_add_request(req, false) struct intel_rps_client; #define NO_WAITBOOST ERR_PTR(-1)