arch/loongarch/configs/loongson3_defconfig | 74 +++++----------------- 1 file changed, 16 insertions(+), 58 deletions(-)
This is a small patchset based on 6.15-rc4, each patch is a
single logical change to better describe the problem and make
it easier to review.
If the changes make sense, all of them can be squashed into one
single patch, I think that would be fine as well, let us see if
other people have concern about it.
By the way, I received many compile-time error reports about tools,
most are related with configs, this is the motivation of this series.
Additionally, I also received one run-time bug report about uprobe,
but it works fine on my test environment. If somebody can reproduce
it, please let me know, maybe I am missing something.
1. How to reproduce
(1) Compile and install Tongsuo
git clone https://github.com/Tongsuo-Project/Tongsuo.git
cd Tongsuo && ./config --prefix=/opt/tongsuo -Wl,-rpath,/opt/tongsuo/lib
make && sudo make install
https://www.tongsuo.net/docs/compilation/source-compilation
(2) Compile and update kernel
Apply this series based on 6.15-rc4, then use the loongson3_defconfig,
CONFIG_UPROBE_EVENTS is already set.
(3) Probe "openssl speed sm2"
cd tools/perf && make
sudo ./perf probe -x /usr/lib64/libcrypto.so BN_mod_mul_montgomery
sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery /opt/tongsuo/bin/openssl speed sm2
2. My test results
fedora@linux:~/uprobe.git/tools/perf$ sudo ./perf probe -x /usr/lib64/libcrypto.so BN_mod_mul_montgomery
Added new event:
probe_libcrypto:BN_mod_mul_montgomery (on BN_mod_mul_montgomery in /usr/lib64/libcrypto.so.3.2.2)
You can now use it in all perf tools, such as:
perf record -e probe_libcrypto:BN_mod_mul_montgomery -aR sleep 1
fedora@linux:~/uprobe.git/tools/perf$ sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery /opt/tongsuo/bin/openssl speed sm2
Doing 256 bits sign CurveSM2's for 10s: 7463 256 bits CurveSM2 signs in 10.00s
Doing 256 bits verify CurveSM2's for 10s: 9681 256 bits CurveSM2 verify in 9.98s
...
sign verify sign/s verify/s
256 bits SM2 (CurveSM2) 0.0013s 0.0010s 746.3 970.0
Performance counter stats for '/opt/tongsuo/bin/openssl speed sm2':
0 probe_libcrypto:BN_mod_mul_montgomery
20.007539877 seconds time elapsed
19.990010000 seconds user
0.000000000 seconds sys
Thanks,
Tiezhu
Tiezhu Yang (5):
LoongArch: Clean up loongson3_defconfig
LoongArch: Enable tracing infrastructure in defconfig
LoongArch: Enable tracing syscalls in defconfig
LoongArch: Enable debug information in defconfig
LoongArch: Enable kprobe and ftrace in defconfig
arch/loongarch/configs/loongson3_defconfig | 74 +++++-----------------
1 file changed, 16 insertions(+), 58 deletions(-)
--
2.42.0
Hi, Tiezhu, When I enable these options: CONFIG_FTRACE=y CONFIG_FUNCTION_TRACER=y CONFIG_FUNCTION_GRAPH_TRACER=y CONFIG_DYNAMIC_FTRACE=y CONFIG_DYNAMIC_FTRACE_WITH_REGS=y CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=y CONFIG_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_KPROBES=y CONFIG_UPROBES=y CONFIG_KPROBE_EVENTS=y CONFIG_UPROBE_EVENTS=y Then your above commands will hang (or get a SIGTRAP), which options I am missing? I haven't tried your patches, maybe it works, but I want to know the exactly needed options. Huacai On Wed, Apr 30, 2025 at 9:15 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote: > > This is a small patchset based on 6.15-rc4, each patch is a > single logical change to better describe the problem and make > it easier to review. > > If the changes make sense, all of them can be squashed into one > single patch, I think that would be fine as well, let us see if > other people have concern about it. > > By the way, I received many compile-time error reports about tools, > most are related with configs, this is the motivation of this series. > > Additionally, I also received one run-time bug report about uprobe, > but it works fine on my test environment. If somebody can reproduce > it, please let me know, maybe I am missing something. > > 1. How to reproduce > > (1) Compile and install Tongsuo > > git clone https://github.com/Tongsuo-Project/Tongsuo.git > cd Tongsuo && ./config --prefix=/opt/tongsuo -Wl,-rpath,/opt/tongsuo/lib > make && sudo make install > > https://www.tongsuo.net/docs/compilation/source-compilation > > (2) Compile and update kernel > > Apply this series based on 6.15-rc4, then use the loongson3_defconfig, > CONFIG_UPROBE_EVENTS is already set. > > (3) Probe "openssl speed sm2" > > cd tools/perf && make > sudo ./perf probe -x /usr/lib64/libcrypto.so BN_mod_mul_montgomery > sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery /opt/tongsuo/bin/openssl speed sm2 > > 2. My test results > > fedora@linux:~/uprobe.git/tools/perf$ sudo ./perf probe -x /usr/lib64/libcrypto.so BN_mod_mul_montgomery > Added new event: > probe_libcrypto:BN_mod_mul_montgomery (on BN_mod_mul_montgomery in /usr/lib64/libcrypto.so.3.2.2) > > You can now use it in all perf tools, such as: > > perf record -e probe_libcrypto:BN_mod_mul_montgomery -aR sleep 1 > > fedora@linux:~/uprobe.git/tools/perf$ sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery /opt/tongsuo/bin/openssl speed sm2 > Doing 256 bits sign CurveSM2's for 10s: 7463 256 bits CurveSM2 signs in 10.00s > Doing 256 bits verify CurveSM2's for 10s: 9681 256 bits CurveSM2 verify in 9.98s > ... > sign verify sign/s verify/s > 256 bits SM2 (CurveSM2) 0.0013s 0.0010s 746.3 970.0 > > Performance counter stats for '/opt/tongsuo/bin/openssl speed sm2': > > 0 probe_libcrypto:BN_mod_mul_montgomery > > 20.007539877 seconds time elapsed > > 19.990010000 seconds user > 0.000000000 seconds sys > > Thanks, > Tiezhu > > Tiezhu Yang (5): > LoongArch: Clean up loongson3_defconfig > LoongArch: Enable tracing infrastructure in defconfig > LoongArch: Enable tracing syscalls in defconfig > LoongArch: Enable debug information in defconfig > LoongArch: Enable kprobe and ftrace in defconfig > > arch/loongarch/configs/loongson3_defconfig | 74 +++++----------------- > 1 file changed, 16 insertions(+), 58 deletions(-) > > -- > 2.42.0 >
Hi, Tiezhu, On Wed, Apr 30, 2025 at 9:41 PM Huacai Chen <chenhuacai@kernel.org> wrote: > > Hi, Tiezhu, > > When I enable these options: > CONFIG_FTRACE=y > CONFIG_FUNCTION_TRACER=y > CONFIG_FUNCTION_GRAPH_TRACER=y > CONFIG_DYNAMIC_FTRACE=y > CONFIG_DYNAMIC_FTRACE_WITH_REGS=y > CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=y > CONFIG_DYNAMIC_FTRACE_WITH_ARGS=y > CONFIG_KPROBES=y > CONFIG_UPROBES=y > CONFIG_KPROBE_EVENTS=y > CONFIG_UPROBE_EVENTS=y > > Then your above commands will hang (or get a SIGTRAP), which options I > am missing? > > I haven't tried your patches, maybe it works, but I want to know the > exactly needed options. Have you investigated this? I have tried your patchset, but still get a SIGTRAP or system hang. I think I know why your tests "success": sudo ./perf probe -x /usr/lib64/libcrypto.so BN_mod_mul_montgomery sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery /opt/tongsuo/bin/openssl speed sm2 In the first step you probe the OpenSSL library, and in the second step you are running "Tongsuo". Have you tried (both OpenSSL) sudo ./perf probe -x /usr/lib64/libcrypto.so BN_mod_mul_montgomery sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery openssl speed sm2 or (both Tongsuo) sudo ./perf probe -x /opt/tongsuo/lib/libcrypto.so BN_mod_mul_montgomery sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery /opt/tongsuo/bin/openssl speed sm2 and still success? I tried, and both got a SIGTRAP or system hang. Huacai > > Huacai > > > On Wed, Apr 30, 2025 at 9:15 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote: > > > > This is a small patchset based on 6.15-rc4, each patch is a > > single logical change to better describe the problem and make > > it easier to review. > > > > If the changes make sense, all of them can be squashed into one > > single patch, I think that would be fine as well, let us see if > > other people have concern about it. > > > > By the way, I received many compile-time error reports about tools, > > most are related with configs, this is the motivation of this series. > > > > Additionally, I also received one run-time bug report about uprobe, > > but it works fine on my test environment. If somebody can reproduce > > it, please let me know, maybe I am missing something. > > > > 1. How to reproduce > > > > (1) Compile and install Tongsuo > > > > git clone https://github.com/Tongsuo-Project/Tongsuo.git > > cd Tongsuo && ./config --prefix=/opt/tongsuo -Wl,-rpath,/opt/tongsuo/lib > > make && sudo make install > > > > https://www.tongsuo.net/docs/compilation/source-compilation > > > > (2) Compile and update kernel > > > > Apply this series based on 6.15-rc4, then use the loongson3_defconfig, > > CONFIG_UPROBE_EVENTS is already set. > > > > (3) Probe "openssl speed sm2" > > > > cd tools/perf && make > > sudo ./perf probe -x /usr/lib64/libcrypto.so BN_mod_mul_montgomery > > sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery /opt/tongsuo/bin/openssl speed sm2 > > > > 2. My test results > > > > fedora@linux:~/uprobe.git/tools/perf$ sudo ./perf probe -x /usr/lib64/libcrypto.so BN_mod_mul_montgomery > > Added new event: > > probe_libcrypto:BN_mod_mul_montgomery (on BN_mod_mul_montgomery in /usr/lib64/libcrypto.so.3.2.2) > > > > You can now use it in all perf tools, such as: > > > > perf record -e probe_libcrypto:BN_mod_mul_montgomery -aR sleep 1 > > > > fedora@linux:~/uprobe.git/tools/perf$ sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery /opt/tongsuo/bin/openssl speed sm2 > > Doing 256 bits sign CurveSM2's for 10s: 7463 256 bits CurveSM2 signs in 10.00s > > Doing 256 bits verify CurveSM2's for 10s: 9681 256 bits CurveSM2 verify in 9.98s > > ... > > sign verify sign/s verify/s > > 256 bits SM2 (CurveSM2) 0.0013s 0.0010s 746.3 970.0 > > > > Performance counter stats for '/opt/tongsuo/bin/openssl speed sm2': > > > > 0 probe_libcrypto:BN_mod_mul_montgomery > > > > 20.007539877 seconds time elapsed > > > > 19.990010000 seconds user > > 0.000000000 seconds sys > > > > Thanks, > > Tiezhu > > > > Tiezhu Yang (5): > > LoongArch: Clean up loongson3_defconfig > > LoongArch: Enable tracing infrastructure in defconfig > > LoongArch: Enable tracing syscalls in defconfig > > LoongArch: Enable debug information in defconfig > > LoongArch: Enable kprobe and ftrace in defconfig > > > > arch/loongarch/configs/loongson3_defconfig | 74 +++++----------------- > > 1 file changed, 16 insertions(+), 58 deletions(-) > > > > -- > > 2.42.0 > >
On 5/7/25 12:24, Huacai Chen wrote: ... > Have you tried (both OpenSSL) > > sudo ./perf probe -x /usr/lib64/libcrypto.so BN_mod_mul_montgomery > sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery openssl speed sm2 > > or (both Tongsuo) > > sudo ./perf probe -x /opt/tongsuo/lib/libcrypto.so BN_mod_mul_montgomery > sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery > /opt/tongsuo/bin/openssl speed sm2 > > and still success? > > I tried, and both got a SIGTRAP or system hang. I can reproduce it now and have a draft patch to fix it. I am busy with some emergency stuff recently and will send the formal patch as soon as I have some free time to make a proper commit message. Thanks, Tiezhu
Hi Tiezhu, On Wed, Apr 30, 2025 at 6:41 AM Huacai Chen <chenhuacai@kernel.org> wrote: > > Hi, Tiezhu, > > When I enable these options: > CONFIG_FTRACE=y > CONFIG_FUNCTION_TRACER=y > CONFIG_FUNCTION_GRAPH_TRACER=y > CONFIG_DYNAMIC_FTRACE=y > CONFIG_DYNAMIC_FTRACE_WITH_REGS=y > CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=y > CONFIG_DYNAMIC_FTRACE_WITH_ARGS=y > CONFIG_KPROBES=y > CONFIG_UPROBES=y > CONFIG_KPROBE_EVENTS=y > CONFIG_UPROBE_EVENTS=y > > Then your above commands will hang (or get a SIGTRAP), which options I > am missing? > > I haven't tried your patches, maybe it works, but I want to know the > exactly needed options. > > Huacai > > > On Wed, Apr 30, 2025 at 9:15 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote: > > > > This is a small patchset based on 6.15-rc4, each patch is a > > single logical change to better describe the problem and make > > it easier to review. > > > > If the changes make sense, all of them can be squashed into one > > single patch, I think that would be fine as well, let us see if > > other people have concern about it. > > > > By the way, I received many compile-time error reports about tools, > > most are related with configs, this is the motivation of this series. > > > > Additionally, I also received one run-time bug report about uprobe, > > but it works fine on my test environment. If somebody can reproduce > > it, please let me know, maybe I am missing something. > > > > 1. How to reproduce > > > > (1) Compile and install Tongsuo > > > > git clone https://github.com/Tongsuo-Project/Tongsuo.git > > cd Tongsuo && ./config --prefix=/opt/tongsuo -Wl,-rpath,/opt/tongsuo/lib > > make && sudo make install > > > > https://www.tongsuo.net/docs/compilation/source-compilation > > > > (2) Compile and update kernel > > > > Apply this series based on 6.15-rc4, then use the loongson3_defconfig, > > CONFIG_UPROBE_EVENTS is already set. > > > > (3) Probe "openssl speed sm2" > > > > cd tools/perf && make > > sudo ./perf probe -x /usr/lib64/libcrypto.so BN_mod_mul_montgomery > > sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery /opt/tongsuo/bin/openssl speed sm2 > > > > 2. My test results > > > > fedora@linux:~/uprobe.git/tools/perf$ sudo ./perf probe -x /usr/lib64/libcrypto.so BN_mod_mul_montgomery > > Added new event: > > probe_libcrypto:BN_mod_mul_montgomery (on BN_mod_mul_montgomery in /usr/lib64/libcrypto.so.3.2.2) > > > > You can now use it in all perf tools, such as: > > > > perf record -e probe_libcrypto:BN_mod_mul_montgomery -aR sleep 1 > > > > fedora@linux:~/uprobe.git/tools/perf$ sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery /opt/tongsuo/bin/openssl speed sm2 > > Doing 256 bits sign CurveSM2's for 10s: 7463 256 bits CurveSM2 signs in 10.00s > > Doing 256 bits verify CurveSM2's for 10s: 9681 256 bits CurveSM2 verify in 9.98s > > ... > > sign verify sign/s verify/s > > 256 bits SM2 (CurveSM2) 0.0013s 0.0010s 746.3 970.0 > > > > Performance counter stats for '/opt/tongsuo/bin/openssl speed sm2': > > > > 0 probe_libcrypto:BN_mod_mul_montgomery > > > > 20.007539877 seconds time elapsed > > > > 19.990010000 seconds user > > 0.000000000 seconds sys > > > > Thanks, > > Tiezhu > > > > Tiezhu Yang (5): > > LoongArch: Clean up loongson3_defconfig > > LoongArch: Enable tracing infrastructure in defconfig > > LoongArch: Enable tracing syscalls in defconfig > > LoongArch: Enable debug information in defconfig > > LoongArch: Enable kprobe and ftrace in defconfig > > > > arch/loongarch/configs/loongson3_defconfig | 74 +++++----------------- > > 1 file changed, 16 insertions(+), 58 deletions(-) I recommend putting all the config changes in one patch so it is easier to review change and test, I have to look through each patch to see what config changed. > > > > -- > > 2.42.0 > > >
Hi, Vincent, On Thu, May 1, 2025 at 9:38 AM Vincent Li <vincent.mc.li@gmail.com> wrote: > > Hi Tiezhu, > > On Wed, Apr 30, 2025 at 6:41 AM Huacai Chen <chenhuacai@kernel.org> wrote: > > > > Hi, Tiezhu, > > > > When I enable these options: > > CONFIG_FTRACE=y > > CONFIG_FUNCTION_TRACER=y > > CONFIG_FUNCTION_GRAPH_TRACER=y > > CONFIG_DYNAMIC_FTRACE=y > > CONFIG_DYNAMIC_FTRACE_WITH_REGS=y > > CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=y > > CONFIG_DYNAMIC_FTRACE_WITH_ARGS=y > > CONFIG_KPROBES=y > > CONFIG_UPROBES=y > > CONFIG_KPROBE_EVENTS=y > > CONFIG_UPROBE_EVENTS=y > > > > Then your above commands will hang (or get a SIGTRAP), which options I > > am missing? > > > > I haven't tried your patches, maybe it works, but I want to know the > > exactly needed options. > > > > Huacai > > > > > > On Wed, Apr 30, 2025 at 9:15 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote: > > > > > > This is a small patchset based on 6.15-rc4, each patch is a > > > single logical change to better describe the problem and make > > > it easier to review. > > > > > > If the changes make sense, all of them can be squashed into one > > > single patch, I think that would be fine as well, let us see if > > > other people have concern about it. > > > > > > By the way, I received many compile-time error reports about tools, > > > most are related with configs, this is the motivation of this series. > > > > > > Additionally, I also received one run-time bug report about uprobe, > > > but it works fine on my test environment. If somebody can reproduce > > > it, please let me know, maybe I am missing something. > > > > > > 1. How to reproduce > > > > > > (1) Compile and install Tongsuo > > > > > > git clone https://github.com/Tongsuo-Project/Tongsuo.git > > > cd Tongsuo && ./config --prefix=/opt/tongsuo -Wl,-rpath,/opt/tongsuo/lib > > > make && sudo make install > > > > > > https://www.tongsuo.net/docs/compilation/source-compilation > > > > > > (2) Compile and update kernel > > > > > > Apply this series based on 6.15-rc4, then use the loongson3_defconfig, > > > CONFIG_UPROBE_EVENTS is already set. > > > > > > (3) Probe "openssl speed sm2" > > > > > > cd tools/perf && make > > > sudo ./perf probe -x /usr/lib64/libcrypto.so BN_mod_mul_montgomery > > > sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery /opt/tongsuo/bin/openssl speed sm2 > > > > > > 2. My test results > > > > > > fedora@linux:~/uprobe.git/tools/perf$ sudo ./perf probe -x /usr/lib64/libcrypto.so BN_mod_mul_montgomery > > > Added new event: > > > probe_libcrypto:BN_mod_mul_montgomery (on BN_mod_mul_montgomery in /usr/lib64/libcrypto.so.3.2.2) > > > > > > You can now use it in all perf tools, such as: > > > > > > perf record -e probe_libcrypto:BN_mod_mul_montgomery -aR sleep 1 > > > > > > fedora@linux:~/uprobe.git/tools/perf$ sudo ./perf stat -e probe_libcrypto:BN_mod_mul_montgomery /opt/tongsuo/bin/openssl speed sm2 > > > Doing 256 bits sign CurveSM2's for 10s: 7463 256 bits CurveSM2 signs in 10.00s > > > Doing 256 bits verify CurveSM2's for 10s: 9681 256 bits CurveSM2 verify in 9.98s > > > ... > > > sign verify sign/s verify/s > > > 256 bits SM2 (CurveSM2) 0.0013s 0.0010s 746.3 970.0 > > > > > > Performance counter stats for '/opt/tongsuo/bin/openssl speed sm2': > > > > > > 0 probe_libcrypto:BN_mod_mul_montgomery > > > > > > 20.007539877 seconds time elapsed > > > > > > 19.990010000 seconds user > > > 0.000000000 seconds sys > > > > > > Thanks, > > > Tiezhu > > > > > > Tiezhu Yang (5): > > > LoongArch: Clean up loongson3_defconfig > > > LoongArch: Enable tracing infrastructure in defconfig > > > LoongArch: Enable tracing syscalls in defconfig > > > LoongArch: Enable debug information in defconfig > > > LoongArch: Enable kprobe and ftrace in defconfig > > > > > > arch/loongarch/configs/loongson3_defconfig | 74 +++++----------------- > > > 1 file changed, 16 insertions(+), 58 deletions(-) > > I recommend putting all the config changes in one patch so it is > easier to review change and test, I have to look through each patch to > see what config changed. This series is probably a RFC and I will not apply. 1) The motivation of this series is to solve an uprobes hang issue, but as I mentioned above I still don't know why it hangs. Maybe due to config options but I'm not sure. 2) Don't mix the kernel defconfig and distribution config. A distribution config tries to enable as many features as possible, and different distributions have different preferences. The kernel defconfig is probably a bootable config, plus some widely used features. Take x86 as an example, it doesn't even enable NUMA Balancing, THP and BPF which are already widely used in morden systems, let alone a large set of tracers. 3) About the cleanup, as I explained before (but not in this thread), though CONFIG_LOONGARCH, CONFIG_64BIT, CONFIG_MACH_LOONGSON64, CONFIG_PAGE_SIZE_16KB=y, CONFIG_HZ_250=y, CONFIG_DMI=y, CONFIG_EFI=y, CONFIG_SMP=y, CONFIG_ACPI=y and some other similar options are implicitly selected so they will disappear during "make savedefconfig". I still want to keep them in the defconfig, just because I hope we can easily know what is fundamentally needed by LoongArch via reading the defconfig file. Huacai > > > > > > > -- > > > 2.42.0 > > > > >
© 2016 - 2026 Red Hat, Inc.