From: Ian Jackson <ian.jackson@citrix.com>
To: Pawel Marczewski <pawel@invisiblethingslab.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Subject: Re: [Xen-devel] Race condition in console_available callback? (libvirt + libxl + xenconsoled)
Date: Tue, 18 Feb 2020 15:12:41 +0000 [thread overview]
Message-ID: <24139.65257.426159.314189@mariner.uk.xensource.com> (raw)
In-Reply-To: <fdc00be9-11c9-ffbf-af4f-fa22baed9d42@invisiblethingslab.com>
Pawel Marczewski writes ("[Xen-devel] Race condition in console_available callback? (libvirt + libxl + xenconsoled)"):
> I am trying to debug an issue in QubesOS where a domain created by
> libvirt often does not have information stored about the console TTY path.
Hi. Marek drew my attention to this.
> The relevant part of libvirt creates a domain using
> libxl_domain_create_new() and registers a callback (aop_console_how)
> that is supposed to fire when the console is available. The callback
> then calls libxl_console_get_tty(), but that fails with:
>
> 2020-01-06 11:52:30.952+0000: libxl: libxl.c:1853:libxl_console_get_tty:
> unable to read console tty path `/local/domain/4/console/tty': Resource
> temporarily unavailable
Hmmm.
> Based on my reading of the libxl code, it's supposed to set the path in
> xenstore and then call the console_available callback, but only if the
> bootloader is configured. Otherwise, we call console_available at a
> later point (in domcreate_attach_devices()) and the path in xenstore is
> being set by xenconsoled independently.
Yes.
> However, there is no guarantee that xenconsoled will do that before we
> call console_available. And indeed, looking at the traces from
> xenstored, the read and write of `.../console/tty` are ordered randomly
> depending on the machine.
Oh dear.
> Should libxl wait for the information appearing in '.../console/tty' at
> this point? Perhaps similar as the code I see in xenconsoled client
> (xen/tools/console/client.c)?
Yes, I think it should.
Looking at my copy of libxl_bootloader.c, I wonder if the same race
exists, in some form, in the with-bootloader case ? I find the code
here confusing (and yes, I wrote the libxl code, although I didn't
design the xenconsoled protocol, which is quite odd).
> I would be happy to work on a patch but I'm unfamiliar with the project
> so I want to check my assumptions.
That makes sense. I hope what I have said is helpful. Feel free to
come back with more questions (or to bother me on irc).
Regards,
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
prev parent reply other threads:[~2020-02-18 15:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-12 10:16 [Xen-devel] Race condition in console_available callback? (libvirt + libxl + xenconsoled) Pawel Marczewski
2020-02-18 15:12 ` Ian Jackson [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=24139.65257.426159.314189@mariner.uk.xensource.com \
--to=ian.jackson@citrix.com \
--cc=marmarek@invisiblethingslab.com \
--cc=pawel@invisiblethingslab.com \
--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 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).