All of lore.kernel.org
 help / color / mirror / Atom feed
From: wangyufen <wangyufen@huawei.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: <linux-leds@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 00/13] leds: Fix devm vs. non-devm ordering
Date: Thu, 8 Dec 2022 10:23:10 +0800	[thread overview]
Message-ID: <be3be4d6-b752-6ed2-9b19-9686186a09e7@huawei.com> (raw)
In-Reply-To: <Y5D1d3WhLCpmfo+N@duo.ucw.cz>



在 2022/12/8 4:20, Pavel Machek 写道:
> Hi!
> 
>> Fault-inject tests reports this issue:
>>
>> DEBUG_LOCKS_WARN_ON(lock->magic != lock)
>> WARNING: CPU: 2 PID: 52 at kernel/locking/mutex.c:582 __mutex_lock+0x1366/0x15b0
>> Call Trace:
> 
> Ok, so:
> 
> a) this does not happen in wild
> 
> b) you have not actually tested any of this
> 

Hi!

Sorry, I don't have an actual device, I tested it with bpf mock device. 
During the test on leds_cr0014114, the following issue occurs:

root@syzkaller:~# python3 -m kddv.cmds.test 
kddv.tests.leds.test_cr0014114.TestCR0014114
test_device_probe (kddv.tests.leds.test_cr0014114.TestCR0014114) ... [ 
61.307831] SPI driver leds_cr0014114 has no spi_device_id for 
crane,cr0014114
[   77.660222] ------------[ cut here ]------------
[   77.660822] DEBUG_LOCKS_WARN_ON(lock->magic != lock)
[   77.660860] WARNING: CPU: 0 PID: 95 at kernel/locking/mutex.c:582 
__mutex_lock+0x1366/0x15b0
[   77.662518] Modules linked in: leds_cr0014114 rtc_cmos
[   77.663190] CPU: 0 PID: 95 Comm: kworker/0:2 Tainted: G 
   N 6.1.0-rc6+ #59 b2d6fc177d3c6952297e89bfb954a5133622046e
[   77.664587] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), 
BIOS 1.13.0-1ubuntu1.1 04/01/2014
[   77.665760] Workqueue: events set_brightness_delayed
[   77.666428] RIP: 0010:__mutex_lock+0x1366/0x15b0
[   77.667035] Code: e8 fc 30 88 e8 3b ed 8a fe 8b 15 cd d6 eb 01 85 d2 
0f 85 9b ed ff ff 48 c7 c6 40 98 a6 86 48 c7 c7 c0 96 a6 86 e8 d3 e2 f4 
ff <0f> 0b e9 81 ed ff ff e8 0e 42 ff ff 85 c0 0f 84 b7 fe ff ff 80 3d
[   77.669233] RSP: 0018:ffff88810bbbfba0 EFLAGS: 00010282
[   77.669876] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 
0000000000000000
[   77.670750] RDX: ffff88810bba3600 RSI: 0000000000000000 RDI: 
ffffed1021777f66
[   77.671628] RBP: ffff88810bbbfce0 R08: ffffffff8492d14f R09: 
ffffed1023604efa
[   77.672503] R10: ffff88811b0277cb R11: ffffed1023604ef9 R12: 
ffff888111a7a0e8
[   77.673376] R13: 0000000000000000 R14: ffff88811b038a20 R15: 
ffff88811b0389c0
[   77.674258] FS:  0000000000000000(0000) GS:ffff88811b000000(0000) 
knlGS:0000000000000000
[   77.675250] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   77.675969] CR2: 00007fc05d4229d0 CR3: 0000000109ba4003 CR4: 
0000000000370ef0
[   77.676828] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 
0000000000000000
[   77.677706] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 
0000000000000400
[   77.678579] Call Trace:
[   77.678913]  <TASK>
[   77.679200]  ? cr0014114_set_sync+0x2d/0x80 [leds_cr0014114 
04aa6b9a9c145895781b235c6c924b67f752bc72]
[   77.680324]  ? mutex_lock_io_nested+0x13d0/0x13d0
[   77.680930]  ? lock_acquire+0x175/0x410
[   77.681422]  ? lock_is_held_type+0xd7/0x130
[   77.681975]  ? cr0014114_set_sync+0x2d/0x80 [leds_cr0014114 
04aa6b9a9c145895781b235c6c924b67f752bc72]
[   77.683103]  cr0014114_set_sync+0x2d/0x80 [leds_cr0014114 
04aa6b9a9c145895781b235c6c924b67f752bc72]
[   77.684214]  ? cr0014114_sync+0x360/0x360 [leds_cr0014114 
04aa6b9a9c145895781b235c6c924b67f752bc72]
[   77.685326]  set_brightness_delayed+0xc5/0x140
[   77.685919]  process_one_work+0x654/0xc30
[   77.686436]  ? pwq_dec_nr_in_flight+0x140/0x140
[   77.687046]  ? rwlock_bug.part.0+0x50/0x50
[   77.687576]  worker_thread+0x30b/0x820
[   77.688076]  ? preempt_count_sub+0xf/0xc0
[   77.688599]  ? process_one_work+0xc30/0xc30
[   77.689149]  kthread+0x1a2/0x1e0
[   77.689575]  ? kthread_complete_and_exit+0x40/0x40
[   77.690202]  ret_from_fork+0x22/0x30
[   77.690679]  </TASK>
[   77.691005] irq event stamp: 25531
[   77.691435] hardirqs last  enabled at (25531): [<ffffffff8645deaf>] 
_raw_spin_unlock_irq+0x1f/0x50
[   77.692533] hardirqs last disabled at (25530): [<ffffffff8645dc61>] 
_raw_spin_lock_irq+0x41/0x50
[   77.693605] softirqs last  enabled at (25522): [<ffffffff868003dc>] 
__do_softirq+0x3dc/0x58d
[   77.694644] softirqs last disabled at (25517): [<ffffffff848d3ad3>] 
irq_exit_rcu+0xd3/0x100
[   77.695672] ---[ end trace 0000000000000000 ]---


