From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: "shaikh.kamal" <shaikhkamal2012@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Paul Durrant <paul@xen.org>,
Sean Christopherson <seanjc@google.com>,
David Woodhouse <dwmw@amazon.co.uk>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rt-devel@lists.linux.dev, pbonzini@redhat.com,
skhan@linuxfoundation.org, me@brighamcampbell.com,
syzbot+919877893c9d28162dc2@syzkaller.appspotmail.com
Subject: Re: [PATCH v2 1/1] KVM: x86/xen: Use trylock for fast path event channel delivery
Date: Thu, 2 Apr 2026 08:36:12 +0200 [thread overview]
Message-ID: <20260402063612.VVXEy0qn@linutronix.de> (raw)
In-Reply-To: <20260402013102.21951-1-shaikhkamal2012@gmail.com>
On 2026-04-02 07:01:02 [+0530], shaikh.kamal wrote:
…
> The function uses read_lock_irqsave() to access two gpc structures:
> shinfo_cache and vcpu_info_cache. On PREEMPT_RT, these rwlocks are
> rt_mutex-based and cannot be acquired from hard IRQ context.
>
> Use read_trylock() instead for both gpc lock acquisitions. If either
> lock is contended, return -EWOULDBLOCK to trigger the existing slow
> path: xen_timer_callback() sets vcpu->arch.xen.timer_pending, kicks
> the vCPU with KVM_REQ_UNBLOCK, and the event gets injected from
> process context via kvm_xen_inject_timer_irqs().
>
> This approach works on all kernels (RT and non-RT) and preserves the
> "fast path" semantics: acquire the lock only if immediately available,
> otherwise bail out rather than blocking.
No. This split into local_irq_save() + trylock is something you must not
do. The fact that it does not lead to any warnings does not mean it is
good.
One problem is that your trylock will record the current task on the CPU
as the owner of this lock which can lead to odd lock chains if observed
by other tasks while trying to PI.
So no.
If this is just to shut up syskaller I would suggest to let xen depend
on !PREEMPT_RT until someone figures out what to do.
> Reported-by: syzbot+919877893c9d28162dc2@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=919877893c9d28162dc2
> Fixes: 77c9b9dea4fb ("KVM: x86/xen: Use fast path for Xen timer delivery")
> Suggested-by: Sean Christopherson <seanjc@google.com>
>
> Signed-off-by: shaikh.kamal <shaikhkamal2012@gmail.com>
Sebastian
next prev parent reply other threads:[~2026-04-02 6:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-29 13:15 [PATCH] KVM: x86/xen: Fix sleeping lock in hard IRQ context on PREEMPT_RT shaikh.kamal
2026-03-30 14:18 ` Steven Rostedt
2026-03-30 14:51 ` Woodhouse, David
2026-04-01 15:40 ` Sean Christopherson
2026-04-02 1:30 ` [PATCH v2 0/1] KVM: x86/xen: Fix PREEMPT_RT sleeping lock bug shaikh.kamal
2026-04-02 1:31 ` [PATCH v2 1/1] KVM: x86/xen: Use trylock for fast path event channel delivery shaikh.kamal
2026-04-02 6:36 ` Sebastian Andrzej Siewior [this message]
2026-04-02 22:40 ` Sean Christopherson
2026-04-02 6:42 ` [PATCH] KVM: x86/xen: Fix sleeping lock in hard IRQ context on PREEMPT_RT Sebastian Andrzej Siewior
2026-04-02 22:23 ` Sean Christopherson
2026-04-29 22:25 ` [PATCH v2 0/1] mm/mmu_notifier: Add async OOM cleanup via call_srcu() shaikh.kamal
2026-04-29 22:25 ` [PATCH v2 1/1] " shaikh.kamal
2026-05-03 3:26 ` kernel test robot
2026-05-03 3:26 ` kernel test robot
2026-06-07 15:28 ` [PATCH] mm/mmu_notifier: Fix build on !CONFIG_MMU_NOTIFIER shaikh.kamal
2026-06-08 8:30 ` [PATCH v2 1/1] mm/mmu_notifier: Add async OOM cleanup via call_srcu() Lorenzo Stoakes
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=20260402063612.VVXEy0qn@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=dwmw@amazon.co.uk \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=me@brighamcampbell.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=shaikhkamal2012@gmail.com \
--cc=skhan@linuxfoundation.org \
--cc=syzbot+919877893c9d28162dc2@syzkaller.appspotmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®