<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/loongarch/kernel/inst.c, branch linux-6.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-06-29T12:58:44Z</updated>
<entry>
<title>LoongArch: Add larch_insn_gen_break() to generate break insns</title>
<updated>2023-06-29T12:58:44Z</updated>
<author>
<name>Tiezhu Yang</name>
</author>
<published>2023-06-29T12:58:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=49ed320da5f52ec729e7f2f9edbc6e79848455bd'/>
<id>urn:sha1:49ed320da5f52ec729e7f2f9edbc6e79848455bd</id>
<content type='text'>
There exist various break insns such as BRK_KPROBE_BP, BRK_KPROBE_SSTEPBP,
BRK_UPROBE_BP and BRK_UPROBE_XOLBP, add larch_insn_gen_break() to generate
break insns simpler, this is preparation for later patch.

Tested-by: Jeff Xie &lt;xiehuan09@gmail.com&gt;
Signed-off-by: Tiezhu Yang &lt;yangtiezhu@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Check for AMO instructions in insns_not_supported()</title>
<updated>2023-06-29T12:58:44Z</updated>
<author>
<name>Tiezhu Yang</name>
</author>
<published>2023-06-29T12:58:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b82fad4d5deb2c2a15fdb581a1e6725dcea666e7'/>
<id>urn:sha1:b82fad4d5deb2c2a15fdb581a1e6725dcea666e7</id>
<content type='text'>
Like llsc instructions, the atomic memory access instructions shouldn't
be supported for probing, so check for them in insns_not_supported().

Closes: https://lore.kernel.org/all/SY4P282MB351877A70A0333C790FE85A5C09C9@SY4P282MB3518.AUSP282.PROD.OUTLOOK.COM/
Tested-by: Jeff Xie &lt;xiehuan09@gmail.com&gt;
Reported-by: Hengqi Chen &lt;hengqi.chen@gmail.com&gt;
Signed-off-by: Tiezhu Yang &lt;yangtiezhu@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Move three functions from kprobes.c to inst.c</title>
<updated>2023-06-29T12:58:44Z</updated>
<author>
<name>Tiezhu Yang</name>
</author>
<published>2023-06-29T12:58:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3d2c3daf82544283c5597028a8a3efc9ac0fb02b'/>
<id>urn:sha1:3d2c3daf82544283c5597028a8a3efc9ac0fb02b</id>
<content type='text'>
The three functions insns_not_supported(), insns_need_simulation() and
arch_simulate_insn() will be used for uprobes, move them from kprobes.c
to inst.c, this is preparation for later patch, no functionality change.

Tested-by: Jeff Xie &lt;xiehuan09@gmail.com&gt;
Signed-off-by: Tiezhu Yang &lt;yangtiezhu@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Add guard for the larch_insn_gen_xxx functions</title>
<updated>2023-06-29T12:58:42Z</updated>
<author>
<name>WANG Rui</name>
</author>
<published>2023-06-29T12:58:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0d03e9dce5c91d841a35af05ca61a5cf318f5064'/>
<id>urn:sha1:0d03e9dce5c91d841a35af05ca61a5cf318f5064</id>
<content type='text'>
Add guard for the larch_insn_gen_xxx functions to verify whether the
immediate operand is within the acceptable range.

Signed-off-by: WANG Rui &lt;wangrui@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Simulate branch and PC* instructions</title>
<updated>2023-02-25T14:12:17Z</updated>
<author>
<name>Tiezhu Yang</name>
</author>
<published>2023-02-25T07:52:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9b3441a6b0e1ed4796e7f5a8586c4d6023c4e3ab'/>
<id>urn:sha1:9b3441a6b0e1ed4796e7f5a8586c4d6023c4e3ab</id>
<content type='text'>
According to LoongArch Reference Manual, simulate branch and PC*
instructions, this is preparation for later patch.

Link: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#branch-instructions
Link: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_pcaddi_pcaddu121_pcaddu18l_pcalau12i

Tested-by: Jeff Xie &lt;xiehuan09@gmail.com&gt;
Co-developed-by: Jinyang He &lt;hejinyang@loongson.cn&gt;
Signed-off-by: Jinyang He &lt;hejinyang@loongson.cn&gt;
Signed-off-by: Tiezhu Yang &lt;yangtiezhu@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Simplify larch_insn_gen_xxx implementation</title>
<updated>2023-01-17T03:42:16Z</updated>
<author>
<name>Youling Tang</name>
</author>
<published>2023-01-17T03:42:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3200983fa8e2c8aa17ed911b617b4a248bcb1267'/>
<id>urn:sha1:3200983fa8e2c8aa17ed911b617b4a248bcb1267</id>
<content type='text'>
Simplify larch_insn_gen_xxx implementation by reusing emit_xxx.

