public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	intel-xe@lists.freedesktop.org
Cc: Matthew Auld <matthew.auld@intel.com>,
	Matthew Brost <matthew.brost@intel.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	Waiman Long <longman@redhat.com>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	LKML <linux-kernel@vger.kernel.org>,
	dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
	"Pelloux-Prayer,
	Pierre-Eric" <Pierre-eric.Pelloux-prayer@amd.com>
Subject: Re: [RFC PATCH 2/2] dma-buf/dma-resv: Improve the dma-resv lockdep checks
Date: Thu, 20 Nov 2025 14:22:28 +0100	[thread overview]
Message-ID: <63d280ed-ea7e-483d-8f64-5066174adf0e@amd.com> (raw)
In-Reply-To: <20251120110341.2425-3-thomas.hellstrom@linux.intel.com>

On 11/20/25 12:03, Thomas Hellström wrote:
> 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öm <thomas.hellstrom@linux.intel.com>

I can't judge the lockdep backend changes, but this patch here makes a lot of sense.

Reviewed-by: Christian König <christian.koenig@amd.com>

That reminds me that Pierre-Eric stumbled over some odd lockdep behavior while working on TTM as well. @Pierre-Eric what that this issue?

Regards,
Christian.

> ---
>  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 dma_resv_iter *cursor)
>  	     fence = dma_resv_iter_first(cursor); fence;	\
>  	     fence = dma_resv_iter_next(cursor))
>  
> -#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)
>  
>  #ifdef CONFIG_DEBUG_MUTEXES
>  void dma_resv_reset_max_fences(struct dma_resv *obj);


      reply	other threads:[~2025-11-20 13:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-20 11:03 [RFC PATCH 0/2] locking/ww_mutex, dma-buf/dma-resv: Improve detection of unheld locks Thomas Hellström
2025-11-20 11:03 ` [RFC PATCH 1/2] kernel/locking/ww_mutex: Add per-lock lock-check helpers Thomas Hellström
2025-11-20 11:38   ` Peter Zijlstra
2025-11-20 11:03 ` [RFC PATCH 2/2] dma-buf/dma-resv: Improve the dma-resv lockdep checks Thomas Hellström
2025-11-20 13:22   ` Christian König [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63d280ed-ea7e-483d-8f64-5066174adf0e@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Pierre-eric.Pelloux-prayer@amd.com \
    --cc=boqun.feng@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sumit.semwal@linaro.org \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox