From: sashiko-bot@kernel.org
To: "David Woodhouse" <dwmw2@infradead.org>, kvm@vger.kernel.org
Subject: Re: [PATCH v3 05/11] KVM: x86/xen: Retry event channel delivery which races a memslot update
Date: Fri, 16 Oct 2026 15:11:56 +0000 [thread overview]
Message-ID: <sashiko-outbox-174536@kernel.org> (raw)
In-Reply-To: <20261016145646.579369-6-dwmw2@infradead.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] kvm/xen: guest hang due to lost/delayed timer interrupt on memslot update
--
commit 8954ef8936e60acd6079cac417ec4cbf08881487
Author: David Woodhouse <dwmw@amazon.co.uk>
KVM: x86/xen: Retry event channel delivery which races a memslot update
This commit modifies event channel delivery to return -EAGAIN when racing
with a memslot update, allowing callers to handle the retry according to
their context.
Closes: https://lore.kernel.org/all/20260920215341.5ECE91F000FF@smtp.kernel.org
> diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c
> index 0ef646cf3990b..6b7532b0e26ab 100644
> --- a/arch/x86/kvm/xen.c
> +++ b/arch/x86/kvm/xen.c
[ ... ]
> @@ -135,7 +136,7 @@ void kvm_xen_inject_timer_irqs(struct kvm_vcpu *vcpu)
> e.port = vcpu->arch.xen.timer_virq;
> e.priority = KVM_IRQ_ROUTING_XEN_EVTCHN_PRIO_2LEVEL;
>
> - rc = kvm_xen_set_evtchn(&e, vcpu->kvm);
> + rc = kvm_xen_set_evtchn(&e, vcpu->kvm, false);
>
> /*
> * Leave timer_pending set if the memslot is being updated
> * (-EAGAIN); delivery is retried on the next entry pass.
> */
> if (rc == -EAGAIN)
> return;
[Severity: High]
Does this early return fail to set a KVM request to abort guest entry?
When kvm_xen_set_evtchn() returns -EAGAIN due to a memslot update race,
returning here leaves timer_pending > 0 but KVM's entry path
(vcpu_enter_guest) will see no pending requests or injectable interrupts.
Because the host hrtimer has already expired and will not restart, could this
cause the vCPU to enter the guest without the timer interrupt and run
indefinitely until an unrelated VM-exit occurs?
For context, this caller is at the end of the vcpu_run() loop:
arch/x86/kvm/x86.c:vcpu_run() {
...
if (kvm_cpu_has_pending_timer(vcpu))
kvm_inject_pending_timer_irqs(vcpu);
...
}
If injection fails here without setting a request like
kvm_make_request(KVM_REQ_EVENT, vcpu), won't the next loop iteration call
vcpu_enter_guest() and enter the guest without scheduling an immediate retry?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261016145646.579369-1-dwmw2@infradead.org?part=5
next prev parent reply other threads:[~2026-10-16 15:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 14:56 [PATCH v3 00/11] KVM: x86/xen: Don't drop event deliveries which race memslot updates David Woodhouse
2026-10-16 14:56 ` [PATCH v3 01/11] KVM: pfncache: Return -EAGAIN for a lookup which hits an invalid memslot David Woodhouse
2026-10-16 14:56 ` [PATCH v3 02/11] KVM: pfncache: Add a 'wait' argument to the refresh and activate functions David Woodhouse
2026-10-16 14:56 ` [PATCH v3 03/11] KVM: x86/xen: Wait out memslot updates in the Xen attribute ioctls David Woodhouse
2026-10-16 15:11 ` sashiko-bot
2026-10-16 16:37 ` David Woodhouse
2026-10-16 14:56 ` [PATCH v3 04/11] KVM: x86/xen: Don't lose the timer event when delivery fails transiently David Woodhouse
2026-10-16 14:56 ` [PATCH v3 05/11] KVM: x86/xen: Retry event channel delivery which races a memslot update David Woodhouse
2026-10-16 15:11 ` sashiko-bot [this message]
2026-10-16 16:45 ` David Woodhouse
2026-10-16 14:56 ` [PATCH v3 06/11] KVM: x86/xen: Extract delivery of event to vCPU into a separate helper David Woodhouse
2026-10-16 14:56 ` [PATCH v3 07/11] KVM: x86/xen: Explicitly tag "shared info" page as never being dirty tracked David Woodhouse
2026-10-16 14:56 ` [PATCH v3 08/11] KVM: x86/xen: Don't dirty track "vCPU info" page David Woodhouse
2026-10-16 14:56 ` [PATCH v3 09/11] KVM: x86: Request the guest TLB flush from record_steal_time() David Woodhouse
2026-10-16 14:56 ` [PATCH v3 10/11] KVM: selftests: Add Xen evtchn vs memslot-update race test David Woodhouse
2026-10-16 14:56 ` [PATCH v3 11/11] KVM: selftests: Fix unreachable timer recovery in xen_shinfo_test David Woodhouse
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=sashiko-outbox-174536@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dwmw2@infradead.org \
--cc=kvm@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