Signed-off-by: Youling Tang &lt;tangyouling@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: modules/ftrace: Initialize PLT at load time</title>
<updated>2022-12-14T00:41:54Z</updated>
<author>
<name>Qing Zhang</name>
</author>
<published>2022-12-10T14:40:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=28ac0a9e04d7dfb42220dc9d221164d93f20fb3a'/>
<id>urn:sha1:28ac0a9e04d7dfb42220dc9d221164d93f20fb3a</id>
<content type='text'>
This patch implements ftrace trampolines through plt entry.

Tested by forcing ftrace_make_call() to use the module PLT, and then
loading up a module after setting up ftrace with:

| echo ":mod:&lt;module-name&gt;" &gt; set_ftrace_filter;
| echo function &gt; current_tracer;
| modprobe &lt;module-name&gt;

Since FTRACE_ADDR/FTRACE_REGS_ADDR is only defined when CONFIG_DYNAMIC_
FTRACE is selected, we wrap their usage in module_init_ftrace_plt() with
ifdeffery rather than using IS_ENABLED().

Signed-off-by: Qing Zhang &lt;zhangqing@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch/ftrace: Add dynamic function graph tracer support</title>
<updated>2022-12-14T00:41:53Z</updated>
<author>
<name>Qing Zhang</name>
</author>
<published>2022-12-10T14:40:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5fcfad3d41cc70f39fb31e7ee314989cc4c5f02c'/>
<id>urn:sha1:5fcfad3d41cc70f39fb31e7ee314989cc4c5f02c</id>
<content type='text'>
Once the function_graph tracer is enabled, a filtered function has the
following call sequence:

1) ftracer_caller     ==&gt; on/off by ftrace_make_call/ftrace_make_nop
2) ftrace_graph_caller
3) ftrace_graph_call  ==&gt; on/off by ftrace_en/disable_ftrace_graph_caller
4) prepare_ftrace_return

Considering the following DYNAMIC_FTRACE_WITH_REGS feature, it would be
more extendable to have a ftrace_graph_caller function, instead of
calling prepare_ftrace_return directly in ftrace_caller.

Co-developed-by: Jinyang He &lt;hejinyang@loongson.cn&gt;
Signed-off-by: Jinyang He &lt;hejinyang@loongson.cn&gt;
Signed-off-by: Qing Zhang &lt;zhangqing@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch/ftrace: Add dynamic function tracer support</title>
<updated>2022-12-14T00:41:53Z</updated>
<author>
<name>Qing Zhang</name>
</author>
<published>2022-12-10T14:40:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4733f09d880745953b88c3358b49ad495aecd8e9'/>
<id>urn:sha1:4733f09d880745953b88c3358b49ad495aecd8e9</id>
<content type='text'>
The compiler has inserted 2 NOPs before the regular function prologue.
T series registers are available and safe because of LoongArch's psABI.

At runtime, we can replace nop with bl to enable ftrace call and replace
bl with nop to disable ftrace call. The bl instruction requires us to
save the original RA value, so it saves RA at t0 here.

Details are:

| Compiled   |       Disabled         |        Enabled         |
+------------+------------------------+------------------------+
| nop        | move     t0, ra        | move    t0, ra         |
| nop        | nop                    | bl      ftrace_caller  |
| func_body  | func_body              | func_body              |

The RA value will be recovered by ftrace_regs_entry, and restored into
RA before returning to the regular function prologue. When a function is
not being traced, the "move t0, ra" is not harmful.

1) ftrace_make_call, ftrace_make_nop (in kernel/ftrace.c)
   The two functions turn each recorded call site of filtered functions
   into a call to ftrace_caller or nops.

2) ftracce_update_ftrace_func (in kernel/ftrace.c)
   turns the nops at ftrace_call into a call to a generic entry for
   function tracers.

3) ftrace_caller (in kernel/mcount_dyn.S)
   The entry where each _mcount call sites calls to once they are
   filtered to be traced.

Co-developed-by: Jinyang He &lt;hejinyang@loongson.cn&gt;
Signed-off-by: Jinyang He &lt;hejinyang@loongson.cn&gt;
Signed-off-by: Qing Zhang &lt;zhangqing@loongson.cn&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
<entry>
<title>LoongArch: Add ELF and module support</title>
<updated>2022-06-03T12:09:28Z</updated>
<author>
<name>Huacai Chen</name>
</author>
<published>2022-05-31T10:04:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fcdfe9d22bed08409968a751e93112f742208be6'/>
<id>urn:sha1:fcdfe9d22bed08409968a751e93112f742208be6</id>
<content type='text'>
Add ELF-related definition and module relocation code for basic
LoongArch support.

Cc: Jessica Yu &lt;jeyu@kernel.org&gt;
Reviewed-by: WANG Xuerui &lt;git@xen0n.name&gt;
Reviewed-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
Reviewed-by: Jiaxun Yang &lt;jiaxun.yang@flygoat.com&gt;
Signed-off-by: Huacai Chen &lt;chenhuacai@loongson.cn&gt;
</content>
</entry>
</feed>
