From nobody Tue Dec 2 02:20:22 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8FF6307AEA for ; Thu, 20 Nov 2025 11:04:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763636685; cv=none; b=KUIi/6uBalFTctm4cnwkfTy4GS2gPYJpKfYNgG1ytXtbi+i7KTad2ab1Bj1WJqY1dbYzJjic4RP5ddXTXwN6Nk7HiMEcHIJ8hblrpVtjrplEi+NuPstzMA1DemwFM1wrRNtgLWMKN6w97MDOLwSQ/QEhdHvYBoxrwUw/y1cxYOs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763636685; c=relaxed/simple; bh=x0BJhxyGfR1XqEF23p9JtlRqYIN+PgNt9iKj9D425XA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kWe+IP4EVWEHgMXwGb4Xa6USsXUhhlPuvp0SMs1NoTJ/DKzO+Szo6m/hwYFOm9uuVATqcl4Wvw0gzIEmg24ci/GvOx67pp9HhOgQAV9cfr4ucXUGJGIUkAUAnJh7TW5tQKCFD59vu5LMgT5TjS5Gj9poxmIFRaBClnFqp/w/A8w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Qx2jndeU; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Qx2jndeU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1763636684; x=1795172684; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x0BJhxyGfR1XqEF23p9JtlRqYIN+PgNt9iKj9D425XA=; b=Qx2jndeU4CcPI0iwNHCvXDgRLaqHnxLHSUu93iRUPFwOjFL+q0+o+Ixd ZDs0UrBho1F+DM58EKMeVVKPOgN486m5O/+Nt5uyAK3TXPYH6Ce7GIKgb CFx0vRh26CR5clZ/DZMew03+iJxp7xiUsbvtuimvFEWnQLsnqcWcZ+pej r0GaP3FYugM+NpHv1wfEbvnHmDAf+1C24lPaAQSbrc0rysEFcMNtVdQF9 D7+oN+amu9EMk5k7yGb+oAPv5XzIoiLn16MI1Kh1I/QSazuJDCOaa2pZ3 N1KH1fbKD4rvp8Wlw6pAlh8DuPa9oeo4IGtjq69ux0aEXpD7OAWubpxnN A==; X-CSE-ConnectionGUID: Zhc5EnyRTYWI7N4VwH1nKA== X-CSE-MsgGUID: llDE0KZ/Rjep8WEkTTMO3A== X-IronPort-AV: E=McAfee;i="6800,10657,11618"; a="68308042" X-IronPort-AV: E=Sophos;i="6.19,317,1754982000"; d="scan'208";a="68308042" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2025 03:04:43 -0800 X-CSE-ConnectionGUID: 5H/ovCg6RZaTR+4534E+pw== X-CSE-MsgGUID: U9eLlPA7SiyXBK4n683UDA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,317,1754982000"; d="scan'208";a="228643730" Received: from agladkov-desk.ger.corp.intel.com (HELO fedora) ([10.245.244.142]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2025 03:04:40 -0800 From: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= To: intel-xe@lists.freedesktop.org Cc: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Matthew Auld , Matthew Brost , Maarten Lankhorst , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= , LKML , dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org Subject: [RFC PATCH 2/2] dma-buf/dma-resv: Improve the dma-resv lockdep checks Date: Thu, 20 Nov 2025 12:03:41 +0100 Message-ID: <20251120110341.2425-3-thomas.hellstrom@linux.intel.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251120110341.2425-1-thomas.hellstrom@linux.intel.com> References: <20251120110341.2425-1-thomas.hellstrom@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Ensure that dma_resv_held() and dma_resv_assert_held() operate on individual reservation objects within a WW transaction rather than on the reservation WW class. Signed-off-by: Thomas Hellstr=C3=B6m Reviewed-by: Christian K=C3=B6nig --- include/linux/dma-resv.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/dma-resv.h b/include/linux/dma-resv.h index c5ab6fd9ebe8..001de3880fde 100644 --- a/include/linux/dma-resv.h +++ b/include/linux/dma-resv.h @@ -308,8 +308,11 @@ static inline bool dma_resv_iter_is_restarted(struct d= ma_resv_iter *cursor) fence =3D dma_resv_iter_first(cursor); fence; \ fence =3D dma_resv_iter_next(cursor)) =20 -#define dma_resv_held(obj) lockdep_is_held(&(obj)->lock.base) -#define dma_resv_assert_held(obj) lockdep_assert_held(&(obj)->lock.base) +#define dma_resv_held(obj) (lockdep_is_held(&(obj)->lock.base) && ww_mutex= _held(&(obj)->lock)) +#define dma_resv_assert_held(obj) do { \ + lockdep_assert_held(&(obj)->lock.base); \ + ww_mutex_assert_held(&(obj)->lock); \ + } while (0) =20 #ifdef CONFIG_DEBUG_MUTEXES void dma_resv_reset_max_fences(struct dma_resv *obj); --=20 2.51.1