<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/arch/riscv/kernel/ftrace.c, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/arch/riscv/kernel/ftrace.c?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/arch/riscv/kernel/ftrace.c?h=linus%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-05-27T01:13:00Z</updated>
<entry>
<title>ftrace: Remove return value of ftrace_arch_modify_*()</title>
<updated>2022-05-27T01:13:00Z</updated>
<author>
<name>Li kunyu</name>
<email>kunyu@nfschina.com</email>
</author>
<published>2022-05-18T02:36:40Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=3a2bfec0b02f2226ff3376a5d2ff604d799bd7ea'/>
<id>urn:sha1:3a2bfec0b02f2226ff3376a5d2ff604d799bd7ea</id>
<content type='text'>
All instances of the function ftrace_arch_modify_prepare() and
  ftrace_arch_modify_post_process() return zero. There's no point in
  checking their return value. Just have them be void functions.

Link: https://lkml.kernel.org/r/20220518023639.4065-1-kunyu@nfschina.com

Signed-off-by: Li kunyu &lt;kunyu@nfschina.com&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace: Cleanup ftrace_dyn_arch_init()</title>
<updated>2021-10-08T23:41:39Z</updated>
<author>
<name>Weizhao Ouyang</name>
<email>o451686892@gmail.com</email>
</author>
<published>2021-09-09T09:02:16Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=6644c654ea70e0d8b8d5111e1272f8f29df00f21'/>
<id>urn:sha1:6644c654ea70e0d8b8d5111e1272f8f29df00f21</id>
<content type='text'>
Most of ARCHs use empty ftrace_dyn_arch_init(), introduce a weak common
ftrace_dyn_arch_init() to cleanup them.

Link: https://lkml.kernel.org/r/20210909090216.1955240-1-o451686892@gmail.com

Acked-by: Heiko Carstens &lt;hca@linux.ibm.com&gt; (s390)
Acked-by: Helge Deller &lt;deller@gmx.de&gt; (parisc)
Signed-off-by: Weizhao Ouyang &lt;o451686892@gmail.com&gt;
Signed-off-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>riscv: Using PATCHABLE_FUNCTION_ENTRY instead of MCOUNT</title>
<updated>2021-01-14T23:09:05Z</updated>
<author>
<name>Guo Ren</name>
<email>guoren@linux.alibaba.com</email>
</author>
<published>2020-12-17T16:01:41Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=afc76b8b80112189b6f11e67e19cf58301944814'/>
<id>urn:sha1:afc76b8b80112189b6f11e67e19cf58301944814</id>
<content type='text'>
This patch changes the current detour mechanism of dynamic ftrace
which has been discussed during LPC 2020 RISCV-MC [1].

Before the patch, we used mcount for detour:
&lt;funca&gt;:
	addi sp,sp,-16
	sd   ra,8(sp)
	sd   s0,0(sp)
	addi s0,sp,16
	mv   a5,ra
	mv   a0,a5
	auipc ra,0x0 -&gt; nop
	jalr  -296(ra) &lt;_mcount@plt&gt; -&gt;nop
	...

After the patch, we use nop call site area for detour:
&lt;funca&gt;:
	nop -&gt; REG_S ra, -SZREG(sp)
	nop -&gt; auipc ra, 0x?
	nop -&gt; jalr ?(ra)
	nop -&gt; REG_L ra, -SZREG(sp)
	...

The mcount mechanism is mixed with gcc function prologue which is
not very clear. The patchable function entry just put 16 bytes nop
before the front of the function prologue which could be filled
with a separated detour mechanism.

[1] https://www.linuxplumbersconf.org/event/7/contributions/807/

