Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6435128pxb; Wed, 17 Feb 2021 04:40:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbcS1HelGerYRjlqs6cbvYDUAqjuTOsBHwYeZN3+UWhoTMEOHnIxL4GyZdSDMpFY46IOnF X-Received: by 2002:aa7:ce8b:: with SMTP id y11mr12197683edv.119.1613565622125; Wed, 17 Feb 2021 04:40:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613565622; cv=none; d=google.com; s=arc-20160816; b=Y13hXz5YYkuIPa5AbgQzttq65NuMimasMdhwJD8vATglBq87UFNBcZ3Lh6HY+A9ZEo Yfs2S8XMx20Xvufd/AcBHcCR6lN5gcljSy9D0omZ6iCGXyyS0kaiqy5uYOMOhVPK3gdN bSeNmi8wFCVI4Yyirbbf7xItcT0KuJa8s+FUHQU6Y/5RmQ/Wnhez+SYPtnL5nVsd6vaT DAgCx6UJSIxb5Douw/dDsfkGxN2HaFOia3GNW3BANEhR26R+UpcQ9Py+MOPGPGr9FQeJ kzsMqaDjGkqU0JrWCZITslvm2qrlyAtMAvlS1gwYbnCg591CuAjJ1nD7Xa4ElrtXnP73 YtWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BMcEaTsr6hvZpRTO/Z+/hPVLzGmBLIj423n6krFv2UM=; b=hj1BtC3DvPM5IgXXrpIsQQeMvaqQuSyF6HOa3D3ZGD7swgMDwWjlt9MbfRbaI0drjz OLbhbc6NBJkk4MlS3ADwl6FPbvakNH1t7xNG2ysqL7FrPJcosB1V+v2NnIHg4MxFFH27 L6Rx47cWOq6ud/a5UDlQria7cQ8kbsigfUbF1ECUUKtqayEN9eewpNjdVR4mdVFqjBSS x/v44H/ZYvFZZU25qPYw4nHWclnek91F3tnhdJMiWs6u9winA6/VQwDB8N0cVgbRZKu3 eEu7vOlzU8SVffewigaKJAgcwsYS6QYGi1JXYWEwuyzZFFYZQtNdNBufUCkKmzg0XMNR AuIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NvOvP4Oa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f17si1153912edw.291.2021.02.17.04.39.58; Wed, 17 Feb 2021 04:40:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NvOvP4Oa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232744AbhBQMfk (ORCPT + 99 others); Wed, 17 Feb 2021 07:35:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44072 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232688AbhBQMdy (ORCPT ); Wed, 17 Feb 2021 07:33:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613565148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BMcEaTsr6hvZpRTO/Z+/hPVLzGmBLIj423n6krFv2UM=; b=NvOvP4Oa7MecTbpzKgwCYp98GTLUlpdqq9NxPNA5nNPNA5Qw54Mqq+6lN0mnljjgbhYMGh MkznNDFJTM5d6RU4X7hoZ+emYy4W0+5oxhZNU1tD3Lg6lpl7KkqZKAOaCS4Q4Pr78YYpUp bqP70hUXlYk4K4iwEUPLxs8/zg/OChs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-401-6b1LB9eDNZCnIMIw3U7qcQ-1; Wed, 17 Feb 2021 07:32:24 -0500 X-MC-Unique: 6b1LB9eDNZCnIMIw3U7qcQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 42A08801975; Wed, 17 Feb 2021 12:32:23 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-114-184.ams2.redhat.com [10.36.114.184]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0D77119D9B; Wed, 17 Feb 2021 12:32:20 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3A8EB1800630; Wed, 17 Feb 2021 13:32:15 +0100 (CET) From: Gerd Hoffmann To: dri-devel@lists.freedesktop.org Cc: Gerd Hoffmann , Thomas Zimmermann , Dave Airlie , David Airlie , Daniel Vetter , virtualization@lists.linux-foundation.org (open list:DRM DRIVER FOR QXL VIRTUAL GPU), spice-devel@lists.freedesktop.org (open list:DRM DRIVER FOR QXL VIRTUAL GPU), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 11/11] drm/qxl: add lock asserts to qxl_bo_vmap_locked + qxl_bo_vunmap_locked Date: Wed, 17 Feb 2021 13:32:13 +0100 Message-Id: <20210217123213.2199186-12-kraxel@redhat.com> In-Reply-To: <20210217123213.2199186-1-kraxel@redhat.com> References: <20210217123213.2199186-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Try avoid re-introducing locking bugs. Signed-off-by: Gerd Hoffmann Acked-by: Thomas Zimmermann --- drivers/gpu/drm/qxl/qxl_object.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c index 82c3bf195ad6..6e26d70f2f07 100644 --- a/drivers/gpu/drm/qxl/qxl_object.c +++ b/drivers/gpu/drm/qxl/qxl_object.c @@ -162,6 +162,8 @@ int qxl_bo_vmap_locked(struct qxl_bo *bo, struct dma_buf_map *map) { int r; + dma_resv_assert_held(bo->tbo.base.resv); + if (bo->kptr) { bo->map_count++; goto out; @@ -236,6 +238,8 @@ void *qxl_bo_kmap_atomic_page(struct qxl_device *qdev, void qxl_bo_vunmap_locked(struct qxl_bo *bo) { + dma_resv_assert_held(bo->tbo.base.resv); + if (bo->kptr == NULL) return; bo->map_count--; -- 2.29.2