diff mbox series

um: add support for TIF_NOTIFY_SIGNAL

Message ID d0b7533b-9c4c-369e-3a3d-6f98a18417d9@kernel.dk
State New
Headers show
Series um: add support for TIF_NOTIFY_SIGNAL | expand

Commit Message

Jens Axboe Oct. 29, 2020, 4:23 p.m. UTC
Wire up TIF_NOTIFY_SIGNAL handling for um.

Cc: linux-um@lists.infradead.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---

5.11 has support queued up for TIF_NOTIFY_SIGNAL, see this posting
for details:

https://lore.kernel.org/io-uring/20201026203230.386348-1-axboe@kernel.dk/

As part of that work, I'm adding TIF_NOTIFY_SIGNAL support to all archs,
as that will enable a set of cleanups once all of them support it. I'm
happy carrying this patch if need be, or it can be funelled through the
arch tree. Let me know.

 arch/um/include/asm/thread_info.h | 2 ++
 arch/um/kernel/process.c          | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Jens Axboe Nov. 5, 2020, 4:17 p.m. UTC | #1
Gentle nudge on this one.

On 10/29/20 10:23 AM, Jens Axboe wrote:
> Wire up TIF_NOTIFY_SIGNAL handling for um.
> 
> Cc: linux-um@lists.infradead.org
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> ---
> 
> 5.11 has support queued up for TIF_NOTIFY_SIGNAL, see this posting
> for details:
> 
> https://lore.kernel.org/io-uring/20201026203230.386348-1-axboe@kernel.dk/
> 
> As part of that work, I'm adding TIF_NOTIFY_SIGNAL support to all archs,
> as that will enable a set of cleanups once all of them support it. I'm
> happy carrying this patch if need be, or it can be funelled through the
> arch tree. Let me know.
> 
>  arch/um/include/asm/thread_info.h | 2 ++
>  arch/um/kernel/process.c          | 3 ++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/um/include/asm/thread_info.h b/arch/um/include/asm/thread_info.h
> index 4c19ce4c49f1..3b1cb8b3b186 100644
> --- a/arch/um/include/asm/thread_info.h
> +++ b/arch/um/include/asm/thread_info.h
> @@ -57,6 +57,7 @@ static inline struct thread_info *current_thread_info(void)
>  #define TIF_SYSCALL_TRACE	0	/* syscall trace active */
>  #define TIF_SIGPENDING		1	/* signal pending */
>  #define TIF_NEED_RESCHED	2	/* rescheduling necessary */
> +#define TIF_NOTIFY_SIGNAL	3	/* signal notifications exist */
>  #define TIF_RESTART_BLOCK	4
>  #define TIF_MEMDIE		5	/* is terminating due to OOM killer */
>  #define TIF_SYSCALL_AUDIT	6
> @@ -67,6 +68,7 @@ static inline struct thread_info *current_thread_info(void)
>  #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
>  #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
>  #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
> +#define _TIF_NOTIFY_SIGNAL	(1 << TIF_NOTIFY_SIGNAL)
>  #define _TIF_MEMDIE		(1 << TIF_MEMDIE)
>  #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
>  #define _TIF_SECCOMP		(1 << TIF_SECCOMP)
> diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
> index 3bed09538dd9..9e19da9e6198 100644
> --- a/arch/um/kernel/process.c
> +++ b/arch/um/kernel/process.c
> @@ -99,7 +99,8 @@ void interrupt_end(void)
>  
>  	if (need_resched())
>  		schedule();
> -	if (test_thread_flag(TIF_SIGPENDING))
> +	if (test_thread_flag(TIF_SIGPENDING) ||
> +	    test_thread_flag(TIF_NOTIFY_SIGNAL))
>  		do_signal(regs);
>  	if (test_thread_flag(TIF_NOTIFY_RESUME))
>  		tracehook_notify_resume(regs);
>
Anton Ivanov Nov. 5, 2020, 6:15 p.m. UTC | #2
On 29/10/2020 16:23, Jens Axboe wrote:
> Wire up TIF_NOTIFY_SIGNAL handling for um.
> 
> Cc: linux-um@lists.infradead.org
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> ---
> 
> 5.11 has support queued up for TIF_NOTIFY_SIGNAL, see this posting
> for details:
> 
> https://lore.kernel.org/io-uring/20201026203230.386348-1-axboe@kernel.dk/
> 
> As part of that work, I'm adding TIF_NOTIFY_SIGNAL support to all archs,
> as that will enable a set of cleanups once all of them support it. I'm
> happy carrying this patch if need be, or it can be funelled through the
> arch tree. Let me know.
> 
>   arch/um/include/asm/thread_info.h | 2 ++
>   arch/um/kernel/process.c          | 3 ++-
>   2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/um/include/asm/thread_info.h b/arch/um/include/asm/thread_info.h
> index 4c19ce4c49f1..3b1cb8b3b186 100644
> --- a/arch/um/include/asm/thread_info.h
> +++ b/arch/um/include/asm/thread_info.h
> @@ -57,6 +57,7 @@ static inline struct thread_info *current_thread_info(void)
>   #define TIF_SYSCALL_TRACE	0	/* syscall trace active */
>   #define TIF_SIGPENDING		1	/* signal pending */
>   #define TIF_NEED_RESCHED	2	/* rescheduling necessary */
> +#define TIF_NOTIFY_SIGNAL	3	/* signal notifications exist */
>   #define TIF_RESTART_BLOCK	4
>   #define TIF_MEMDIE		5	/* is terminating due to OOM killer */
>   #define TIF_SYSCALL_AUDIT	6
> @@ -67,6 +68,7 @@ static inline struct thread_info *current_thread_info(void)
>   #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
>   #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
>   #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
> +#define _TIF_NOTIFY_SIGNAL	(1 << TIF_NOTIFY_SIGNAL)
>   #define _TIF_MEMDIE		(1 << TIF_MEMDIE)
>   #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
>   #define _TIF_SECCOMP		(1 << TIF_SECCOMP)
> diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
> index 3bed09538dd9..9e19da9e6198 100644
> --- a/arch/um/kernel/process.c
> +++ b/arch/um/kernel/process.c
> @@ -99,7 +99,8 @@ void interrupt_end(void)
>   
>   	if (need_resched())
>   		schedule();
> -	if (test_thread_flag(TIF_SIGPENDING))
> +	if (test_thread_flag(TIF_SIGPENDING) ||
> +	    test_thread_flag(TIF_NOTIFY_SIGNAL))
>   		do_signal(regs);
>   	if (test_thread_flag(TIF_NOTIFY_RESUME))
>   		tracehook_notify_resume(regs);
> 

Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Jens Axboe Nov. 5, 2020, 6:18 p.m. UTC | #3
On 11/5/20 11:15 AM, Anton Ivanov wrote:
> 
> 
> On 29/10/2020 16:23, Jens Axboe wrote:
>> Wire up TIF_NOTIFY_SIGNAL handling for um.
>>
>> Cc: linux-um@lists.infradead.org
>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>> ---
>>
>> 5.11 has support queued up for TIF_NOTIFY_SIGNAL, see this posting
>> for details:
>>
>> https://lore.kernel.org/io-uring/20201026203230.386348-1-axboe@kernel.dk/
>>
>> As part of that work, I'm adding TIF_NOTIFY_SIGNAL support to all archs,
>> as that will enable a set of cleanups once all of them support it. I'm
>> happy carrying this patch if need be, or it can be funelled through the
>> arch tree. Let me know.
>>
>>   arch/um/include/asm/thread_info.h | 2 ++
>>   arch/um/kernel/process.c          | 3 ++-
>>   2 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/um/include/asm/thread_info.h b/arch/um/include/asm/thread_info.h
>> index 4c19ce4c49f1..3b1cb8b3b186 100644
>> --- a/arch/um/include/asm/thread_info.h
>> +++ b/arch/um/include/asm/thread_info.h
>> @@ -57,6 +57,7 @@ static inline struct thread_info *current_thread_info(void)
>>   #define TIF_SYSCALL_TRACE	0	/* syscall trace active */
>>   #define TIF_SIGPENDING		1	/* signal pending */
>>   #define TIF_NEED_RESCHED	2	/* rescheduling necessary */
>> +#define TIF_NOTIFY_SIGNAL	3	/* signal notifications exist */
>>   #define TIF_RESTART_BLOCK	4
>>   #define TIF_MEMDIE		5	/* is terminating due to OOM killer */
>>   #define TIF_SYSCALL_AUDIT	6
>> @@ -67,6 +68,7 @@ static inline struct thread_info *current_thread_info(void)
>>   #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
>>   #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
>>   #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
>> +#define _TIF_NOTIFY_SIGNAL	(1 << TIF_NOTIFY_SIGNAL)
>>   #define _TIF_MEMDIE		(1 << TIF_MEMDIE)
>>   #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
>>   #define _TIF_SECCOMP		(1 << TIF_SECCOMP)
>> diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
>> index 3bed09538dd9..9e19da9e6198 100644
>> --- a/arch/um/kernel/process.c
>> +++ b/arch/um/kernel/process.c
>> @@ -99,7 +99,8 @@ void interrupt_end(void)
>>   
>>   	if (need_resched())
>>   		schedule();
>> -	if (test_thread_flag(TIF_SIGPENDING))
>> +	if (test_thread_flag(TIF_SIGPENDING) ||
>> +	    test_thread_flag(TIF_NOTIFY_SIGNAL))
>>   		do_signal(regs);
>>   	if (test_thread_flag(TIF_NOTIFY_RESUME))
>>   		tracehook_notify_resume(regs);
>>
> 
> Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com>

