[BUG v6.3-rc4+] WARNING: CPU: 0 PID: 1 at drivers/thermal/thermal_sysfs.c:879 cooling_device_stats_setup+0xac/0xc0

From: Steven Rostedt
Date: Wed Mar 29 2023 - 16:58:30 EST


In preparation to adding my patch that checks for some kinds of bugs in
trace events, I decided to run it on the Linus's latest branch, to see if
there's any other trace events that may cause issues. But instead I hit
this unrelated bug. Looks to be triggering an added lockdep_assert() on
boot up.

static void cooling_device_stats_setup(struct thermal_cooling_device *cdev)
{
const struct attribute_group *stats_attr_group = NULL;
struct cooling_dev_stats *stats;
/* Total number of states is highest state + 1 */
unsigned long states = cdev->max_state + 1;
int var;

lockdep_assert_held(&cdev->lock); <<<---- line 879


[ 12.379345] ------------[ cut here ]------------
[ 12.380501] WARNING: CPU: 0 PID: 1 at drivers/thermal/thermal_sysfs.c:879 cooling_device_stats_setup+0xac/0xc0
[ 12.382844] Modules linked in:
[ 12.383657] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.3.0-rc4-test-00040-g077623e2804f-dirty #12
[ 12.385753] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-debian-1.16.0-5 04/01/2014
[ 12.387921] RIP: 0010:cooling_device_stats_setup+0xac/0xc0
[ 12.389256] Code: ff 48 89 1d 2e 8d 07 01 5b 5d 41 5c c3 cc cc cc cc 48 8d bf 18 05 00 00 be ff ff ff ff e8 dc c1 36 00 85 c0 0f 85 72 ff ff ff <0f> 0b e9 6b ff ff ff 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 90 90
[ 12.394812] RSP: 0000:ffffa4d580013c60 EFLAGS: 00010246
[ 12.396076] RAX: 0000000000000000 RBX: ffff99cc82e4e000 RCX: 0000000000000001
[ 12.397747] RDX: 0000000000000000 RSI: ffffffff9b2e7401 RDI: ffffffff9b316e4c
[ 12.399398] RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000001
[ 12.401057] R10: ffff99cc80262340 R11: ffff99cc80263138 R12: ffff99cc82e4e000
[ 12.402698] R13: ffff99cc82e4e018 R14: ffff99cc80bc7800 R15: 0000000000000000
[ 12.404337] FS: 0000000000000000(0000) GS:ffff99ccfbc00000(0000) knlGS:0000000000000000
[ 12.406266] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 12.407632] CR2: ffff99ccb7401000 CR3: 0000000134a64001 CR4: 0000000000170ef0
[ 12.409313] Call Trace:
[ 12.410001] <TASK>
[ 12.410618] thermal_cooling_device_setup_sysfs+0x12/0x30
[ 12.411910] __thermal_cooling_device_register.part.0+0x13c/0x3d0
[ 12.413372] acpi_processor_thermal_init+0x26/0x100
[ 12.414557] __acpi_processor_start+0x7f/0xf0
[ 12.415628] acpi_processor_start+0x30/0x50
[ 12.416684] really_probe+0x1a2/0x400
[ 12.417635] ? __pfx___driver_attach+0x10/0x10
[ 12.418726] __driver_probe_device+0x78/0x170
[ 12.419800] driver_probe_device+0x1f/0x90
[ 12.423242] __driver_attach+0xd6/0x1d0
[ 12.424220] bus_for_each_dev+0x8f/0xe0
[ 12.425210] bus_add_driver+0x119/0x220
[ 12.426174] driver_register+0x59/0x100
[ 12.427139] ? __pfx_acpi_processor_driver_init+0x10/0x10
[ 12.428427] acpi_processor_driver_init+0x3f/0xc0
[ 12.429582] ? __pfx_acpi_processor_driver_init+0x10/0x10
[ 12.430865] do_one_initcall+0x74/0x290
[ 12.431839] kernel_init_freeable+0x3cc/0x580
[ 12.432938] ? __pfx_kernel_init+0x10/0x10
[ 12.433957] kernel_init+0x1a/0x1c0
[ 12.434847] ret_from_fork+0x2c/0x50
[ 12.435772] </TASK>
[ 12.436402] irq event stamp: 10911001
[ 12.437356] hardirqs last enabled at (10911013): [<ffffffff99e6513e>] __up_console_sem+0x5e/0x70
[ 12.439440] hardirqs last disabled at (10911022): [<ffffffff99e65123>] __up_console_sem+0x43/0x70
[ 12.441531] softirqs last enabled at (10910744): [<ffffffff9abd17a2>] __do_softirq+0x322/0x429
[ 12.443577] softirqs last disabled at (10910739): [<ffffffff99dc27e7>] __irq_exit_rcu+0xc7/0x150
[ 12.445651] ---[ end trace 0000000000000000 ]---
[ 12.446965] ------------[ cut here ]------------

Config attached.

-- Steve

Attachment: config
Description: Binary data