After patch "leds: cr0014114: Fix devm vs. non-devm ordering" is 
installed, the test is successful.

root@syzkaller:~# python3 -m kddv.cmds.test 
kddv.tests.leds.test_cr0014114.TestCR0014114
test_device_probe (kddv.tests.leds.test_cr0014114.TestCR0014114) ... [ 
216.419070] SPI driver leds_cr0014114 has no spi_device_id for 
crane,cr0014114
ok


The bpf mock device test tool is provided by Yongjun. Currently, some of 
the tools have been submitted to the community 
(https://lwn.net/Articles/906236/). The whole test set is still in the 
preliminary validation phase, will send to the community after the 
further verification.

By the way, here's an introduction to the tool, but now only in Chinese:
https://github.com/ChinaLinuxKernel/CLK2022/blob/main/%E5%9F%BA%E4%BA%8EeBPF%E7%9A%84%E8%AE%BE%E5%A4%87%E9%A9%B1%E5%8A%A8%E6%B5%8B%E8%AF%95%E6%A1%86%E6%9E%B6.pdf

Thanks,
Wang

> ?
> 
> It looks reasonable, but the "Fixes:" tags mean -stable will pick this
> up almost immediately.
> 
> Is anyone else willing to say this looks ok to him?
> 
> Any testers?
> 
> Best regards,
> 								Pavel

      reply	other threads:[~2022-12-08  2:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09  8:48 [PATCH 00/13] leds: Fix devm vs. non-devm ordering Wang Yufen
2022-11-09  8:48 ` [PATCH 01/13] leds: cr0014114: " Wang Yufen
2022-11-09  8:48 ` [PATCH 02/13] leds: el15203000: " Wang Yufen
2022-11-09  9:39   ` Oleh Kravchenko
2022-11-09 10:25     ` wangyufen
2022-11-09 10:43       ` Oleh Kravchenko
     [not found]         ` <c53e4614-eb06-cda8-f9da-2ca58396df54@huawei.com>
2022-11-11 10:39           ` Oleh Kravchenko
2022-11-15  2:06             ` Wei Yongjun
2022-11-22  1:10               ` Wang Yufen
2022-11-25 22:21                 ` Oleh Kravchenko
2022-11-09  8:48 ` [PATCH 03/13] leds: lm3532: " Wang Yufen
2022-11-09  8:48 ` [PATCH 04/13] leds: lm3692x: " Wang Yufen
2022-11-09  8:48 ` [PATCH 05/13] leds: lm3697: " Wang Yufen
2022-11-09  8:48 ` [PATCH 06/13] leds: lp50xx: " Wang Yufen
2022-11-09  8:48 ` [PATCH 07/13] leds: lp8860: " Wang Yufen
2022-11-09  8:48 ` [PATCH 08/13] leds: mlxreg: " Wang Yufen
2022-11-09  8:48 ` [PATCH 09/13] leds: mt6323: " Wang Yufen
2022-11-09  8:48 ` [PATCH 10/13] leds: powernv: " Wang Yufen
2022-11-09  8:48 ` [PATCH 11/13] leds: sc27xx: " Wang Yufen
2022-11-09  8:48 ` [PATCH 12/13] leds: spi-byte: " Wang Yufen
2022-11-09  8:48 ` [PATCH 13/13] leds: rt8515: " Wang Yufen
2022-12-07 20:20 ` [PATCH 00/13] leds: " Pavel Machek
2022-12-08  2:23   ` wangyufen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be3be4d6-b752-6ed2-9b19-9686186a09e7@huawei.com \
    --to=wangyufen@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.