Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1442564pxb; Sun, 7 Mar 2021 19:30:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxxZgPjCfohf8Xuq8QIaB+/QxFqdIgxCsY6Oy8SCm8OUrofUpeTYDqwW76m7KHhJVkrlI9 X-Received: by 2002:a17:906:1448:: with SMTP id q8mr13009648ejc.449.1615174245512; Sun, 07 Mar 2021 19:30:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615174245; cv=none; d=google.com; s=arc-20160816; b=EjdPYnzwbytYcHDoi8riFs3E8PH22LHv5kznNvJ2wPOS5/Z4EZRgNyjZVZwP2HHljK R7RFCdkojjQlfvDLK8yRw3g6crbiDSzioFQmL12dRAi6Tu2ev/5nH+DQvHNUB1BWVEyZ jsD9egWyqWfnEgAjv080D5gpq+nDeG79KSFkpLdjF3Y4OSgzBu6mbzVMJadIq7rHn3QS 9y3YyAVO6QlOawKsTSGU2SaNs5nEOcy4nwayKb62thDu/CdsB1adFDglm+MO3li7Cq6p 3xrShEmfI3apYVat2n28Xew8HMcvOXbejbpdOMIT9C2lZY0wi7PntffSc57DAYXIuKAg NQfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Jyo42xnFrf8Jlmol01vOy5a+lUJWvtE2gTpBAJvtj2I=; b=idxQSB328UPXCPCgTtoXBjUSSnbqtIZFtCKPS+X6yrjos9GC/8VDbZt5pNRJSG4RAP 2GSbeXg49t+IhkHnZiwtsPe/tDgBWtfVZpt7F8uu9uu3c8NX7C+ARe2EGICX0SJmrc8l Yr8CFjbZolx7rVjzD/KhNI9cbLC1Zbw6+UmOEEOE4lb5vWyeTGMb6upfxBYCD23Hh5kr EvaQiR6p+shTQwQ0+UGwurxIbmgJT+VjXCdYd1lbQh80JlHCmTkTlRjFzhydnvPTZ1PF 3rQki7nWI7cIMowcCXy3jwGJy9IWtI4utpULMqy++fPNOLpAI5XK0BRXZw7+mAq6OqYL 24sA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb13si6331905edb.465.2021.03.07.19.30.21; Sun, 07 Mar 2021 19:30:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232415AbhCGQ0P (ORCPT + 99 others); Sun, 7 Mar 2021 11:26:15 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:42202 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231314AbhCGQ0O (ORCPT ); Sun, 7 Mar 2021 11:26:14 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 5AA7A1C0B76; Sun, 7 Mar 2021 17:26:12 +0100 (CET) Date: Sun, 7 Mar 2021 17:26:12 +0100 From: Pavel Machek To: Marc Kleine-Budde Cc: Andrea Righi , Boqun Feng , Dan Murphy , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, schuchmann@schleissheimer.de Subject: Re: [PATCH] leds: trigger: fix potential deadlock with libata Message-ID: <20210307162612.GB2933@duo.ucw.cz> References: <20201102104152.GG9930@xps-13-7390> <20210306203954.ya5oqgkdalcw45c4@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eAbsdosE1cNLO4uF" Content-Disposition: inline In-Reply-To: <20210306203954.ya5oqgkdalcw45c4@pengutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --eAbsdosE1cNLO4uF Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > --- > > drivers/leds/led-triggers.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > >=20 > > diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c > > index 91da90cfb11d..16d1a93a10a8 100644 > > --- a/drivers/leds/led-triggers.c > > +++ b/drivers/leds/led-triggers.c > > @@ -378,14 +378,15 @@ void led_trigger_event(struct led_trigger *trig, > > enum led_brightness brightness) > > { > > struct led_classdev *led_cdev; > > + unsigned long flags; > > =20 > > if (!trig) > > return; > > =20 > > - read_lock(&trig->leddev_list_lock); > > + read_lock_irqsave(&trig->leddev_list_lock, flags); > > list_for_each_entry(led_cdev, &trig->led_cdevs, trig_list) > > led_set_brightness(led_cdev, brightness); > > - read_unlock(&trig->leddev_list_lock); > > + read_unlock_irqrestore(&trig->leddev_list_lock, flags); > > } > > EXPORT_SYMBOL_GPL(led_trigger_event); >=20 > meanwhile this patch hit v5.10.x stable and caused a performance > degradation on our use case: >=20 > It's an embedded ARM system, 4x Cortex A53, with an SPI attached CAN > controller. CAN stands for Controller Area Network and here used to > connect to some automotive equipment. Over CAN an ISOTP (a CAN-specific > Transport Protocol) transfer is running. With this patch, we see CAN > frames delayed for ~6ms, the usual gap between CAN frames is 240=B5s. >=20 > Reverting this patch, restores the old performance. >=20 > What is the best way to solve this dilemma? Identify the critical path > in our use case? Is there a way we can get around the irqsave in > led_trigger_event()? 6ms is quite long. Are you actively using any triggers? Do you have LED blinking on CAN access? Can you verify if it is cli/sti taking too long, or if the led_set_brightness takes too long? Best regards, Pavel --=20 http://www.livejournal.com/~pavelmachek --eAbsdosE1cNLO4uF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCYET+pAAKCRAw5/Bqldv6 8hqWAJsGTor4gK80/dmQh4yapYzLr0FfnwCeNL+N4oNpPPE33AxnJC0G1XAklVk= =QMR2 -----END PGP SIGNATURE----- --eAbsdosE1cNLO4uF--