From patchwork Mon Feb 19 09:56:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 10227353 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 573C1602DC for ; Mon, 19 Feb 2018 09:56:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CCA62884F for ; Mon, 19 Feb 2018 09:56:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41BB52897F; Mon, 19 Feb 2018 09:56:21 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 074062884F for ; Mon, 19 Feb 2018 09:56:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 27E6E6E0BB; Mon, 19 Feb 2018 09:56:18 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@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 CD1F06E054; Mon, 19 Feb 2018 09:56:13 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id x21so13852574wmh.0; Mon, 19 Feb 2018 01:56:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Fd8Oe4d/2GJlp7FvrN1MvMU8xiSrm897FnPPA2xd5Fs=; b=iHyUoW3sckXMeuYBw2M/UV0pQtWhojzbgK+4evMbk6AORmQY5DFaK7zJoRhOOSbgqb Z2E6/IeltVCRgiSQpAW0ew4MPdMMg3aLCOh2bA2gTRLsHoIQ+gf1Cj1A0+d/EbSLWxJf iBN9Mb6nGHWl2/qwVKbzFly8UHlvqhiYNcoVeMDFcODL1wPBQWu93qs9onF9vBk3TzDa Dqf/sjzdunL6laqvivwXSkptmOymVEZ6w/nlYocvFDBjO4Uxov3XBei0Jy4UOYT5oPBM ocggW/NvHgtTJt2QUJ/7PzbIYCGRvjzyInrGxV56DJD8sE8nxAjhYDqUdDx6hsjeBxeJ 5g7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Fd8Oe4d/2GJlp7FvrN1MvMU8xiSrm897FnPPA2xd5Fs=; b=JUiMAE7JCNMQLlmoBdI+F7H4tETb1t6mwoNmbQBGCwbZXreMCDy7ousZpyXFkcJk9V D65PXxkxW4u7lV9GYN/yWKF5TdTq1SFn3qkJvW9LJglHakwsmnTTl+DxpAeG0Qt0X20u 6Im/UnCxYgWRiF6hBPoId8E/Z5qeYOUMg2uUgiU3Yt+PQ7oBLSdBPaB0nhK8Ja1KNJVY 9V03fwRj9Ivr1xgOfG2c/ZKhexES4ZcVH9dBqA+hbwmAENh1isNowzggQEyryRs/cxMP YwHj4cGqjHD69FJDvPfM6AIvwUXl/+JFCh5lgiy96YvISYxdGZtBHagc+YMoJ4xP14MM YfwA== X-Gm-Message-State: APf1xPDYyVok9pbKFCLmFEZnXJyu6OME9SzVUOfbeYwOWyvcwDA36KOB GvOOLffj0JehKZMT6Pc9lenBVQ== X-Google-Smtp-Source: AH8x224DH5lH9KSP20AP0BGfRmeu+fGM4w4pfWDBBOzRoFRX+g85AqW9Fk2qT2P36uO4D77GeHm9LQ== X-Received: by 10.28.6.147 with SMTP id 141mr1109935wmg.8.1519034172281; Mon, 19 Feb 2018 01:56:12 -0800 (PST) Received: from baker.fritz.box ([2a02:908:1251:8fc0:9533:206a:c0b5:3ad7]) by smtp.gmail.com with ESMTPSA id z74sm22309976wmz.21.2018.02.19.01.56.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Feb 2018 01:56:11 -0800 (PST) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org Subject: [PATCH 2/4] drm/amdgpu: use new ww_mutex_is_owned_by function Date: Mon, 19 Feb 2018 10:56:08 +0100 Message-Id: <20180219095610.2747-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180219095610.2747-1-christian.koenig@amd.com> References: <20180219095610.2747-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Instead of accessing ww_mutex internals directly use the provided function to check if the ww_mutex was indeed locked by the current command submission. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index eaa3cb0c3ad1..4c04b560e358 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -1594,7 +1594,8 @@ int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser, *map = mapping; /* Double check that the BO is reserved by this CS */ - if (READ_ONCE((*bo)->tbo.resv->lock.ctx) != &parser->ticket) + if (!ww_mutex_is_owned_by(&(*bo)->tbo.resv->lock, current, + &parser->ticket)) return -EINVAL; if (!((*bo)->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS)) {