Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernel update 3.10.9 --> 3.11.0: 1wire bus problem with DS18B20 thermo sensor #374

Closed
crashmaster1 opened this issue Sep 10, 2013 · 10 comments

Comments

@crashmaster1
Copy link

I use Archlinux and some of my RPi's have a 1w sensor DS18B20 to measure temperature.
After upgrading to 3.11.0 the 1w bus doesn't show this sensor anymore. One RPi loads w1-gpio and w1-therm automatically, another RPi hangs during bootup, the "systemd-load-modules.service" never returns. I masked it, then it boots and i loaded w1_therm and w1_gpio manually, but no device was found (they are connected at gpio4).
Switching back to 3.10.9 all works fine again.

greets, CM1

@trilader
Copy link

Here is the relevant part of the logfile on my Pi, it happens after modprobe w1_therm, wire and w1_gpio work ok.

Sep 29 11:25:24 redpi kernel: INFO: task modprobe:610 blocked for more than 120 seconds.
Sep 29 11:25:24 redpi kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
Sep 29 11:25:24 redpi kernel: modprobe        D c068f5fc     0   610    609 0x00000000
Sep 29 11:25:24 redpi kernel: [<c068f5fc>] (__schedule+0x284/0x5c0) from [<c0690028>] (schedule_preempt_disabled+0x14/0x20)
Sep 29 11:25:24 redpi kernel: [<c0690028>] (schedule_preempt_disabled+0x14/0x20) from [<c068ec18>] (__mutex_lock_slowpath+0x9c/0x12c)
Sep 29 11:25:24 redpi kernel: [<c068ec18>] (__mutex_lock_slowpath+0x9c/0x12c) from [<bf0e2008>] (w1_reconnect_slaves+0x3c/0xf8 [wire])
Sep 29 11:25:24 redpi kernel: [<bf0e2008>] (w1_reconnect_slaves+0x3c/0xf8 [wire]) from [<bf0e2ac0>] (w1_register_family+0x9c/0xb8 [wire])
Sep 29 11:25:24 redpi kernel: [<bf0e2ac0>] (w1_register_family+0x9c/0xb8 [wire]) from [<bf0f401c>] (w1_therm_init+0x1c/0x3c [w1_therm])
Sep 29 11:25:24 redpi kernel: [<bf0f401c>] (w1_therm_init+0x1c/0x3c [w1_therm]) from [<c00085d4>] (do_one_initcall+0x108/0x170)
Sep 29 11:25:24 redpi kernel: [<c00085d4>] (do_one_initcall+0x108/0x170) from [<c006de78>] (load_module+0x16e0/0x1e8c)
Sep 29 11:25:24 redpi kernel: [<c006de78>] (load_module+0x16e0/0x1e8c) from [<c006e6cc>] (SyS_init_module+0xa8/0xec)
Sep 29 11:25:24 redpi kernel: [<c006e6cc>] (SyS_init_module+0xa8/0xec) from [<c000e1a0>] (ret_fast_syscall+0x0/0x30)

@popcornmix
Copy link
Collaborator

@FrankBuss
any thoughts?

@FrankBuss
Copy link

Looks interesting. I didn't write the w1 code, but from the provided callstack it looks like a deadlock.
Is this from the rpi-3.11.y branch? I could try to compile this branch and to reproduce it tomorrow. A websearch shows some bad history for "w1 linux deadlock".

@popcornmix
Copy link
Collaborator

Yes, I believe this is on rpi-3.11.y branch.

@FrankBuss
Copy link

I tested it and I can't reproduce the problem. What I've done: I compiled a new toolchain as described at http://elinux.org/RPi_Linaro_GCC_Compilation , because the pre-compiled gcc from the tools repository didn't work on my new 64 bit Debian installation, then I compiled a new kernel as described at http://elinux.org/RPi_Kernel_Compilation . "cat /proc/version" says "Linux version 3.11.2+ (fb@debian7) (gcc version 4.7.3 20130102 (prerelease) (crosstool-NG 1.18.0) ) #1 Tue Oct 1 17:11:11 CEST 2013". I used "arch/arm/configs/bcmrpi_defconfig" as a base, but the w1 module was disabled in this config. This is the config after enabling it (and all other one-wire modules, because I know that at least the I2C/1-wire bridge is popular): http://www.frank-buss.de/tmp/config-rpi-3.11.txt

