All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vishal Chourasia" <vishalc@linux.ibm.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v2 1/1] KVM: powerpc: Use generic xfer to guest work function
Date: Wed, 01 Jul 2026 18:42:19 +0000	[thread overview]
Message-ID: <20260701184220.5BF471F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260701183030.3610451-2-vishalc@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Early return on pending signals bypasses the vCPU exit tracepoint
--

commit 902f7514807a6e7be76bed1f71c7055f873978b8
Author: Vishal Chourasia <vishalc@linux.ibm.com>

KVM: powerpc: Use generic xfer to guest work function

This commit replaces open-coded need_resched() and cond_resched() checks
with the generic xfer_to_guest_mode_handle_work() infrastructure in powerpc
KVM run loops to properly handle deferred task work like CFS bandwidth
throttling.

> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 61dbeea317f3b..a1b2077561bb5 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c

[ ... ]

> @@ -4899,8 +4923,21 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
>  		}
>  	}
>  
> -	if (need_resched())
> -		cond_resched();
> +	/*
> +	 * Run pending work before (re-)entering the guest, most importantly
> +	 * task_work queued via TWA_RESUME (e.g. the deferred CFS bandwidth
> +	 * throttle, which only sets TIF_NOTIFY_RESUME). Without this a CPU-bound
> +	 * vCPU that keeps returning RESUME_GUEST never reaches an exit-to-user
> +	 * point, so the throttle is never enforced and the task runs far beyond
> +	 * its quota. The helper also handles reschedule and signals, replacing
> +	 * the cond_resched() that was here. It may schedule(), so it runs before
> +	 * preemption and IRQs are disabled, with no vcore/KVM locks held. This
> +	 * is the per-reentry site shared by the bare-metal and pseries (nested)
> +	 * paths, so both are covered.
> +	 */
> +	r = kvm_xfer_to_guest_mode_handle_work(vcpu);
> +	if (r)	/* -EINTR: signal pending, exit to userspace (KVM_EXIT_INTR) */
> +		return r;

[Severity: Medium]
When kvm_xfer_to_guest_mode_handle_work() returns a pending signal, this
direct return bypasses the done: label at the end of the function.

Since trace_kvmppc_run_vcpu_enter() is executed unconditionally at the start
of kvmhv_run_single_vcpu(), does this early return cause unbalanced
tracepoints on signal-driven userspace exits? This might break performance
monitoring tools that rely on symmetric enter/exit events.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260701183030.3610451-2-vishalc@linux.ibm.com?part=1

  reply	other threads:[~2026-07-01 18:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 18:30 [PATCH v2 0/1] KVM: powerpc: Use generic xfer to guest work function Vishal Chourasia
2026-07-01 18:30 ` [PATCH v2 1/1] " Vishal Chourasia
2026-07-01 18:42   ` sashiko-bot [this message]
2026-07-02  7:47   ` Shrikanth Hegde

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=20260701184220.5BF471F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vishalc@linux.ibm.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.