Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1466343ybi; Sat, 25 May 2019 02:39:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNoGa9XB/OyPUbOrwJiQLXxR6w+EQMv3NyX4zfwbaXwPjnB32UDeoRSc2jUri2EsZXJH3M X-Received: by 2002:a17:90a:a27:: with SMTP id o36mr14964996pjo.95.1558777175567; Sat, 25 May 2019 02:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558777175; cv=none; d=google.com; s=arc-20160816; b=lBWaW8QHJhphLNO+9T9wdbNqhfIIcakwT1KoKCsNWLqHrpi2W1BzhdSSsVIAn8lprO f+vH1mjhptRbm+hcFmDigSig08/qD1nkOZ2roSVytIMu9EDk61o0VeKRsC/Egi2i9Kfg VIEpDQKkaVyfmUGI5ormux4z0IknQ6/2swB1gZKxzV5tKBqxZRUxxc1FRz0mHBs7cnh1 sF8aT/5uepstl2yfsCV7NG/a9GOWqDAQdC+aYk7JlGaFc3ZgcAHA1GCsWKllj3++YV0E uQQh9+yvq9I2XcnglIUefN1ZUSVzd3On88fJTu00xC14EBm+9oN7Zm4VKn4UHY/C3el+ dlfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=FTWg2R/+ejJu6wuTE7c/Ma3BeEBZ24/xoWhw6OpKwPg=; b=B5ucxg+kgjCAtq2flRpNG9SRZ6+qT2sT57cxtUXSEdPubw0+S1lwQFWG1s52jzV6Qy 7VLFsWZTneNh3iIEwnyUREW8h6VcwHnlifLniqt53Xpku+IWrhJJrUv0exQRdGBBYq7q cdwShxybjgqak/MTNGW6sT2uOkjPpUvoaCdFfTz8AAdJDmR4ese/LECn4PxqzSzw/hOz 34mCOCaprZ+ZFmQqQOdyMp/Bhj9Ls5LoGAEu4bd0/NU3Dmo2Uw0lleaG0iU9uMHTmZwp V7PUxH6Dke7+0NCX+LaNMFhR83dwrvnbVNx6j96ACWtPXIYx7H2MVdoOYlYJmEXRkbJT JFCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t76si8470391pfa.110.2019.05.25.02.39.18; Sat, 25 May 2019 02:39:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726679AbfEYJiE (ORCPT + 99 others); Sat, 25 May 2019 05:38:04 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:39451 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726464AbfEYJiE (ORCPT ); Sat, 25 May 2019 05:38:04 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 968FB80358; Sat, 25 May 2019 11:37:50 +0200 (CEST) Date: Sat, 25 May 2019 11:37:59 +0200 From: Pavel Machek To: Hugh Dickins Cc: Jacek Anaszewski , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Revert "leds: avoid races with workqueue"? Message-ID: <20190525093759.GA17767@amd> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zYM0uCDKw75PZbzx" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 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_classde= v *led_cdev, } =20 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? */ } =20 - +/* 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/le= dtrig-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 *le= d_cdev) led_cdev->flags &=3D ~LED_INIT_DEFAULT_TRIGGER; } =20 + /* + * 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); =20 --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --zYM0uCDKw75PZbzx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlzpDPcACgkQMOfwapXb+vJBTQCdGXyvrKhaF+8tfO2Ckd9ww0th AsAAmwXZqlXOMenyO2Hnp6+x7P7ekSsP =nRA5 -----END PGP SIGNATURE----- --zYM0uCDKw75PZbzx--