Thanks, added.
diff mbox series

Patch

diff --git a/arch/um/include/asm/thread_info.h b/arch/um/include/asm/thread_info.h
index 4c19ce4c49f1..3b1cb8b3b186 100644
--- a/arch/um/include/asm/thread_info.h
+++ b/arch/um/include/asm/thread_info.h
@@ -57,6 +57,7 @@  static inline struct thread_info *current_thread_info(void)
 #define TIF_SYSCALL_TRACE	0	/* syscall trace active */
 #define TIF_SIGPENDING		1	/* signal pending */
 #define TIF_NEED_RESCHED	2	/* rescheduling necessary */
+#define TIF_NOTIFY_SIGNAL	3	/* signal notifications exist */
 #define TIF_RESTART_BLOCK	4
 #define TIF_MEMDIE		5	/* is terminating due to OOM killer */
 #define TIF_SYSCALL_AUDIT	6
@@ -67,6 +68,7 @@  static inline struct thread_info *current_thread_info(void)
 #define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
 #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
+#define _TIF_NOTIFY_SIGNAL	(1 << TIF_NOTIFY_SIGNAL)
 #define _TIF_MEMDIE		(1 << TIF_MEMDIE)
 #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
 #define _TIF_SECCOMP		(1 << TIF_SECCOMP)
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 3bed09538dd9..9e19da9e6198 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -99,7 +99,8 @@  void interrupt_end(void)
 
 	if (need_resched())
 		schedule();
-	if (test_thread_flag(TIF_SIGPENDING))
+	if (test_thread_flag(TIF_SIGPENDING) ||
+	    test_thread_flag(TIF_NOTIFY_SIGNAL))
 		do_signal(regs);
 	if (test_thread_flag(TIF_NOTIFY_RESUME))
 		tracehook_notify_resume(regs);