Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1868704ybi; Sat, 25 May 2019 10:35:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBeVqxL/HdViVoP7Os7/GfUOhaF/aP8HV1IO5wgZjToXJ1JrQmBakiQv1MM6gj37zRc3R2 X-Received: by 2002:aa7:81d1:: with SMTP id c17mr102859152pfn.174.1558805704012; Sat, 25 May 2019 10:35:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558805704; cv=none; d=google.com; s=arc-20160816; b=PCxQjIKVj84IVNf0/unS9Ey6yS8l7TGvhKKixAnbH7w0DOA1OxXr0d+iazuVAn4ggy lb52capdiBgM7q0YDFrHGPha5fIkt4jiJnIn1QA+1mMnbX1V31AW9lV15yr/9KqtlU7q 7q7dRFqRWaUYWDoBG8LkJc6j0+rvz6sBmqxyByUGnrg4HrhT72x5ZPeOmhGIScL8DXPF DqocQN0foCjRv3YuzoPwYmXJj+aJTBiKCc2hMM8MHLKnaSdX+9iagDn6icWeLSJEIQiu kIb3huH19fpw3cXSlf7i/S2iOwkxbHE9S/7yyxwVcAoUsWbE2CB4+s8BVpTRdMUqqa3O aSMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=Gy9W1697bnJcZZYL9JPR13RWL43dUSo9hT4REu7ye88=; b=diu/JxFxGbjCQrgAGl3DW+HaGsURPzQkNdvXow2S4+LZR7uurCVE8IP/2Ew8uDD+jV kWYnuHOhf3ix+F7MT+hzcl7oktcC9PSnuQkoI6b13Xo6KnOpzxKSbqDJidSolPFaYrJJ Ev90vHz71o0Tw6J/8KgarK7+MpV0dmevxUu1mVryuncf8ZmPi7DiwIrUX6vm8Zw8+SE8 A5xkZ9vTykZg6Np645AV/EuAR6Ke7cAOo2q7q/l9IgJv+Ibf2yOWucOCIbXbJx9U85M9 x09temcGGowE1/IiBRPj+ewkzfwQOOahSCQLHDYv4o7TN/teHSMX+BRisN7otJcBmhP9 y1ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=iFWPNFkW; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q205si10398682pfc.151.2019.05.25.10.34.48; Sat, 25 May 2019 10:35:03 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=iFWPNFkW; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727198AbfEYRct (ORCPT + 99 others); Sat, 25 May 2019 13:32:49 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:40880 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726126AbfEYRcs (ORCPT ); Sat, 25 May 2019 13:32:48 -0400 Received: by mail-ot1-f66.google.com with SMTP id u11so11474839otq.7 for ; Sat, 25 May 2019 10:32:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=Gy9W1697bnJcZZYL9JPR13RWL43dUSo9hT4REu7ye88=; b=iFWPNFkW/msjuLBcH1597P5z4p04Oh2a5rg9i23EXl8eHTZLZ8x4Xb7VKbO5ERrBOc Ou3T1kdVwVnvAIkwRx2aXrnqOhf0BWokJrU6ARtpeKnimQXrZQLpT7lqNJz1u6ohw3N7 RhkW4oggrur4UWZjaTO/qI3TEp2qhkkWMr2XYG6e1zwXV26WmH8YQPSXDgnCMkAHJAOD YqC2eDGARMY45KF6aPgL1PyeYkr6Fo5cqJLekG5Aw8a7F5pRUv5ISEqj3x141FTuSGh9 GMuq2ORD/QbFkD66n3C1Q6F/OAEHhdvZ0ix/DorC2vHmJB8t0ntym9/U1RaomsyKoq2o vXXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=Gy9W1697bnJcZZYL9JPR13RWL43dUSo9hT4REu7ye88=; b=bVdPjivJeVjYZNkF2VLM6ND36g2/Mrd4vYwcgD5atKl6W8Q9lKogx+okuzOkdZjalC p8N1JBjrrOzvz86Yv4CazeHjFDeSj3649jrlsh9xsLGmGZx3ptCpzH1X+ScR814sN3Qw 3gs9aFLw6aK1Zqbj6y2z7Z62xD80bgrgT5MOx8R5ePbYfDhEFPMRtBCzGumYdX1Zmyvs DWR7XLRmLmTnKm9Iv0iOy4pDbxquYhVUrD65x5mQshCBP/sR5uNXxpkxk1K3HJBhCFWY kepdh7l85GdzDJHqOpkReM9st46rFZB59F/ZAE44yisEnrlMEJ3KkJ9CFdp3rM/VerTm M5TQ== X-Gm-Message-State: APjAAAUexFljPWbLzmoOWBuIwbgcoD4aMEeQxr0RiwZC2rJwRbVwrNbL 1THym4PvQmlyUn1T5kTN0Q140w== X-Received: by 2002:a05:6830:1545:: with SMTP id l5mr32208199otp.69.1558805567517; Sat, 25 May 2019 10:32:47 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id b127sm2413034oih.43.2019.05.25.10.32.46 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 25 May 2019 10:32:46 -0700 (PDT) Date: Sat, 25 May 2019 10:32:31 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Pavel Machek cc: Hugh Dickins , Jacek Anaszewski , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Revert "leds: avoid races with workqueue"? In-Reply-To: <20190525093759.GA17767@amd> Message-ID: References: <20190525093759.GA17767@amd> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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