diff mbox series

[3/3] riscv: Allow to enable PREEMPT_RT.

Message ID 20240906111841.562402-4-bigeasy@linutronix.de (mailing list archive)
State New, archived
Headers show
Series Allow to enable PREEMPT_RT. | expand

Commit Message

Sebastian Andrzej Siewior Sept. 6, 2024, 10:59 a.m. UTC
It is really time.

riscv has all the required architecture related changes, that have been
identified over time, in order to enable PREEMPT_RT. With the recent
printk changes, the last known road block has been addressed.

Allow to enable PREEMPT_RT on riscv.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/riscv/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Nam Cao Sept. 6, 2024, 3:13 p.m. UTC | #1
On Fri, Sep 06, 2024 at 12:59:06PM +0200, Sebastian Andrzej Siewior wrote:
> It is really time.
> 
> riscv has all the required architecture related changes, that have been
> identified over time, in order to enable PREEMPT_RT. With the recent
> printk changes, the last known road block has been addressed.
> 
> Allow to enable PREEMPT_RT on riscv.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

With the printk patches applied:

Tested-by: Nam Cao <namcao@linutronix.de> # Visionfive 2

Best regards,
Nam
Palmer Dabbelt Sept. 6, 2024, 6:48 p.m. UTC | #2
On Fri, 06 Sep 2024 08:13:24 PDT (-0700), namcao@linutronix.de wrote:
> On Fri, Sep 06, 2024 at 12:59:06PM +0200, Sebastian Andrzej Siewior wrote:
>> It is really time.
>>
>> riscv has all the required architecture related changes, that have been
>> identified over time, in order to enable PREEMPT_RT. With the recent
>> printk changes, the last known road block has been addressed.
>>
>> Allow to enable PREEMPT_RT on riscv.
>>
>> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>
> With the printk patches applied:
>
> Tested-by: Nam Cao <namcao@linutronix.de> # Visionfive 2


Thanks.  LMK if you guys want me to take this through the RISC-V tree, 
but no big deal if you want it somewhere else -- and if there's some 
dependencies already going in through some sort of RT tree maybe that's 
just easier.  So

Acked-by: Palmer Dabbelt <palmer@rivosinc.com>

I don't have a test setup yet, but I figure it's a new feature so I'll 
just flip it on as a config post-rc1.  Presumably this just works in the 
QEMU virt board, or is there some wizardry I'll need to copy?

> Best regards,
> Nam
Sebastian Andrzej Siewior Sept. 17, 2024, 10:44 a.m. UTC | #3
On 2024-09-06 11:48:03 [-0700], Palmer Dabbelt wrote:
> I don't have a test setup yet, but I figure it's a new feature so I'll just
> flip it on as a config post-rc1.  Presumably this just works in the QEMU
> virt board, or is there some wizardry I'll need to copy?

I don't think you want to enable it by default for everyone. The riscv
defconfig sets CONFIG_PREEMPT_NONE=y by default. For testing you need to
flip this to CONFIG_PREEMPT_RT=y and since CONFIG_EXPERT=y is already
set this option is available.
And yes, it works on the virt board and there is no wizardry needed ;)

Sebastian
Palmer Dabbelt Oct. 9, 2024, 4:44 p.m. UTC | #4
On Fri, 06 Sep 2024 11:48:03 PDT (-0700), Palmer Dabbelt wrote:
> On Fri, 06 Sep 2024 08:13:24 PDT (-0700), namcao@linutronix.de wrote:
>> On Fri, Sep 06, 2024 at 12:59:06PM +0200, Sebastian Andrzej Siewior wrote:
>>> It is really time.
>>>
>>> riscv has all the required architecture related changes, that have been
>>> identified over time, in order to enable PREEMPT_RT. With the recent
>>> printk changes, the last known road block has been addressed.
>>>
>>> Allow to enable PREEMPT_RT on riscv.
>>>
>>> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>>
>> With the printk patches applied:
>>
>> Tested-by: Nam Cao <namcao@linutronix.de> # Visionfive 2
>
>
> Thanks.  LMK if you guys want me to take this through the RISC-V tree,
> but no big deal if you want it somewhere else -- and if there's some
> dependencies already going in through some sort of RT tree maybe that's
> just easier.  So
>
> Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
>
> I don't have a test setup yet, but I figure it's a new feature so I'll
> just flip it on as a config post-rc1.  Presumably this just works in the
> QEMU virt board, or is there some wizardry I'll need to copy?

and it breaks my boot test script.  Looks like it's actually working 
mostly fine, I'm just not getting the "reboot: System halted" message 
that I'm checking for to make sure the system actually went down 
cleanly.

I'm not sure if this is expected behavior in RT land, or if we've got 
some sort of bug.  It sort of smells like we're losing the last printk() 
line...

