From: Eric Blake <eblake@redhat.com>
To: Steve Sistare <steven.sistare@oracle.com>, qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
"Daniel P. Berrange" <berrange@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH V2] vl: pause option
Date: Wed, 4 Nov 2020 13:26:23 -0600 [thread overview]
Message-ID: <d93b83ea-f31d-4e6b-2350-c6d4c9b71448@redhat.com> (raw)
In-Reply-To: <1604332203-435466-1-git-send-email-steven.sistare@oracle.com>
On 11/2/20 9:50 AM, Steve Sistare wrote:
> Provide the -pause command-line parameter and the QEMU_PAUSE environment
> variable to pause QEMU during process startup using SIGSTOP and allow a
> developer to attach a debugger, or observe the process using tools such as
> strace. Useful when the QEMU has been launched with some other entity, such
> as libvirt. QEMU_PAUSE is checked in a constructor at the highest priority,
> and can be used to debug other constructors. The -pause option is checked
> later, during argument processing in main, but is useful if passing an
> environment variable from a launcher to qemu is awkard.
>
> Usage: qemu -pause, or QEMU_PAUSE=1
> After attaching a debugger, send SIGCONT to the qemu process to continue.
Changing behavior via a new environment variable is awkward. What
happens, for example, if libvirt inherits this variable set, but is not
aware of its impact to alter how qemu starts up? Can we get by with
ONLY a command line option?
Also, how does this option differ from what we already have with qemu
--preconfig?
>
> Example:
>
> $ QEMU_PAUSE=1 qemu-system-x86_64 ...
> QEMU pid 18371 is stopped.
> [1]+ Stopped
> $ gdb -p 18371
> (gdb)
> $ kill -cont 18371
> (gdb) break rcu_init
> (gdb) continue
> Program received signal SIGCONT, Continued.
> (gdb) continue
> Breakpoint 1, rcu_init () at util/rcu.c:380
>
> Thanks to Daniel P. Berrange <berrange@redhat.com> for suggesting SIGSTOP.
>
> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> ---
> qemu-options.hx | 14 ++++++++++++++
> softmmu/vl.c | 23 +++++++++++++++++++++++
> 2 files changed, 37 insertions(+)
>
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 708583b..42edd70 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -3668,6 +3668,20 @@ SRST
> option is experimental.
> ERST
>
> +DEF("pause", 0, QEMU_OPTION_pause, \
> + "-pause pause the qemu process in main using SIGSTOP.\n"
> + " to pause earlier, before constructors are run, set the\n"
> + " environment variable QEMU_PAUSE=1 before starting qemu.\n",
> + QEMU_ARCH_ALL)
> +
> +SRST
> +``-pause``
> + Pause the qemu process in main using SIGSTOP. This is useful for attaching
> + a debugger after QEMU has been launched by some other entity. After
> + attaching, send SIGCONT to continue. To pause earlier, before constructors
> + are run, set the environment variable QEMU_PAUSE=1 before starting qemu.
> +ERST
Isn't it always possible to provide a wrapper qemu process to be invoked
by whatever third-party management app (like libvirt), where your
wrapper then starts the real qemu under gdb to begin with, rather than
having to hack qemu itself to have a special start-up mode?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2020-11-04 19:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-02 15:50 [PATCH V2] vl: pause option Steve Sistare
2020-11-04 19:26 ` Eric Blake [this message]
2020-11-04 20:39 ` Steven Sistare
2020-11-04 21:40 ` Alex Bennée
2020-11-05 14:55 ` Steven Sistare
2020-11-05 15:07 ` Daniel P. Berrangé
2020-11-05 15:19 ` Steven Sistare
2021-01-06 20:32 ` Steven Sistare
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=d93b83ea-f31d-4e6b-2350-c6d4c9b71448@redhat.com \
--to=eblake@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=steven.sistare@oracle.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;
as well as URLs for NNTP newsgroup(s).