I checked it with a DS1822Z+ and after manual loading the modules, the device was detected and I could read the temperature. But I've ordered a DS18B20 from eBay, just in case if it behaves differently, should arrive the next days.

The only other problem could be the Linux distribution or maybe some hardware edge problem, if it is not a driver problem. My base system was 2013-09-25-wheezy-raspbian and I installed the new kernel in it. I could try Archlinux. @crashmaster1 did you use archlinux-hf-2013-07-22.img? Could you send me your /proc/config.gz file from the running Raspberry Pi? How did you load the module on startup (I know nothing about Archlinux) ? How did you attach the DS18B20 (cable length, what pullup resistor, how many sensors)? Is there other attached hardware, USB keyboard (sometimes I had problems with my keyboard, I guess because of the massive amount of interrupts from the Broadcom chip), network?

@crashmaster1
Copy link
Author

Thanks Frank, the standard kernel of Archlinux is like in Raspbian the 3.6 branch (where all works fine).
The 3.11 (or let's say always the latest) kernels are provided inofficial without an appreciable difference in configuration from the 3.11 branch.

In the meanwhile i found the problem:
You have to load w1-therm first and afterwards w1-gpio. If w1-gpio is loaded before w1-therm it crashes, hangs or whatever (like written above). It doesn't matter to load these modules manually or in /etc/modules... during startup.

You should have the same experience ??

@FrankBuss
Copy link

Ok, got my DS18B20 and I can reproduce the problem. I don't know why it worked before, maybe I loaded the w1-therm module first.

The documentation of the w1-driver in Documentation/w1 says, that the driver loads the required slave driver automatically, if it detects a new device with a known family id. So it should be sufficient to use "modprobe w1". And in fact the w1-driver tries to load the w1-therm module. But then the deadlock happens. Fortunately deadlocks in the kernel can be dumped with callstack with the "w" sysrq. Following is a full kernel bug report, I'll contact the maintainer Evgeniy Polyakov of the w1 module by eMail and send the link to this report, because I assume he is faster than me to correct this bug, or maybe it is already corrected in a later kernel version.

[1.] One line summary of the problem:
w1 driver deadlock

[2.] Full description of the problem/report:
I attached a DS18B20 to a Raspberry Pi on GPIO4 and with a 4k7 resistor from Vdd to DQ, and tried to load the w1 module. This results in a deadlock.

[3.] Keywords (i.e., modules, networking, kernel):
modules, w1

[4.] Kernel version (from /proc/version):
Linux version 3.11.2+ (fb@debian7) (gcc version 4.7.3 20130102 (prerelease) (crosstool-NG 1.18.0) ) #1 Tue Oct 1 17:11:11 CEST 2013

[5.] Output of Oops.. message (if applicable) with symbolic information 
     resolved (see Documentation/oops-tracing.txt)
echo w > /proc/sysrq-trigger output:
Oct  5 22:18:07 raspberrypi kernel: [14824.584458] SysRq : Show Blocked State
Oct  5 22:18:07 raspberrypi kernel: [14824.590089]   task                PC stack   pid father
Oct  5 22:18:07 raspberrypi kernel: [14824.590171] w1_bus_master1  D c044afdc  6180  2669      2 0x00000000
Oct  5 22:18:07 raspberrypi kernel: [14824.590293] [<c044afdc>] (__schedule+0x284/0x53c) from [<c044b388>] (schedule+0x40/0x80)
Oct  5 22:18:07 raspberrypi kernel: [14824.590328] [<c044b388>] (schedule+0x40/0x80) from [<c044952c>] (schedule_timeout+0x17c/0x1f8)
Oct  5 22:18:07 raspberrypi kernel: [14824.590360] [<c044952c>] (schedule_timeout+0x17c/0x1f8) from [<c044aa84>] (wait_for_common+0xc0/0x154)
Oct  5 22:18:07 raspberrypi kernel: [14824.590393] [<c044aa84>] (wait_for_common+0xc0/0x154) from [<c044abc8>] (wait_for_completion_killable+0x20/0x2c)
Oct  5 22:18:07 raspberrypi kernel: [14824.590433] [<c044abc8>] (wait_for_completion_killable+0x20/0x2c) from [<c0035430>] (call_usermodehelper_exec+0xfc/0x158)
Oct  5 22:18:07 raspberrypi kernel: [14824.590465] [<c0035430>] (call_usermodehelper_exec+0xfc/0x158) from [<c0035be8>] (__request_module+0x15c/0x284)
Oct  5 22:18:07 raspberrypi kernel: [14824.590541] [<c0035be8>] (__request_module+0x15c/0x284) from [<bf0793a8>] (w1_attach_slave_device+0xb4/0x3ac [wire])
Oct  5 22:18:07 raspberrypi kernel: [14824.590599] [<bf0793a8>] (w1_attach_slave_device+0xb4/0x3ac [wire]) from [<bf079754>] (w1_slave_found+0xb4/0xb8 [wire])
Oct  5 22:18:07 raspberrypi kernel: [14824.590662] [<bf079754>] (w1_slave_found+0xb4/0xb8 [wire]) from [<bf07a4b0>] (w1_search+0x1a4/0x200 [wire])
Oct  5 22:18:07 raspberrypi kernel: [14824.590727] [<bf07a4b0>] (w1_search+0x1a4/0x200 [wire]) from [<bf07b804>] (w1_search_devices+0x54/0x58 [wire])
Oct  5 22:18:07 raspberrypi kernel: [14824.590791] [<bf07b804>] (w1_search_devices+0x54/0x58 [wire]) from [<bf07a568>] (w1_search_process_cb+0x5c/0xdc [wire])
Oct  5 22:18:07 raspberrypi kernel: [14824.590852] [<bf07a568>] (w1_search_process_cb+0x5c/0xdc [wire]) from [<bf07a6cc>] (w1_process+0xe4/0x114 [wire])
Oct  5 22:18:07 raspberrypi kernel: [14824.590906] [<bf07a6cc>] (w1_process+0xe4/0x114 [wire]) from [<c003f364>] (kthread+0xb4/0xc0)
Oct  5 22:18:07 raspberrypi kernel: [14824.590948] [<c003f364>] (kthread+0xb4/0xc0) from [<c000e768>] (ret_from_fork+0x14/0x20)
Oct  5 22:18:07 raspberrypi kernel: [14824.590965] modprobe        D c044afdc  5740  2671   2670 0x00000000
Oct  5 22:18:07 raspberrypi kernel: [14824.591055] [<c044afdc>] (__schedule+0x284/0x53c) from [<c044b388>] (schedule+0x40/0x80)
Oct  5 22:18:07 raspberrypi kernel: [14824.591087] [<c044b388>] (schedule+0x40/0x80) from [<c044b5d0>] (schedule_preempt_disabled+0x18/0x1c)
Oct  5 22:18:07 raspberrypi kernel: [14824.591118] [<c044b5d0>] (schedule_preempt_disabled+0x18/0x1c) from [<c044a1e4>] (__mutex_lock_slowpath+0x88/0xd4)
Oct  5 22:18:07 raspberrypi kernel: [14824.591150] [<c044a1e4>] (__mutex_lock_slowpath+0x88/0xd4) from [<c044a264>] (mutex_lock+0x34/0x38)
Oct  5 22:18:07 raspberrypi kernel: [14824.591205] [<c044a264>] (mutex_lock+0x34/0x38) from [<bf07a250>] (w1_reconnect_slaves+0x4c/0x108 [wire])
Oct  5 22:18:07 raspberrypi kernel: [14824.591271] [<bf07a250>] (w1_reconnect_slaves+0x4c/0x108 [wire]) from [<bf07ad64>] (w1_register_family+0x7c/0x90 [wire])
Oct  5 22:18:07 raspberrypi kernel: [14824.591335] [<bf07ad64>] (w1_register_family+0x7c/0x90 [wire]) from [<bf08c024>] (w1_therm_init+0x24/0x44 [w1_therm])
Oct  5 22:18:07 raspberrypi kernel: [14824.591374] [<bf08c024>] (w1_therm_init+0x24/0x44 [w1_therm]) from [<c000864c>] (do_one_initcall+0x130/0x1b0)
Oct  5 22:18:07 raspberrypi kernel: [14824.591417] [<c000864c>] (do_one_initcall+0x130/0x1b0) from [<c006d264>] (load_module+0x1758/0x1ea4)
Oct  5 22:18:07 raspberrypi kernel: [14824.591450] [<c006d264>] (load_module+0x1758/0x1ea4) from [<c006da98>] (SyS_init_module+0xe8/0xfc)
Oct  5 22:18:07 raspberrypi kernel: [14824.591482] [<c006da98>] (SyS_init_module+0xe8/0xfc) from [<c000e6a0>] (ret_fast_syscall+0x0/0x48)

[6.] A small shell script or example program which triggers the
     problem (if possible)
modprobe w1-gpio

[7.] Environment

[7.1.] Software (add the output of the ver_linux script here)
Linux raspberrypi 3.11.2+ #1 Tue Oct 1 17:11:11 CEST 2013 armv6l GNU/Linux
Gnu C                  4.6
Gnu make               3.81
binutils               2.22
util-linux             2.20.1
mount                  support
module-init-tools      9
e2fsprogs              1.42.5
Linux C Library        2.13
Dynamic linker (ldd)   2.13
Procps                 3.3.3
Net-tools              1.60
Kbd                    1.15.3
Sh-utils               8.13
wireless-tools         30
Modules Loaded         fuse w1_therm w1_gpio wire snd_bcm2835 snd_pcm snd_page_alloc snd_seq snd_seq_device snd_timer snd leds_gpio led_class

[7.2.] Processor information (from /proc/cpuinfo):
processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 2.00
Features        : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7
Hardware        : BCM2708
Revision        : 0002
Serial          : 000000006376cdae

[7.3.] Module information (from /proc/modules):
fuse 79904 3 - Live 0xbf08e000
w1_therm 6219 1 - Loading 0xbf08a000
w1_gpio 2748 0 - Live 0xbf086000
wire 24599 2 w1_therm,w1_gpio, Live 0xbf079000
snd_bcm2835 17659 0 - Live 0xbf070000
snd_pcm 85339 1 snd_bcm2835, Live 0xbf051000
snd_page_alloc 5580 1 snd_pcm, Live 0xbf04b000
snd_seq 57859 0 - Live 0xbf034000
snd_seq_device 7114 1 snd_seq, Live 0xbf02e000
snd_timer 20602 2 snd_pcm,snd_seq, Live 0xbf023000
snd 63449 5 snd_bcm2835,snd_pcm,snd_seq,snd_seq_device,snd_timer, Live 0xbf009000
leds_gpio 2328 0 - Live 0xbf005000
led_class 4294 1 leds_gpio, Live 0xbf000000

[7.4.] Loaded driver and hardware information (/proc/ioports, /proc/iomem)
root@raspberrypi:/mnt/linux# cat /proc/iomem
00000000-0bffffff : System RAM
  00008000-0062e3e7 : Kernel code
  00674000-0078afa7 : Kernel data
20000000-20000fff : bcm2708_vcio
20003000-20003fff : bcm2708_systemtimer
20006000-20006fff : bcm2708_usb
  20006000-20006fff : dwc_otg
20007000-20007fff : bcm2708_dma.0
  20007000-20007fff : bcm2708_dma
20100000-201000ff : bcm2708_powerman.0
20200000-20200fff : bcm2708_gpio
20201000-20201fff : dev:f1
  20201000-20201fff : uart-pl011
20204000-202040ff : bcm2708_spi.0
20205000-202050ff : bcm2708_i2c.0
20300000-203000ff : bcm2708_sdhci.0
  20300000-203000ff : mmc0
20804000-208040ff : bcm2708_i2c.1
20980000-2099ffff : bcm2708_usb
  20980000-2099ffff : dwc_otg
root@raspberrypi:/mnt/linux# cat /proc/iomem
[empty]

@bioothod
Copy link
Contributor

bioothod commented Oct 6, 2013

Hi

It looks like bug was introduced in 11-rc1 with automatic module loading, patches are pending

@FrankBuss
Copy link

Thanks @bioothod. When will the patches be applied? If it helps, you can send me the patches and I can test it on my Raspberry Pi, too.

@bioothod
Copy link
Contributor

bioothod commented Oct 7, 2013

Its there, I acked them yesterday, so exepct it in the next stable release

popcornmix pushed a commit that referenced this issue Oct 8, 2014
Corrects the following checkpatch gripes:

    WARNING: quoted string split across lines
    #95: FILE: drivers/mfd/ab3100-core.c:95:
    +			"write error (write register) "
    +			"%d bytes transferred (expected 2)\n",

    WARNING: quoted string split across lines
    #139: FILE: drivers/mfd/ab3100-core.c:139:
    +			"write error (write test register) "
    +			"%d bytes transferred (expected 2)\n",

    WARNING: quoted string split across lines
    #175: FILE: drivers/mfd/ab3100-core.c:175:
    +			"write error (send register address) "
    +			"%d bytes transferred (expected 1)\n",

    WARNING: quoted string split across lines
    #193: FILE: drivers/mfd/ab3100-core.c:193:
    +			"write error (read register) "
    +			"%d bytes transferred (expected 1)\n",

    WARNING: quoted string split across lines
    #241: FILE: drivers/mfd/ab3100-core.c:241:
    +			"write error (send first register address) "
    +			"%d bytes transferred (expected 1)\n",

    WARNING: quoted string split across lines
    #256: FILE: drivers/mfd/ab3100-core.c:256:
    +			"write error (read register page) "
    +			"%d bytes transferred (expected %d)\n",

    WARNING: quoted string split across lines
    #299: FILE: drivers/mfd/ab3100-core.c:299:
    +			"write error (maskset send address) "
    +			"%d bytes transferred (expected 1)\n",

    WARNING: quoted string split across lines
    #314: FILE: drivers/mfd/ab3100-core.c:314:
    +			"write error (maskset read register) "
    +			"%d bytes transferred (expected 1)\n",

    WARNING: quoted string split across lines
    #334: FILE: drivers/mfd/ab3100-core.c:334:
    +			"write error (write register) "
    +			"%d bytes transferred (expected 2)\n",

    WARNING: please, no spaces at the start of a line
    #374: FILE: drivers/mfd/ab3100-core.c:374:
    +  return blocking_notifier_chain_unregister(&ab3100->event_subscribers,$

    WARNING: Prefer seq_puts to seq_printf
    #458: FILE: drivers/mfd/ab3100-core.c:458:
    +	seq_printf(s, "AB3100 registers:\n");

    WARNING: quoted string split across lines
    #564: FILE: drivers/mfd/ab3100-core.c:564:
    +			 "debug write reg[0x%02x] with 0x%02x, "
    +			 "after readback: 0x%02x\n",

    WARNING: quoted string split across lines
    #723: FILE: drivers/mfd/ab3100-core.c:723:
    +			 "AB3100 P1E variant detected, "
    +			 "forcing chip to 32KHz\n");

    WARNING: quoted string split across lines
    #882: FILE: drivers/mfd/ab3100-core.c:882:
    +			"could not communicate with the AB3100 analog "
    +			"baseband chip\n");

    WARNING: quoted string split across lines
    #906: FILE: drivers/mfd/ab3100-core.c:906:
    +		dev_err(&client->dev, "accepting it anyway. Please update "
    +			"the driver.\n");

    total: 0 errors, 15 warnings, 999 lines checked

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
popcornmix pushed a commit that referenced this issue Dec 24, 2018
Reported by syzkaller:

    CPU: 1 PID: 5962 Comm: syz-executor118 Not tainted 4.20.0-rc6+ #374
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    RIP: 0010:kvm_apic_hw_enabled arch/x86/kvm/lapic.h:169 [inline]
    RIP: 0010:vcpu_scan_ioapic arch/x86/kvm/x86.c:7449 [inline]
    RIP: 0010:vcpu_enter_guest arch/x86/kvm/x86.c:7602 [inline]
    RIP: 0010:vcpu_run arch/x86/kvm/x86.c:7874 [inline]
    RIP: 0010:kvm_arch_vcpu_ioctl_run+0x5296/0x7320 arch/x86/kvm/x86.c:8074
    Call Trace:
	 kvm_vcpu_ioctl+0x5c8/0x1150 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2596
	 vfs_ioctl fs/ioctl.c:46 [inline]
	 file_ioctl fs/ioctl.c:509 [inline]
	 do_vfs_ioctl+0x1de/0x1790 fs/ioctl.c:696
	 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:713
	 __do_sys_ioctl fs/ioctl.c:720 [inline]
	 __se_sys_ioctl fs/ioctl.c:718 [inline]
	 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
	 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
	 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The reason is that the testcase writes hyperv synic HV_X64_MSR_SINT14 msr
