* [PATCH] coresight: cti: Initialize dynamic sysfs attributes
@ 2020-10-28 10:54 Suzuki K Poulose
2020-10-28 19:16 ` Mathieu Poirier
0 siblings, 1 reply; 3+ messages in thread
From: Suzuki K Poulose @ 2020-10-28 10:54 UTC (permalink / raw)
To: linux-arm-kernel
Cc: coresight, Suzuki K Poulose, Mike Leach, Mathieu Poirier, leo.yan
With LOCKDEP enabled, CTI driver triggers the following splat due
to uninitialized lock class for dynamically allocated attribute
objects.
[ 5.372901] coresight etm0: CPU0: ETM v4.0 initialized
[ 5.376694] coresight etm1: CPU1: ETM v4.0 initialized
[ 5.380785] coresight etm2: CPU2: ETM v4.0 initialized
[ 5.385851] coresight etm3: CPU3: ETM v4.0 initialized
[ 5.389808] BUG: key ffff00000564a798 has not been registered!
[ 5.392456] ------------[ cut here ]------------
[ 5.398195] DEBUG_LOCKS_WARN_ON(1)
[ 5.398233] WARNING: CPU: 1 PID: 32 at kernel/locking/lockdep.c:4623 lockdep_init_map_waits+0x14c/0x260
[ 5.406149] Modules linked in:
[ 5.415411] CPU: 1 PID: 32 Comm: kworker/1:1 Not tainted 5.9.0-12034-gbbe85027ce80 #51
[ 5.418553] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
[ 5.426453] Workqueue: events amba_deferred_retry_func
[ 5.433299] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
[ 5.438252] pc : lockdep_init_map_waits+0x14c/0x260
[ 5.444410] lr : lockdep_init_map_waits+0x14c/0x260
[ 5.449007] sp : ffff800012bbb720
...
[ 5.531561] Call trace:
[ 5.536847] lockdep_init_map_waits+0x14c/0x260
[ 5.539027] __kernfs_create_file+0xa8/0x1c8
[ 5.543539] sysfs_add_file_mode_ns+0xd0/0x208
[ 5.548054] internal_create_group+0x118/0x3c8
[ 5.552307] internal_create_groups+0x58/0xb8
[ 5.556733] sysfs_create_groups+0x2c/0x38
[ 5.561160] device_add+0x2d8/0x768
[ 5.565148] device_register+0x28/0x38
[ 5.568537] coresight_register+0xf8/0x320
[ 5.572358] cti_probe+0x1b0/0x3f0
...
Fix this by initializing the attributes when they are allocated.
Fixes : 3c5597e398124 ("coresight: cti: Add connection information to sysfs")
Reported-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
drivers/hwtracing/coresight/coresight-cti-sysfs.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
index 392757f3a019..7ff7e7780bbf 100644
--- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
@@ -1065,6 +1065,13 @@ static int cti_create_con_sysfs_attr(struct device *dev,
}
eattr->var = con;
con->con_attrs[attr_idx] = &eattr->attr.attr;
+ /*
+ * Initialize the dynamically allocated attribute
+ * to avoid LOCKDEP splat. See include/linux/sysfs.h
+ * for more details.
+ */
+ sysfs_attr_init(con->con_attrs[attr_idx]);
+
return 0;
}
--
2.24.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] coresight: cti: Initialize dynamic sysfs attributes
2020-10-28 10:54 [PATCH] coresight: cti: Initialize dynamic sysfs attributes Suzuki K Poulose
@ 2020-10-28 19:16 ` Mathieu Poirier
2020-10-28 22:14 ` Suzuki K Poulose
0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Poirier @ 2020-10-28 19:16 UTC (permalink / raw)
To: Suzuki K Poulose; +Cc: coresight, Mike Leach, linux-arm-kernel, leo.yan
On Wed, Oct 28, 2020 at 10:54:53AM +0000, Suzuki K Poulose wrote:
> With LOCKDEP enabled, CTI driver triggers the following splat due
> to uninitialized lock class for dynamically allocated attribute
> objects.
>
> [ 5.372901] coresight etm0: CPU0: ETM v4.0 initialized
> [ 5.376694] coresight etm1: CPU1: ETM v4.0 initialized
> [ 5.380785] coresight etm2: CPU2: ETM v4.0 initialized
> [ 5.385851] coresight etm3: CPU3: ETM v4.0 initialized
> [ 5.389808] BUG: key ffff00000564a798 has not been registered!
> [ 5.392456] ------------[ cut here ]------------
> [ 5.398195] DEBUG_LOCKS_WARN_ON(1)
> [ 5.398233] WARNING: CPU: 1 PID: 32 at kernel/locking/lockdep.c:4623 lockdep_init_map_waits+0x14c/0x260
> [ 5.406149] Modules linked in:
> [ 5.415411] CPU: 1 PID: 32 Comm: kworker/1:1 Not tainted 5.9.0-12034-gbbe85027ce80 #51
> [ 5.418553] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
> [ 5.426453] Workqueue: events amba_deferred_retry_func
> [ 5.433299] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
> [ 5.438252] pc : lockdep_init_map_waits+0x14c/0x260
> [ 5.444410] lr : lockdep_init_map_waits+0x14c/0x260
> [ 5.449007] sp : ffff800012bbb720
> ...
>
> [ 5.531561] Call trace:
> [ 5.536847] lockdep_init_map_waits+0x14c/0x260
> [ 5.539027] __kernfs_create_file+0xa8/0x1c8
> [ 5.543539] sysfs_add_file_mode_ns+0xd0/0x208
> [ 5.548054] internal_create_group+0x118/0x3c8
> [ 5.552307] internal_create_groups+0x58/0xb8
> [ 5.556733] sysfs_create_groups+0x2c/0x38
> [ 5.561160] device_add+0x2d8/0x768
> [ 5.565148] device_register+0x28/0x38
> [ 5.568537] coresight_register+0xf8/0x320
> [ 5.572358] cti_probe+0x1b0/0x3f0
>
> ...
>
> Fix this by initializing the attributes when they are allocated.
>
> Fixes : 3c5597e398124 ("coresight: cti: Add connection information to sysfs")
This needs to be 12 rather than 13 characters. I have made the modification and
applied your changes.
Thanks,
Mathieu
> Reported-by: Leo Yan <leo.yan@linaro.org>
> Tested-by: Leo Yan <leo.yan@linaro.org>
> Cc: Mike Leach <mike.leach@linaro.org>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
> drivers/hwtracing/coresight/coresight-cti-sysfs.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> index 392757f3a019..7ff7e7780bbf 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> @@ -1065,6 +1065,13 @@ static int cti_create_con_sysfs_attr(struct device *dev,
> }
> eattr->var = con;
> con->con_attrs[attr_idx] = &eattr->attr.attr;
> + /*
> + * Initialize the dynamically allocated attribute
> + * to avoid LOCKDEP splat. See include/linux/sysfs.h
> + * for more details.
> + */
> + sysfs_attr_init(con->con_attrs[attr_idx]);
> +
> return 0;
> }
>
> --
> 2.24.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] coresight: cti: Initialize dynamic sysfs attributes
2020-10-28 19:16 ` Mathieu Poirier
@ 2020-10-28 22:14 ` Suzuki K Poulose
0 siblings, 0 replies; 3+ messages in thread
From: Suzuki K Poulose @ 2020-10-28 22:14 UTC (permalink / raw)
To: Mathieu Poirier; +Cc: coresight, Mike Leach, linux-arm-kernel, leo.yan
On 10/28/20 7:16 PM, Mathieu Poirier wrote:
> On Wed, Oct 28, 2020 at 10:54:53AM +0000, Suzuki K Poulose wrote:
>> With LOCKDEP enabled, CTI driver triggers the following splat due
>> to uninitialized lock class for dynamically allocated attribute
>> objects.
>>
>> [ 5.372901] coresight etm0: CPU0: ETM v4.0 initialized
>> [ 5.376694] coresight etm1: CPU1: ETM v4.0 initialized
>> [ 5.380785] coresight etm2: CPU2: ETM v4.0 initialized
>> [ 5.385851] coresight etm3: CPU3: ETM v4.0 initialized
>> [ 5.389808] BUG: key ffff00000564a798 has not been registered!
>> [ 5.392456] ------------[ cut here ]------------
>> [ 5.398195] DEBUG_LOCKS_WARN_ON(1)
>> [ 5.398233] WARNING: CPU: 1 PID: 32 at kernel/locking/lockdep.c:4623 lockdep_init_map_waits+0x14c/0x260
>> [ 5.406149] Modules linked in:
>> [ 5.415411] CPU: 1 PID: 32 Comm: kworker/1:1 Not tainted 5.9.0-12034-gbbe85027ce80 #51
>> [ 5.418553] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
>> [ 5.426453] Workqueue: events amba_deferred_retry_func
>> [ 5.433299] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
>> [ 5.438252] pc : lockdep_init_map_waits+0x14c/0x260
>> [ 5.444410] lr : lockdep_init_map_waits+0x14c/0x260
>> [ 5.449007] sp : ffff800012bbb720
>> ...
>>
>> [ 5.531561] Call trace:
>> [ 5.536847] lockdep_init_map_waits+0x14c/0x260
>> [ 5.539027] __kernfs_create_file+0xa8/0x1c8
>> [ 5.543539] sysfs_add_file_mode_ns+0xd0/0x208
>> [ 5.548054] internal_create_group+0x118/0x3c8
>> [ 5.552307] internal_create_groups+0x58/0xb8
>> [ 5.556733] sysfs_create_groups+0x2c/0x38
>> [ 5.561160] device_add+0x2d8/0x768
>> [ 5.565148] device_register+0x28/0x38
>> [ 5.568537] coresight_register+0xf8/0x320
>> [ 5.572358] cti_probe+0x1b0/0x3f0
>>
>> ...
>>
>> Fix this by initializing the attributes when they are allocated.
>>
>> Fixes : 3c5597e398124 ("coresight: cti: Add connection information to sysfs")
>
> This needs to be 12 rather than 13 characters. I have made the modification and
> applied your changes.
>
Thanks Mathieu. Sorry for missing the checkpath run.
Cheers
Suzuki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-28 22:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28 10:54 [PATCH] coresight: cti: Initialize dynamic sysfs attributes Suzuki K Poulose
2020-10-28 19:16 ` Mathieu Poirier
2020-10-28 22:14 ` Suzuki K Poulose
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.