<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/riscv/kernel/entry.S, branch linux-6.4.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.4.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.4.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-03-23T15:47:03Z</updated>
<entry>
<title>riscv: entry: Consolidate general regs saving/restoring</title>
<updated>2023-03-23T15:47:03Z</updated>
<author>
<name>Jisheng Zhang</name>
</author>
<published>2023-02-22T03:30:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=45b32b946a97bb4553bab30c2519bbaac55f39db'/>
<id>urn:sha1:45b32b946a97bb4553bab30c2519bbaac55f39db</id>
<content type='text'>
Consolidate the saving/restoring GPs (except zero, ra, sp, gp,
tp and t0) into save_from_x6_to_x31/restore_from_x6_to_x31 macros.

No functional change intended.

Signed-off-by: Jisheng Zhang &lt;jszhang@kernel.org&gt;
Reviewed-by: Guo Ren &lt;guoren@kernel.org&gt;
Reviewed-by: Björn Töpel &lt;bjorn@rivosinc.com&gt;
Tested-by: Guo Ren &lt;guoren@kernel.org&gt;
Signed-off-by: Guo Ren &lt;guoren@kernel.org&gt;
Link: https://lore.kernel.org/r/20230222033021.983168-8-guoren@kernel.org
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
</content>
</entry>
<entry>
<title>riscv: entry: Consolidate ret_from_kernel_thread into ret_from_fork</title>
<updated>2023-03-23T15:47:02Z</updated>
<author>
<name>Jisheng Zhang</name>
</author>
<published>2023-02-22T03:30:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ab9164dae27334415537ccf1c3fbabf56b7793b2'/>
<id>urn:sha1:ab9164dae27334415537ccf1c3fbabf56b7793b2</id>
<content type='text'>
The ret_from_kernel_thread() behaves similarly with ret_from_fork(),
the only difference is whether call the fn(arg) or not, this can be
achieved by testing fn is NULL or not, I.E s0 is 0 or not. Many
architectures have done the same thing, it makes entry.S more clean.