and triggers scan ioapic logic to load synic vectors into EOI exit bitmap.
However, irqchip is not initialized by this simple testcase, ioapic/apic
objects should not be accessed.

This patch fixes it by also considering whether or not apic is present.

Reported-by: syzbot+39810e6c400efadfef71@syzkaller.appspotmail.com
Cc: stable@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
popcornmix pushed a commit that referenced this issue Jan 1, 2019
commit dcbd3e4 upstream.

Reported by syzkaller:

    CPU: 1 PID: 5962 Comm: syz-executor118 Not tainted 4.20.0-rc6+ #374
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    RIP: 0010:kvm_apic_hw_enabled arch/x86/kvm/lapic.h:169 [inline]
    RIP: 0010:vcpu_scan_ioapic arch/x86/kvm/x86.c:7449 [inline]
    RIP: 0010:vcpu_enter_guest arch/x86/kvm/x86.c:7602 [inline]
    RIP: 0010:vcpu_run arch/x86/kvm/x86.c:7874 [inline]
    RIP: 0010:kvm_arch_vcpu_ioctl_run+0x5296/0x7320 arch/x86/kvm/x86.c:8074
    Call Trace:
	 kvm_vcpu_ioctl+0x5c8/0x1150 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2596
	 vfs_ioctl fs/ioctl.c:46 [inline]
	 file_ioctl fs/ioctl.c:509 [inline]
	 do_vfs_ioctl+0x1de/0x1790 fs/ioctl.c:696
	 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:713
	 __do_sys_ioctl fs/ioctl.c:720 [inline]
	 __se_sys_ioctl fs/ioctl.c:718 [inline]
	 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
	 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
	 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The reason is that the testcase writes hyperv synic HV_X64_MSR_SINT14 msr
