From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Jens Axboe <axboe@kernel.dk>
Cc: "linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] arm: add support for TIF_NOTIFY_SIGNAL
Date: Thu, 29 Oct 2020 17:17:38 +0000 [thread overview]
Message-ID: <20201029171738.GZ1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <3a512c06-8387-e989-af5c-d9698d42cb11@kernel.dk>
On Thu, Oct 29, 2020 at 11:15:37AM -0600, Jens Axboe wrote:
> How about this?
>
> commit c03932936d8f99ff7c1c6c7d984e7a457284396c
> Author: Jens Axboe <axboe@kernel.dk>
> Date: Fri Oct 9 16:00:49 2020 -0600
>
> arm: add support for TIF_NOTIFY_SIGNAL
>
> Wire up TIF_NOTIFY_SIGNAL handling for arm.
>
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>
> diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
> index 536b6b979f63..eb7ce2747eb0 100644
> --- a/arch/arm/include/asm/thread_info.h
> +++ b/arch/arm/include/asm/thread_info.h
> @@ -126,6 +126,8 @@ extern int vfp_restore_user_hwstate(struct user_vfp *,
> * thread information flags:
> * TIF_USEDFPU - FPU was used by this task this quantum (SMP)
> * TIF_POLLING_NRFLAG - true if poll_idle() is polling TIF_NEED_RESCHED
> + *
> + * Any bit in the range of 0..15 will cause do_work_pending() to be invoked.
> */
> #define TIF_SIGPENDING 0 /* signal pending */
> #define TIF_NEED_RESCHED 1 /* rescheduling necessary */
> @@ -135,6 +137,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *,
> #define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */
> #define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */
> #define TIF_SECCOMP 7 /* seccomp syscall filtering active */
> +#define TIF_NOTIFY_SIGNAL 8 /* signal notifications exist */
>
> #define TIF_USING_IWMMXT 17
> #define TIF_MEMDIE 18 /* is terminating due to OOM killer */
> @@ -148,6 +151,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *,
> #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
> #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
> #define _TIF_SECCOMP (1 << TIF_SECCOMP)
> +#define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL)
> #define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
>
> /* Checks for any syscall work in entry-common.S */
> @@ -158,7 +162,8 @@ extern int vfp_restore_user_hwstate(struct user_vfp *,
> * Change these and you break ASM code in entry-common.S
> */
> #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
> - _TIF_NOTIFY_RESUME | _TIF_UPROBE)
> + _TIF_NOTIFY_RESUME | _TIF_UPROBE | \
> + _TIF_NOTIFY_SIGNAL)
>
> #endif /* __KERNEL__ */
> #endif /* __ASM_ARM_THREAD_INFO_H */
> diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
> index 271cb8a1eba1..77d16390a524 100644
> --- a/arch/arm/kernel/entry-common.S
> +++ b/arch/arm/kernel/entry-common.S
> @@ -53,7 +53,7 @@ __ret_fast_syscall:
> cmp r2, #TASK_SIZE
> blne addr_limit_check_failed
> ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing
> - tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
> + movs r1, r1, lsl #16
> bne fast_work_pending
>
>
> @@ -90,7 +90,7 @@ __ret_fast_syscall:
> cmp r2, #TASK_SIZE
> blne addr_limit_check_failed
> ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing
> - tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK
> + movs r1, r1, lsl #16
> beq no_work_pending
> UNWIND(.fnend )
> ENDPROC(ret_fast_syscall)
> @@ -131,7 +131,7 @@ ENTRY(ret_to_user_from_irq)
> cmp r2, #TASK_SIZE
> blne addr_limit_check_failed
> ldr r1, [tsk, #TI_FLAGS]
> - tst r1, #_TIF_WORK_MASK
> + movs r1, r1, lsl #16
> bne slow_work_pending
> no_work_pending:
> asm_trace_hardirqs_on save = 0
> diff --git a/arch/arm/kernel/entry-v7m.S b/arch/arm/kernel/entry-v7m.S
> index de1f20624be1..d0e898608d30 100644
> --- a/arch/arm/kernel/entry-v7m.S
> +++ b/arch/arm/kernel/entry-v7m.S
> @@ -59,7 +59,7 @@ __irq_entry:
>
> get_thread_info tsk
> ldr r2, [tsk, #TI_FLAGS]
> - tst r2, #_TIF_WORK_MASK
> + movs r2, r2, lsl #16
> beq 2f @ no work pending
> mov r0, #V7M_SCB_ICSR_PENDSVSET
> str r0, [r1, V7M_SCB_ICSR] @ raise PendSV
> diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
> index 585edbfccf6d..9d2e916121be 100644
> --- a/arch/arm/kernel/signal.c
> +++ b/arch/arm/kernel/signal.c
> @@ -655,7 +655,7 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
> if (unlikely(!user_mode(regs)))
> return 0;
> local_irq_enable();
> - if (thread_flags & _TIF_SIGPENDING) {
> + if (thread_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)) {
> int restart = do_signal(regs, syscall);
> if (unlikely(restart)) {
> /*
>
Looks perfect to me, thanks! I assume the pre-requisits for this are
already in mainline or linux-next?
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-10-29 17:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 16:11 [PATCH] arm: add support for TIF_NOTIFY_SIGNAL Jens Axboe
2020-10-29 16:29 ` Russell King - ARM Linux admin
2020-10-29 16:35 ` Jens Axboe
2020-10-29 17:01 ` Russell King - ARM Linux admin
2020-10-29 17:15 ` Jens Axboe
2020-10-29 17:17 ` Russell King - ARM Linux admin [this message]
2020-10-29 17:20 ` Jens Axboe
2020-10-29 17:42 ` Russell King - ARM Linux admin
2020-10-29 17:50 ` Jens Axboe
2020-11-03 15:11 ` Jens Axboe
2020-11-12 15:32 ` Russell King - ARM Linux admin
2020-11-12 15:42 ` Jens Axboe
2020-11-12 15:44 ` Russell King - ARM Linux admin
2020-11-12 15:51 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201029171738.GZ1551@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=axboe@kernel.dk \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).