From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Andrey Ryabinin <arbn@yandex-team.com>
Cc: "Stefan Hajnoczi" <stefanha@redhat.com>,
qemu-devel@nongnu.org,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Juan Quintela" <quintela@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
yc-core@yandex-team.ru
Subject: Re: [PATCH 1/2] chardev: don't set O_NONBLOCK on SCM_RIGHTS file descriptors.
Date: Fri, 24 Jun 2022 12:34:34 +0100 [thread overview]
Message-ID: <YrWhShg0FBRdVGZh@redhat.com> (raw)
In-Reply-To: <83350578-69d7-2b17-6aa1-4faf7f51b3f3@yandex-team.com>
On Fri, Jun 24, 2022 at 02:00:15PM +0300, Andrey Ryabinin wrote:
>
>
> On 6/15/22 16:12, Stefan Hajnoczi wrote:
> > On Tue, Jun 14, 2022 at 02:18:42PM +0300, Andrey Ryabinin wrote:
> >> This reverts commit 9b938c7262e4 ("chardev: clear O_NONBLOCK on SCM_RIGHTS file descriptors").
> >> File descriptor passed to QEMU via 'getfd' QMP command always
> >> changed to blocking mode. Instead of that, change blocking mode by QEMU
> >> file descriptors users when necessary, e.g. like migration.
> >>
> >> We need to preserve the state of the file descriptor in case it's still
> >> used by an external process and before the QEMU itself started
> >> using it.
> >>
> >> E.g. our local migration scenario with TAP networking looks like this:
> >> 1. Create TAP devices and pass file descriptors to source QEMU
> >> 2. Launch destination QEMU (-incoming defer) and pass same descriptors to it.
> >> 3. Start migration
> >>
> >> In such scenario setting blocking state at stage (2) will hang source QEMU
> >> since TAP fd suddenly become blocking.
> >
> > Is it possible to add a special flag or API for preserving the
> > O_NONBLOCK open flag? That way the rest of QEMU could continue to safely
> > reset the flag while the tap fd passing code would explicitly ask for
> > the O_NONBLOCK open flag to be preserved. That seems safer but I haven't
> > checked whether it's possible to do this.
> >
>
> The only possibility I see here is embedding some kind 'nonblock' in the message
> itself along with fds. Not sure if this sensible approach.
>
> Not changing fd state seems like more correct approach to me. E.g. I would expect
> that sending fd to qemu and executing qmp commands 'getfd' & 'closefd' shouldn't
> induce any changes in fd state. Which is currently no true.
I think that's a wrong expectation. The contract with 'getfd' is that
you are giving the target QEMU ownership of the file. The caller should
not expect todo anything with the FD after it has passd it to QEMU, and
target QEMU has freedom todo whatever it wants. Admittedly this usage
model doesn't fit with what you're trying to make it now do, but those
are the historical expectations of getfd.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2022-06-24 11:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-14 11:18 [PATCH 0/2] Make local migration with TAP network device possible Andrey Ryabinin
2022-06-14 11:18 ` [PATCH 1/2] chardev: don't set O_NONBLOCK on SCM_RIGHTS file descriptors Andrey Ryabinin
2022-06-15 13:12 ` Stefan Hajnoczi
2022-06-24 11:00 ` Andrey Ryabinin
2022-06-24 11:34 ` Daniel P. Berrangé [this message]
2022-06-14 11:21 ` [PATCH 2/2] tap: initialize TAPState->enabled according to the actual state of queue Andrey Ryabinin
2022-06-28 4:15 ` Jason Wang
2022-06-14 11:32 ` [PATCH 0/2] Make local migration with TAP network device possible Daniel P. Berrangé
2022-06-15 13:10 ` Stefan Hajnoczi
2022-06-24 10:53 ` Andrey Ryabinin
2022-06-24 11:45 ` Stefan Hajnoczi
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=YrWhShg0FBRdVGZh@redhat.com \
--to=berrange@redhat.com \
--cc=arbn@yandex-team.com \
--cc=dgilbert@redhat.com \
--cc=jasowang@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
--cc=yc-core@yandex-team.ru \
/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).