and triggers scan ioapic logic to load synic vectors into EOI exit bitmap.
However, irqchip is not initialized by this simple testcase, ioapic/apic
objects should not be accessed.

This patch fixes it by also considering whether or not apic is present.

Reported-by: syzbot+39810e6c400efadfef71@syzkaller.appspotmail.com
Cc: stable@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
popcornmix pushed a commit that referenced this issue Jul 24, 2023
To pick the changes in:

  1fd96a3 ("riscv: Add prctl controls for userspace vector management")

That adds some RISC-V specific prctl options:

  $ tools/perf/trace/beauty/prctl_option.sh > before
  $ cp include/uapi/linux/prctl.h tools/include/uapi/linux/prctl.h
  $ tools/perf/trace/beauty/prctl_option.sh > after
  $ diff -u before after
  --- before	2023-07-11 13:22:01.928705942 -0300
  +++ after	2023-07-11 13:22:36.342645970 -0300
  @@ -63,6 +63,8 @@
   	[66] = "GET_MDWE",
   	[67] = "SET_MEMORY_MERGE",
   	[68] = "GET_MEMORY_MERGE",
  +	[69] = "RISCV_V_SET_CONTROL",
  +	[70] = "RISCV_V_GET_CONTROL",
   };
   static const char *prctl_set_mm_options[] = {
   	[1] = "START_CODE",
  $

That now will be used to decode the syscall option and also to compose
filters, for instance:

  [root@five ~]# perf trace -e syscalls:sys_enter_prctl --filter option==SET_NAME
       0.000 Isolated Servi/3474327 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23f13b7aee)
       0.032 DOM Worker/3474327 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23deb25670)
       7.920 :3474328/3474328 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24fbb10)
       7.935 StreamT~s #374/3474328 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24fb970)
       8.400 Isolated Servi/3474329 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24bab10)
       8.418 StreamT~s #374/3474329 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24ba970)
  ^C[root@five ~]#

