Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1423743pxb; Sun, 7 Mar 2021 18:43:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGY9FVTr7bP8cusrBVup0E2vJk5Tck7upWwQ/d4eQbrnWAaMxzb3gRBOwMEuL2PGDjkbzZ X-Received: by 2002:a17:906:26c9:: with SMTP id u9mr13574323ejc.166.1615171384283; Sun, 07 Mar 2021 18:43:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615171384; cv=none; d=google.com; s=arc-20160816; b=XMUAn3HqYsmhBTPx/8YAkS+1uIkdmYpmZMAr/wTx30g9P0YNBLaT+w/fmSk7ZAuCz3 bcPZp6ZN+qom91hknce8SUTMJ9mZE8YbuiUcbZlNz5bNmlKEqoQcxqW4IHV8ONGBk2TZ KJJFYFxCYe8E7FKApZSgvC5pgoGzvyfgJeNwV3LkXrMBuUOBmBGdsyAB6IG4jgU3Jnu8 6YJMBBsNvT67G//wzku14YnLI0yHF9ybbyN15UENccaqbLgli4qsgglhEE9rkowvXRCP cux+g3CVd3BPL0MkQ11cVrBF+SfDO+hl0Ydh2uWsPbnyVg6+IFV8TxiUQcYak+/7S1MK yB5A== 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=8ijx6CMfDIrApY+NCfswuuSJIgJtNnuzbp1ZOZ1ZNFU=; b=ofSALgROAu3pS2m4mp+NtZGeExvATqLjLU7xBLP9dKffE+D/9A63ipSgQpSB6OXCf2 2qXRs/JLgNuNwfNdtELLt3KzhOpBotrkKn/0NFHNvcIIGgxY8AvIc/q52W8yE1NRtDwt dOo9yjzBC+6ByljtPVs4SXgoyS4ES+wyYzy4SrgWlATtKLv1/18rgnqN+U0abGKcKvBl 81wblI08kVdWY03EpS/FulBJoAhMnfrn5WsjCz3+sb6TiHy3i394NANIAriHIQAT3QKl ufTvY2BkOAk25UgMU6Z4S8u4xsG01QvsgFcdQucag+JWfEiuG/dS68b5snB+Un7b7dj+ cAdg== 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 g2si6344624edb.398.2021.03.07.18.42.42; Sun, 07 Mar 2021 18:43:04 -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 S232411AbhCGQOP (ORCPT + 99 others); Sun, 7 Mar 2021 11:14:15 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:39488 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232377AbhCGQOA (ORCPT ); Sun, 7 Mar 2021 11:14:00 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id DA7101C0B76; Sun, 7 Mar 2021 17:13:57 +0100 (CET) Date: Sun, 7 Mar 2021 17:13:57 +0100 From: Pavel Machek To: Marc Kleine-Budde , hdegoede@redhat.com 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: <20210307161357.GA2933@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="J/dobhs11T7y2rNN" 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 --J/dobhs11T7y2rNN Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > --- 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()? Hans was pushing for this patch, perhaps he has some ideas... Pavel --=20 http://www.livejournal.com/~pavelmachek --J/dobhs11T7y2rNN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCYET7xQAKCRAw5/Bqldv6 8vKIAKDCxR0yuLq5ex211qqLUpFiWAZK+ACfc2M1gGpIsYkKLbgDIDuOujybruM= =/uEM -----END PGP SIGNATURE----- --J/dobhs11T7y2rNN--