All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jeongjun Park <aha310510@gmail.com>
Cc: richardcochran@gmail.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	yangbo.lu@nxp.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ptp: remove ptp->n_vclocks check logic in ptp_vclock_in_use()
Date: Thu, 22 May 2025 14:50:37 -0700	[thread overview]
Message-ID: <20250522145037.4715a643@kernel.org> (raw)
In-Reply-To: <20250520160717.7350-1-aha310510@gmail.com>

On Wed, 21 May 2025 01:07:17 +0900 Jeongjun Park wrote:
> The reason why this is appropriate is that any path that uses
> ptp->n_vclocks must unconditionally check if ptp->n_vclocks is greater
> than 0 before unregistering vclocks, and all functions are already
> written this way. And in the function that uses ptp->n_vclocks, we
> already get ptp->n_vclocks_mux before unregistering vclocks.

What about ptp_clock_freerun()? We seem to call it for clock ops
like settime and it does not check n_vclocks.

> Therefore, we need to remove the redundant check for ptp->n_vclocks in
> ptp_vclock_in_use() to prevent recursive locking.

IIUC lockdep is complaining that we are trying to lock the vclock's
n_vclocks_mux, while we already hold that lock for the real clock's
instance. It doesn't understand that the two are in a fixed hierarchy
so the deadlock is not possible.

If my understanding is correct could you please clearly state in the
commit message that this is a false positive? And if so isn't a better
fix to _move_ the !ptp->is_virtual_clock check before the lock in
ptp_vclock_in_use()? that way we preserve current behavior for real
clocks, but vclocks can return early and avoid confusing lockdep?
-- 
pw-bot: cr

  parent reply	other threads:[~2025-05-22 21:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-20 16:07 [PATCH v2] ptp: remove ptp->n_vclocks check logic in ptp_vclock_in_use() Jeongjun Park
2025-05-22 12:32 ` Richard Cochran
2025-05-22 21:50 ` Jakub Kicinski [this message]
2025-05-26 11:00   ` Jeongjun Park
2025-05-27 17:42     ` Jakub Kicinski
2025-06-04 14:10       ` Jeongjun Park
2025-06-06  1:30 ` patchwork-bot+netdevbpf

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=20250522145037.4715a643@kernel.org \
    --to=kuba@kernel.org \
    --cc=aha310510@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=yangbo.lu@nxp.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.