Signed-off-by: Jisheng Zhang &lt;jszhang@kernel.org&gt;
Reviewed-by: Björn Töpel &lt;bjorn@rivosinc.com&gt;
Reviewed-by: Guo Ren &lt;guoren@kernel.org&gt;
Tested-by: Guo Ren &lt;guoren@kernel.org&gt;
Signed-off-by: Guo Ren &lt;guoren@kernel.org&gt;
Link: https://lore.kernel.org/r/20230222033021.983168-7-guoren@kernel.org
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
</content>
</entry>
<entry>
<title>riscv: entry: Convert to generic entry</title>
<updated>2023-03-23T15:47:00Z</updated>
<author>
<name>Guo Ren</name>
</author>
<published>2023-02-22T03:30:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f0bddf50586da81360627a772be0e355b62f071e'/>
<id>urn:sha1:f0bddf50586da81360627a772be0e355b62f071e</id>
<content type='text'>
This patch converts riscv to use the generic entry infrastructure from
kernel/entry/*. The generic entry makes maintainers' work easier and
codes more elegant. Here are the changes:

 - More clear entry.S with handle_exception and ret_from_exception
 - Get rid of complex custom signal implementation
 - Move syscall procedure from assembly to C, which is much more
   readable.
 - Connect ret_from_fork &amp; ret_from_kernel_thread to generic entry.
 - Wrap with irqentry_enter/exit and syscall_enter/exit_from_user_mode
 - Use the standard preemption code instead of custom

Suggested-by: Huacai Chen &lt;chenhuacai@kernel.org&gt;
Reviewed-by: Björn Töpel &lt;bjorn@rivosinc.com&gt;
Tested-by: Yipeng Zou &lt;zouyipeng@huawei.com&gt;
Tested-by: Jisheng Zhang &lt;jszhang@kernel.org&gt;
Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Signed-off-by: Guo Ren &lt;guoren@kernel.org&gt;
Cc: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Link: https://lore.kernel.org/r/20230222033021.983168-5-guoren@kernel.org
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
</content>
</entry>
<entry>
<title>Merge patch series "RISC-V: Align the shadow stack"</title>
<updated>2022-12-12T17:30:37Z</updated>
<author>
<name>Palmer Dabbelt</name>
</author>
<published>2022-12-12T17:30:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c3ec1e8964fb0ca00c79936160a027bd8b47e140'/>
<id>urn:sha1:c3ec1e8964fb0ca00c79936160a027bd8b47e140</id>
<content type='text'>
Palmer Dabbelt &lt;palmer@rivosinc.com&gt; says:

This contains a pair of cleanups that depend on a fix that has already
landed upstream.

* b4-shazam-merge:
  RISC-V: Add some comments about the shadow and overflow stacks
  RISC-V: Align the shadow stack
  riscv: fix race when vmap stack overflow

Link: https://lore.kernel.org/r/20221130023515.20217-1-palmer@rivosinc.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
</content>
</entry>
<entry>
<title>Merge patch "RISC-V: Fix unannoted hardirqs-on in return to userspace slow-path"</title>
<updated>2022-12-08T23:31:44Z</updated>
<author>
<name>Palmer Dabbelt</name>
</author>
<published>2022-12-08T23:31:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e1ceb096416311be1564de69ea40bb872d7cc327'/>
<id>urn:sha1:e1ceb096416311be1564de69ea40bb872d7cc327</id>
<content type='text'>
I'm merging this in as a single patch to make it easier to handle the
backports.

* b4-shazam-merge:
  RISC-V: Fix unannoted hardirqs-on in return to userspace slow-path

Link: https://lore.kernel.org/r/20221111223108.1976562-1-abrestic@rivosinc.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
</content>
</entry>
<entry>
<title>RISC-V: Fix unannoted hardirqs-on in return to userspace slow-path</title>
<updated>2022-12-08T23:31:41Z</updated>
<author>
<name>Andrew Bresticker</name>
</author>
<published>2022-11-11T22:31:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b0f4c74eadbf69a3298f38566bfaa2e202541f2f'/>
<id>urn:sha1:b0f4c74eadbf69a3298f38566bfaa2e202541f2f</id>
<content type='text'>
The return to userspace path in entry.S may enable interrupts without the
corresponding lockdep annotation, producing a splat[0] when DEBUG_LOCKDEP
is enabled. Simply calling __trace_hardirqs_on() here gets a bit messy
due to the use of RA to point back to ret_from_exception, so just move
the whole slow-path loop into C. It's more readable and it lets us use
local_irq_{enable,disable}(), avoiding the need for manual annotations
altogether.

[0]:
  ------------[ cut here ]------------
  DEBUG_LOCKS_WARN_ON(!lockdep_hardirqs_enabled())
  WARNING: CPU: 2 PID: 1 at kernel/locking/lockdep.c:5512 check_flags+0x10a/0x1e0
  Modules linked in:
  CPU: 2 PID: 1 Comm: init Not tainted 6.1.0-rc4-00160-gb56b6e2b4f31 #53
  Hardware name: riscv-virtio,qemu (DT)
  epc : check_flags+0x10a/0x1e0
  ra : check_flags+0x10a/0x1e0
  &lt;snip&gt;
   status: 0000000200000100 badaddr: 0000000000000000 cause: 0000000000000003
  [&lt;ffffffff808edb90&gt;] lock_is_held_type+0x78/0x14e
  [&lt;ffffffff8003dae2&gt;] __might_resched+0x26/0x22c
  [&lt;ffffffff8003dd24&gt;] __might_sleep+0x3c/0x66
  [&lt;ffffffff80022c60&gt;] get_signal+0x9e/0xa70
  [&lt;ffffffff800054a2&gt;] do_notify_resume+0x6e/0x422
  [&lt;ffffffff80003c68&gt;] ret_from_exception+0x0/0x10
  irq event stamp: 44512
  hardirqs last  enabled at (44511): [&lt;ffffffff808f901c&gt;] _raw_spin_unlock_irqrestore+0x54/0x62
  hardirqs last disabled at (44512): [&lt;ffffffff80008200&gt;] __trace_hardirqs_off+0xc/0x14
  softirqs last  enabled at (44472): [&lt;ffffffff808f9fbe&gt;] __do_softirq+0x3de/0x51e
  softirqs last disabled at (44467): [&lt;ffffffff80017760&gt;] irq_exit+0xd6/0x104
  ---[ end trace 0000000000000000 ]---
  possible reason: unannotated irqs-on.

Signed-off-by: Andrew Bresticker &lt;abrestic@rivosinc.com&gt;
Fixes: 3c4697982982 ("riscv: Enable LOCKDEP_SUPPORT &amp; fixup TRACE_IRQFLAGS_SUPPORT")
Link: https://lore.kernel.org/r/20221111223108.1976562-1-abrestic@rivosinc.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
</content>
</entry>
<entry>
<title>riscv: stacktrace: Make walk_stackframe cross pt_regs frame</title>
<updated>2022-12-06T02:13:34Z</updated>
<author>
<name>Guo Ren</name>
</author>
<published>2022-11-09T06:49:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7ecdadf7f8c659524f6b2aebf6be7bf619764d90'/>
<id>urn:sha1:7ecdadf7f8c659524f6b2aebf6be7bf619764d90</id>
<content type='text'>
The current walk_stackframe with FRAME_POINTER would stop unwinding at
ret_from_exception:
  BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1518
  in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 1, name: init
  CPU: 0 PID: 1 Comm: init Not tainted 5.10.113-00021-g15c15974895c-dirty #192
  Call Trace:
  [&lt;ffffffe0002038c8&gt;] walk_stackframe+0x0/0xee
  [&lt;ffffffe000aecf48&gt;] show_stack+0x32/0x4a
  [&lt;ffffffe000af1618&gt;] dump_stack_lvl+0x72/0x8e
  [&lt;ffffffe000af1648&gt;] dump_stack+0x14/0x1c
  [&lt;ffffffe000239ad2&gt;] ___might_sleep+0x12e/0x138
  [&lt;ffffffe000239aec&gt;] __might_sleep+0x10/0x18
  [&lt;ffffffe000afe3fe&gt;] down_read+0x22/0xa4
  [&lt;ffffffe000207588&gt;] do_page_fault+0xb0/0x2fe
  [&lt;ffffffe000201b80&gt;] ret_from_exception+0x0/0xc

The optimization would help walk_stackframe cross the pt_regs frame and
get more backtrace of debug info:
  BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1518
  in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 1, name: init
  CPU: 0 PID: 1 Comm: init Not tainted 5.10.113-00021-g15c15974895c-dirty #192
  Call Trace:
  [&lt;ffffffe0002038c8&gt;] walk_stackframe+0x0/0xee
  [&lt;ffffffe000aecf48&gt;] show_stack+0x32/0x4a
  [&lt;ffffffe000af1618&gt;] dump_stack_lvl+0x72/0x8e
  [&lt;ffffffe000af1648&gt;] dump_stack+0x14/0x1c
  [&lt;ffffffe000239ad2&gt;] ___might_sleep+0x12e/0x138
  [&lt;ffffffe000239aec&gt;] __might_sleep+0x10/0x18
  [&lt;ffffffe000afe3fe&gt;] down_read+0x22/0xa4
  [&lt;ffffffe000207588&gt;] do_page_fault+0xb0/0x2fe
  [&lt;ffffffe000201b80&gt;] ret_from_exception+0x0/0xc
  [&lt;ffffffe000613c06&gt;] riscv_intc_irq+0x1a/0x72
  [&lt;ffffffe000201b80&gt;] ret_from_exception+0x0/0xc
  [&lt;ffffffe00033f44a&gt;] vma_link+0x54/0x160
  [&lt;ffffffe000341d7a&gt;] mmap_region+0x2cc/0x4d0
  [&lt;ffffffe000342256&gt;] do_mmap+0x2d8/0x3ac
  [&lt;ffffffe000326318&gt;] vm_mmap_pgoff+0x70/0xb8
  [&lt;ffffffe00032638a&gt;] vm_mmap+0x2a/0x36
  [&lt;ffffffe0003cfdde&gt;] elf_map+0x72/0x84
  [&lt;ffffffe0003d05f8&gt;] load_elf_binary+0x69a/0xec8
  [&lt;ffffffe000376240&gt;] bprm_execve+0x246/0x53a
  [&lt;ffffffe00037786c&gt;] kernel_execve+0xe8/0x124
  [&lt;ffffffe000aecdf2&gt;] run_init_process+0xfa/0x10c
  [&lt;ffffffe000aece16&gt;] try_to_run_init_process+0x12/0x3c
  [&lt;ffffffe000afa920&gt;] kernel_init+0xb4/0xf8
  [&lt;ffffffe000201b80&gt;] ret_from_exception+0x0/0xc

Here is the error injection test code for the above output:
 drivers/irqchip/irq-riscv-intc.c:
 static asmlinkage void riscv_intc_irq(struct pt_regs *regs)
 {
        unsigned long cause = regs-&gt;cause &amp; ~CAUSE_IRQ_FLAG;
+       u32 tmp; __get_user(tmp, (u32 *)0);

Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Signed-off-by: Guo Ren &lt;guoren@kernel.org&gt;
Link: https://lore.kernel.org/r/20221109064937.3643993-3-guoren@kernel.org
[Palmer: use SYM_CODE_*]
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
</content>
</entry>
<entry>
<title>riscv: fix race when vmap stack overflow</title>
<updated>2022-11-30T02:16:55Z</updated>
<author>
<name>Jisheng Zhang</name>
</author>
<published>2022-10-30T12:45:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7e1864332fbc1b993659eab7974da9fe8bf8c128'/>
<id>urn:sha1:7e1864332fbc1b993659eab7974da9fe8bf8c128</id>
<content type='text'>
Currently, when detecting vmap stack overflow, riscv firstly switches
to the so called shadow stack, then use this shadow stack to call the
get_overflow_stack() to get the overflow stack. However, there's
a race here if two or more harts use the same shadow stack at the same
time.

To solve this race, we introduce spin_shadow_stack atomic var, which
will be swap between its own address and 0 in atomic way, when the
var is set, it means the shadow_stack is being used; when the var
is cleared, it means the shadow_stack isn't being used.

Fixes: 31da94c25aea ("riscv: add VMAP_STACK overflow detection")
Signed-off-by: Jisheng Zhang &lt;jszhang@kernel.org&gt;
Suggested-by: Guo Ren &lt;guoren@kernel.org&gt;
Reviewed-by: Guo Ren &lt;guoren@kernel.org&gt;
Link: https://lore.kernel.org/r/20221030124517.2370-1-jszhang@kernel.org
[Palmer: Add AQ to the swap, and also some comments.]
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
</content>
</entry>
<entry>
<title>context_tracking: Split user tracking Kconfig</title>
<updated>2022-06-30T00:04:09Z</updated>
<author>
<name>Frederic Weisbecker</name>
</author>
<published>2022-06-08T14:40:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=24a9c54182b3758801b8ca6c8c237cc2ff654732'/>
<id>urn:sha1:24a9c54182b3758801b8ca6c8c237cc2ff654732</id>
<content type='text'>
Context tracking is going to be used not only to track user transitions
but also idle/IRQs/NMIs. The user tracking part will then become a
separate feature. Prepare Kconfig for that.

[ frederic: Apply Max Filippov feedback. ]

Signed-off-by: Frederic Weisbecker &lt;frederic@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Neeraj Upadhyay &lt;quic_neeraju@quicinc.com&gt;
Cc: Uladzislau Rezki &lt;uladzislau.rezki@sony.com&gt;
Cc: Joel Fernandes &lt;joel@joelfernandes.org&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Nicolas Saenz Julienne &lt;nsaenz@kernel.org&gt;
Cc: Marcelo Tosatti &lt;mtosatti@redhat.com&gt;
Cc: Xiongfeng Wang &lt;wangxiongfeng2@huawei.com&gt;
Cc: Yu Liao &lt;liaoyu15@huawei.com&gt;
Cc: Phil Auld &lt;pauld@redhat.com&gt;
Cc: Paul Gortmaker&lt;paul.gortmaker@windriver.com&gt;
Cc: Alex Belits &lt;abelits@marvell.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Reviewed-by: Nicolas Saenz Julienne &lt;nsaenzju@redhat.com&gt;
Tested-by: Nicolas Saenz Julienne &lt;nsaenzju@redhat.com&gt;
</content>
</entry>
<entry>
<title>context_tracking: Rename context_tracking_user_enter/exit() to user_enter/exit_callable()</title>
<updated>2022-06-30T00:03:27Z</updated>
<author>
<name>Frederic Weisbecker</name>
</author>
<published>2022-06-08T14:40:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f163f0302ab69722c052519f4014814bf10026a9'/>
<id>urn:sha1:f163f0302ab69722c052519f4014814bf10026a9</id>
<content type='text'>
context_tracking_user_enter() and context_tracking_user_exit() are
ASM callable versions of user_enter() and user_exit() for architectures
that didn't manage to check the context tracking static key from ASM.
Change those function names to better reflect their purpose.

[ frederic: Apply Max Filippov feedback. ]

Signed-off-by: Frederic Weisbecker &lt;frederic@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Neeraj Upadhyay &lt;quic_neeraju@quicinc.com&gt;
Cc: Uladzislau Rezki &lt;uladzislau.rezki@sony.com&gt;
Cc: Joel Fernandes &lt;joel@joelfernandes.org&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Nicolas Saenz Julienne &lt;nsaenz@kernel.org&gt;
Cc: Marcelo Tosatti &lt;mtosatti@redhat.com&gt;
Cc: Xiongfeng Wang &lt;wangxiongfeng2@huawei.com&gt;
Cc: Yu Liao &lt;liaoyu15@huawei.com&gt;
Cc: Phil Auld &lt;pauld@redhat.com&gt;
Cc: Paul Gortmaker&lt;paul.gortmaker@windriver.com&gt;
Cc: Alex Belits &lt;abelits@marvell.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Reviewed-by: Nicolas Saenz Julienne &lt;nsaenzju@redhat.com&gt;
Tested-by: Nicolas Saenz Julienne &lt;nsaenzju@redhat.com&gt;
</content>
</entry>
</feed>
