Linux LED subsystem development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Hans de Goede <hdegoede@redhat.com>, Pavel Machek <pavel@ucw.cz>,
	Lee Jones <lee@kernel.org>
Cc: Linux LED Subsystem <linux-leds@vger.kernel.org>
Subject: Re: "leds: trigger: use RCU to protect the led_cdevs list" triggers RCU error checks
Date: Tue, 11 Apr 2023 21:38:00 +0200	[thread overview]
Message-ID: <b449dda32e0f3bb0adeeda4fd0e1e7f58a29b43f.camel@sipsolutions.net> (raw)
In-Reply-To: <600cc06e-081d-cd90-947d-f8988f1af194@redhat.com>

Hi,

> Sorry to bring the bearer of bad news, but your commit 2a5a8fa8b23
> ("leds: trigger: use RCU to protect the led_cdevs list"),
> is causing the following RCU warning when used with blinking
> triggers on I2C LED controllers which support hw blinking.

Err, well, surely that is a pre-existing driver bug then?

> The specific problem is drivers/leds/led-triggers.c:
> led_trigger_blink_setup() which does:
> 
>         rcu_read_lock();
>         list_for_each_entry_rcu(led_cdev, &trig->led_cdevs, trig_list) {
>                 if (oneshot)
>                         led_blink_set_oneshot(led_cdev, delay_on, delay_off,
>                                               invert);
>                 else
>                         led_blink_set(led_cdev, delay_on, delay_off);
>         }
>         rcu_read_unlock();
> 
> And that led_blink_set() call then hits this path:
> 
>         if (!test_bit(LED_BLINK_ONESHOT, &led_cdev->work_flags) &&
>             led_cdev->blink_set &&
>             !led_cdev->blink_set(led_cdev, delay_on, delay_off))
>                 return;
> 
> Which calls directly into the LED controller driver

Sure, so far so good.

> which talks to the LED controller over I2C which may sleep.

Which seems to me was already wrong before my patch, since the code was:

       read_lock_irqsave(&trig->leddev_list_lock, flags);
       list_for_each_entry(led_cdev, &trig->led_cdevs, trig_list) {
               if (oneshot)
                       led_blink_set_oneshot(led_cdev, delay_on, delay_off,
                                             invert);
               else
                       led_blink_set(led_cdev, delay_on, delay_off);
       }
       read_unlock_irqrestore(&trig->leddev_list_lock, flags);


Surely, the code wasn't allowed to sleep in an _irqsave() section? You'd
just see a different check complain, rather than about RCU, I guess.


So maybe you're bringing bad news, but I don't think it's for me ;-) I
don't see cht_wc_leds_brightness_get() or a driver/module called
leds_cht_wcove even in linux-next, so I guess you should look wherever
you got _that_ from.

johannes

  reply	other threads:[~2023-04-11 19:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11 18:15 "leds: trigger: use RCU to protect the led_cdevs list" triggers RCU error checks Hans de Goede
2023-04-11 19:38 ` Johannes Berg [this message]
2023-04-11 21:26   ` Hans de Goede
2023-04-12  8:13     ` Johannes Berg
2023-04-12 21:06       ` Hans de Goede

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=b449dda32e0f3bb0adeeda4fd0e1e7f58a29b43f.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=hdegoede@redhat.com \
    --cc=lee@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox