Bug 29824 - BUG: using smp_processor_id() in preemptible [00000000] code: stapio/58567
Summary: BUG: using smp_processor_id() in preemptible [00000000] code: stapio/58567
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: kprobes (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-23 19:45 UTC by Paulo Edgar Castro
Modified: 2023-03-14 16:12 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2022-11-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paulo Edgar Castro 2022-11-23 19:45:39 UTC
Hi folks.

Whilst running stap against https://sourceware.org/systemtap/examples/io/iotime.stp I kept seeing this message crop up in my messages.


```
Nov 22 21:21:31 localhost kernel: BUG: using smp_processor_id() in preemptible [00000000] code: staprun/11549
Nov 22 21:21:31 localhost kernel: caller is _stp_runtime_context_trylock+0x12/0x70 [stap_9a5b952d5e3e6fb7e5d57e067c529c6a_11549]
Nov 22 21:21:31 localhost kernel: CPU: 4 PID: 11549 Comm: staprun Tainted: P           OE      6.0.8-300.fc37.x86_64 #1
Nov 22 21:21:31 localhost kernel: Hardware name: Micro-Star International Co., Ltd. Stealth GS77 12UGS/MS-17P1, BIOS E17P1IMS.109 06/27/2022
Nov 22 21:21:31 localhost kernel: Call Trace:
Nov 22 21:21:31 localhost kernel:  <TASK>
Nov 22 21:21:31 localhost kernel:  dump_stack_lvl+0x44/0x5c
Nov 22 21:21:31 localhost kernel:  check_preemption_disabled+0xe1/0xf0
Nov 22 21:21:31 localhost kernel:  _stp_runtime_context_trylock+0x12/0x70 [stap_9a5b952d5e3e6fb7e5d57e067c529c6a_11549]
Nov 22 21:21:31 localhost kernel:  _stp_runtime_entryfn_get_context+0xb/0x70 [stap_9a5b952d5e3e6fb7e5d57e067c529c6a_11549]
Nov 22 21:21:31 localhost kernel:  _stp_ctl_send_notify.isra.0+0x71/0x200 [stap_9a5b952d5e3e6fb7e5d57e067c529c6a_11549]
Nov 22 21:21:31 localhost kernel:  _stp_transport_init+0x708/0x820 [stap_9a5b952d5e3e6fb7e5d57e067c529c6a_11549]
Nov 22 21:21:31 localhost kernel:  ? _stp_ctl_write_cmd+0xba0/0xba0 [stap_9a5b952d5e3e6fb7e5d57e067c529c6a_11549]
Nov 22 21:21:31 localhost kernel:  do_one_initcall+0x56/0x220
Nov 22 21:21:31 localhost kernel:  do_init_module+0x4a/0x200
Nov 22 21:21:31 localhost kernel:  __do_sys_init_module+0x157/0x180
Nov 22 21:21:31 localhost kernel:  do_syscall_64+0x58/0x80
Nov 22 21:21:31 localhost kernel:  ? exc_page_fault+0x70/0x170
Nov 22 21:21:31 localhost kernel:  entry_SYSCALL_64_after_hwframe+0x63/0xcd
Nov 22 21:21:31 localhost kernel: RIP: 0033:0x7fad91f30d9e
Nov 22 21:21:31 localhost kernel: Code: 48 8b 0d 95 50 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 af 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 62 50 0c 00 f7 d8 64 >
Nov 22 21:21:31 localhost kernel: RSP: 002b:00007fffb1302b08 EFLAGS: 00000246 ORIG_RAX: 00000000000000af
Nov 22 21:21:31 localhost kernel: RAX: ffffffffffffffda RBX: 0000561bdd343180 RCX: 00007fad91f30d9e
Nov 22 21:21:31 localhost kernel: RDX: 0000561bdd343180 RSI: 0000000000028fb0 RDI: 00007fad925c5010
Nov 22 21:21:31 localhost kernel: RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000001
Nov 22 21:21:31 localhost kernel: R10: 0000000000000053 R11: 0000000000000246 R12: 00007fffb1302c00
Nov 22 21:21:31 localhost kernel: R13: 00007fad925c5010 R14: 00007fffb1302b30 R15: 00007fad925d4ae8
Nov 22 21:21:31 localhost kernel:  </TASK>
```

I'm running

```
# stap -V
Systemtap translator/driver (version 4.8/0.187, rpm 4.8-1.fc37)
Copyright (C) 2005-2022 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
tested kernel versions: 2.6.32 ... 6.1.0-rc3
enabled features: AVAHI BOOST_STRING_REF DYNINST BPF JAVA PYTHON3 LIBRPM LIBSQLITE3 LIBVIRT LIBXML2 NLS NSS READLINE MONITOR_LIBS
```

After I ran:

```
export DEBUGINFOD_URLS=https://debuginfod.elfutils.org
export DEBUGINFOD_PROGRESS=1
```

The only other similar bug I found referring a similar occurrence this was https://sourceware.org/bugzilla/show_bug.cgi?id=13386 but it seems rather old but I thought I'd mention it since I'd seen it.
Comment 1 William Cohen 2022-11-23 20:08:21 UTC
That looks like an issue fixed by recent git commit (https://sourceware.org/git/?p=systemtap.git;a=commit;h=7eed8d1fef36997b9e4c1d9cdb67643483a51e56)  Could you check whether that patch addresses the problem?  The patch should be backported to various build to address this issue.
Comment 2 Paulo Edgar Castro 2022-11-23 20:41:01 UTC
It actually seems to work once you manage to build it. :p 

```
Nov 23 20:33:55 localhost kernel: stap_43aa084633286aa721632867a50e8a1_451099 (iotime.stp): systemtap: 4.9/0.187, base: ffffffffc1091000, memory: 88data/68text/183ctx/327782net/19888alloc kb, probes: 28
```

I had to amend the "recommended" configure incantation to: 

./configure python3='/usr/bin/python3' py3execdir='${exec_prefix}/lib64/python3.11/site-packages' --prefix=/home/pecastro/systemtap-4.9-428877 --without-python2-probes

the default recommended by ./configure in the first run kept on complaining about 

```
make[2]: Entering directory '/download/systemtap/python'
(cd .; CFLAGS="-I./../includes -I/download/systemtap/python/../includes/sys" /usr/bin/python2 setup.py build \
         --build-base /download/systemtap/python/py2build \
         --verbose)
Traceback (most recent call last):
  File "setup.py", line 9, in <module>
    from setuptools import setup, Extension
ImportError: No module named setuptools
make[2]: *** [Makefile:626: all-local] Error 1
make[2]: Leaving directory '/download/systemtap/python'
make[1]: *** [Makefile:2134: all-recursive] Error 1
make[1]: Leaving directory '/download/systemtap'
make: *** [Makefile:799: all] Error 2
```
Comment 3 William Cohen 2023-03-14 16:12:02 UTC
commit 7eed8d1fef36997b9e4c1d9cdb67643483a51e56 is upstream systemtap and has been backported to various releases of Fedora.