From patchwork Fri Aug 5 09:05:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9264981 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 1234F60760 for ; Fri, 5 Aug 2016 09:06:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 025A327F46 for ; Fri, 5 Aug 2016 09:06:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA76C2808C; Fri, 5 Aug 2016 09:06:22 +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 90A7228426 for ; Fri, 5 Aug 2016 09:06:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C8BF16EB1D; Fri, 5 Aug 2016 09:06:21 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6704D6EB18 for ; Fri, 5 Aug 2016 09:06:17 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id x83so2861929wma.3 for ; Fri, 05 Aug 2016 02:06:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=fDvdNl8CLqMtKQKqR5ihypu9UOK/QCUbVnJg2tkVXkc=; b=x+O8JOY58XGnDcFiBdaPxQU3ufbhUerThvAF0mE5LObUZKeW0f7VmPbhI9xg18wv+v xD/l5ZinD5Z98ETLIlPQob2LcHfhGFP7GnLkDUdh6JwXRu7JBIs87hj2h0xsaZgyCXOF 9F9bSgrakpMNRXwxao35Ww+jeggvTZj5sif/8hxe08Cqzk2aZoE2I3DttBYva/3brsqV OrJ1T5E/IZoNoBLgdSeRO5Xv+OGcplcB3gCASA3TgDv14i0KG4MkPOePPZX/kzVizfty STCUGpITft+I1ZhhSg1cWjWfKmUZuzzdkd8sUnH41FKJqwAcbgqu+R58T0tg8yrBUTaT v1Uw== 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:cc:subject:date:message-id :in-reply-to:references; bh=fDvdNl8CLqMtKQKqR5ihypu9UOK/QCUbVnJg2tkVXkc=; b=Xw6+Q7w0eAPpA+sXff1SCDnZmnzlcXGEWkrMGE7HNuTR2vowrQSC/yDV5EqS4+6v9v H8aze6Q7tn60+A4dVDLfY/4wOFO7bWXztVHpPlTzJ0qMbCpqNRJOXsDb6FERdWeLuVHs id3SyxRffpqhVaF6uYyOED6BZGKQewyTeASEQ4lWgn74H4b8K1tYEpX31IyX32AY/seo y+9XJMK4KUyXmAGzLROiHsLKN4Q8+4ycu6aLYWIIp6/rozVBPDCf8meGMYGaNP1b3HkG E2iQ8724J1nQ3CmSHQmVpopGXsxmA/1hTkk7EthcfL7b+ceV4pLqquYilqfhViCLTE9U cPiA== X-Gm-Message-State: AEkooushMJ5yZmNwmzokAyb1ae6AXKbsmqWV3iEf+oVrjyPiAQlynD4f2BQx1QP4giz8KA== X-Received: by 10.28.165.207 with SMTP id o198mr2340715wme.87.1470387975794; Fri, 05 Aug 2016 02:06:15 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id m81sm7623439wmf.1.2016.08.05.02.06.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Aug 2016 02:06:14 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 5 Aug 2016 10:05:55 +0100 Message-Id: <1470387964-3363-5-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1470387964-3363-1-git-send-email-chris@chris-wilson.co.uk> References: <1470387964-3363-1-git-send-email-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH 04/13] 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 --- 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 b317a672040f..3c70c2708249 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.c +++ b/drivers/gpu/drm/i915/i915_gem_request.c @@ -426,9 +426,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; @@ -469,14 +467,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 3496e28785e7..24f95a348f16 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.h +++ b/drivers/gpu/drm/i915/i915_gem_request.h @@ -218,13 +218,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)