* [PATCH 3/3] riscv: add PREEMPT_LAZY support
[not found] <20241009105709.887510-1-bigeasy@linutronix.de>
@ 2024-10-09 10:50 ` Sebastian Andrzej Siewior
2024-10-09 13:03 ` Peter Zijlstra
0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Andrzej Siewior @ 2024-10-09 10:50 UTC (permalink / raw)
To: linux-trace-kernel, linux-kernel
Cc: Peter Zijlstra, tglx, mingo, juri.lelli, vincent.guittot,
dietmar.eggemann, rostedt, bsegall, mgorman, vschneid,
ankur.a.arora, efault, Masami Hiramatsu, Mathieu Desnoyers,
Jisheng Zhang, Paul Walmsley, Palmer Dabbelt, Albert Ou,
linux-riscv, Sebastian Andrzej Siewior
From: Jisheng Zhang <jszhang@kernel.org>
riscv has switched to GENERIC_ENTRY, so adding PREEMPT_LAZY is as simple
as adding TIF_NEED_RESCHED_LAZY related definitions and enabling
ARCH_HAS_PREEMPT_LAZY.
[bigeasy: Replace old PREEMPT_AUTO bits with new PREEMPT_LAZY ]
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: linux-riscv@lists.infradead.org
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
arch/riscv/Kconfig | 1 +
arch/riscv/include/asm/thread_info.h | 2 ++
2 files changed, 3 insertions(+)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 62545946ecf43..3516c58480612 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -39,6 +39,7 @@ config RISCV
select ARCH_HAS_MMIOWB
select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
select ARCH_HAS_PMEM_API
+ select ARCH_HAS_PREEMPT_LAZY
select ARCH_HAS_PREPARE_SYNC_CORE_CMD
select ARCH_HAS_PTE_DEVMAP if 64BIT && MMU
select ARCH_HAS_PTE_SPECIAL
diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h
index 9c10fb180f438..8b5a5ddea4293 100644
--- a/arch/riscv/include/asm/thread_info.h
+++ b/arch/riscv/include/asm/thread_info.h
@@ -107,6 +107,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
* - pending work-to-be-done flags are in lowest half-word
* - other flags in upper half-word(s)
*/
+#define TIF_NEED_RESCHED_LAZY 0 /* Lazy rescheduling needed */
#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
#define TIF_SIGPENDING 2 /* signal pending */
#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
@@ -117,6 +118,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
#define TIF_32BIT 11 /* compat-mode 32bit process */
#define TIF_RISCV_V_DEFER_RESTORE 12 /* restore Vector before returing to user */
+#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
--
2.45.2
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] riscv: add PREEMPT_LAZY support
2024-10-09 10:50 ` [PATCH 3/3] riscv: add PREEMPT_LAZY support Sebastian Andrzej Siewior
@ 2024-10-09 13:03 ` Peter Zijlstra
2024-10-09 13:05 ` Sebastian Andrzej Siewior
2024-10-10 12:25 ` [PATCH v2 " Sebastian Andrzej Siewior
0 siblings, 2 replies; 6+ messages in thread
From: Peter Zijlstra @ 2024-10-09 13:03 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: linux-trace-kernel, linux-kernel, tglx, mingo, juri.lelli,
vincent.guittot, dietmar.eggemann, rostedt, bsegall, mgorman,
vschneid, ankur.a.arora, efault, Masami Hiramatsu,
Mathieu Desnoyers, Jisheng Zhang, Paul Walmsley, Palmer Dabbelt,
Albert Ou, linux-riscv
On Wed, Oct 09, 2024 at 12:50:57PM +0200, Sebastian Andrzej Siewior wrote:
> From: Jisheng Zhang <jszhang@kernel.org>
>
> riscv has switched to GENERIC_ENTRY, so adding PREEMPT_LAZY is as simple
> as adding TIF_NEED_RESCHED_LAZY related definitions and enabling
> ARCH_HAS_PREEMPT_LAZY.
>
> [bigeasy: Replace old PREEMPT_AUTO bits with new PREEMPT_LAZY ]
>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Cc: linux-riscv@lists.infradead.org
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> arch/riscv/Kconfig | 1 +
> arch/riscv/include/asm/thread_info.h | 2 ++
> 2 files changed, 3 insertions(+)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 62545946ecf43..3516c58480612 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -39,6 +39,7 @@ config RISCV
> select ARCH_HAS_MMIOWB
> select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
> select ARCH_HAS_PMEM_API
> + select ARCH_HAS_PREEMPT_LAZY
> select ARCH_HAS_PREPARE_SYNC_CORE_CMD
> select ARCH_HAS_PTE_DEVMAP if 64BIT && MMU
> select ARCH_HAS_PTE_SPECIAL
> diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h
> index 9c10fb180f438..8b5a5ddea4293 100644
> --- a/arch/riscv/include/asm/thread_info.h
> +++ b/arch/riscv/include/asm/thread_info.h
> @@ -107,6 +107,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
> * - pending work-to-be-done flags are in lowest half-word
> * - other flags in upper half-word(s)
> */
> +#define TIF_NEED_RESCHED_LAZY 0 /* Lazy rescheduling needed */
> #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
> #define TIF_SIGPENDING 2 /* signal pending */
> #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
So for x86 I shuffled the flags around to have the two NEED_RESCHED ones
side-by-side. Not strictly required ofcourse, but...
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] riscv: add PREEMPT_LAZY support
2024-10-09 13:03 ` Peter Zijlstra
@ 2024-10-09 13:05 ` Sebastian Andrzej Siewior
2024-10-17 21:49 ` Palmer Dabbelt
2024-10-10 12:25 ` [PATCH v2 " Sebastian Andrzej Siewior
1 sibling, 1 reply; 6+ messages in thread
From: Sebastian Andrzej Siewior @ 2024-10-09 13:05 UTC (permalink / raw)
To: Peter Zijlstra
Cc: linux-trace-kernel, linux-kernel, tglx, mingo, juri.lelli,
vincent.guittot, dietmar.eggemann, rostedt, bsegall, mgorman,
vschneid, ankur.a.arora, efault, Masami Hiramatsu,
Mathieu Desnoyers, Jisheng Zhang, Paul Walmsley, Palmer Dabbelt,
Albert Ou, linux-riscv
On 2024-10-09 15:03:07 [+0200], Peter Zijlstra wrote:
> > diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h
> > index 9c10fb180f438..8b5a5ddea4293 100644
> > --- a/arch/riscv/include/asm/thread_info.h
> > +++ b/arch/riscv/include/asm/thread_info.h
> > @@ -107,6 +107,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
> > * - pending work-to-be-done flags are in lowest half-word
> > * - other flags in upper half-word(s)
> > */
> > +#define TIF_NEED_RESCHED_LAZY 0 /* Lazy rescheduling needed */
> > #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
> > #define TIF_SIGPENDING 2 /* signal pending */
> > #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
>
> So for x86 I shuffled the flags around to have the two NEED_RESCHED ones
> side-by-side. Not strictly required ofcourse, but...
I can shuffle them. I don't think the riscv camp will complain (saying
this for them to actual complain if so).
Sebastian
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] riscv: add PREEMPT_LAZY support
2024-10-09 13:03 ` Peter Zijlstra
2024-10-09 13:05 ` Sebastian Andrzej Siewior
@ 2024-10-10 12:25 ` Sebastian Andrzej Siewior
2024-12-11 22:32 ` patchwork-bot+linux-riscv
1 sibling, 1 reply; 6+ messages in thread
From: Sebastian Andrzej Siewior @ 2024-10-10 12:25 UTC (permalink / raw)
To: Peter Zijlstra
Cc: linux-trace-kernel, linux-kernel, tglx, mingo, juri.lelli,
vincent.guittot, dietmar.eggemann, rostedt, bsegall, mgorman,
vschneid, ankur.a.arora, efault, Masami Hiramatsu,
Mathieu Desnoyers, Jisheng Zhang, Paul Walmsley, Palmer Dabbelt,
Albert Ou, linux-riscv
From: Jisheng Zhang <jszhang@kernel.org>
riscv has switched to GENERIC_ENTRY, so adding PREEMPT_LAZY is as simple
as adding TIF_NEED_RESCHED_LAZY related definitions and enabling
ARCH_HAS_PREEMPT_LAZY.
[bigeasy: Replace old PREEMPT_AUTO bits with new PREEMPT_LAZY ]
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: linux-riscv@lists.infradead.org
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
v1…v2:
- shuffle TIF bits around to make RESCHED next to RESCHED_LAZY.
Compiles & boots.
arch/riscv/Kconfig | 1 +
arch/riscv/include/asm/thread_info.h | 10 ++++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 62545946ecf43..3516c58480612 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -39,6 +39,7 @@ config RISCV
select ARCH_HAS_MMIOWB
select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
select ARCH_HAS_PMEM_API
+ select ARCH_HAS_PREEMPT_LAZY
select ARCH_HAS_PREPARE_SYNC_CORE_CMD
select ARCH_HAS_PTE_DEVMAP if 64BIT && MMU
select ARCH_HAS_PTE_SPECIAL
diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h
index 9c10fb180f438..f5916a70879a8 100644
--- a/arch/riscv/include/asm/thread_info.h
+++ b/arch/riscv/include/asm/thread_info.h
@@ -107,9 +107,10 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
* - pending work-to-be-done flags are in lowest half-word
* - other flags in upper half-word(s)
*/
-#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
-#define TIF_SIGPENDING 2 /* signal pending */
-#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
+#define TIF_NEED_RESCHED 0 /* rescheduling necessary */
+#define TIF_NEED_RESCHED_LAZY 1 /* Lazy rescheduling needed */
+#define TIF_NOTIFY_RESUME 2 /* callback before returning to user */
+#define TIF_SIGPENDING 3 /* signal pending */
#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */
#define TIF_MEMDIE 5 /* is terminating due to OOM killer */
#define TIF_NOTIFY_SIGNAL 9 /* signal notifications exist */
@@ -117,9 +118,10 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
#define TIF_32BIT 11 /* compat-mode 32bit process */
#define TIF_RISCV_V_DEFER_RESTORE 12 /* restore Vector before returing to user */
+#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
+#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
-#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
#define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL)
#define _TIF_UPROBE (1 << TIF_UPROBE)
#define _TIF_RISCV_V_DEFER_RESTORE (1 << TIF_RISCV_V_DEFER_RESTORE)
--
2.45.2
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] riscv: add PREEMPT_LAZY support
2024-10-09 13:05 ` Sebastian Andrzej Siewior
@ 2024-10-17 21:49 ` Palmer Dabbelt
0 siblings, 0 replies; 6+ messages in thread
From: Palmer Dabbelt @ 2024-10-17 21:49 UTC (permalink / raw)
To: bigeasy
Cc: peterz, linux-trace-kernel, linux-kernel, tglx, mingo, juri.lelli,
vincent.guittot, dietmar.eggemann, rostedt, bsegall, mgorman,
vschneid, ankur.a.arora, efault, mhiramat, mathieu.desnoyers,
jszhang, Paul Walmsley, aou, linux-riscv
On Wed, 09 Oct 2024 06:05:30 PDT (-0700), bigeasy@linutronix.de wrote:
> On 2024-10-09 15:03:07 [+0200], Peter Zijlstra wrote:
>> > diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h
>> > index 9c10fb180f438..8b5a5ddea4293 100644
>> > --- a/arch/riscv/include/asm/thread_info.h
>> > +++ b/arch/riscv/include/asm/thread_info.h
>> > @@ -107,6 +107,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
>> > * - pending work-to-be-done flags are in lowest half-word
>> > * - other flags in upper half-word(s)
>> > */
>> > +#define TIF_NEED_RESCHED_LAZY 0 /* Lazy rescheduling needed */
>> > #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
>> > #define TIF_SIGPENDING 2 /* signal pending */
>> > #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
>>
>> So for x86 I shuffled the flags around to have the two NEED_RESCHED ones
>> side-by-side. Not strictly required ofcourse, but...
>
> I can shuffle them. I don't think the riscv camp will complain (saying
> this for them to actual complain if so).
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/3] riscv: add PREEMPT_LAZY support
2024-10-10 12:25 ` [PATCH v2 " Sebastian Andrzej Siewior
@ 2024-12-11 22:32 ` patchwork-bot+linux-riscv
0 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-12-11 22:32 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: linux-riscv, peterz, linux-trace-kernel, linux-kernel, tglx,
mingo, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt,
bsegall, mgorman, vschneid, ankur.a.arora, efault, mhiramat,
mathieu.desnoyers, jszhang, paul.walmsley, palmer, aou
Hello:
This patch was applied to riscv/linux.git (fixes)
by Peter Zijlstra <peterz@infradead.org>:
On Thu, 10 Oct 2024 14:25:45 +0200 you wrote:
> From: Jisheng Zhang <jszhang@kernel.org>
>
> riscv has switched to GENERIC_ENTRY, so adding PREEMPT_LAZY is as simple
> as adding TIF_NEED_RESCHED_LAZY related definitions and enabling
> ARCH_HAS_PREEMPT_LAZY.
>
> [bigeasy: Replace old PREEMPT_AUTO bits with new PREEMPT_LAZY ]
>
> [...]
Here is the summary with links:
- [v2,3/3] riscv: add PREEMPT_LAZY support
https://git.kernel.org/riscv/c/22aaec357c1f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-12-11 22:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20241009105709.887510-1-bigeasy@linutronix.de>
2024-10-09 10:50 ` [PATCH 3/3] riscv: add PREEMPT_LAZY support Sebastian Andrzej Siewior
2024-10-09 13:03 ` Peter Zijlstra
2024-10-09 13:05 ` Sebastian Andrzej Siewior
2024-10-17 21:49 ` Palmer Dabbelt
2024-10-10 12:25 ` [PATCH v2 " Sebastian Andrzej Siewior
2024-12-11 22:32 ` patchwork-bot+linux-riscv
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).