From patchwork Tue Nov 19 21:08:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11252673 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6DDAC930 for ; Tue, 19 Nov 2019 21:09:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 56D1822311 for ; Tue, 19 Nov 2019 21:09:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 56D1822311 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C12EC6E409; Tue, 19 Nov 2019 21:08:58 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0E5406E3F2 for ; Tue, 19 Nov 2019 21:08:56 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id c22so5492675wmd.1 for ; Tue, 19 Nov 2019 13:08:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/J7G3D2ebt6Z0HB4QG8yK+4PVkYn3CZE5ldyfHzxSrE=; b=WaD1qX8K5gRqd4HJEWYn1C9WqhCZDh7C/tCf6CgTY8bmFtFKaO2+yXAWriEOlPq+oe c/u9tWMOdjkHMEvo0R7c4qaM4evS5GmnZdMohSOjmLPVl9iKgSCvSdQdOkNnc1/XrG3x EIyba2YNVfCwwgtHJpc7cHpOILDbrK3uoLaPH/ozzqugElOqI+Y8itRaK6fuXJl8/15N A+9m679tVCkyOrxb/Dy23QH4B2TEY6DBR15BL+VU2wg3GzrEe5jM7mdXhtv/51SesFTR 7oyiWh9VkB/BCS4zb6VWTchmIbz+qCJvs02sMdxP526mNDgXFHUTbsZ5i5OlundjdxpL dICg== X-Gm-Message-State: APjAAAWjt4pQV3i/a3APs0GFu0t+0kP2w0A82DgD8nKg30epJBBk5uLn DLP69FAX9VRDb14+LicpL/6KIZ7Vqc8= X-Google-Smtp-Source: APXvYqweGr5lRb2H3jBAb7BO6vyXvuEU0Xn9y82lr1/l6PpO5IamxURKkygb4S/V5DyM3yZ+YUBQ7Q== X-Received: by 2002:a1c:9a81:: with SMTP id c123mr8080941wme.118.1574197733780; Tue, 19 Nov 2019 13:08:53 -0800 (PST) Received: from phenom.ffwll.local (212-51-149-96.fiber7.init7.net. [212.51.149.96]) by smtp.gmail.com with ESMTPSA id z14sm28005126wrl.60.2019.11.19.13.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2019 13:08:53 -0800 (PST) From: Daniel Vetter To: Intel Graphics Development , DRI Development Date: Tue, 19 Nov 2019 22:08:44 +0100 Message-Id: <20191119210844.16947-4-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119210844.16947-1-daniel.vetter@ffwll.ch> References: <20191119210844.16947-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/J7G3D2ebt6Z0HB4QG8yK+4PVkYn3CZE5ldyfHzxSrE=; b=Y/D3zFMQVqiSBfqH6DZ+/jejFtdbuHL69Yvo58kYvUYGswh2OtzunEL51V44+jnRNa ri1kIAI1ZNJN/CtNFGIo+A400H2rA2nL/IEVUKaLYCYC1t/ulVTa46bNV8lnrM52+bJh 1LyG44aDuM6YxyD6IdzCvZtz5DTf0tod3Ew+I= Subject: [Intel-gfx] [PATCH 3/3] drm/msm: Don't init ww_mutec acquire ctx before needed X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , linux-arm-msm@vger.kernel.org, Daniel Vetter , freedreno@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" For locking semantics it really doesn't matter when we grab the ticket. But for lockdep validation it does: the acquire ctx is a fake lockdep. Since other drivers might want to do a full multi-lock dance in their fault-handler, not just lock a single dma_resv. Therefore we must init the acquire_ctx only after we've done all the copy_*_user or anything else that might trigger a pagefault. For msm this means we need to move it past submit_lookup_objects. Aside: Why is msm still using struct_mutex, it seems to be using dma_resv_lock for general buffer state protection? Signed-off-by: Daniel Vetter Cc: Rob Clark Cc: Sean Paul Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org --- drivers/gpu/drm/msm/msm_gem_submit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index fb1fdd7fa3ef..126b2f62bfe7 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -54,7 +54,6 @@ static struct msm_gem_submit *submit_create(struct drm_device *dev, INIT_LIST_HEAD(&submit->node); INIT_LIST_HEAD(&submit->bo_list); - ww_acquire_init(&submit->ticket, &reservation_ww_class); return submit; } @@ -489,6 +488,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, if (ret) goto out; + ww_acquire_init(&submit->ticket, &reservation_ww_class); ret = submit_lock_objects(submit); if (ret) goto out;