All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
@ 2020-10-29 16:21 Jens Axboe
  2020-11-05 16:17 ` Jens Axboe
                   ` (12 more replies)
  0 siblings, 13 replies; 26+ messages in thread
From: Jens Axboe @ 2020-10-29 16:21 UTC (permalink / raw)
  To: linux-sh

Wire up TIF_NOTIFY_SIGNAL handling for sh.

Cc: linux-sh@vger.kernel.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/sh/include/asm/thread_info.h | 4 +++-
 arch/sh/kernel/signal_32.c        | 7 +++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index 243ea5150aa0..598d0184ffea 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -105,6 +105,7 @@ extern void init_thread_xstate(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_SINGLESTEP		4	/* singlestepping active */
 #define TIF_SYSCALL_AUDIT	5	/* syscall auditing active */
 #define TIF_SECCOMP		6	/* secure computing */
@@ -116,6 +117,7 @@ extern void init_thread_xstate(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_SINGLESTEP		(1 << TIF_SINGLESTEP)
 #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
 #define _TIF_SECCOMP		(1 << TIF_SECCOMP)
@@ -132,7 +134,7 @@ extern void init_thread_xstate(void);
 #define _TIF_ALLWORK_MASK	(_TIF_SYSCALL_TRACE | _TIF_SIGPENDING      | \
 				 _TIF_NEED_RESCHED  | _TIF_SYSCALL_AUDIT   | \
 				 _TIF_SINGLESTEP    | _TIF_NOTIFY_RESUME   | \
-				 _TIF_SYSCALL_TRACEPOINT)
+				 _TIF_SYSCALL_TRACEPOINT | _TIF_NOTIFY_SIGNAL)
 
 /* work to do on interrupt/exception return */
 #define _TIF_WORK_MASK		(_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
index 1add47fd31f6..8cfae5a75edb 100644
--- a/arch/sh/kernel/signal_32.c
+++ b/arch/sh/kernel/signal_32.c
@@ -466,7 +466,10 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
 	if (!user_mode(regs))
 		return;
 
