[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <874ka7csce.ffs@tglx>
Date: Sun, 26 Sep 2021 16:41:05 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Sohil Mehta <sohil.mehta@...el.com>, x86@...nel.org
Cc: Sohil Mehta <sohil.mehta@...el.com>,
Tony Luck <tony.luck@...el.com>,
Dave Hansen <dave.hansen@...el.com>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
Jens Axboe <axboe@...nel.dk>,
Christian Brauner <christian@...uner.io>,
Peter Zijlstra <peterz@...radead.org>,
Shuah Khan <shuah@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Jonathan Corbet <corbet@....net>,
Ashok Raj <ashok.raj@...el.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
Gayatri Kammela <gayatri.kammela@...el.com>,
Zeng Guang <guang.zeng@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Randy E Witt <randy.e.witt@...el.com>,
Ravi V Shankar <ravi.v.shankar@...el.com>,
Ramesh Thomas <ramesh.thomas@...el.com>,
linux-api@...r.kernel.org, linux-arch@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [RFC PATCH 11/13] x86/uintr: Introduce uintr_wait() syscall
On Mon, Sep 13 2021 at 13:01, Sohil Mehta wrote:
> Add a new system call to allow applications to block in the kernel and
> wait for user interrupts.
>
> <The current implementation doesn't support waking up from other
> blocking system calls like sleep(), read(), epoll(), etc.
>
> uintr_wait() is a placeholder syscall while we decide on that
> behaviour.>
Which behaviour? You cannot integrate this into [clock_]nanosleep() by
any means or wakeup something which is blocked in read(somefd) via
SENDUIPI.
What you can do is implement read() and poll() support for the
uintrfd. Anything else is just not going to fly.
Adding support for read/poll is pretty much a straight forward variant
of a correctly implemented wait()/wakeup() mechanism.
While poll()/read() support might be useful and poll() also provides a
timeout, having an explicit (timed) wait mechanism might be interesting.
But that brings me to an interesting question. There are two cases:
1) The task installed a user space interrupt handler. Now it
want's to play nice and yield the CPU while waiting.
So it needs to reinstall the UINV vector on return to user and
update UIRR, but that'd be covered by the existing mechanism. Fine.
2) Task has no user space interrupt handler installed and just want's
to use that wait mechanism.
What is consuming the pending bit(s)?
If that's not a valid use case, then the wait has to check for that
and reject the syscall with EINVAL.
If it is valid, then how are the pending bits consumed and relayed to
user space?
The same questions arise when you think about implementing poll/read
support simply because the regular poll/read semantics are:
poll waits for the event and read consumes the event
which would be similar to #2 above, but with an installed user space
interrupt handler the return from the poll system call would consume the
event immediately (assumed that UIF is set).
Thanks,
tglx
Powered by blists - more mailing lists