* [PATCH] ACPI: fan: fix warning with CONFIG_DEBUG_LOCK_ALLOC
@ 2020-12-04 18:25 Pierre-Louis Bossart
2020-12-07 13:14 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Pierre-Louis Bossart @ 2020-12-04 18:25 UTC (permalink / raw)
To: linux-kernel
Cc: Pierre-Louis Bossart, Srinivas Pandruvada, Rafael J . Wysocki,
Zhang Rui, Rafael J. Wysocki, Len Brown,
open list:ACPI FAN DRIVER
On a TigerLake device with CONFIG_DEBUG_LOCK_ALLOC the following
warning is thrown:
[ 13.784413] BUG: key ffff88810ea5a080 has not been registered!
[ 13.784722] DEBUG_LOCKS_WARN_ON(1)
[ 13.784737] WARNING: CPU: 2 PID: 1 at kernel/locking/lockdep.c:4623
lockdep_init_map_waits+0x25e/0x310
[ 13.787831] Call Trace:
[ 13.787902] __kernfs_create_file+0xa5/0x180
[ 13.788016] sysfs_add_file_mode_ns+0x120/0x270
[ 13.788138] sysfs_create_file_ns+0xcd/0x120
[ 13.788256] ? sysfs_add_file_mode_ns+0x270/0x270
[ 13.788381] ? fan_get_max_state+0x70/0x70
[ 13.788491] ? sort_r+0x1a5/0x200
[ 13.788579] acpi_fan_probe+0x63b/0x7a0
Dynamically-allocated attributes need to be initialized to make
lockdep happy, see include/linux/sysfs.h
Fixes: d19e470b6605c ('ACPI: fan: Expose fan performance state information')
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
drivers/acpi/fan.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index 66c3983f0ccc..9cab806298ff 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -357,6 +357,7 @@ static int acpi_fan_get_fps(struct acpi_device *device)
fps->dev_attr.store = NULL;
fps->dev_attr.attr.name = fps->name;
fps->dev_attr.attr.mode = 0444;
+ sysfs_attr_init(&fps->dev_attr.attr);
status = sysfs_create_file(&device->dev.kobj, &fps->dev_attr.attr);
if (status) {
int j;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ACPI: fan: fix warning with CONFIG_DEBUG_LOCK_ALLOC
2020-12-04 18:25 [PATCH] ACPI: fan: fix warning with CONFIG_DEBUG_LOCK_ALLOC Pierre-Louis Bossart
@ 2020-12-07 13:14 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2020-12-07 13:14 UTC (permalink / raw)
To: Pierre-Louis Bossart
Cc: Linux Kernel Mailing List, Srinivas Pandruvada,
Rafael J . Wysocki, Zhang Rui, Rafael J. Wysocki, Len Brown,
open list:ACPI FAN DRIVER
On Fri, Dec 4, 2020 at 7:27 PM Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:
>
> On a TigerLake device with CONFIG_DEBUG_LOCK_ALLOC the following
> warning is thrown:
>
> [ 13.784413] BUG: key ffff88810ea5a080 has not been registered!
> [ 13.784722] DEBUG_LOCKS_WARN_ON(1)
> [ 13.784737] WARNING: CPU: 2 PID: 1 at kernel/locking/lockdep.c:4623
> lockdep_init_map_waits+0x25e/0x310
> [ 13.787831] Call Trace:
> [ 13.787902] __kernfs_create_file+0xa5/0x180
> [ 13.788016] sysfs_add_file_mode_ns+0x120/0x270
> [ 13.788138] sysfs_create_file_ns+0xcd/0x120
> [ 13.788256] ? sysfs_add_file_mode_ns+0x270/0x270
> [ 13.788381] ? fan_get_max_state+0x70/0x70
> [ 13.788491] ? sort_r+0x1a5/0x200
> [ 13.788579] acpi_fan_probe+0x63b/0x7a0
>
> Dynamically-allocated attributes need to be initialized to make
> lockdep happy, see include/linux/sysfs.h
>
> Fixes: d19e470b6605c ('ACPI: fan: Expose fan performance state information')
> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
> drivers/acpi/fan.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
> index 66c3983f0ccc..9cab806298ff 100644
> --- a/drivers/acpi/fan.c
> +++ b/drivers/acpi/fan.c
> @@ -357,6 +357,7 @@ static int acpi_fan_get_fps(struct acpi_device *device)
> fps->dev_attr.store = NULL;
> fps->dev_attr.attr.name = fps->name;
> fps->dev_attr.attr.mode = 0444;
> + sysfs_attr_init(&fps->dev_attr.attr);
> status = sysfs_create_file(&device->dev.kobj, &fps->dev_attr.attr);
> if (status) {
> int j;
> --
This has been fixed in the mainline already AFAICS, by commit
7dc7a8b04f3d ("ACPI: fan: Initialize performance state sysfs
attribute").
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-07 13:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-04 18:25 [PATCH] ACPI: fan: fix warning with CONFIG_DEBUG_LOCK_ALLOC Pierre-Louis Bossart
2020-12-07 13:14 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).