Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dmitry Ilvokhin" <d@ilvokhin.com>
Cc: linux-hyperv@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 5/5] x86/paravirt: Trace contended_release on unlock
Date: Tue, 04 Aug 2026 07:38:45 +0000	[thread overview]
Message-ID: <20260804073846.8A86D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <17fa67f9fa4cf93f1150725e89f5f916e41a9b6f.1785778551.git.d@ilvokhin.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Paravirt queued spinlocks unconditionally trace 'contended_release' when the tracepoint is enabled globally, ignoring the CONFIG_QUEUED_SPINLOCKS_TRACE_CONTENDED_RELEASE opt-out.
--

--- Patch [5]: [PATCH 5/5] x86/paravirt: Trace contended_release on unlock ---
commit 1a2ad2e72bd14437a21c720ae7476112bc7cb8d5
Author: Dmitry Ilvokhin <d@ilvokhin.com>

x86/paravirt: Trace contended_release on unlock

This commit introduces traced variants of paravirt spinlock unlock functions
to trace the contended_release event. It dynamically swaps the static call
target to point to these traced versions when the tracepoint is enabled,
keeping the disabled path zero-cost.

> diff --git a/arch/x86/kernel/paravirt-spinlocks.c b/arch/x86/kernel/paravirt-spinlocks.c
> index ddc19dc28ba16..ca12b36553074 100644
> --- a/arch/x86/kernel/paravirt-spinlocks.c
> +++ b/arch/x86/kernel/paravirt-spinlocks.c
[ ... ]
> +int arch_contended_release_trace_reg(void)
> +{
> +	void *cur = static_call_query(queued_spin_unlock);
> +
> +	if (cur == __raw_callee_save___native_queued_spin_unlock)
> +		static_call_update(queued_spin_unlock,
> +				   __raw_callee_save_native_queued_spin_unlock_traced);
> +	else if (cur == __raw_callee_save___pv_queued_spin_unlock)
> +		static_call_update(queued_spin_unlock,
> +				   __raw_callee_save_pv_queued_spin_unlock_traced);
> +	return 0;
> +}

[Severity: Medium]
Will arch_contended_release_trace_reg() unconditionally trace the paravirt
queued spinlocks when the tracepoint is enabled globally, even if the kernel
was built with CONFIG_QUEUED_SPINLOCKS_TRACE_CONTENDED_RELEASE=n?

It looks like this registration callback swaps the static calls to the traced
variants without checking if spinlock tracing was explicitly opted out in the
kernel configuration.

> +
> +void arch_contended_release_trace_unreg(void)
> +{
> +	void *cur = static_call_query(queued_spin_unlock);
> +
> +	if (cur == __raw_callee_save_native_queued_spin_unlock_traced)
> +		static_call_update(queued_spin_unlock,
> +				   __raw_callee_save___native_queued_spin_unlock);
> +	else if (cur == __raw_callee_save_pv_queued_spin_unlock_traced)
> +		static_call_update(queued_spin_unlock,
> +				   __raw_callee_save___pv_queued_spin_unlock);
>  }

[Severity: Medium]
Similarly, does arch_contended_release_trace_unreg() also need to check the
CONFIG_QUEUED_SPINLOCKS_TRACE_CONTENDED_RELEASE configuration?

Without a config guard, this manipulates the static calls when the tracepoint
is disabled globally, even if spinlock tracing was intentionally excluded
during the build.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1785778551.git.d@ilvokhin.com?part=5

  reply	other threads:[~2026-08-04  7:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04  7:15 [PATCH 0/5] locking/qspinlock: Add contended_release tracepoint Dmitry Ilvokhin
2026-08-04  7:15 ` [PATCH 1/5] x86/paravirt: Use static_call() for the paravirt spinlock ops Dmitry Ilvokhin
2026-08-04 19:00   ` Borislav Petkov
2026-08-04 19:54     ` Peter Zijlstra
2026-08-04  7:15 ` [PATCH 2/5] locking: Factor out queued_spin_release() Dmitry Ilvokhin
2026-08-04  7:15 ` [PATCH 3/5] locking/qspinlock: Add contended_release tracepoint Dmitry Ilvokhin
2026-08-04  7:36   ` sashiko-bot
2026-08-04  7:15 ` [PATCH 4/5] tracing/lock: Use TRACE_EVENT_FN() for contended_release Dmitry Ilvokhin
2026-08-04  7:15 ` [PATCH 5/5] x86/paravirt: Trace contended_release on unlock Dmitry Ilvokhin
2026-08-04  7:38   ` sashiko-bot [this message]
2026-08-04  7:57 ` [PATCH 0/5] locking/qspinlock: Add contended_release tracepoint Juergen Gross
2026-08-04 10:39 ` Peter Zijlstra

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=20260804073846.8A86D1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=d@ilvokhin.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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