2021-04-07 21:39:55

by Naresh Kamboju

[permalink] [raw]
Subject: [next] [arm64] [gpio] BUG: key has not been registered! DEBUG_LOCKS_WARN_ON:

While running kselftest recently added gpio gpio-sim.sh test case the following
warning was triggered on Linux next tag 20210330 tag running on arm64 juno
and hikey devices.

GOOD: next-20210326
BAD: next-20210330

This is still happening today on Linux next tag 20210407.

# selftests: gpio: gpio-sim.sh
# 1. chip_name and dev_name attributes
# 1.1. Chip name is communicated to user
[ 143.081193] BUG: key ffff000800eba398 has not been registered!
[ 143.087326] ------------[ cut here ]------------
[ 143.091987] DEBUG_LOCKS_WARN_ON(1)
[ 143.092005] WARNING: CPU: 1 PID: 1821 at
/usr/src/kernel/kernel/locking/lockdep.c:4688
lockdep_init_map_type+0xf0/0x298
[ 143.106223] Modules linked in: gpio_sim rfkill tda998x cec
drm_kms_helper drm crct10dif_ce fuse [last unloaded: gpio_mockup]
[ 143.117495] CPU: 1 PID: 1821 Comm: mv Not tainted 5.12.0-rc5-next-20210330 #1
[ 143.124645] Hardware name: ARM Juno development board (r2) (DT)
[ 143.130572] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
[ 143.136589] pc : lockdep_init_map_type+0xf0/0x298
[ 143.141302] lr : lockdep_init_map_type+0xf0/0x298
[ 143.146014] sp : ffff800013fb3560
[ 143.149330] x29: ffff800013fb3560 x28: 00000000ffffee4b
[ 143.154655] x27: 00000000000011b4 x26: 0000000000001000
[ 143.159979] x25: ffff000800eba380 x24: 0000000000000000
[ 143.165303] x23: 0000000000000000 x22: 0000000000000000
[ 143.170626] x21: ffff80001382b000 x20: ffff000800eba398
[ 143.175949] x19: ffff000827ac32a8 x18: ffffffffffffffff
[ 143.181273] x17: 0000000000000000 x16: 0000000000000000
[ 143.186595] x15: ffff800012900a88 x14: ffff800093fb3167
[ 143.191918] x13: ffff800013fb3175 x12: 000000000000a0ec
[ 143.197241] x11: 0000000005f5e0ff x10: ffff800013fb30c0
[ 143.202565] x9 : ffff800013fb3560 x8 : 4e5241575f534b43
[ 143.207888] x7 : ffff800012989ad8 x6 : ffff800013fb3180
[ 143.213211] x5 : 0000000000000001 x4 : 0000000000000001
[ 143.218534] x3 : ffff800012901000 x2 : 0000000000000000
[ 143.223856] x1 : b4b7acac5f71bc00 x0 : 0000000000000000
[ 143.229180] Call trace:
[ 143.231625] lockdep_init_map_type+0xf0/0x298
[ 143.235989] __kernfs_create_file+0xa8/0x1d0
[ 143.240268] sysfs_add_file_mode_ns+0xa8/0x1f8
[ 143.244718] internal_create_group+0x118/0x420
[ 143.249169] sysfs_create_group+0x2c/0x38
[ 143.253185] gpio_sim_probe+0x358/0x3c0 [gpio_sim]
[ 143.257995] platform_probe+0x6c/0xd8
[ 143.261663] really_probe+0x16c/0x508
[ 143.265332] driver_probe_device+0x104/0x178
[ 143.269610] __device_attach_driver+0xa4/0x130
[ 143.274062] bus_for_each_drv+0x78/0xd8
[ 143.277903] __device_attach+0xf0/0x178
[ 143.281745] device_initial_probe+0x24/0x30
[ 143.285935] bus_probe_device+0xa0/0xa8
[ 143.289776] device_add+0x424/0x810
[ 143.293270] platform_device_add+0x12c/0x2c0
[ 143.297545] platform_device_register_full+0x124/0x150
[ 143.302692] gpio_sim_config_commit_item+0x160/0x1e0 [gpio_sim]
[ 143.308628] configfs_rename+0x1dc/0x220
[ 143.312557] vfs_rename+0x394/0x960
[ 143.316051] do_renameat2+0x408/0x4c0
[ 143.319718] __arm64_sys_renameat+0x5c/0x70
[ 143.323908] el0_svc_common+0x7c/0x158
[ 143.327665] do_el0_svc+0x38/0x90
[ 143.330985] el0_svc+0x20/0x30
[ 143.334045] el0_sync_handler+0x8c/0xb0
[ 143.337886] el0_sync+0x13c/0x140
[ 143.341204] irq event stamp: 5607
[ 143.344520] hardirqs last enabled at (5607): [<ffff800011462dd8>]
_raw_spin_unlock_irq+0x48/0x90
[ 143.353410] hardirqs last disabled at (5606): [<ffff8000114586c4>]
__schedule+0x364/0x950
[ 143.361605] softirqs last enabled at (5602): [<ffff800010010958>]
__do_softirq+0x510/0x63c
[ 143.369971] softirqs last disabled at (5577): [<ffff8000100a7474>]
irq_exit+0x1b4/0x1c0
[ 143.377992] ---[ end trace bc3c86ef609281aa ]---
# 1.2. chip_name returns 'none' if the chip is still pending