This addresses this perf build warning:

  Warning: Kernel ABI header differences:
    diff -u tools/include/uapi/linux/prctl.h include/uapi/linux/prctl.h

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andy Chiu <andy.chiu@sifive.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Palmer Dabbelt <palmer@rivosinc.com>
Link: https://lore.kernel.org/lkml/ZK2DhOB6JJKu2A7M@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
popcornmix pushed a commit that referenced this issue Jun 10, 2024
To pick the changes in:

  628d701 ("powerpc/dexcr: Add DEXCR prctl interface")
  6b9391b ("riscv: Include riscv_set_icache_flush_ctx prctl")

That adds some PowerPC and a RISC-V specific prctl options:

  $ tools/perf/trace/beauty/prctl_option.sh > before
  $ cp include/uapi/linux/prctl.h tools/perf/trace/beauty/include/uapi/linux/prctl.h
  $ tools/perf/trace/beauty/prctl_option.sh > after
  $ diff -u before after
  --- before	2024-05-27 12:14:21.358032781 -0300
  +++ after	2024-05-27 12:14:32.364530185 -0300
  @@ -65,6 +65,9 @@
   	[68] = "GET_MEMORY_MERGE",
   	[69] = "RISCV_V_SET_CONTROL",
   	[70] = "RISCV_V_GET_CONTROL",
  +	[71] = "RISCV_SET_ICACHE_FLUSH_CTX",
  +	[72] = "PPC_GET_DEXCR",
  +	[73] = "PPC_SET_DEXCR",
   };
   static const char *prctl_set_mm_options[] = {
   	[1] = "START_CODE",
  $

That now will be used to decode the syscall option and also to compose
filters, for instance:

  [root@five ~]# perf trace -e syscalls:sys_enter_prctl --filter option==SET_NAME
       0.000 Isolated Servi/3474327 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23f13b7aee)
       0.032 DOM Worker/3474327 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23deb25670)
       7.920 :3474328/3474328 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24fbb10)
       7.935 StreamT~s #374/3474328 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24fb970)
       8.400 Isolated Servi/3474329 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24bab10)
       8.418 StreamT~s #374/3474329 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24ba970)
  ^C[root@five ~]#

This addresses this perf build warning:

  Warning: Kernel ABI header differences:
    diff -u tools/include/uapi/linux/prctl.h include/uapi/linux/prctl.h

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Benjamin Gray <bgray@linux.ibm.com>
Cc: Charlie Jenkins <charlie@rivosinc.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Palmer Dabbelt <palmer@rivosinc.com>
Link: https://lore.kernel.org/lkml/ZlSklGWp--v_Ije7@x1
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants