Skip to contentSkip to conversation

ia64: add support for TIF_NOTIFY_SIGNAL

PATCH In review Jens Axboe 2 participants 10 messages Oct 29, 2020 – Jan 28, 2021

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

PATCH 1/1 ia64: add support for TIF_NOTIFY_SIGNAL

Wire up TIF_NOTIFY_SIGNAL handling for ia64.

---

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

https://lore.kernel.org/io-uring/[email protected]/

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/ia64/include/asm/thread_info.h | 4 +++-
 arch/ia64/kernel/process.c          | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)
arch/ia64/include/asm/thread_info.h +3 -1
index 64a1011f6812..759d7d68a5f2 100644
@@ -104,6 +104,7 @@ struct thread_info {
 #define TIF_SYSCALL_AUDIT	3	/* syscall auditing active */
 #define TIF_SINGLESTEP		4	/* restore singlestep on return to user mode */
 #define TIF_NOTIFY_RESUME	6	/* resumption notification requested */
+#define TIF_NOTIFY_SIGNAL	7	/* signal notification exist */
 #define TIF_MEMDIE		17	/* is terminating due to OOM killer */
 #define TIF_MCA_INIT		18	/* this task is processing MCA or INIT */
 #define TIF_DB_DISABLED		19	/* debug trap disabled for fsyscall */
@@ -115,6 +116,7 @@ struct thread_info {
 #define _TIF_SINGLESTEP		(1 << TIF_SINGLESTEP)
 #define _TIF_SYSCALL_TRACEAUDIT	(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP)
 #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
+#define _TIF_SIGNAL_NOTIFY	(1 << TIF_SIGNAL_NOTIFY)
 #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
 #define _TIF_MCA_INIT		(1 << TIF_MCA_INIT)
@@ -124,7 +126,7 @@ struct thread_info {
 
 /* "work to do on user-return" bits */
 #define TIF_ALLWORK_MASK	(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SYSCALL_AUDIT|\
-				 _TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE)
+				 _TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_NOTIFY_SIGNAL)
 /* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */
 #define TIF_WORK_MASK		(TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT))
 
arch/ia64/kernel/process.c +2 -1
index 6b61a703bcf5..0e0146daa88d 100644
@@ -171,7 +171,8 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
 	}
 
 	/* deal with pending signal delivery */
-	if (test_thread_flag(TIF_SIGPENDING)) {
+	if (test_thread_flag(TIF_SIGPENDING) ||
+	    test_thread_flags(TIF_NOTIFY_SIGNAL)) {
 		local_irq_enable();	/* force interrupt enable */
 		ia64_do_signal(scr, in_syscall);
 	}
Signature · 4 lines
2.29.0

-- 
Jens Axboe
author
#1 lore raw

Gentle nudge on this one.

Quoted 64 lines · Jens Axboe

Wire up TIF_NOTIFY_SIGNAL handling for ia64.

---

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

https://lore.kernel.org/io-uring/[email protected]/

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/ia64/include/asm/thread_info.h | 4 +++-
 arch/ia64/kernel/process.c          | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)
arch/ia64/include/asm/thread_info.h +3 -1
index 64a1011f6812..759d7d68a5f2 100644
@@ -104,6 +104,7 @@ struct thread_info {
 #define TIF_SYSCALL_AUDIT	3	/* syscall auditing active */
 #define TIF_SINGLESTEP		4	/* restore singlestep on return to user mode */
 #define TIF_NOTIFY_RESUME	6	/* resumption notification requested */
+#define TIF_NOTIFY_SIGNAL	7	/* signal notification exist */
 #define TIF_MEMDIE		17	/* is terminating due to OOM killer */
 #define TIF_MCA_INIT		18	/* this task is processing MCA or INIT */
 #define TIF_DB_DISABLED		19	/* debug trap disabled for fsyscall */
@@ -115,6 +116,7 @@ struct thread_info {
 #define _TIF_SINGLESTEP		(1 << TIF_SINGLESTEP)
 #define _TIF_SYSCALL_TRACEAUDIT	(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP)
 #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
+#define _TIF_SIGNAL_NOTIFY	(1 << TIF_SIGNAL_NOTIFY)
 #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
 #define _TIF_MCA_INIT		(1 << TIF_MCA_INIT)
@@ -124,7 +126,7 @@ struct thread_info {
 
 /* "work to do on user-return" bits */
 #define TIF_ALLWORK_MASK	(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SYSCALL_AUDIT|\
-				 _TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE)
+				 _TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_NOTIFY_SIGNAL)
 /* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */
 #define TIF_WORK_MASK		(TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT))
 
arch/ia64/kernel/process.c +2 -1
index 6b61a703bcf5..0e0146daa88d 100644
@@ -171,7 +171,8 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
 	}
 
 	/* deal with pending signal delivery */
-	if (test_thread_flag(TIF_SIGPENDING)) {
+	if (test_thread_flag(TIF_SIGPENDING) ||
+	    test_thread_flags(TIF_NOTIFY_SIGNAL)) {
 		local_irq_enable();	/* force interrupt enable */
 		ia64_do_signal(scr, in_syscall);
 	}
Signature · 1 line
Jens Axboe
#2 lore raw
In reply to Jens Axboe

Hi Jens!

Quoted 55 lines · Jens Axboe

Wire up TIF_NOTIFY_SIGNAL handling for ia64.

---

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

https://lore.kernel.org/io-uring/[email protected]/

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/ia64/include/asm/thread_info.h | 4 +++-
 arch/ia64/kernel/process.c          | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)
arch/ia64/include/asm/thread_info.h +3 -1
index 64a1011f6812..759d7d68a5f2 100644
@@ -104,6 +104,7 @@ struct thread_info {
 #define TIF_SYSCALL_AUDIT	3	/* syscall auditing active */
 #define TIF_SINGLESTEP		4	/* restore singlestep on return to user mode */
 #define TIF_NOTIFY_RESUME	6	/* resumption notification requested */
+#define TIF_NOTIFY_SIGNAL	7	/* signal notification exist */
 #define TIF_MEMDIE		17	/* is terminating due to OOM killer */
 #define TIF_MCA_INIT		18	/* this task is processing MCA or INIT */
 #define TIF_DB_DISABLED		19	/* debug trap disabled for fsyscall */
@@ -115,6 +116,7 @@ struct thread_info {
 #define _TIF_SINGLESTEP		(1 << TIF_SINGLESTEP)
 #define _TIF_SYSCALL_TRACEAUDIT	(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP)
 #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
+#define _TIF_SIGNAL_NOTIFY	(1 << TIF_SIGNAL_NOTIFY)
 #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
 #define _TIF_MCA_INIT		(1 << TIF_MCA_INIT)
@@ -124,7 +126,7 @@ struct thread_info {
 
 /* "work to do on user-return" bits */
 #define TIF_ALLWORK_MASK	(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SYSCALL_AUDIT|\
-				 _TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE)
+				 _TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_NOTIFY_SIGNAL)
 /* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */
 #define TIF_WORK_MASK		(TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT))
 
arch/ia64/kernel/process.c +0 -0
index 6b61a703bcf5..0e0146daa88d 100644

arch/ia64/kernel/process.c do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall) · line 178

Quoted 9 lines
arch/ia64/kernel/process.c +2 -1
@@ -171,7 +171,8 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
 	}
 
 	/* deal with pending signal delivery */
-	if (test_thread_flag(TIF_SIGPENDING)) {
+	if (test_thread_flag(TIF_SIGPENDING) ||
+	    test_thread_flags(TIF_NOTIFY_SIGNAL)) {
 		local_irq_enable();	/* force interrupt enable */
 		ia64_do_signal(scr, in_syscall);
 	}

This change broke the hpsa driver on my RX-2600 ia64 workstation in the sense that the driver no longer loads and hence hard disks are no longer recognized.

Any idea what could be wrong?

Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
author
#3 lore raw
In reply to Jens Axboe
Quoted 59 lines · John Paul Adrian Glaubitz

Hi Jens!

Quoted 56 lines · Jens Axboe

Wire up TIF_NOTIFY_SIGNAL handling for ia64.

---

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

https://lore.kernel.org/io-uring/[email protected]/

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/ia64/include/asm/thread_info.h | 4 +++-
 arch/ia64/kernel/process.c          | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)
arch/ia64/include/asm/thread_info.h +3 -1
index 64a1011f6812..759d7d68a5f2 100644
@@ -104,6 +104,7 @@ struct thread_info {
 #define TIF_SYSCALL_AUDIT	3	/* syscall auditing active */
 #define TIF_SINGLESTEP		4	/* restore singlestep on return to user mode */
 #define TIF_NOTIFY_RESUME	6	/* resumption notification requested */
+#define TIF_NOTIFY_SIGNAL	7	/* signal notification exist */
 #define TIF_MEMDIE		17	/* is terminating due to OOM killer */
 #define TIF_MCA_INIT		18	/* this task is processing MCA or INIT */
 #define TIF_DB_DISABLED		19	/* debug trap disabled for fsyscall */
@@ -115,6 +116,7 @@ struct thread_info {
 #define _TIF_SINGLESTEP		(1 << TIF_SINGLESTEP)
 #define _TIF_SYSCALL_TRACEAUDIT	(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP)
 #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
+#define _TIF_SIGNAL_NOTIFY	(1 << TIF_SIGNAL_NOTIFY)
 #define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
 #define _TIF_MCA_INIT		(1 << TIF_MCA_INIT)
@@ -124,7 +126,7 @@ struct thread_info {
 
 /* "work to do on user-return" bits */
 #define TIF_ALLWORK_MASK	(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SYSCALL_AUDIT|\
-				 _TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE)
+				 _TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_NOTIFY_SIGNAL)
 /* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */
 #define TIF_WORK_MASK		(TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT))
 
arch/ia64/kernel/process.c +0 -0
index 6b61a703bcf5..0e0146daa88d 100644
@@ -171,7 +171,8 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
 	}
 
Quoted 11 lines

arch/ia64/kernel/process.c do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall) · line 178

Quoted 8 lines
arch/ia64/kernel/process.c +2 -1
 	/* deal with pending signal delivery */
