From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Anthony PERARD <anthony.perard@cloud.com>
Cc: qemu-devel@nongnu.org, Jason Andryuk <jandryuk@gmail.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Paul Durrant <paul@xen.org>,
"open list:X86 Xen CPUs" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v2 1/2] hw/xen: detect when running inside stubdomain
Date: Wed, 27 Mar 2024 02:13:02 +0100 [thread overview]
Message-ID: <ZgNynlHAAuFA1vTy@mail-itl> (raw)
In-Reply-To: <a6345b81-5c67-4c05-acff-f73ceea904ad@perard>
[-- Attachment #1: Type: text/plain, Size: 2054 bytes --]
On Tue, Mar 26, 2024 at 05:06:50PM +0000, Anthony PERARD wrote:
> On Tue, Mar 05, 2024 at 08:12:29PM +0100, Marek Marczykowski-Górecki wrote:
> > diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c
> > index 124dd5f3d6..6bd4e6eb2f 100644
> > --- a/hw/xen/xen-legacy-backend.c
> > +++ b/hw/xen/xen-legacy-backend.c
> > @@ -603,6 +603,20 @@ static void xen_set_dynamic_sysbus(void)
> > machine_class_allow_dynamic_sysbus_dev(mc, TYPE_XENSYSDEV);
> > }
> >
> > +static bool xen_check_stubdomain(void)
> > +{
> > + char *dm_path = g_strdup_printf("/local/domain/%d/image", xen_domid);
> > + int32_t dm_domid;
> > + bool is_stubdom = false;
> > +
> > + if (!xenstore_read_int(dm_path, "device-model-domid", &dm_domid)) {
> > + is_stubdom = dm_domid != 0;
> > + }
> > +
> > + g_free(dm_path);
> > + return is_stubdom;
> > +}
> > +
> > void xen_be_init(void)
> > {
> > xenstore = qemu_xen_xs_open();
> > @@ -616,6 +630,8 @@ void xen_be_init(void)
> > exit(1);
> > }
> >
> > + xen_is_stubdomain = xen_check_stubdomain();
>
> This isn't really a backend specific information, and xen_be_init() is
> all about old backend implementation support. (qdisk which have been the
> first to be rewritten doesn't need xen_be_init(), or shouldn't). Could
> we move the initialisation elsewhere?
I can try to move it, sure.
> Is this relevant PV guests? If not, we could move the initialisation to
> xen_hvm_init_pc().
>
> Also, avoid having xen_check_stubdomain() depending on
> "xen-legacy-backend", if possible.
>
> (In xen_hvm_init_pc(), a call to xen_register_ioreq() opens another
> xenstore, as `state->xenstore`.)
And xen_register_ioreq() calls xen_be_init() anyway, so it wouldn't
change much in practice (at least for now)...
> (There's already been effort to build QEMU without legacy backends, that
> stubdom check would break in this scenario.)
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2024-03-27 1:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-05 19:12 [PATCH v2 1/2] hw/xen: detect when running inside stubdomain Marek Marczykowski-Górecki
2024-03-05 19:12 ` [PATCH v2 2/2] xen: fix stubdom PCI addr Marek Marczykowski-Górecki
2024-03-09 3:35 ` Jason Andryuk
2024-03-26 17:30 ` Anthony PERARD
2024-03-09 3:29 ` [PATCH v2 1/2] hw/xen: detect when running inside stubdomain Jason Andryuk
2024-03-26 17:06 ` Anthony PERARD
2024-03-27 1:13 ` Marek Marczykowski-Górecki [this message]
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=ZgNynlHAAuFA1vTy@mail-itl \
--to=marmarek@invisiblethingslab.com \
--cc=anthony.perard@cloud.com \
--cc=jandryuk@gmail.com \
--cc=paul@xen.org \
--cc=qemu-devel@nongnu.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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.