Reported-by: Naresh Kamboju <[email protected]>

metadata:
git branch: master
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git describe: next-20210330
kernel-config:
http://snapshots.linaro.org/openembedded/lkft/lkft/sumo/juno/lkft/linux-next/995/config

https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20210407/testrun/4306292/suite/linux-log-parser/test/check-kernel-bug-2485709/log

Full test log link,
https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20210330/testrun/4268728/suite/linux-log-parser/test/check-kernel-bug-2463256/log

git log --oneline next-20210326..next-20210330 -- tools/testing/selftests/gpio/
9d940ab72645 selftests: gpio: add test cases for gpio-sim
8a4cb2823240 selftests: gpio: add a helper for reading GPIO line names
ab1dbed6f4e8 selftests: gpio: provide a helper for reading chip info

--
Linaro LKFT
https://lkft.linaro.org


2021-04-07 22:53:26

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [next] [arm64] [gpio] BUG: key has not been registered! DEBUG_LOCKS_WARN_ON:

On Thu, Apr 8, 2021 at 12:38 AM Naresh Kamboju
<[email protected]> wrote:
>
> While running kselftest recently added gpio gpio-sim.sh test case the following
> warning was triggered on Linux next tag 20210330 tag running on arm64 juno
> and hikey devices.
>
> GOOD: next-20210326
> BAD: next-20210330
>
> This is still happening today on Linux next tag 20210407.

Can you add the following

sysfs_attr_init(attrs[i]);

to the end of the loop in gpio_sim_setup_sysfs()?

If it fixes an issue I'll send a formal patch.

--
With Best Regards,
Andy Shevchenko

2021-04-08 08:36:39

by Naresh Kamboju

[permalink] [raw]
Subject: Re: [next] [arm64] [gpio] BUG: key has not been registered! DEBUG_LOCKS_WARN_ON:

On Thu, 8 Apr 2021 at 04:21, Andy Shevchenko <[email protected]> wrote:
>
> On Thu, Apr 8, 2021 at 12:38 AM Naresh Kamboju
> <[email protected]> wrote:
> >
> > While running kselftest recently added gpio gpio-sim.sh test case the following
> > warning was triggered on Linux next tag 20210330 tag running on arm64 juno
> > and hikey devices.
> >
> > GOOD: next-20210326
> > BAD: next-20210330
> >
> > This is still happening today on Linux next tag 20210407.
>
> Can you add the following
>
> sysfs_attr_init(attrs[i]);
>
> to the end of the loop in gpio_sim_setup_sysfs()?

Do you mean like this,

diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index ea17289a869c..5fe67ccf45f7 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -296,6 +296,7 @@ static int gpio_sim_setup_sysfs(struct gpio_sim_chip *chip)
dev_attr->store = gpio_sim_sysfs_line_store;