-	if (test_thread_flag(TIF_SIGPENDING)) {
+	if (test_thread_flag(TIF_SIGPENDING) ||
+	    test_thread_flags(TIF_NOTIFY_SIGNAL)) {
 		local_irq_enable();	/* force interrupt enable */
 		ia64_do_signal(scr, in_syscall);
 	}

This change broke the hpsa driver on my RX-2600 ia64 workstation in the sense that the driver no longer loads and hence hard disks are no longer recognized.

What does "no longer loads" mean? Does it hang?

Quoted 1 line

Any idea what could be wrong?

Can you try current -git? There's a task_work related fix in there which is related to this series, maybe that's it...

Signature · 1 line
Jens Axboe
#4 lore raw
In reply to Jens Axboe
Quoted 4 lines · Jens Axboe
Quoted 2 lines

This change broke the hpsa driver on my RX-2600 ia64 workstation in the sense that the driver no longer loads and hence hard disks are no longer recognized.

What does "no longer loads" mean? Does it hang?

It does not load at all. The driver no longer shows up in the kernel message buffer and therefore no disks are found.

Quoted 4 lines
Quoted 1 line

Any idea what could be wrong?

Can you try current -git? There's a task_work related fix in there which is related to this series, maybe that's it...

I can. However, I already tested 5.11-rc4 before I sent the mail.

Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
author
#5 lore raw
In reply to Jens Axboe
Quoted 8 lines · John Paul Adrian Glaubitz
Quoted 4 lines · Jens Axboe
Quoted 2 lines

This change broke the hpsa driver on my RX-2600 ia64 workstation in the sense that the driver no longer loads and hence hard disks are no longer recognized.

What does "no longer loads" mean? Does it hang?

It does not load at all. The driver no longer shows up in the kernel message buffer and therefore no disks are found.

Really should be no relation there at all. Is it built-in or modular?

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Any idea what could be wrong?

Can you try current -git? There's a task_work related fix in there which is related to this series, maybe that's it...

I can. However, I already tested 5.11-rc4 before I sent the mail.

-rc4 doesn't have the fix, it wasn't merged until yesterday. I doubt that it's related to this though...

Signature · 1 line
Jens Axboe
author
#6 lore raw
In reply to Jens Axboe
Quoted 6 lines · John Paul Adrian Glaubitz

Hi Jens!

Quoted 3 lines · Jens Axboe
Quoted 2 lines

This change broke the hpsa driver on my RX-2600 ia64 workstation in the sense that the driver no longer loads and hence hard disks are no longer recognized.

Quoted 8 lines
Quoted 6 lines

What does "no longer loads" mean? Does it hang?

Quoted 1 line

Any idea what could be wrong?

Can you try current -git? There's a task_work related fix in there which is related to this series, maybe that's it...

I just tried Linus' current tree (ge5ff2cb9cf67) and the problem still persists.

Funky... Can you see if this helps?

arch/ia64/kernel/signal.c +3 -3
index e67b22fc3c60..7de57ace4799 100644
@@ -358,9 +358,6 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
 			 */
 			restart = 0;
 
-		if (ksig.sig <= 0)
-			break;
-
 		if (unlikely(restart)) {
 			switch (errno) {
 			case ERESTART_RESTARTBLOCK:
@@ -381,6 +378,9 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
 			}
 		}
 
+		if (ksig.sig <= 0)
+			break;
+
 		/*
 		 * Whee!  Actually deliver the signal.  If the delivery failed, we need to
 		 * continue to iterate in this loop so we can deliver the SIGSEGV...
Signature · 1 line
Jens Axboe
author
#7 lore raw
In reply to Jens Axboe
Quoted 9 lines · Jens Axboe
Quoted 8 lines · John Paul Adrian Glaubitz

Hi Jens!

Quoted 5 lines · Jens Axboe
Quoted 2 lines

This change broke the hpsa driver on my RX-2600 ia64 workstation in the sense that the driver no longer loads and hence hard disks are no longer recognized.

What does "no longer loads" mean? Does it hang?

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Any idea what could be wrong?

Can you try current -git? There's a task_work related fix in there which is related to this series, maybe that's it...

I just tried Linus' current tree (ge5ff2cb9cf67) and the problem still persists.

Funky... Can you see if this helps?

Actually, this one might be better.

arch/ia64/kernel/signal.c +2 -5
index e67b22fc3c60..22d825f26668 100644
@@ -340,7 +340,7 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
 	 * This only loops in the rare cases of handle_signal() failing, in which case we
 	 * need to push through a forced SIGSEGV.
 	 */
-	while (1) {
+	do {
 		get_signal(&ksig);
 
 		/*
@@ -358,9 +358,6 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
 			 */
 			restart = 0;
 
-		if (ksig.sig <= 0)
-			break;
-
 		if (unlikely(restart)) {
 			switch (errno) {
 			case ERESTART_RESTARTBLOCK:
@@ -387,7 +384,7 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
 		 */
 		if (handle_signal(&ksig, scr))
 			return;
-	}
+	} while (ksig.sig > 0);
 
 	/* Did we come from a system call? */
 	if (restart) {
Signature · 1 line
Jens Axboe
#8 lore raw
In reply to Jens Axboe
Quoted 19 lines · Jens Axboe
Quoted 1 line

I just tried Linus' current tree (ge5ff2cb9cf67) and the problem still persists.

Funky... Can you see if this helps?

arch/ia64/kernel/signal.c +0 -3
index e67b22fc3c60..7de57ace4799 100644
@@ -358,9 +358,6 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
 			 */
 			restart = 0;
 
-		if (ksig.sig <= 0)
-			break;
-
 		if (unlikely(restart)) {
 			switch (errno) {
 			case ERESTART_RESTARTBLOCK:

arch/ia64/kernel/signal.c ia64_do_signal (struct sigscratch *scr, long in_syscall) · line 386

Quoted 9 lines
arch/ia64/kernel/signal.c +3 -0
@@ -381,6 +378,9 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
 			}
 		}
 
+		if (ksig.sig <= 0)
+			break;
+
 		/*
 		 * Whee!  Actually deliver the signal.  If the delivery failed, we need to
 		 * continue to iterate in this loop so we can deliver the SIGSEGV...

This one doesn't help. Will try the other in a minute.

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
author
#9 lore raw
In reply to Jens Axboe
Quoted 23 lines · John Paul Adrian Glaubitz
Quoted 22 lines · Jens Axboe
Quoted 1 line

I just tried Linus' current tree (ge5ff2cb9cf67) and the problem still persists.

Funky... Can you see if this helps?

arch/ia64/kernel/signal.c +0 -3
index e67b22fc3c60..7de57ace4799 100644
@@ -358,9 +358,6 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
 			 */
 			restart = 0;
 
-		if (ksig.sig <= 0)
-			break;
-
 		if (unlikely(restart)) {
 			switch (errno) {
 			case ERESTART_RESTARTBLOCK:
@@ -381,6 +378,9 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
 			}
 		}
 
Quoted 8 lines

arch/ia64/kernel/signal.c ia64_do_signal (struct sigscratch *scr, long in_syscall) · line 386

Quoted 6 lines
arch/ia64/kernel/signal.c +3 -0
+		if (ksig.sig <= 0)
+			break;
+
 		/*
 		 * Whee!  Actually deliver the signal.  If the delivery failed, we need to
 		 * continue to iterate in this loop so we can deliver the SIGSEGV...

This one doesn't help. Will try the other in a minute.

Also looks like you might need to add a:

	ksig.sig = 0;

right above get_signal(), just in case. For the 2nd patch, I mean. But thanks for testing, interested if the other one will do it...

Signature · 1 line
Jens Axboe