From: Hugh Dickins <hughd@google.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Hugh Dickins <hughd@google.com>,
Jacek Anaszewski <jacek.anaszewski@gmail.com>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Revert "leds: avoid races with workqueue"?
Date: Sat, 25 May 2019 10:32:31 -0700 (PDT) [thread overview]
Message-ID: <alpine.LSU.2.11.1905251025300.1112@eggly.anvils> (raw)
In-Reply-To: <20190525093759.GA17767@amd>
On Sat, 25 May 2019, Pavel Machek wrote:
> Hi!
>
> > I'm having to revert 0db37915d912 ("leds: avoid races with workqueue")
> > from my 5.2-rc testing tree, because lockdep and other debug options
> > don't like it: net/mac80211/led.c arranges for led_blink_setup() to be
> > called at softirq time, and flush_work() is not good for calling
> > then.
>
> This should keep X60 working (as well as it is now; X60 will still
> have problems with lost events in setup like yours).
>
> Can you test this instead of the revert?
Thanks, Pavel: yes, that works fine for me on the T420s, no debug
complaints, good and silent; and the wifi LED is blinking as before.
Hugh
>
> Thanks,
> Pavel
>
> diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
> index aefac4d..ebaac4d 100644
> --- a/drivers/leds/led-core.c
> +++ b/drivers/leds/led-core.c
> @@ -158,19 +159,14 @@ static void led_set_software_blink(struct led_classdev *led_cdev,
> }
>
> set_bit(LED_BLINK_SW, &led_cdev->work_flags);
> - mod_timer(&led_cdev->blink_timer, jiffies + 1);
> + mod_timer(&led_cdev->blink_timer, jiffies + 1); /* Why oh why? Just call it directly? */
> }
>
> -
> +/* May not block */
> static void led_blink_setup(struct led_classdev *led_cdev,
> unsigned long *delay_on,
> unsigned long *delay_off)
> {
> - /*
> - * If "set brightness to 0" is pending in workqueue, we don't
> - * want that to be reordered after blink_set()
> - */
> - flush_work(&led_cdev->set_brightness_work);
> if (!test_bit(LED_BLINK_ONESHOT, &led_cdev->work_flags) &&
> led_cdev->blink_set &&
> !led_cdev->blink_set(led_cdev, delay_on, delay_off))
> diff --git a/drivers/leds/trigger/ledtrig-timer.c b/drivers/leds/trigger/ledtrig-timer.c
> index ca898c1..427fc3c 100644
> --- a/drivers/leds/trigger/ledtrig-timer.c
> +++ b/drivers/leds/trigger/ledtrig-timer.c
> @@ -113,6 +113,11 @@ static int timer_trig_activate(struct led_classdev *led_cdev)
> led_cdev->flags &= ~LED_INIT_DEFAULT_TRIGGER;
> }
>
> + /*
> + * If "set brightness to 0" is pending in workqueue, we don't
> + * want that to be reordered after blink_set()
> + */
> + flush_work(&led_cdev->set_brightness_work);
> led_blink_set(led_cdev, &led_cdev->blink_delay_on,
> &led_cdev->blink_delay_off);
>
>
>
>
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2019-05-25 17:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 23:02 Revert "leds: avoid races with workqueue"? Hugh Dickins
2019-05-25 9:08 ` Pavel Machek
2019-05-25 9:37 ` Pavel Machek
2019-05-25 17:32 ` Hugh Dickins [this message]
2019-05-26 17:20 ` Pavel Machek
2019-05-26 20:36 ` Hugh Dickins
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=alpine.LSU.2.11.1905251025300.1112@eggly.anvils \
--to=hughd@google.com \
--cc=jacek.anaszewski@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).