-	if (get_signal(&ksig)) {
+	if (ti_work & _TIF_NOTIFY_SIGNAL)
+		tracehook_notify_signal();
+
+	if ((ti_work & _TIF_SIGPENDING) && get_signal(&ksig)) {
 		handle_syscall_restart(save_r0, regs, &ksig.ka.sa);
 
 		/* Whee!  Actually deliver the signal.  */
@@ -499,7 +502,7 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
 				 unsigned long thread_info_flags)
 {
 	/* deal with pending signal delivery */
-	if (thread_info_flags & _TIF_SIGPENDING)
+	if (thread_info_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL))
 		do_signal(regs, save_r0);
 
 	if (thread_info_flags & _TIF_NOTIFY_RESUME)
-- 
2.29.0

-- 
Jens Axboe

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2020-10-29 16:21 [PATCH] sh: add support for TIF_NOTIFY_SIGNAL Jens Axboe
@ 2020-11-05 16:17 ` Jens Axboe
  2020-11-05 16:20 ` John Paul Adrian Glaubitz
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Jens Axboe @ 2020-11-05 16:17 UTC (permalink / raw)
  To: linux-sh

Gentle nudge on this one.

On 10/29/20 10:21 AM, Jens Axboe wrote:
> Wire up TIF_NOTIFY_SIGNAL handling for sh.
> 
> Cc: linux-sh@vger.kernel.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/sh/include/asm/thread_info.h | 4 +++-
>  arch/sh/kernel/signal_32.c        | 7 +++++--
>  2 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
> index 243ea5150aa0..598d0184ffea 100644
> --- a/arch/sh/include/asm/thread_info.h
> +++ b/arch/sh/include/asm/thread_info.h
> @@ -105,6 +105,7 @@ extern void init_thread_xstate(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_SINGLESTEP		4	/* singlestepping active */
>  #define TIF_SYSCALL_AUDIT	5	/* syscall auditing active */
>  #define TIF_SECCOMP		6	/* secure computing */
> @@ -116,6 +117,7 @@ extern void init_thread_xstate(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_SINGLESTEP		(1 << TIF_SINGLESTEP)
>  #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
>  #define _TIF_SECCOMP		(1 << TIF_SECCOMP)
> @@ -132,7 +134,7 @@ extern void init_thread_xstate(void);
>  #define _TIF_ALLWORK_MASK	(_TIF_SYSCALL_TRACE | _TIF_SIGPENDING      | \
>  				 _TIF_NEED_RESCHED  | _TIF_SYSCALL_AUDIT   | \
>  				 _TIF_SINGLESTEP    | _TIF_NOTIFY_RESUME   | \
> -				 _TIF_SYSCALL_TRACEPOINT)
> +				 _TIF_SYSCALL_TRACEPOINT | _TIF_NOTIFY_SIGNAL)
>  
>  /* work to do on interrupt/exception return */
>  #define _TIF_WORK_MASK		(_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \
> diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
> index 1add47fd31f6..8cfae5a75edb 100644
> --- a/arch/sh/kernel/signal_32.c
> +++ b/arch/sh/kernel/signal_32.c
> @@ -466,7 +466,10 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
>  	if (!user_mode(regs))
>  		return;
>  
> -	if (get_signal(&ksig)) {
> +	if (ti_work & _TIF_NOTIFY_SIGNAL)
> +		tracehook_notify_signal();
> +
> +	if ((ti_work & _TIF_SIGPENDING) && get_signal(&ksig)) {
>  		handle_syscall_restart(save_r0, regs, &ksig.ka.sa);
>  
>  		/* Whee!  Actually deliver the signal.  */
> @@ -499,7 +502,7 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
>  				 unsigned long thread_info_flags)
>  {
>  	/* deal with pending signal delivery */
> -	if (thread_info_flags & _TIF_SIGPENDING)
> +	if (thread_info_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL))
>  		do_signal(regs, save_r0);
>  
>  	if (thread_info_flags & _TIF_NOTIFY_RESUME)
> 


-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2020-10-29 16:21 [PATCH] sh: add support for TIF_NOTIFY_SIGNAL Jens Axboe
  2020-11-05 16:17 ` Jens Axboe
@ 2020-11-05 16:20 ` John Paul Adrian Glaubitz
  2020-11-05 17:15 ` Jens Axboe
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-11-05 16:20 UTC (permalink / raw)
  To: linux-sh

Hi Jens!

On 11/5/20 5:17 PM, Jens Axboe wrote:
> Gentle nudge on this one.

I can build- and boot-test on SH and IA64.

I assume Rich will be fine with the SH changes, not sure about the IA64 and Tony.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2020-10-29 16:21 [PATCH] sh: add support for TIF_NOTIFY_SIGNAL Jens Axboe
  2020-11-05 16:17 ` Jens Axboe
  2020-11-05 16:20 ` John Paul Adrian Glaubitz
@ 2020-11-05 17:15 ` Jens Axboe
  2020-11-09  8:15 ` Rob Landley
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Jens Axboe @ 2020-11-05 17:15 UTC (permalink / raw)
  To: linux-sh

On 11/5/20 9:20 AM, John Paul Adrian Glaubitz wrote:
> Hi Jens!
> 
> On 11/5/20 5:17 PM, Jens Axboe wrote:
>> Gentle nudge on this one.
> 
> I can build- and boot-test on SH and IA64.

That'd be great, thanks!

> I assume Rich will be fine with the SH changes, not sure about the IA64 and Tony.

Let's add Tony - maybe he'll have a chance to take a look at the ia64 change.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2020-10-29 16:21 [PATCH] sh: add support for TIF_NOTIFY_SIGNAL Jens Axboe
                   ` (2 preceding siblings ...)
  2020-11-05 17:15 ` Jens Axboe
@ 2020-11-09  8:15 ` Rob Landley
  2020-11-09 10:59 ` John Paul Adrian Glaubitz
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Rob Landley @ 2020-11-09  8:15 UTC (permalink / raw)
  To: linux-sh

On 11/5/20 11:15 AM, Jens Axboe wrote:
> On 11/5/20 9:20 AM, John Paul Adrian Glaubitz wrote:
>> Hi Jens!
>>
>> On 11/5/20 5:17 PM, Jens Axboe wrote:
>>> Gentle nudge on this one.
>>
>> I can build- and boot-test on SH and IA64.
> 
> That'd be great, thanks!
> 
>> I assume Rich will be fine with the SH changes, not sure about the IA64 and Tony.
> 
> Let's add Tony - maybe he'll have a chance to take a look at the ia64 change.

It breaks my ARCH=sh j2_defconfig build:

arch/sh/kernel/signal_32.c: In function 'do_signal':
arch/sh/kernel/signal_32.c:469:6: error: 'ti_work' undeclared (first use in this
function)

Admittedly I'm testing a stack of 6 other patches at the same time:

[PATCH -next v2] sh: intc: Convert to DEFINE_SHOW_ATTRIBUTE.eml
[PATCH] sh: dma: fix kconfig dependency for G2_DMA.eml
[PATCH] sh: remove CONFIG_IDE from most defconfig.eml
[PATCH] sh: Remove unused HAVE_COPY_THREAD_TLS macro.eml
[PATCH v1] sh: Drop ARCH_NR_GPIOS definition.eml
[PATCH v2 RESEND +TRIVIAL] arch_sh: hyphenate Non-Uniform in Kconfig prompt.eml

But this is the one I need to revert to get 5.10-rc3 to build, the rest compile.

Rob

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2020-10-29 16:21 [PATCH] sh: add support for TIF_NOTIFY_SIGNAL Jens Axboe
                   ` (3 preceding siblings ...)
  2020-11-09  8:15 ` Rob Landley
@ 2020-11-09 10:59 ` John Paul Adrian Glaubitz
  2020-11-09 14:14 ` Jens Axboe
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-11-09 10:59 UTC (permalink / raw)
  To: linux-sh

Hi Jens!

On 11/5/20 6:15 PM, Jens Axboe wrote:
> On 11/5/20 9:20 AM, John Paul Adrian Glaubitz wrote:
>> Hi Jens!
>>
>> On 11/5/20 5:17 PM, Jens Axboe wrote:
>>> Gentle nudge on this one.
>>
>> I can build- and boot-test on SH and IA64.
> 
> That'd be great, thanks!

Sorry for the delay. I'm busy at the moment and my SH board is currently
building the Perl 5.32 package for Debian. Will try to test your patches
by tomorrow, also ia64.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2020-10-29 16:21 [PATCH] sh: add support for TIF_NOTIFY_SIGNAL Jens Axboe
                   ` (4 preceding siblings ...)
  2020-11-09 10:59 ` John Paul Adrian Glaubitz
@ 2020-11-09 14:14 ` Jens Axboe
  2020-11-09 14:14 ` Jens Axboe
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Jens Axboe @ 2020-11-09 14:14 UTC (permalink / raw)
  To: linux-sh

On 11/9/20 1:15 AM, Rob Landley wrote:
> On 11/5/20 11:15 AM, Jens Axboe wrote:
>> On 11/5/20 9:20 AM, John Paul Adrian Glaubitz wrote:
>>> Hi Jens!
>>>
>>> On 11/5/20 5:17 PM, Jens Axboe wrote:
>>>> Gentle nudge on this one.
>>>
>>> I can build- and boot-test on SH and IA64.
>>
>> That'd be great, thanks!
>>
>>> I assume Rich will be fine with the SH changes, not sure about the IA64 and Tony.
>>
>> Let's add Tony - maybe he'll have a chance to take a look at the ia64 change.
> 
> It breaks my ARCH=sh j2_defconfig build:
> 
> arch/sh/kernel/signal_32.c: In function 'do_signal':
> arch/sh/kernel/signal_32.c:469:6: error: 'ti_work' undeclared (first use in this
> function)
> 
> Admittedly I'm testing a stack of 6 other patches at the same time:
> 
> [PATCH -next v2] sh: intc: Convert to DEFINE_SHOW_ATTRIBUTE.eml
> [PATCH] sh: dma: fix kconfig dependency for G2_DMA.eml
> [PATCH] sh: remove CONFIG_IDE from most defconfig.eml
> [PATCH] sh: Remove unused HAVE_COPY_THREAD_TLS macro.eml
> [PATCH v1] sh: Drop ARCH_NR_GPIOS definition.eml
> [PATCH v2 RESEND +TRIVIAL] arch_sh: hyphenate Non-Uniform in Kconfig prompt.eml
> 
> But this is the one I need to revert to get 5.10-rc3 to build, the rest compile.

Yeah that's my fault, this one should be a lot better...


commit de2791b15d47a56854054da71064b9634896728b
Author: Jens Axboe <axboe@kernel.dk>
Date:   Fri Oct 9 15:36:35 2020 -0600

    sh: add support for TIF_NOTIFY_SIGNAL
    
    Wire up TIF_NOTIFY_SIGNAL handling for sh.
    
    Cc: linux-sh@vger.kernel.org
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index 243ea5150aa0..598d0184ffea 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -105,6 +105,7 @@ extern void init_thread_xstate(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_SINGLESTEP		4	/* singlestepping active */
 #define TIF_SYSCALL_AUDIT	5	/* syscall auditing active */
 #define TIF_SECCOMP		6	/* secure computing */
@@ -116,6 +117,7 @@ extern void init_thread_xstate(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_SINGLESTEP		(1 << TIF_SINGLESTEP)
 #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
 #define _TIF_SECCOMP		(1 << TIF_SECCOMP)
@@ -132,7 +134,7 @@ extern void init_thread_xstate(void);
 #define _TIF_ALLWORK_MASK	(_TIF_SYSCALL_TRACE | _TIF_SIGPENDING      | \
 				 _TIF_NEED_RESCHED  | _TIF_SYSCALL_AUDIT   | \
 				 _TIF_SINGLESTEP    | _TIF_NOTIFY_RESUME   | \
-				 _TIF_SYSCALL_TRACEPOINT)
+				 _TIF_SYSCALL_TRACEPOINT | _TIF_NOTIFY_SIGNAL)
 
 /* work to do on interrupt/exception return */
 #define _TIF_WORK_MASK		(_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
index 1add47fd31f6..e78d3e10a203 100644
--- a/arch/sh/kernel/signal_32.c
+++ b/arch/sh/kernel/signal_32.c
@@ -453,7 +453,8 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs, unsigned int save_r0)
  * the kernel can handle, and then we build all the user-level signal handling
  * stack-frames in one go after that.
  */
-static void do_signal(struct pt_regs *regs, unsigned int save_r0)
+static void do_signal(struct pt_regs *regs, unsigned int save_r0,
+		      unsigned long ti_work)
 {
 	struct ksignal ksig;
 
@@ -466,7 +467,10 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
 	if (!user_mode(regs))
 		return;
 
-	if (get_signal(&ksig)) {
+	if (ti_work & _TIF_NOTIFY_SIGNAL)
+		tracehook_notify_signal();
+
+	if ((ti_work & _TIF_SIGPENDING) && get_signal(&ksig)) {
 		handle_syscall_restart(save_r0, regs, &ksig.ka.sa);
 
 		/* Whee!  Actually deliver the signal.  */
@@ -499,8 +503,8 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
 				 unsigned long thread_info_flags)
 {
 	/* deal with pending signal delivery */
-	if (thread_info_flags & _TIF_SIGPENDING)
-		do_signal(regs, save_r0);
+	if (thread_info_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL))
+		do_signal(regs, save_r0, thread_info_flags);
 
 	if (thread_info_flags & _TIF_NOTIFY_RESUME)
 		tracehook_notify_resume(regs);

-- 
Jens Axboe

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2020-10-29 16:21 [PATCH] sh: add support for TIF_NOTIFY_SIGNAL Jens Axboe
                   ` (5 preceding siblings ...)
  2020-11-09 14:14 ` Jens Axboe
@ 2020-11-09 14:14 ` Jens Axboe
  2020-11-09 15:10 ` Jens Axboe
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Jens Axboe @ 2020-11-09 14:14 UTC (permalink / raw)
  To: linux-sh

On 11/9/20 3:59 AM, John Paul Adrian Glaubitz wrote:
> Hi Jens!
> 
> On 11/5/20 6:15 PM, Jens Axboe wrote:
>> On 11/5/20 9:20 AM, John Paul Adrian Glaubitz wrote:
>>> Hi Jens!
>>>
>>> On 11/5/20 5:17 PM, Jens Axboe wrote:
>>>> Gentle nudge on this one.
>>>
>>> I can build- and boot-test on SH and IA64.
>>
>> That'd be great, thanks!
> 
> Sorry for the delay. I'm busy at the moment and my SH board is currently
> building the Perl 5.32 package for Debian. Will try to test your patches
> by tomorrow, also ia64.

Thanks, both would be appreciated! Just CC'ed you on the updated patch
for sh.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2020-10-29 16:21 [PATCH] sh: add support for TIF_NOTIFY_SIGNAL Jens Axboe
                   ` (6 preceding siblings ...)
  2020-11-09 14:14 ` Jens Axboe
@ 2020-11-09 15:10 ` Jens Axboe
  2020-11-09 15:15 ` Rob Landley
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Jens Axboe @ 2020-11-09 15:10 UTC (permalink / raw)
  To: linux-sh

On 11/9/20 8:15 AM, Rob Landley wrote:
> 
> 
> On 11/9/20 8:14 AM, Jens Axboe wrote:
>> On 11/9/20 1:15 AM, Rob Landley wrote:
>>> On 11/5/20 11:15 AM, Jens Axboe wrote:
>>>> On 11/5/20 9:20 AM, John Paul Adrian Glaubitz wrote:
>>>>> Hi Jens!
>>>>>
>>>>> On 11/5/20 5:17 PM, Jens Axboe wrote:
>>>>>> Gentle nudge on this one.
>>>>>
>>>>> I can build- and boot-test on SH and IA64.
>>>>
>>>> That'd be great, thanks!
>>>>
>>>>> I assume Rich will be fine with the SH changes, not sure about the IA64 and Tony.
>>>>
>>>> Let's add Tony - maybe he'll have a chance to take a look at the ia64 change.
>>>
>>> It breaks my ARCH=sh j2_defconfig build:
>>>
>>> arch/sh/kernel/signal_32.c: In function 'do_signal':
>>> arch/sh/kernel/signal_32.c:469:6: error: 'ti_work' undeclared (first use in this
>>> function)
>>>
>>> Admittedly I'm testing a stack of 6 other patches at the same time:
>>>
>>> [PATCH -next v2] sh: intc: Convert to DEFINE_SHOW_ATTRIBUTE.eml
>>> [PATCH] sh: dma: fix kconfig dependency for G2_DMA.eml
>>> [PATCH] sh: remove CONFIG_IDE from most defconfig.eml
>>> [PATCH] sh: Remove unused HAVE_COPY_THREAD_TLS macro.eml
>>> [PATCH v1] sh: Drop ARCH_NR_GPIOS definition.eml
>>> [PATCH v2 RESEND +TRIVIAL] arch_sh: hyphenate Non-Uniform in Kconfig prompt.eml
>>>
>>> But this is the one I need to revert to get 5.10-rc3 to build, the rest compile.
>>
>> Yeah that's my fault, this one should be a lot better...
> 
> arch/sh/kernel/signal_32.c: In function 'do_signal':
> arch/sh/kernel/signal_32.c:471:3: error: implicit declaration of function
> 'tracehook_notify_signal'; did you mean 'tracehook_notify_resume'?
> [-Werror=implicit-function-declaration]
> 
> Keep 'em coming...

Gah, it was still using the old style. This one should work and be correct,
promise, double checked :-)


commit 748887e0b8e7557d79a04e0f8e930027770d7b28
Author: Jens Axboe <axboe@kernel.dk>
Date:   Fri Oct 9 15:36:35 2020 -0600

    sh: add support for TIF_NOTIFY_SIGNAL
    
    Wire up TIF_NOTIFY_SIGNAL handling for sh.
    
    Cc: linux-sh@vger.kernel.org
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index 243ea5150aa0..598d0184ffea 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -105,6 +105,7 @@ extern void init_thread_xstate(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_SINGLESTEP		4	/* singlestepping active */
 #define TIF_SYSCALL_AUDIT	5	/* syscall auditing active */
 #define TIF_SECCOMP		6	/* secure computing */
@@ -116,6 +117,7 @@ extern void init_thread_xstate(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_SINGLESTEP		(1 << TIF_SINGLESTEP)
 #define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
 #define _TIF_SECCOMP		(1 << TIF_SECCOMP)
@@ -132,7 +134,7 @@ extern void init_thread_xstate(void);
 #define _TIF_ALLWORK_MASK	(_TIF_SYSCALL_TRACE | _TIF_SIGPENDING      | \
 				 _TIF_NEED_RESCHED  | _TIF_SYSCALL_AUDIT   | \
 				 _TIF_SINGLESTEP    | _TIF_NOTIFY_RESUME   | \
-				 _TIF_SYSCALL_TRACEPOINT)
+				 _TIF_SYSCALL_TRACEPOINT | _TIF_NOTIFY_SIGNAL)
 
 /* work to do on interrupt/exception return */
 #define _TIF_WORK_MASK		(_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
index 1add47fd31f6..dd3092911efa 100644
--- a/arch/sh/kernel/signal_32.c
+++ b/arch/sh/kernel/signal_32.c
@@ -499,7 +499,7 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
 				 unsigned long thread_info_flags)
 {
 	/* deal with pending signal delivery */
-	if (thread_info_flags & _TIF_SIGPENDING)
+	if (thread_info_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL))
 		do_signal(regs, save_r0);
 
 	if (thread_info_flags & _TIF_NOTIFY_RESUME)

-- 
Jens Axboe

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2020-10-29 16:21 [PATCH] sh: add support for TIF_NOTIFY_SIGNAL Jens Axboe
                   ` (7 preceding siblings ...)
  2020-11-09 15:10 ` Jens Axboe
@ 2020-11-09 15:15 ` Rob Landley
  2020-11-09 16:29 ` Jens Axboe
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Rob Landley @ 2020-11-09 15:15 UTC (permalink / raw)
  To: linux-sh



On 11/9/20 8:14 AM, Jens Axboe wrote:
> On 11/9/20 1:15 AM, Rob Landley wrote:
>> On 11/5/20 11:15 AM, Jens Axboe wrote:
>>> On 11/5/20 9:20 AM, John Paul Adrian Glaubitz wrote:
>>>> Hi Jens!
>>>>
>>>> On 11/5/20 5:17 PM, Jens Axboe wrote:
>>>>> Gentle nudge on this one.
>>>>
>>>> I can build- and boot-test on SH and IA64.
>>>
>>> That'd be great, thanks!
>>>
>>>> I assume Rich will be fine with the SH changes, not sure about the IA64 and Tony.
>>>
>>> Let's add Tony - maybe he'll have a chance to take a look at the ia64 change.
>>
>> It breaks my ARCH=sh j2_defconfig build:
>>
>> arch/sh/kernel/signal_32.c: In function 'do_signal':
>> arch/sh/kernel/signal_32.c:469:6: error: 'ti_work' undeclared (first use in this
>> function)
>>
>> Admittedly I'm testing a stack of 6 other patches at the same time:
>>
>> [PATCH -next v2] sh: intc: Convert to DEFINE_SHOW_ATTRIBUTE.eml
>> [PATCH] sh: dma: fix kconfig dependency for G2_DMA.eml
>> [PATCH] sh: remove CONFIG_IDE from most defconfig.eml
>> [PATCH] sh: Remove unused HAVE_COPY_THREAD_TLS macro.eml
>> [PATCH v1] sh: Drop ARCH_NR_GPIOS definition.eml
>> [PATCH v2 RESEND +TRIVIAL] arch_sh: hyphenate Non-Uniform in Kconfig prompt.eml
>>
>> But this is the one I need to revert to get 5.10-rc3 to build, the rest compile.
> 
> Yeah that's my fault, this one should be a lot better...

arch/sh/kernel/signal_32.c: In function 'do_signal':
arch/sh/kernel/signal_32.c:471:3: error: implicit declaration of function
'tracehook_notify_signal'; did you mean 'tracehook_notify_resume'?
[-Werror=implicit-function-declaration]

Keep 'em coming...

Rob

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2020-10-29 16:21 [PATCH] sh: add support for TIF_NOTIFY_SIGNAL Jens Axboe
                   ` (8 preceding siblings ...)
  2020-11-09 15:15 ` Rob Landley
@ 2020-11-09 16:29 ` Jens Axboe
  2020-11-09 16:34 ` Rob Landley
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Jens Axboe @ 2020-11-09 16:29 UTC (permalink / raw)
  To: linux-sh

On 11/9/20 9:34 AM, Rob Landley wrote:
> On 11/9/20 9:10 AM, Jens Axboe wrote:
>> On 11/9/20 8:15 AM, Rob Landley wrote:
>>>
>>>
>>> On 11/9/20 8:14 AM, Jens Axboe wrote:
>>>> On 11/9/20 1:15 AM, Rob Landley wrote:
>>>>> On 11/5/20 11:15 AM, Jens Axboe wrote:
>>>>>> On 11/5/20 9:20 AM, John Paul Adrian Glaubitz wrote:
>>>>>>> Hi Jens!
>>>>>>>
>>>>>>> On 11/5/20 5:17 PM, Jens Axboe wrote:
>>>>>>>> Gentle nudge on this one.
>>>>>>>
>>>>>>> I can build- and boot-test on SH and IA64.
>>>>>>
>>>>>> That'd be great, thanks!
>>>>>>
>>>>>>> I assume Rich will be fine with the SH changes, not sure about the IA64 and Tony.
>>>>>>
>>>>>> Let's add Tony - maybe he'll have a chance to take a look at the ia64 change.
>>>>>
>>>>> It breaks my ARCH=sh j2_defconfig build:
>>>>>
>>>>> arch/sh/kernel/signal_32.c: In function 'do_signal':
>>>>> arch/sh/kernel/signal_32.c:469:6: error: 'ti_work' undeclared (first use in this
>>>>> function)
>>>>>
>>>>> Admittedly I'm testing a stack of 6 other patches at the same time:
>>>>>
>>>>> [PATCH -next v2] sh: intc: Convert to DEFINE_SHOW_ATTRIBUTE.eml
>>>>> [PATCH] sh: dma: fix kconfig dependency for G2_DMA.eml
>>>>> [PATCH] sh: remove CONFIG_IDE from most defconfig.eml
>>>>> [PATCH] sh: Remove unused HAVE_COPY_THREAD_TLS macro.eml
>>>>> [PATCH v1] sh: Drop ARCH_NR_GPIOS definition.eml
>>>>> [PATCH v2 RESEND +TRIVIAL] arch_sh: hyphenate Non-Uniform in Kconfig prompt.eml
>>>>>
>>>>> But this is the one I need to revert to get 5.10-rc3 to build, the rest compile.
>>>>
>>>> Yeah that's my fault, this one should be a lot better...
>>>
>>> arch/sh/kernel/signal_32.c: In function 'do_signal':
>>> arch/sh/kernel/signal_32.c:471:3: error: implicit declaration of function
>>> 'tracehook_notify_signal'; did you mean 'tracehook_notify_resume'?
>>> [-Werror=implicit-function-declaration]
>>>
>>> Keep 'em coming...
>>
>> Gah, it was still using the old style. This one should work and be correct,
>> promise, double checked :-)
> 
> This one compiled fine. What does it do? (I ask having read
> https://lwn.net/Articles/835340/ and come out none the wiser.)

The motivation is in another patch:

https://git.kernel.dk/cgit/linux-block/commit/?h=tif-task_work&idýb5f027ce662d1e10d8d16793b1f588b8543277

Basically it decouples TWA_SIGNAL task_work from actual signals, since
they contend on the sighand lock, particularly for threads. Hence the
goal is to get all archs supporting TIF_NOTIFY_SIGNAL, so we can use
that for TWA_SIGNAL.

The patches are done such that the signal handling core still handles
running the task_work, but if invoked without TIF_SIGPENDING, we don't
do actual signal delivery, just the syscall restart part.

> I can try it on hardware in the morning, it's 1am in this time zone...

Thanks, that'd be great! It really should be a no-op, as you can see
from the final patch, it's just masking in an extra flag for when to
call get_signal(). At least it should've been, if I hadn't neglected
to properly updated the 'sh' patch for the cleaner setup...

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2020-10-29 16:21 [PATCH] sh: add support for TIF_NOTIFY_SIGNAL Jens Axboe
                   ` (9 preceding siblings ...)
  2020-11-09 16:29 ` Jens Axboe
@ 2020-11-09 16:34 ` Rob Landley
  2020-11-17  5:26 ` John Paul Adrian Glaubitz
  2020-11-17 15:06 ` Jens Axboe
  12 siblings, 0 replies; 26+ messages in thread
From: Rob Landley @ 2020-11-09 16:34 UTC (permalink / raw)
  To: linux-sh

On 11/9/20 9:10 AM, Jens Axboe wrote:
> On 11/9/20 8:15 AM, Rob Landley wrote:
>>
>>
>> On 11/9/20 8:14 AM, Jens Axboe wrote:
>>> On 11/9/20 1:15 AM, Rob Landley wrote:
>>>> On 11/5/20 11:15 AM, Jens Axboe wrote:
>>>>> On 11/5/20 9:20 AM, John Paul Adrian Glaubitz wrote:
>>>>>> Hi Jens!
>>>>>>
>>>>>> On 11/5/20 5:17 PM, Jens Axboe wrote:
>>>>>>> Gentle nudge on this one.
>>>>>>
>>>>>> I can build- and boot-test on SH and IA64.
>>>>>
>>>>> That'd be great, thanks!
>>>>>
>>>>>> I assume Rich will be fine with the SH changes, not sure about the IA64 and Tony.
>>>>>
>>>>> Let's add Tony - maybe he'll have a chance to take a look at the ia64 change.
>>>>
>>>> It breaks my ARCH=sh j2_defconfig build:
>>>>
>>>> arch/sh/kernel/signal_32.c: In function 'do_signal':
>>>> arch/sh/kernel/signal_32.c:469:6: error: 'ti_work' undeclared (first use in this
>>>> function)
>>>>
>>>> Admittedly I'm testing a stack of 6 other patches at the same time:
>>>>
>>>> [PATCH -next v2] sh: intc: Convert to DEFINE_SHOW_ATTRIBUTE.eml
>>>> [PATCH] sh: dma: fix kconfig dependency for G2_DMA.eml
>>>> [PATCH] sh: remove CONFIG_IDE from most defconfig.eml
>>>> [PATCH] sh: Remove unused HAVE_COPY_THREAD_TLS macro.eml
>>>> [PATCH v1] sh: Drop ARCH_NR_GPIOS definition.eml
>>>> [PATCH v2 RESEND +TRIVIAL] arch_sh: hyphenate Non-Uniform in Kconfig prompt.eml
>>>>
>>>> But this is the one I need to revert to get 5.10-rc3 to build, the rest compile.
>>>
>>> Yeah that's my fault, this one should be a lot better...
>>
>> arch/sh/kernel/signal_32.c: In function 'do_signal':
>> arch/sh/kernel/signal_32.c:471:3: error: implicit declaration of function
>> 'tracehook_notify_signal'; did you mean 'tracehook_notify_resume'?
>> [-Werror=implicit-function-declaration]
>>
>> Keep 'em coming...
> 
> Gah, it was still using the old style. This one should work and be correct,
> promise, double checked :-)

This one compiled fine. What does it do? (I ask having read
https://lwn.net/Articles/835340/ and come out none the wiser.)

I can try it on hardware in the morning, it's 1am in this time zone...

Rob

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2020-10-29 16:21 [PATCH] sh: add support for TIF_NOTIFY_SIGNAL Jens Axboe
                   ` (10 preceding siblings ...)
  2020-11-09 16:34 ` Rob Landley
@ 2020-11-17  5:26 ` John Paul Adrian Glaubitz
  2020-11-17 15:06 ` Jens Axboe
  12 siblings, 0 replies; 26+ messages in thread
From: John Paul Adrian Glaubitz @ 2020-11-17  5:26 UTC (permalink / raw)
  To: linux-sh

Hi Jens!

On 11/9/20 3:14 PM, Jens Axboe wrote:
>> Sorry for the delay. I'm busy at the moment and my SH board is currently
>> building the Perl 5.32 package for Debian. Will try to test your patches
>> by tomorrow, also ia64.
> 
> Thanks, both would be appreciated! Just CC'ed you on the updated patch
> for sh.

Is this still relevant for testing? I'm ready to test now, much later than
I thought, sorry.

I'm going to build Linus' latest kernel for my SH and IA64 machines now
and then I can test additional patches on top of it.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2020-10-29 16:21 [PATCH] sh: add support for TIF_NOTIFY_SIGNAL Jens Axboe
                   ` (11 preceding siblings ...)
  2020-11-17  5:26 ` John Paul Adrian Glaubitz
@ 2020-11-17 15:06 ` Jens Axboe
  2021-01-01 14:06     ` John Paul Adrian Glaubitz
  12 siblings, 1 reply; 26+ messages in thread
From: Jens Axboe @ 2020-11-17 15:06 UTC (permalink / raw)
  To: linux-sh

On 11/16/20 10:26 PM, John Paul Adrian Glaubitz wrote:
> Hi Jens!
> 
> On 11/9/20 3:14 PM, Jens Axboe wrote:
>>> Sorry for the delay. I'm busy at the moment and my SH board is currently
>>> building the Perl 5.32 package for Debian. Will try to test your patches
>>> by tomorrow, also ia64.
>>
>> Thanks, both would be appreciated! Just CC'ed you on the updated patch
>> for sh.
> 
> Is this still relevant for testing? I'm ready to test now, much later than
> I thought, sorry.
> 
> I'm going to build Linus' latest kernel for my SH and IA64 machines now
> and then I can test additional patches on top of it.

Thanks, would definitely still appreciate testing. You can just run
linux-next if you want, it's got everything in there. Or apply the
separate patches to -git, either approach is fine.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2020-11-17 15:06 ` Jens Axboe
@ 2021-01-01 14:06     ` John Paul Adrian Glaubitz
  0 siblings, 0 replies; 26+ messages in thread
From: John Paul Adrian Glaubitz @ 2021-01-01 14:06 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-sh, linux-ia64

Hi Jens!

On 11/17/20 4:06 PM, Jens Axboe wrote:
> On 11/16/20 10:26 PM, John Paul Adrian Glaubitz wrote:
>> Hi Jens!
>>
>> On 11/9/20 3:14 PM, Jens Axboe wrote:
>>>> Sorry for the delay. I'm busy at the moment and my SH board is currently
>>>> building the Perl 5.32 package for Debian. Will try to test your patches
>>>> by tomorrow, also ia64.
>>>
>>> Thanks, both would be appreciated! Just CC'ed you on the updated patch
>>> for sh.
>>
>> Is this still relevant for testing? I'm ready to test now, much later than
>> I thought, sorry.
>>
>> I'm going to build Linus' latest kernel for my SH and IA64 machines now
>> and then I can test additional patches on top of it.
> 
> Thanks, would definitely still appreciate testing. You can just run
> linux-next if you want, it's got everything in there. Or apply the
> separate patches to -git, either approach is fine.

Apologies for the late reply.

I just pulled Linus' latest tree today with your patch for SH included and
I'm not seeing any regressions.

Is there away to test the change itself?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
@ 2021-01-01 14:06     ` John Paul Adrian Glaubitz
  0 siblings, 0 replies; 26+ messages in thread
From: John Paul Adrian Glaubitz @ 2021-01-01 14:06 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-sh, linux-ia64

Hi Jens!

On 11/17/20 4:06 PM, Jens Axboe wrote:
> On 11/16/20 10:26 PM, John Paul Adrian Glaubitz wrote:
>> Hi Jens!
>>
>> On 11/9/20 3:14 PM, Jens Axboe wrote:
>>>> Sorry for the delay. I'm busy at the moment and my SH board is currently
>>>> building the Perl 5.32 package for Debian. Will try to test your patches
>>>> by tomorrow, also ia64.
>>>
>>> Thanks, both would be appreciated! Just CC'ed you on the updated patch
>>> for sh.
>>
>> Is this still relevant for testing? I'm ready to test now, much later than
>> I thought, sorry.
>>
>> I'm going to build Linus' latest kernel for my SH and IA64 machines now
>> and then I can test additional patches on top of it.
> 
> Thanks, would definitely still appreciate testing. You can just run
> linux-next if you want, it's got everything in there. Or apply the
> separate patches to -git, either approach is fine.

Apologies for the late reply.

I just pulled Linus' latest tree today with your patch for SH included and
I'm not seeing any regressions.

Is there away to test the change itself?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2021-01-01 14:06     ` John Paul Adrian Glaubitz
@ 2021-01-01 15:08       ` Jens Axboe
  -1 siblings, 0 replies; 26+ messages in thread
From: Jens Axboe @ 2021-01-01 15:08 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz; +Cc: linux-sh, linux-ia64

[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]

On 1/1/21 7:06 AM, John Paul Adrian Glaubitz wrote:
> Hi Jens!
> 
> On 11/17/20 4:06 PM, Jens Axboe wrote:
>> On 11/16/20 10:26 PM, John Paul Adrian Glaubitz wrote:
>>> Hi Jens!
>>>
>>> On 11/9/20 3:14 PM, Jens Axboe wrote:
>>>>> Sorry for the delay. I'm busy at the moment and my SH board is currently
>>>>> building the Perl 5.32 package for Debian. Will try to test your patches
>>>>> by tomorrow, also ia64.
>>>>
>>>> Thanks, both would be appreciated! Just CC'ed you on the updated patch
>>>> for sh.
>>>
>>> Is this still relevant for testing? I'm ready to test now, much later than
>>> I thought, sorry.
>>>
>>> I'm going to build Linus' latest kernel for my SH and IA64 machines now
>>> and then I can test additional patches on top of it.
>>
>> Thanks, would definitely still appreciate testing. You can just run
>> linux-next if you want, it's got everything in there. Or apply the
>> separate patches to -git, either approach is fine.
> 
> Apologies for the late reply.
> 
> I just pulled Linus' latest tree today with your patch for SH included and
> I'm not seeing any regressions.
> 
> Is there away to test the change itself?

The only user of TWA_SIGNAL, which uses TIF_NOTIFY_SIGNAL, so far is io_uring.
You need something that triggers deferred task_work processing, which is
basically anything that ends up being poll driven for data/space readiness.
Here's a small test app from the liburing test suite, that'll trigger it.

If you install liburing, compile with:

gcc -Wall -O2 -o socket-rw socket-rw.c -luring

and run it without any arguments.

-- 
Jens Axboe


[-- Attachment #2: socket-rw.c --]
[-- Type: text/x-csrc, Size: 2839 bytes --]

/* SPDX-License-Identifier: MIT */
/*
 * Check that a readv on a socket queued before a writev doesn't hang
 * the processing.
 *
 * From Hrvoje Zeba <zeba.hrvoje@gmail.com>
 */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>

#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/tcp.h>
#include <netinet/in.h>

#include <liburing.h>

int main(int argc, char *argv[])
{
	int p_fd[2], ret;
	int32_t recv_s0;
	int32_t val = 1;
	struct sockaddr_in addr;

	if (argc > 1)
		return 0;

	recv_s0 = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, IPPROTO_TCP);

	ret = setsockopt(recv_s0, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val));
	assert(ret != -1);
	ret = setsockopt(recv_s0, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
	assert(ret != -1);

	addr.sin_family = AF_INET;
	addr.sin_port = 0x1235;
	addr.sin_addr.s_addr = 0x0100007fU;

	ret = bind(recv_s0, (struct sockaddr*)&addr, sizeof(addr));
	assert(ret != -1);
	ret = listen(recv_s0, 128);
	assert(ret != -1);


	p_fd[1] = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, IPPROTO_TCP);

	val = 1;
	ret = setsockopt(p_fd[1], IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
	assert(ret != -1);

	int32_t flags = fcntl(p_fd[1], F_GETFL, 0);
	assert(flags != -1);

	flags |= O_NONBLOCK;
	ret = fcntl(p_fd[1], F_SETFL, flags);
	assert(ret != -1);

	ret = connect(p_fd[1], (struct sockaddr*)&addr, sizeof(addr));
	assert(ret == -1);

	flags = fcntl(p_fd[1], F_GETFL, 0);
	assert(flags != -1);

	flags &= ~O_NONBLOCK;
	ret = fcntl(p_fd[1], F_SETFL, flags);
	assert(ret != -1);

	p_fd[0] = accept(recv_s0, NULL, NULL);
	assert(p_fd[0] != -1);

	while (1) {
		int32_t code;
		socklen_t code_len = sizeof(code);

		ret = getsockopt(p_fd[1], SOL_SOCKET, SO_ERROR, &code, &code_len);
		assert(ret != -1);

		if (!code)
			break;
	}

	struct io_uring m_io_uring;

	ret = io_uring_queue_init(32, &m_io_uring, 0);
	assert(ret >= 0);

	char recv_buff[128];
	char send_buff[128];

	{
		struct iovec iov[1];

		iov[0].iov_base = recv_buff;
		iov[0].iov_len = sizeof(recv_buff);

		struct io_uring_sqe* sqe = io_uring_get_sqe(&m_io_uring);
		assert(sqe != NULL);

		io_uring_prep_readv(sqe, p_fd[0], iov, 1, 0);
	}

	{
		struct iovec iov[1];

		iov[0].iov_base = send_buff;
		iov[0].iov_len = sizeof(send_buff);

		struct io_uring_sqe* sqe = io_uring_get_sqe(&m_io_uring);
		assert(sqe != NULL);

		io_uring_prep_writev(sqe, p_fd[1], iov, 1, 0);
	}

	ret = io_uring_submit_and_wait(&m_io_uring, 2);
	assert(ret != -1);

	struct io_uring_cqe* cqe;
	uint32_t head;
	uint32_t count = 0;

	while (count != 2) {
		io_uring_for_each_cqe(&m_io_uring, head, cqe) {
			assert(cqe->res == 128);
			count++;
		}

		assert(count <= 2);
		io_uring_cq_advance(&m_io_uring, count);
	}

	io_uring_queue_exit(&m_io_uring);
	return 0;
}

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
@ 2021-01-01 15:08       ` Jens Axboe
  0 siblings, 0 replies; 26+ messages in thread
From: Jens Axboe @ 2021-01-01 15:08 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz; +Cc: linux-sh, linux-ia64

[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]

On 1/1/21 7:06 AM, John Paul Adrian Glaubitz wrote:
> Hi Jens!
> 
> On 11/17/20 4:06 PM, Jens Axboe wrote:
>> On 11/16/20 10:26 PM, John Paul Adrian Glaubitz wrote:
>>> Hi Jens!
>>>
>>> On 11/9/20 3:14 PM, Jens Axboe wrote:
>>>>> Sorry for the delay. I'm busy at the moment and my SH board is currently
>>>>> building the Perl 5.32 package for Debian. Will try to test your patches
>>>>> by tomorrow, also ia64.
>>>>
>>>> Thanks, both would be appreciated! Just CC'ed you on the updated patch
>>>> for sh.
>>>
>>> Is this still relevant for testing? I'm ready to test now, much later than
>>> I thought, sorry.
>>>
>>> I'm going to build Linus' latest kernel for my SH and IA64 machines now
>>> and then I can test additional patches on top of it.
>>
>> Thanks, would definitely still appreciate testing. You can just run
>> linux-next if you want, it's got everything in there. Or apply the
>> separate patches to -git, either approach is fine.
> 
> Apologies for the late reply.
> 
> I just pulled Linus' latest tree today with your patch for SH included and
> I'm not seeing any regressions.
> 
> Is there away to test the change itself?

The only user of TWA_SIGNAL, which uses TIF_NOTIFY_SIGNAL, so far is io_uring.
You need something that triggers deferred task_work processing, which is
basically anything that ends up being poll driven for data/space readiness.
Here's a small test app from the liburing test suite, that'll trigger it.

If you install liburing, compile with:

gcc -Wall -O2 -o socket-rw socket-rw.c -luring

and run it without any arguments.

-- 
Jens Axboe


[-- Attachment #2: socket-rw.c --]
[-- Type: text/x-csrc, Size: 2839 bytes --]

/* SPDX-License-Identifier: MIT */
/*
 * Check that a readv on a socket queued before a writev doesn't hang
 * the processing.
 *
 * From Hrvoje Zeba <zeba.hrvoje@gmail.com>
 */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>

#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/tcp.h>
#include <netinet/in.h>

#include <liburing.h>

int main(int argc, char *argv[])
{
	int p_fd[2], ret;
	int32_t recv_s0;
	int32_t val = 1;
	struct sockaddr_in addr;

	if (argc > 1)
		return 0;

	recv_s0 = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, IPPROTO_TCP);

	ret = setsockopt(recv_s0, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val));
	assert(ret != -1);
	ret = setsockopt(recv_s0, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
	assert(ret != -1);

	addr.sin_family = AF_INET;
	addr.sin_port = 0x1235;
	addr.sin_addr.s_addr = 0x0100007fU;

	ret = bind(recv_s0, (struct sockaddr*)&addr, sizeof(addr));
	assert(ret != -1);
	ret = listen(recv_s0, 128);
	assert(ret != -1);


	p_fd[1] = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, IPPROTO_TCP);

	val = 1;
	ret = setsockopt(p_fd[1], IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
	assert(ret != -1);

	int32_t flags = fcntl(p_fd[1], F_GETFL, 0);
	assert(flags != -1);

	flags |= O_NONBLOCK;
	ret = fcntl(p_fd[1], F_SETFL, flags);
	assert(ret != -1);

	ret = connect(p_fd[1], (struct sockaddr*)&addr, sizeof(addr));
	assert(ret == -1);

	flags = fcntl(p_fd[1], F_GETFL, 0);
	assert(flags != -1);

	flags &= ~O_NONBLOCK;
	ret = fcntl(p_fd[1], F_SETFL, flags);
	assert(ret != -1);

	p_fd[0] = accept(recv_s0, NULL, NULL);
	assert(p_fd[0] != -1);

	while (1) {
		int32_t code;
		socklen_t code_len = sizeof(code);

		ret = getsockopt(p_fd[1], SOL_SOCKET, SO_ERROR, &code, &code_len);
		assert(ret != -1);

		if (!code)
			break;
	}

	struct io_uring m_io_uring;

	ret = io_uring_queue_init(32, &m_io_uring, 0);
	assert(ret >= 0);

	char recv_buff[128];
	char send_buff[128];

	{
		struct iovec iov[1];

		iov[0].iov_base = recv_buff;
		iov[0].iov_len = sizeof(recv_buff);

		struct io_uring_sqe* sqe = io_uring_get_sqe(&m_io_uring);
		assert(sqe != NULL);

		io_uring_prep_readv(sqe, p_fd[0], iov, 1, 0);
	}

	{
		struct iovec iov[1];

		iov[0].iov_base = send_buff;
		iov[0].iov_len = sizeof(send_buff);

		struct io_uring_sqe* sqe = io_uring_get_sqe(&m_io_uring);
		assert(sqe != NULL);

		io_uring_prep_writev(sqe, p_fd[1], iov, 1, 0);
	}

	ret = io_uring_submit_and_wait(&m_io_uring, 2);
	assert(ret != -1);

	struct io_uring_cqe* cqe;
	uint32_t head;
	uint32_t count = 0;

	while (count != 2) {
		io_uring_for_each_cqe(&m_io_uring, head, cqe) {
			assert(cqe->res == 128);
			count++;
		}

		assert(count <= 2);
		io_uring_cq_advance(&m_io_uring, count);
	}

	io_uring_queue_exit(&m_io_uring);
	return 0;
}

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2021-01-01 15:08       ` Jens Axboe
@ 2021-01-01 15:30         ` John Paul Adrian Glaubitz
  -1 siblings, 0 replies; 26+ messages in thread
From: John Paul Adrian Glaubitz @ 2021-01-01 15:30 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-sh, linux-ia64

Hi Jens!

On 1/1/21 4:08 PM, Jens Axboe wrote:
> On 1/1/21 7:06 AM, John Paul Adrian Glaubitz wrote:
>> Is there away to test the change itself?
> 
> The only user of TWA_SIGNAL, which uses TIF_NOTIFY_SIGNAL, so far is io_uring.
> You need something that triggers deferred task_work processing, which is
> basically anything that ends up being poll driven for data/space readiness.
> Here's a small test app from the liburing test suite, that'll trigger it.
> 
> If you install liburing, compile with:
> 
> gcc -Wall -O2 -o socket-rw socket-rw.c -luring
> 
> and run it without any arguments.

How long is this test supposed to run? It's already been running for some minutes
on my 600 MHz machine.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
@ 2021-01-01 15:30         ` John Paul Adrian Glaubitz
  0 siblings, 0 replies; 26+ messages in thread
From: John Paul Adrian Glaubitz @ 2021-01-01 15:30 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-sh, linux-ia64

Hi Jens!

On 1/1/21 4:08 PM, Jens Axboe wrote:
> On 1/1/21 7:06 AM, John Paul Adrian Glaubitz wrote:
>> Is there away to test the change itself?
> 
> The only user of TWA_SIGNAL, which uses TIF_NOTIFY_SIGNAL, so far is io_uring.
> You need something that triggers deferred task_work processing, which is
> basically anything that ends up being poll driven for data/space readiness.
> Here's a small test app from the liburing test suite, that'll trigger it.
> 
> If you install liburing, compile with:
> 
> gcc -Wall -O2 -o socket-rw socket-rw.c -luring
> 
> and run it without any arguments.

How long is this test supposed to run? It's already been running for some minutes
on my 600 MHz machine.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2021-01-01 15:30         ` John Paul Adrian Glaubitz
@ 2021-01-01 15:35           ` Jens Axboe
  -1 siblings, 0 replies; 26+ messages in thread
From: Jens Axboe @ 2021-01-01 15:35 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz; +Cc: linux-sh, linux-ia64

On 1/1/21 8:30 AM, John Paul Adrian Glaubitz wrote:
> Hi Jens!
> 
> On 1/1/21 4:08 PM, Jens Axboe wrote:
>> On 1/1/21 7:06 AM, John Paul Adrian Glaubitz wrote:
>>> Is there away to test the change itself?
>>
>> The only user of TWA_SIGNAL, which uses TIF_NOTIFY_SIGNAL, so far is io_uring.
>> You need something that triggers deferred task_work processing, which is
>> basically anything that ends up being poll driven for data/space readiness.
>> Here's a small test app from the liburing test suite, that'll trigger it.
>>
>> If you install liburing, compile with:
>>
>> gcc -Wall -O2 -o socket-rw socket-rw.c -luring
>>
>> and run it without any arguments.
> 
> How long is this test supposed to run? It's already been running for some minutes
> on my 600 MHz machine.

It's supposed to finish very quickly:

axboe@p1 ~> time ./socket-rw                                                             0.000s

________________________________________________________
Executed in    1.10 millis    fish           external 
   usr time  888.00 micros  278.00 micros  610.00 micros 
   sys time   35.00 micros   35.00 micros    0.00 micros 

If it doesn't, can you try:

# echo 1 > /sys/kernel/debug/tracing/events/io_uring/enable

Then run the socket-rw app, and then do:

# cat /sys/kernel/debug/tracing/trace

and send that output? Might also be useful to include the strace
of the socket-rw just in case, so maybe run it ala

strace -o foo ./socket-rw

and include foo in the reply as well.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
@ 2021-01-01 15:35           ` Jens Axboe
  0 siblings, 0 replies; 26+ messages in thread
From: Jens Axboe @ 2021-01-01 15:35 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz; +Cc: linux-sh, linux-ia64

On 1/1/21 8:30 AM, John Paul Adrian Glaubitz wrote:
> Hi Jens!
> 
> On 1/1/21 4:08 PM, Jens Axboe wrote:
>> On 1/1/21 7:06 AM, John Paul Adrian Glaubitz wrote:
>>> Is there away to test the change itself?
>>
>> The only user of TWA_SIGNAL, which uses TIF_NOTIFY_SIGNAL, so far is io_uring.
>> You need something that triggers deferred task_work processing, which is
>> basically anything that ends up being poll driven for data/space readiness.
>> Here's a small test app from the liburing test suite, that'll trigger it.
>>
>> If you install liburing, compile with:
>>
>> gcc -Wall -O2 -o socket-rw socket-rw.c -luring
>>
>> and run it without any arguments.
> 
> How long is this test supposed to run? It's already been running for some minutes
> on my 600 MHz machine.

It's supposed to finish very quickly:

axboe@p1 ~> time ./socket-rw                                                             0.000s

________________________________________________________
Executed in    1.10 millis    fish           external 
   usr time  888.00 micros  278.00 micros  610.00 micros 
   sys time   35.00 micros   35.00 micros    0.00 micros 

If it doesn't, can you try:

# echo 1 > /sys/kernel/debug/tracing/events/io_uring/enable

Then run the socket-rw app, and then do:

# cat /sys/kernel/debug/tracing/trace

and send that output? Might also be useful to include the strace
of the socket-rw just in case, so maybe run it ala

strace -o foo ./socket-rw

and include foo in the reply as well.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2021-01-01 15:35           ` Jens Axboe
@ 2021-01-01 18:16             ` John Paul Adrian Glaubitz
  -1 siblings, 0 replies; 26+ messages in thread
From: John Paul Adrian Glaubitz @ 2021-01-01 18:16 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-sh, linux-ia64

On 1/1/21 4:35 PM, Jens Axboe wrote:> It's supposed to finish very quickly:
> 
> axboe@p1 ~> time ./socket-rw                                                             0.000s
> 
> ________________________________________________________
> Executed in    1.10 millis    fish           external 
>    usr time  888.00 micros  278.00 micros  610.00 micros 
>    sys time   35.00 micros   35.00 micros    0.00 micros 
> 
> If it doesn't, can you try:
> 
> # echo 1 > /sys/kernel/debug/tracing/events/io_uring/enable
> 
> Then run the socket-rw app, and then do:
> 
> # cat /sys/kernel/debug/tracing/trace
> 
> and send that output? Might also be useful to include the strace
> of the socket-rw just in case, so maybe run it ala
> 
> strace -o foo ./socket-rw
> 
> and include foo in the reply as well.

Odd, I just ran it through strace and it exited immediately:

root@tirpitz:~> strace ./socket-rw 
execve("./socket-rw", ["./socket-rw"], 0x7bb26670 /* 25 vars */) = 0
brk(NULL)                               = 0x412000
uname({sysname="Linux", nodename="tirpitz", ...}) = 0
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=64232, ...}) = 0
mmap2(NULL, 64232, PROT_READ, MAP_PRIVATE, 3, 0) = 0x29584000
close(3)                                = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x29574000
openat(AT_FDCWD, "/usr/lib/sh4-linux-gnu/liburing.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0*\0\1\0\0\0\324\17\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=9536, ...}) = 0
mmap2(NULL, 73852, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x29594000
mprotect(0x29596000, 61440, PROT_NONE)  = 0
mmap2(0x295a5000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x295a5000
close(3)                                = 0
openat(AT_FDCWD, "/lib/sh4-linux-gnu/libc.so.6", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0*\0\1\0\0\0\224\306\1\0004\0\0\0"..., 512) = 512
pread64(3, "\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\3\0\0\0\2\0\0\0\0\0\0\0", 32, 1290836) = 32
fstat64(3, {st_mode=S_IFREG|0755, st_size=1297036, ...}) = 0
mmap2(NULL, 1366256, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x295a8000
mprotect(0x296e1000, 61440, PROT_NONE)  = 0
mmap2(0x296f0000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x138000) = 0x296f0000
mmap2(0x296f4000, 6384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x296f4000
close(3)                                = 0
mprotect(0x296f0000, 8192, PROT_READ)   = 0
mprotect(0x295a5000, 4096, PROT_READ)   = 0
mprotect(0x410000, 4096, PROT_READ)     = 0
mprotect(0x29582000, 4096, PROT_READ)   = 0
munmap(0x29584000, 64232)               = 0
socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEPORT, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(3, {sa_family=AF_INET, sin_port=htons(13586), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
listen(3, 128)                          = 0
socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 4
setsockopt(4, SOL_TCP, TCP_NODELAY, [1], 4) = 0
fcntl64(4, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
connect(4, {sa_family=AF_INET, sin_port=htons(13586), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
fcntl64(4, F_GETFL)                     = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl64(4, F_SETFL, O_RDWR)             = 0
accept(3, NULL, NULL)                   = 5
getsockopt(4, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
io_uring_setup(32, {flags=0, sq_thread_cpu=0, sq_thread_idle=0, sq_entries=32, cq_entries=64, features=IORING_FEAT_SINGLE_MMAP|IORING_FEAT_NODROP|IORING_FEAT_SUBMIT_STABLE|IORING_FEAT_RW_CUR_POS|IORING_FEAT_CUR_PERSONALITY|0x1e0, sq_off={head=0, tail=4, ring_mask=16, ring_entries=24, flags=36, dropped=32, array=1072}, cq_off={head=8, tail=12, ring_mask=20, ring_entries=28, overflow=44, cqes=48, resv=[0x28, 0]}}) = 6
mmap2(NULL, 1200, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, 6, 0) = 0x29576000
mmap2(NULL, 2048, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, 6, 0x10000000) = 0x29578000
io_uring_enter(6, 2, 2, IORING_ENTER_GETEVENTS, NULL, 8) = 2
munmap(0x29578000, 2048)                = 0
munmap(0x29576000, 1200)                = 0
close(6)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++
root@tirpitz:~>

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
@ 2021-01-01 18:16             ` John Paul Adrian Glaubitz
  0 siblings, 0 replies; 26+ messages in thread
From: John Paul Adrian Glaubitz @ 2021-01-01 18:16 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-sh, linux-ia64

On 1/1/21 4:35 PM, Jens Axboe wrote:> It's supposed to finish very quickly:
> 
> axboe@p1 ~> time ./socket-rw                                                             0.000s
> 
> ________________________________________________________
> Executed in    1.10 millis    fish           external 
>    usr time  888.00 micros  278.00 micros  610.00 micros 
>    sys time   35.00 micros   35.00 micros    0.00 micros 
> 
> If it doesn't, can you try:
> 
> # echo 1 > /sys/kernel/debug/tracing/events/io_uring/enable
> 
> Then run the socket-rw app, and then do:
> 
> # cat /sys/kernel/debug/tracing/trace
> 
> and send that output? Might also be useful to include the strace
> of the socket-rw just in case, so maybe run it ala
> 
> strace -o foo ./socket-rw
> 
> and include foo in the reply as well.

Odd, I just ran it through strace and it exited immediately:

root@tirpitz:~> strace ./socket-rw 
execve("./socket-rw", ["./socket-rw"], 0x7bb26670 /* 25 vars */) = 0
brk(NULL)                               = 0x412000
uname({sysname="Linux", nodename="tirpitz", ...}) = 0
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_sized232, ...}) = 0
mmap2(NULL, 64232, PROT_READ, MAP_PRIVATE, 3, 0) = 0x29584000
close(3)                                = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x29574000
openat(AT_FDCWD, "/usr/lib/sh4-linux-gnu/liburing.so.1", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0*\0\1\0\0\0\324\17\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size•36, ...}) = 0
mmap2(NULL, 73852, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x29594000
mprotect(0x29596000, 61440, PROT_NONE)  = 0
mmap2(0x295a5000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x295a5000
close(3)                                = 0
openat(AT_FDCWD, "/lib/sh4-linux-gnu/libc.so.6", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0*\0\1\0\0\0\224\306\1\0004\0\0\0"..., 512) = 512
pread64(3, "\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\3\0\0\0\2\0\0\0\0\0\0\0", 32, 1290836) = 32
fstat64(3, {st_mode=S_IFREG|0755, st_size\x1297036, ...}) = 0
mmap2(NULL, 1366256, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x295a8000
mprotect(0x296e1000, 61440, PROT_NONE)  = 0
mmap2(0x296f0000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x138000) = 0x296f0000
mmap2(0x296f4000, 6384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x296f4000
close(3)                                = 0
mprotect(0x296f0000, 8192, PROT_READ)   = 0
mprotect(0x295a5000, 4096, PROT_READ)   = 0
mprotect(0x410000, 4096, PROT_READ)     = 0
mprotect(0x29582000, 4096, PROT_READ)   = 0
munmap(0x29584000, 64232)               = 0
socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEPORT, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(3, {sa_family¯_INET, sin_port=htons(13586), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
listen(3, 128)                          = 0
socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 4
setsockopt(4, SOL_TCP, TCP_NODELAY, [1], 4) = 0
fcntl64(4, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
connect(4, {sa_family¯_INET, sin_port=htons(13586), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
fcntl64(4, F_GETFL)                     = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl64(4, F_SETFL, O_RDWR)             = 0
accept(3, NULL, NULL)                   = 5
getsockopt(4, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
io_uring_setup(32, {flags=0, sq_thread_cpu=0, sq_thread_idle=0, sq_entries2, cq_entriesd, features=IORING_FEAT_SINGLE_MMAP|IORING_FEAT_NODROP|IORING_FEAT_SUBMIT_STABLE|IORING_FEAT_RW_CUR_POS|IORING_FEAT_CUR_PERSONALITY|0x1e0, sq_off={head=0, tail=4, ring_mask\x16, ring_entries$, flags6, dropped2, array\x1072}, cq_off={head=8, tail\x12, ring_mask , ring_entries(, overflowD, cqesH, resv=[0x28, 0]}}) = 6
mmap2(NULL, 1200, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, 6, 0) = 0x29576000
mmap2(NULL, 2048, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, 6, 0x10000000) = 0x29578000
io_uring_enter(6, 2, 2, IORING_ENTER_GETEVENTS, NULL, 8) = 2
munmap(0x29578000, 2048)                = 0
munmap(0x29576000, 1200)                = 0
close(6)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++
root@tirpitz:~>

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
  2021-01-01 18:16             ` John Paul Adrian Glaubitz
@ 2021-01-01 18:22               ` Jens Axboe
  -1 siblings, 0 replies; 26+ messages in thread
From: Jens Axboe @ 2021-01-01 18:22 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz; +Cc: linux-sh, linux-ia64

On 1/1/21 11:16 AM, John Paul Adrian Glaubitz wrote:
> On 1/1/21 4:35 PM, Jens Axboe wrote:> It's supposed to finish very quickly:
>>
>> axboe@p1 ~> time ./socket-rw                                                             0.000s
>>
>> ________________________________________________________
>> Executed in    1.10 millis    fish           external 
>>    usr time  888.00 micros  278.00 micros  610.00 micros 
>>    sys time   35.00 micros   35.00 micros    0.00 micros 
>>
>> If it doesn't, can you try:
>>
>> # echo 1 > /sys/kernel/debug/tracing/events/io_uring/enable
>>
>> Then run the socket-rw app, and then do:
>>
>> # cat /sys/kernel/debug/tracing/trace
>>
>> and send that output? Might also be useful to include the strace
>> of the socket-rw just in case, so maybe run it ala
>>
>> strace -o foo ./socket-rw
>>
>> and include foo in the reply as well.
> 
> Odd, I just ran it through strace and it exited immediately:

That looks correct, it sets up a ring, issues and waits for two
requests. Both of those requests require TWA_SIGNAL processing.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] sh: add support for TIF_NOTIFY_SIGNAL
@ 2021-01-01 18:22               ` Jens Axboe
  0 siblings, 0 replies; 26+ messages in thread
From: Jens Axboe @ 2021-01-01 18:22 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz; +Cc: linux-sh, linux-ia64

On 1/1/21 11:16 AM, John Paul Adrian Glaubitz wrote:
> On 1/1/21 4:35 PM, Jens Axboe wrote:> It's supposed to finish very quickly:
>>
>> axboe@p1 ~> time ./socket-rw                                                             0.000s
>>
>> ________________________________________________________
>> Executed in    1.10 millis    fish           external 
>>    usr time  888.00 micros  278.00 micros  610.00 micros 
>>    sys time   35.00 micros   35.00 micros    0.00 micros 
>>
>> If it doesn't, can you try:
>>
>> # echo 1 > /sys/kernel/debug/tracing/events/io_uring/enable
>>
>> Then run the socket-rw app, and then do:
>>
>> # cat /sys/kernel/debug/tracing/trace
>>
>> and send that output? Might also be useful to include the strace
>> of the socket-rw just in case, so maybe run it ala
>>
>> strace -o foo ./socket-rw
>>
>> and include foo in the reply as well.
> 
> Odd, I just ran it through strace and it exited immediately:

That looks correct, it sets up a ring, issues and waits for two
requests. Both of those requests require TWA_SIGNAL processing.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2021-01-01 18:23 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29 16:21 [PATCH] sh: add support for TIF_NOTIFY_SIGNAL Jens Axboe
2020-11-05 16:17 ` Jens Axboe
2020-11-05 16:20 ` John Paul Adrian Glaubitz
2020-11-05 17:15 ` Jens Axboe
2020-11-09  8:15 ` Rob Landley
2020-11-09 10:59 ` John Paul Adrian Glaubitz
2020-11-09 14:14 ` Jens Axboe
2020-11-09 14:14 ` Jens Axboe
2020-11-09 15:10 ` Jens Axboe
2020-11-09 15:15 ` Rob Landley
2020-11-09 16:29 ` Jens Axboe
2020-11-09 16:34 ` Rob Landley
2020-11-17  5:26 ` John Paul Adrian Glaubitz
2020-11-17 15:06 ` Jens Axboe
2021-01-01 14:06   ` John Paul Adrian Glaubitz
2021-01-01 14:06     ` John Paul Adrian Glaubitz
2021-01-01 15:08     ` Jens Axboe
2021-01-01 15:08       ` Jens Axboe
2021-01-01 15:30       ` John Paul Adrian Glaubitz
2021-01-01 15:30         ` John Paul Adrian Glaubitz
2021-01-01 15:35         ` Jens Axboe
2021-01-01 15:35           ` Jens Axboe
2021-01-01 18:16           ` John Paul Adrian Glaubitz
2021-01-01 18:16             ` John Paul Adrian Glaubitz
2021-01-01 18:22             ` Jens Axboe
2021-01-01 18:22               ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.