Signed-off-by: Guo Ren &lt;guoren@linux.alibaba.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
</entry>
<entry>
<title>risc-v: kernel: ftrace: Fixes improper SPDX comment style</title>
<updated>2020-11-04T21:28:20Z</updated>
<author>
<name>Ryan Kosta</name>
<email>ryanpkosta@gmail.com</email>
</author>
<published>2020-10-11T03:03:51Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=9d750c75bd2c3fcf20a3c15378d1bc6b2d4ec31f'/>
<id>urn:sha1:9d750c75bd2c3fcf20a3c15378d1bc6b2d4ec31f</id>
<content type='text'>
Signed-off-by: Ryan Kosta &lt;ryanpkosta@gmail.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
</entry>
<entry>
<title>RISC-V: Take text_mutex in ftrace_init_nop()</title>
<updated>2020-09-11T19:15:21Z</updated>
<author>
<name>Palmer Dabbelt</name>
<email>palmerdabbelt@google.com</email>
</author>
<published>2020-08-25T00:21:22Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=66d18dbda8469a944dfec6c49d26d5946efba218'/>
<id>urn:sha1:66d18dbda8469a944dfec6c49d26d5946efba218</id>
<content type='text'>
Without this we get lockdep failures.  They're spurious failures as SMP isn't
up when ftrace_init_nop() is called.  As far as I can tell the easiest fix is
to just take the lock, which also seems like the safest fix.

Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Acked-by: Guo Ren &lt;guoren@kernel.org&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
</entry>
<entry>
<title>maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault</title>
<updated>2020-06-17T17:57:41Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-06-17T07:37:53Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=fe557319aa06c23cffc9346000f119547e0f289a'/>
<id>urn:sha1:fe557319aa06c23cffc9346000f119547e0f289a</id>
<content type='text'>
Better describe what these functions do.

Suggested-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>riscv: Use text_mutex instead of patch_lock</title>
<updated>2020-05-18T18:38:16Z</updated>
<author>
<name>Zong Li</name>
<email>zong.li@sifive.com</email>
</author>
<published>2020-04-21T07:30:01Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=0ff7c3b331276f584bde3ae9a16bacd8fa3d01e6'/>
<id>urn:sha1:0ff7c3b331276f584bde3ae9a16bacd8fa3d01e6</id>
<content type='text'>
We don't need the additional lock protection when patching the text.

There are two patching interfaces here:
 - patch_text: patch code and always synchronize with stop_machine()
 - patch_text_nosync: patch code without synchronization, it's caller's
                      responsibility to synchronize all CPUs if needed.

For the first one, stop_machine() is protected by its own mutex, and
also the irq is already disabled here.

For the second one, in risc-v real case now, it would be used to ftrace
patching the mcount function, since it already running under
kstop_machine(), no other thread will run, so we could use text_mutex
on ftrace side.

Signed-off-by: Zong Li &lt;zong.li@sifive.com&gt;
Reviewed-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Reviewed-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
</entry>
<entry>
<title>riscv: Remove the 'riscv_' prefix of function name</title>
<updated>2020-05-18T18:38:13Z</updated>
<author>
<name>Zong Li</name>
<email>zong.li@sifive.com</email>
</author>
<published>2020-04-21T07:29:59Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=b80b3d582ebd8c7c49687319b3c624e03c4b2b93'/>
<id>urn:sha1:b80b3d582ebd8c7c49687319b3c624e03c4b2b93</id>
<content type='text'>
Refactor the function name by removing the 'riscv_' prefix, it would be
better unless it could mix up with arch-independent functions.

Signed-off-by: Zong Li &lt;zong.li@sifive.com&gt;
Reviewed-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Reviewed-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
</entry>
<entry>
<title>riscv: patch code by fixmap mapping</title>
<updated>2020-03-26T16:24:55Z</updated>
<author>
<name>Zong Li</name>
<email>zong.li@sifive.com</email>
</author>
<published>2020-03-09T16:55:44Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=8fdddb2eae731dd6beb89f9b812e5915d1beb744'/>
<id>urn:sha1:8fdddb2eae731dd6beb89f9b812e5915d1beb744</id>
<content type='text'>
On strict kernel memory permission, the ftrace have to change the
permission of text for dynamic patching the intructions. Use
riscv_patch_text_nosync() to patch code instead of probe_kernel_write.

Signed-off-by: Zong Li &lt;zong.li@sifive.com&gt;
Signed-off-by: Palmer Dabbelt &lt;palmerdabbelt@google.com&gt;
</content>
</entry>
<entry>
<title>riscv: ftrace: correct the condition logic in function graph tracer</title>
<updated>2020-01-03T08:56:37Z</updated>
<author>
<name>Zong Li</name>
<email>zong.li@sifive.com</email>
</author>
<published>2019-12-23T08:46:13Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=1d8f65798240b6577d8c44d20c8ea8f1d429e495'/>
<id>urn:sha1:1d8f65798240b6577d8c44d20c8ea8f1d429e495</id>
<content type='text'>
The condition should be logical NOT to assign the hook address to parent
address. Because the return value 0 of function_graph_enter upon
success.

Fixes: e949b6db51dc (riscv/function_graph: Simplify with function_graph_enter())
Signed-off-by: Zong Li &lt;zong.li@sifive.com&gt;
Reviewed-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Paul Walmsley &lt;paul.walmsley@sifive.com&gt;</content>
</entry>
</feed>
