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