io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Jens Axboe <axboe@kernel.dk>,
	linux-kernel@vger.kernel.org, io-uring@vger.kernel.org
Cc: peterz@infradead.org, oleg@redhat.com, Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH 3/4] kernel: add support for TIF_NOTIFY_SIGNAL
Date: Wed, 14 Oct 2020 01:42:53 +0200	[thread overview]
Message-ID: <878sc9d75u.fsf@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20201008152752.218889-4-axboe@kernel.dk>

On Thu, Oct 08 2020 at 09:27, Jens Axboe wrote:
> This adds TIF_NOTIFY_SIGNAL handling in the generic code, which if set,
> will return true if signal_pending() is used in a wait loop. That causes
> an exit of the loop so that notify_signal tracehooks can be run. If the
> wait loop is currently inside a system call, the system call is restarted
> once task_work has been processed.
>
> x86 is using the generic entry code, add the necessary TIF_NOTIFY_SIGNAL
> definitions for it.

Can you please split that into core changes and a patch which adds
support for x86?

>  static inline int signal_pending(struct task_struct *p)
>  {
> +#ifdef TIF_NOTIFY_SIGNAL

As I said in the other thread, plase make this

#if defined(CONFIG_GENERIC_ENTRY) && defined(TIF_NOTIFY_SIGNAL)

> +/*
> + * called by exit_to_user_mode_loop() if ti_work & _TIF_NOTIFY_SIGNAL. This
> + * is currently used by TWA_SIGNAL based task_work, which requires breaking
> + * wait loops to ensure that task_work is noticed and run.
> + */
> +static inline void tracehook_notify_signal(void)
> +{
> +#ifdef TIF_NOTIFY_SIGNAL

Ditto.

> +	clear_thread_flag(TIF_NOTIFY_SIGNAL);
> +	smp_mb__after_atomic();
> +	if (current->task_works)
> +		task_work_run();
> +#endif
> +}
> +
> +/*
> + * Called when we have work to process from exit_to_user_mode_loop()
> + */
> +static inline void set_notify_signal(struct task_struct *task)
> +{
> +#ifdef TIF_NOTIFY_SIGNAL

And this one.

Other than that, this approach of using arch_do_signal() addresses my
earlier concerns about the syscall restart machinery.

Thanks,

        tglx

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

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 15:27 [PATCHSET v4] Add support for TIF_NOTIFY_SIGNAL Jens Axboe
2020-10-08 15:27 ` [PATCH 1/4] tracehook: clear TIF_NOTIFY_RESUME in tracehook_notify_resume() Jens Axboe
2020-10-13 23:35   ` Thomas Gleixner
2020-10-14  1:13     ` Jens Axboe
2020-10-08 15:27 ` [PATCH 2/4] kernel: add task_sigpending() helper Jens Axboe
2020-10-13 23:36   ` Thomas Gleixner
2020-10-08 15:27 ` [PATCH 3/4] kernel: add support for TIF_NOTIFY_SIGNAL Jens Axboe
2020-10-09 14:43   ` Oleg Nesterov
2020-10-09 15:13     ` Jens Axboe
2020-10-13 23:45       ` Thomas Gleixner
2020-10-13 23:54         ` Jens Axboe
2020-10-13 23:42   ` Thomas Gleixner [this message]
2020-10-13 23:45     ` Jens Axboe
2020-10-08 15:27 ` [PATCH 4/4] task_work: use TIF_NOTIFY_SIGNAL if available Jens Axboe
2020-10-13 23:50   ` Thomas Gleixner
2020-10-13 23:55     ` Jens Axboe
2020-10-09 14:30 ` [PATCHSET v4] Add support for TIF_NOTIFY_SIGNAL Oleg Nesterov
2020-10-09 15:16   ` 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=878sc9d75u.fsf@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.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).