io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-kernel@vger.kernel.org, io-uring@vger.kernel.org,
	peterz@infradead.org, tglx@linutronix.de
Subject: Re: [PATCH 3/6] kernel: split syscall restart from signal handling
Date: Thu, 8 Oct 2020 16:21:35 +0200	[thread overview]
Message-ID: <20201008142135.GH9995@redhat.com> (raw)
In-Reply-To: <20201005150438.6628-4-axboe@kernel.dk>

On 10/05, Jens Axboe wrote:
>
> Move the restart syscall logic into a separate generic entry helper,
> and handle that part separately from signal checking and delivery.
>
> This is in preparation for being able to do syscall restarting
> independently from handling signals.
>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> ---
>  arch/x86/kernel/signal.c     | 32 ++++++++++++++++++--------------
>  include/linux/entry-common.h | 14 ++++++++++++--
>  kernel/entry/common.c        | 11 ++++++++---
>  3 files changed, 38 insertions(+), 19 deletions(-)

Can't we avoid this patch and the and simplify the change in
exit_to_user_mode_loop() from the next patch? Can't the much more simple
patch below work?

Then later we can even change arch_do_signal() to accept the additional
argument, ti_work, so that it can use ti_work & TIF_NOTIFY_SIGNAL/SIGPENDING
instead of test_thread_flag/task_sigpending.

Oleg.

--- x/arch/x86/kernel/signal.c
+++ x/arch/x86/kernel/signal.c
@@ -808,7 +808,10 @@ void arch_do_signal(struct pt_regs *regs
 {
 	struct ksignal ksig;
 
-	if (get_signal(&ksig)) {
+	if (test_thread_flag(TIF_NOTIFY_SIGNAL))
+		tracehook_notify_signal();
+
+	if (task_sigpending(current) && get_signal(&ksig)) {
 		/* Whee! Actually deliver the signal.  */
 		handle_signal(&ksig, regs);
 		return;
--- x/kernel/entry/common.c
+++ x/kernel/entry/common.c
@@ -155,7 +155,7 @@ static unsigned long exit_to_user_mode_l
 		if (ti_work & _TIF_PATCH_PENDING)
 			klp_update_patch_state(current);
 
-		if (ti_work & _TIF_SIGPENDING)
+		if (ti_work & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)
 			arch_do_signal(regs);
 
 		if (ti_work & _TIF_NOTIFY_RESUME) {


  reply	other threads:[~2020-10-08 14:21 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 15:04 [PATCHSET RFC v3 0/6] Add support for TIF_NOTIFY_SIGNAL Jens Axboe
2020-10-05 15:04 ` [PATCH 1/6] tracehook: clear TIF_NOTIFY_RESUME in tracehook_notify_resume() Jens Axboe
2020-10-08 12:37   ` Oleg Nesterov
2020-10-08 13:36     ` Jens Axboe
2020-10-05 15:04 ` [PATCH 2/6] kernel: add task_sigpending() helper Jens Axboe
2020-10-08 12:58   ` Oleg Nesterov
2020-10-08 13:36     ` Jens Axboe
2020-10-08 13:24   ` Oleg Nesterov
2020-10-08 13:38     ` Jens Axboe
2020-10-05 15:04 ` [PATCH 3/6] kernel: split syscall restart from signal handling Jens Axboe
2020-10-08 14:21   ` Oleg Nesterov [this message]
2020-10-08 14:31     ` Jens Axboe
2020-10-08 14:41       ` Jens Axboe
2020-10-08 14:45       ` Oleg Nesterov
2020-10-08 14:47         ` Jens Axboe
2020-10-05 15:04 ` [PATCH 4/6] kernel: add support for TIF_NOTIFY_SIGNAL Jens Axboe
2020-10-08 13:53   ` Oleg Nesterov
2020-10-08 14:07     ` Jens Axboe
2020-10-08 14:27       ` Oleg Nesterov
2020-10-05 15:04 ` [PATCH 5/6] x86: define _TIF_NOTIFY_SIGNAL Jens Axboe
2020-10-05 15:04 ` [PATCH 6/6] task_work: use TIF_NOTIFY_SIGNAL if available Jens Axboe
2020-10-08 14:56 ` [PATCHSET RFC v3 0/6] Add support for TIF_NOTIFY_SIGNAL Oleg Nesterov
2020-10-08 15:00   ` Jens Axboe
2020-10-09  8:01   ` Miroslav Benes
2020-10-09 15:21     ` Jens Axboe
2020-10-10 16:53       ` Jens Axboe
2020-10-12 17:27         ` Miroslav Benes
2020-10-13 19:39           ` Jens Axboe
2020-10-13 23:34             ` Thomas Gleixner
2020-10-13 23:37               ` Jens Axboe

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=20201008142135.GH9995@redhat.com \
    --to=oleg@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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).