From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Philipp Reisner <philipp.reisner@linbit.com>,
qemu-devel@nongnu.org, Fabiano Rosas <farosas@suse.de>,
Peter Xu <peterx@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>,
David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH] util: retry open() when it gets interrupted by a signal
Date: Wed, 31 Jul 2024 16:34:01 +0100 [thread overview]
Message-ID: <ZqpZaZTqC8xvmyEn@redhat.com> (raw)
In-Reply-To: <CAFEAcA83zF4Gr3KUDAZMYmwZ7onw0zs=N0HeNkc3mSMF6n_sKQ@mail.gmail.com>
On Wed, Jul 31, 2024 at 04:24:45PM +0100, Peter Maydell wrote:
> On Wed, 31 Jul 2024 at 16:21, Daniel P. Berrangé <berrange@redhat.com> wrote:
> >
> > On Wed, Jul 31, 2024 at 03:32:52PM +0100, Peter Maydell wrote:
> > > This is why we have the RETRY_ON_EINTR() macro, right?
> > >
> > > Currently we have some places that call qemu_open_old() inside
> > > RETRY_ON_EINTR -- we should decide whether we want to
> > > handle EINTR inside the qemu_open family of functions,
> > > or make the caller deal with it, and put the macro uses
> > > in the right place consistently.
> >
> > It is incredibly arbitrary where we use RETRY_ON_EINTR, which I think
> > points towards it being a sub-optimal solution to the general problem.
>
> Agreed (and agreed that SA_RESTART is the usual approach to
> avoid this mess). Partly I just vaguely recall discussions
> about this back when we added/improved the RETRY_ON_EINTR
> macro in the first place: maybe there's a reason we have it
> still...
>
> > > I agree that it would be nicer if we could use SA_RESTART,
> > > but presumably there's a reason why we don't. (At any
> > > rate code that's shared with the user-mode emulation
> > > has to be EINTR-resistant, because we can't force the
> > > user-mode guest code to avoid registering signal handlers
> > > that aren't SA_RESTART.)
> >
> > For user mode emulation isn't it valid to just propagage the
> > EINTR back up to the application, since EINTR is a valid errno
> > they have to be willing to handle unless the app has itself
> > use SA_RESTART.
>
> Yes, that's what we must do for cases where we are doing some
> syscall on behalf of the guest. But for cases where we're
> doing a syscall because of something QEMU itself needs to do,
> we may need to retry, because we might not be in a position
> to be able to back out of what we're doing (or we might not
> even be inside the "handle a guest syscall" codepath at all).
Ah ok, so RETRY_ON_EINTR conceivably makes sense in the linux-user
/ bsd-user code in certain scenarios......but it seems almost every
single use today is in system emulator code !
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:[~2024-07-31 15:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-31 13:25 [PATCH] util: retry open() when it gets interrupted by a signal Philipp Reisner
2024-07-31 14:00 ` David Hildenbrand
2024-07-31 14:10 ` Daniel P. Berrangé
2024-07-31 14:32 ` Peter Maydell
2024-07-31 14:49 ` Philipp Reisner
2024-07-31 15:17 ` [PATCH] util: use RETRY_ON_EINTR() on open() more consistently Philipp Reisner
2024-08-01 12:48 ` [PATCH v3] " Philippe Mathieu-Daudé
2024-08-02 7:26 ` Philipp Reisner
2024-07-31 15:21 ` [PATCH] util: retry open() when it gets interrupted by a signal Daniel P. Berrangé
2024-07-31 15:24 ` Peter Maydell
2024-07-31 15:34 ` Daniel P. Berrangé [this message]
2024-07-31 15:34 ` Philipp Reisner
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=ZqpZaZTqC8xvmyEn@redhat.com \
--to=berrange@redhat.com \
--cc=david@redhat.com \
--cc=farosas@suse.de \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philipp.reisner@linbit.com \
--cc=qemu-devel@nongnu.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.