>
>> Best regards,
>> Nam
Palmer Dabbelt Oct. 9, 2024, 4:47 p.m. UTC | #5
On Tue, 17 Sep 2024 03:44:09 PDT (-0700), bigeasy@linutronix.de wrote:
> On 2024-09-06 11:48:03 [-0700], Palmer Dabbelt wrote:
>> I don't have a test setup yet, but I figure it's a new feature so I'll just
>> flip it on as a config post-rc1.  Presumably this just works in the QEMU
>> virt board, or is there some wizardry I'll need to copy?
>
> I don't think you want to enable it by default for everyone. The riscv
> defconfig sets CONFIG_PREEMPT_NONE=y by default. For testing you need to
> flip this to CONFIG_PREEMPT_RT=y and since CONFIG_EXPERT=y is already
> set this option is available.
> And yes, it works on the virt board and there is no wizardry needed ;)

Sorry I missed this.  Just in case anyone's curious: I'm not flipping it 
on by default or anything, just adding a CONFIG_PREEMPT_RT=y 
configuration to the list of things I test before pushing to 
for-next or fixes.

>
> Sebastian
Nam Cao Oct. 9, 2024, 5:41 p.m. UTC | #6
On Wed, Oct 09, 2024 at 09:44:59AM -0700, Palmer Dabbelt wrote:
> On Fri, 06 Sep 2024 11:48:03 PDT (-0700), Palmer Dabbelt wrote:
> > On Fri, 06 Sep 2024 08:13:24 PDT (-0700), namcao@linutronix.de wrote:
> > > On Fri, Sep 06, 2024 at 12:59:06PM +0200, Sebastian Andrzej Siewior wrote:
> > > > It is really time.
> > > > 
> > > > riscv has all the required architecture related changes, that have been
> > > > identified over time, in order to enable PREEMPT_RT. With the recent
> > > > printk changes, the last known road block has been addressed.
> > > > 
> > > > Allow to enable PREEMPT_RT on riscv.
> > > > 
> > > > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > > 
> > > With the printk patches applied:
> > > 
> > > Tested-by: Nam Cao <namcao@linutronix.de> # Visionfive 2
> > 
> > 
> > Thanks.  LMK if you guys want me to take this through the RISC-V tree,
> > but no big deal if you want it somewhere else -- and if there's some
> > dependencies already going in through some sort of RT tree maybe that's
> > just easier.  So
> > 
> > Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
> > 
> > I don't have a test setup yet, but I figure it's a new feature so I'll
> > just flip it on as a config post-rc1.  Presumably this just works in the
> > QEMU virt board, or is there some wizardry I'll need to copy?
> 
> and it breaks my boot test script.  Looks like it's actually working mostly
> fine, I'm just not getting the "reboot: System halted" message that I'm
> checking for to make sure the system actually went down cleanly.
> 
> I'm not sure if this is expected behavior in RT land, or if we've got some
> sort of bug.  It sort of smells like we're losing the last printk() line...

I also had some occasional problem with rebooting my Visionfive 2 board,
which was fixed with:
https://lore.kernel.org/lkml/20241003084152.2422969-1-namcao@linutronix.de/

Any chance this fixes your issue as well?

Best regards,
Nam
John Ogness Oct. 10, 2024, 8:54 a.m. UTC | #7
On 2024-10-09, Palmer Dabbelt <palmer@dabbelt.com> wrote:
> and it breaks my boot test script.  Looks like it's actually working 
> mostly fine, I'm just not getting the "reboot: System halted" message 
> that I'm checking for to make sure the system actually went down 
> cleanly.
>
> I'm not sure if this is expected behavior in RT land, or if we've got 
> some sort of bug.  It sort of smells like we're losing the last printk() 
> line...

For PREEMPT_RT, the console printing is done via a thread. On
shutdown/reboot, the threads are no longer active to print the final
messages. There is a new console driver type (NBCON) that is available
for this. However, currently in mainline there are no console drivers
that have been converted to NBCON yet.

I am currently working [0] to get an NBCON console driver for the 8250
uart in mainline. But that will not help your case if you are using some
other console driver.

John Ogness

[0] https://lore.kernel.org/lkml/20240913140538.221708-1-john.ogness@linutronix.de
Sebastian Andrzej Siewior Oct. 10, 2024, 12:21 p.m. UTC | #8
On 2024-10-09 09:44:59 [-0700], Palmer Dabbelt wrote:
> 
> and it breaks my boot test script.  Looks like it's actually working mostly
> fine, I'm just not getting the "reboot: System halted" message that I'm
> checking for to make sure the system actually went down cleanly.
> 
> I'm not sure if this is expected behavior in RT land, or if we've got some
> sort of bug.  It sort of smells like we're losing the last printk() line...

Is it just defconfig + kvm_guest.config + PREEMPT_RT on "-cpu rv64
-machine virt" or is there more to it?

Sebastian
diff mbox series

Patch

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 801ee681059ca..a9be4dca380dc 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -65,6 +65,7 @@  config RISCV
 	select ARCH_SUPPORTS_LTO_CLANG_THIN if LLD_VERSION >= 140000
 	select ARCH_SUPPORTS_PAGE_TABLE_CHECK if MMU
 	select ARCH_SUPPORTS_PER_VMA_LOCK if MMU
+	select ARCH_SUPPORTS_RT
 	select ARCH_SUPPORTS_SHADOW_CALL_STACK if HAVE_SHADOW_CALL_STACK
 	select ARCH_USE_CMPXCHG_LOCKREF if 64BIT
 	select ARCH_USE_MEMTEST