attrs[i] = &dev_attr->attr;
+ sysfs_attr_init(attrs[i]);
}

chip->attr_group.name = "line-ctrl";


>
> If it fixes an issue I'll send a formal patch.

I will build and test this and report here.

- Naresh

2021-04-08 09:48:46

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [next] [arm64] [gpio] BUG: key has not been registered! DEBUG_LOCKS_WARN_ON:

On Thu, Apr 8, 2021 at 11:33 AM Naresh Kamboju
<[email protected]> wrote:
> On Thu, 8 Apr 2021 at 04:21, Andy Shevchenko <[email protected]> wrote:
> > On Thu, Apr 8, 2021 at 12:38 AM Naresh Kamboju
> > <[email protected]> wrote:
> > >
> > > While running kselftest recently added gpio gpio-sim.sh test case the following
> > > warning was triggered on Linux next tag 20210330 tag running on arm64 juno
> > > and hikey devices.
> > >
> > > GOOD: next-20210326
> > > BAD: next-20210330
> > >
> > > This is still happening today on Linux next tag 20210407.
> >
> > Can you add the following
> >
> > sysfs_attr_init(attrs[i]);
> >
> > to the end of the loop in gpio_sim_setup_sysfs()?
>
> Do you mean like this,
>
> diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
> index ea17289a869c..5fe67ccf45f7 100644
> --- a/drivers/gpio/gpio-sim.c
> +++ b/drivers/gpio/gpio-sim.c
> @@ -296,6 +296,7 @@ static int gpio_sim_setup_sysfs(struct gpio_sim_chip *chip)
> dev_attr->store = gpio_sim_sysfs_line_store;
>
> attrs[i] = &dev_attr->attr;
> + sysfs_attr_init(attrs[i]);
> }
>
> chip->attr_group.name = "line-ctrl";

Precisely.

> > If it fixes an issue I'll send a formal patch.
>
> I will build and test this and report here.

Thanks!

--
With Best Regards,
Andy Shevchenko

2021-04-08 15:33:59

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [next] [arm64] [gpio] BUG: key has not been registered! DEBUG_LOCKS_WARN_ON:

On Thu, Apr 8, 2021 at 3:59 PM Naresh Kamboju <[email protected]> wrote:
> On Thu, 8 Apr 2021 at 15:17, Andy Shevchenko <[email protected]> wrote:
> > On Thu, Apr 8, 2021 at 11:33 AM Naresh Kamboju
> > <[email protected]> wrote:
> > > On Thu, 8 Apr 2021 at 04:21, Andy Shevchenko <[email protected]> wrote:
> > > > On Thu, Apr 8, 2021 at 12:38 AM Naresh Kamboju
> > > > <[email protected]> wrote:
> > > > >
> > > > > While running kselftest recently added gpio gpio-sim.sh test case the following
> > > > > warning was triggered on Linux next tag 20210330 tag running on arm64 juno
> > > > > and hikey devices.
> > > > >
> > > > > GOOD: next-20210326
> > > > > BAD: next-20210330
> > > > >
> > > > > This is still happening today on Linux next tag 20210407.
> > > >
> > > > Can you add the following
> > > >
> > > > sysfs_attr_init(attrs[i]);
> > > >
> > > > to the end of the loop in gpio_sim_setup_sysfs()?
> > >
> > > Do you mean like this,
> > >
> > > diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
> > > index ea17289a869c..5fe67ccf45f7 100644
> > > --- a/drivers/gpio/gpio-sim.c
> > > +++ b/drivers/gpio/gpio-sim.c
> > > @@ -296,6 +296,7 @@ static int gpio_sim_setup_sysfs(struct gpio_sim_chip *chip)
> > > dev_attr->store = gpio_sim_sysfs_line_store;
> > >
> > > attrs[i] = &dev_attr->attr;
> > > + sysfs_attr_init(attrs[i]);
> > > }
> > >
> > > chip->attr_group.name = "line-ctrl";
> >
> > Precisely.
>
> As per your suggestions the above line added and build tested
> the reported issue is fixed now.
>
> Reported-by: Naresh Kamboju <[email protected]>
> Tested-by: Naresh Kamboju <[email protected]>

