On 10/20/20 11:09 AM, Leo Yan wrote:
On Tue, Oct 20, 2020 at 10:45:48AM +0100, Suzuki Kuruppassery Poulose wrote:
On 10/20/20 1:35 AM, Leo Yan wrote:
Hi all,
After I enabled kernel configs CONFIG_LOCKDEP and CONFIG_LOCK_STAT on the mainline kernel, the kernel reports warning as below. Read a bit the code, the issue seems is related with the CTI's SysFS attribution: "cti_desc.groups = drvdata->ctidev.con_groups;", which might not initialize properly so cause this warning.
[ 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
This is triggered due to the missing "sysfs_attr_init()" call on the dynamically allocated attributes. Does the following patch fix the issue ?
diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c index 392757f3a019..2ffe1c6ff7f4 100644 --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c @@ -1065,6 +1065,8 @@ static int cti_create_con_sysfs_attr(struct device *dev, } eattr->var = con; con->con_attrs[attr_idx] = &eattr->attr.attr;
sysf_init_attr(con->con_attrs[attr_idx]);
here should: s/sysf_init_attr/sysfs_attr_init
whoops, thanks for fixing that ;-)
With this change, I confirmed the patch can fix the issue: Tested-by: Leo Yan leo.yan@linaro.org
Thanks for the fixing!
I will post this soon to the list. Thanks for the quick testing !
Cheers Suzuki