QEMU-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: "Denis V. Lunev" <den@openvz.org>, qemu-devel@nongnu.org
Cc: den@openvz.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
	"Zhao Liu" <zhao1.liu@intel.com>
Subject: Re: [PATCH 07/10] system/cpus: report a BQL held past a deadline
Date: Tue, 17 Nov 2026 15:24:09 -0300	[thread overview]
Message-ID: <87bj7ns4dy.fsf@suse.de> (raw)
In-Reply-To: <20260915203455.580999-8-den@openvz.org>

"Denis V. Lunev" <den@openvz.org> writes:

> From: Denis V. Lunev <den@openvz.org>
>
> A vCPU thread reacquires the BQL on every exit that needs userspace, so
> a lock held for tens of seconds stops those vCPUs dead and the guest
> reports its own soft lockup. Nothing in qemu records that this
> happened, which leaves a guest panic as the only evidence and no way to
> tell a stuck holder from a guest that wedged on its own.
>
> Add a BQL watchdog. A thread of its own samples a counter advanced on
> every acquire and every release, so it is odd while the lock is held.
> One odd value seen throughout the window means a single owner held the
> lock for the whole window, because any handover would have advanced the
> counter twice.
>
> Advance it in bql_update_status(), which the mutex hooks already call
> for exactly those two transitions, so a cond-wait that drops and
> retakes the lock is covered without the wrappers knowing, and so is any
> caller that reaches the BQL through the plain mutex API. Record the
> holder's tid beside it, under the same lock, because the thread listing
> alone cannot tell a thread parked on its own condvar from one blocked
> on the BQL. Cache the tid per thread, since gettid is a syscall and
> this is the lock path.
>
> On expiry, name the holder and list every thread's state. The listing
> separates a thread blocked on the BQL, which waits in a futex, from one
> idle inside KVM, which waits in kvm_vcpu_block, and names the syscall a
> wedged holder is stuck in. Report once per episode, or a lock held for
> a minute buries the log in copies of one answer. Put the time on the
> line unless -msg timestamp=on already does: a hold is only worth
> reporting if it can be lined up against what the guest saw, and that
> option has to be asked for in advance.
>
> The deadline has to clear the longest legitimate hold, and migration
> setup can hold the BQL for a while, so the watchdog stays off unless
> asked for. The bql-watchdog-ms machine property is the whole interface:
> it sets the deadline, on the command line or over qom-set at any time,
> and 0 turns the watchdog off. Reject a deadline above a minute: a hold
> that long has already shown up as a soft lockup inside the guest.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> Cc: Zhao Liu <zhao1.liu@intel.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>

Reviewed-by: Fabiano Rosas <farosas@suse.de>


  reply	other threads:[~2026-11-17 18:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 20:34 [PATCH 0/10] system: add a watchdog for the Big QEMU Lock Denis V. Lunev
2026-09-15 20:34 ` [PATCH 01/10] util/qemu-thread: track bql_locked across the timed condvar wait Denis V. Lunev
2026-10-14 22:36   ` Fabiano Rosas
2026-09-15 20:34 ` [PATCH 02/10] oslib: add qemu_debugger_attached() Denis V. Lunev
2026-11-17 13:45   ` Fabiano Rosas
2026-11-17 14:38   ` Peter Maydell
2026-09-15 20:34 ` [PATCH 03/10] oslib: add qemu_thread_states() Denis V. Lunev
2026-11-17 14:02   ` Fabiano Rosas
2026-09-15 20:34 ` [PATCH 04/10] oslib: report kernel stacks in qemu_thread_states() Denis V. Lunev
2026-11-17 18:13   ` Fabiano Rosas
2026-09-15 20:34 ` [PATCH 05/10] util/qemu-thread: reserve a signal for thread introspection Denis V. Lunev
2026-09-15 20:34 ` [PATCH 06/10] oslib: report each thread's program counter Denis V. Lunev
2026-11-17 18:19   ` Fabiano Rosas
2026-09-15 20:34 ` [PATCH 07/10] system/cpus: report a BQL held past a deadline Denis V. Lunev
2026-11-17 18:24   ` Fabiano Rosas [this message]
2026-09-15 20:34 ` [PATCH 08/10] system/cpus: hold off the BQL watchdog under a debugger Denis V. Lunev
2026-11-17 18:25   ` Fabiano Rosas
2026-09-15 20:34 ` [PATCH 09/10] system/cpus: add bql-watchdog-abort Denis V. Lunev
2026-10-14 23:30   ` Fabiano Rosas
2026-09-15 20:34 ` [PATCH 10/10] tests/functional: cover the BQL watchdog Denis V. Lunev
2026-09-16  4:57   ` Thomas Huth
2026-09-16  6:44     ` Marc-André Lureau
2026-09-16  7:56       ` Denis V. Lunev
2026-09-18 21:56 ` [PATCH 0/10] system: add a watchdog for the Big QEMU Lock Fabiano Rosas

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=87bj7ns4dy.fsf@suse.de \
    --to=farosas@suse.de \
    --cc=den@openvz.org \
    --cc=pbonzini@redhat.com \
    --cc=philmd@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=zhao1.liu@intel.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