Thanks, I'll send a formal patch.

The rest I leave for Bart to figure out what to do.


--
With Best Regards,
Andy Shevchenko

2021-04-08 19:13:34

by Naresh Kamboju

[permalink] [raw]
Subject: Re: [next] [arm64] [gpio] BUG: key has not been registered! DEBUG_LOCKS_WARN_ON:

On Thu, 8 Apr 2021 at 15:17, Andy Shevchenko <[email protected]> wrote:
>
> On Thu, Apr 8, 2021 at 11:33 AM Naresh Kamboju
> <[email protected]> wrote:
> > On Thu, 8 Apr 2021 at 04:21, Andy Shevchenko <[email protected]> wrote:
> > > On Thu, Apr 8, 2021 at 12:38 AM Naresh Kamboju
> > > <[email protected]> wrote:
> > > >
> > > > While running kselftest recently added gpio gpio-sim.sh test case the following
> > > > warning was triggered on Linux next tag 20210330 tag running on arm64 juno
> > > > and hikey devices.
> > > >
> > > > GOOD: next-20210326
> > > > BAD: next-20210330
> > > >
> > > > This is still happening today on Linux next tag 20210407.
> > >
> > > Can you add the following
> > >
> > > sysfs_attr_init(attrs[i]);
> > >
> > > to the end of the loop in gpio_sim_setup_sysfs()?
> >
> > Do you mean like this,
> >
> > diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
> > index ea17289a869c..5fe67ccf45f7 100644
> > --- a/drivers/gpio/gpio-sim.c
> > +++ b/drivers/gpio/gpio-sim.c
> > @@ -296,6 +296,7 @@ static int gpio_sim_setup_sysfs(struct gpio_sim_chip *chip)
> > dev_attr->store = gpio_sim_sysfs_line_store;
> >
> > attrs[i] = &dev_attr->attr;
> > + sysfs_attr_init(attrs[i]);
> > }
> >
> > chip->attr_group.name = "line-ctrl";
>
> Precisely.

As per your suggestions the above line added and build tested
the reported issue is fixed now.

Reported-by: Naresh Kamboju <[email protected]>
Tested-by: Naresh Kamboju <[email protected]>

>
> > > If it fixes an issue I'll send a formal patch.
> >
> > I will build and test this and report here.

OTOH,
LKFT builds kernel and rootfs on host and runs tests on various target
devices. While doing this process "make install" is not installing required
test files like gpio-mockup-cdev and gpio-line-name.

# ./gpio-mockup.sh: line 106: ./gpio-mockup-cdev: No such file or directory
# ./gpio-sim.sh: line 100: ./gpio-line-name: No such file or directory

Test run log:
------------------
# selftests: gpio: gpio-mockup.sh
# 1. Module load tests
# 1.1. dynamic allocation of gpio
# ./gpio-mockup.sh: line 106: ./gpio-mockup-cdev: No such file or directory
# test failed: line value is 127 when 1 was expected
# GPIO gpio-mockup test FAIL
not ok 1 selftests: gpio: gpio-mockup.sh # exit=1
# selftests: gpio: gpio-sim.sh
# 1. chip_name and dev_name attributes
# 1.1. Chip name is communicated to user
# 1.2. chip_name returns 'none' if the chip is still pending
# 1.3. Device name is communicated to user
# 1.4. dev_name returns 'none' if chip is still pending
# 2. Creating simulated chips
# 2.1. Default number of lines is 1
# 2.2. Number of lines can be specified
# 2.3. Label can be set
# 2.4. Label can be left empty
# 2.5. Line names can be configured
# ./gpio-sim.sh: line 100: ./gpio-line-name: No such file or directory
# line name is incorrect
# GPIO gpio-sim test FAIL
not ok 2 selftests: gpio: gpio-sim.sh # exit=1

- Naresh