Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp285550ybz; Tue, 28 Apr 2020 23:42:22 -0700 (PDT) X-Google-Smtp-Source: APiQypK4QqNAL5e1nMo/CkyHh2BlnntiLV0WgQtL+4uNdvPSPqgcPeONCBIPI8nF1nCqHXyHYFVF X-Received: by 2002:a17:906:2b96:: with SMTP id m22mr1191083ejg.330.1588142541829; Tue, 28 Apr 2020 23:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588142541; cv=none; d=google.com; s=arc-20160816; b=0m9hAC0SgOzX5GQBU8r3xLwX+n1lzoBHe6fgb0tlAcK8AcKMDnhFSu123cZzBh4kPq cIP8hTo1BuaqoIpJnRV2Uoy0jCI4I1lWkW4SSp7YSRqUOixom4dv8odm2CefAhBG4in5 vEPnGn0U97uCJbCj5tb0V9K9pCWewA17O7PrDgCLpQarrfDHSn/jTqgN1hVK+dXlhsjm 3QCw5AcW9K9CdCxhmDELxDYq/KePxWKzNBKXKyZibguxBHJ0aDFRwwDZ41Io7bGyDZGD AammWEyLotS1CUKhh/YnradTIDxhP0FB+49Sw50DZfw0rGub77+g8+nDEbupxh3uKonM JTNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=yG9vpPKDzpfRJJCk2llJaWFnWsJYaiICHL0xvUKSsXA=; b=LTge5jxS5UROSkWtfm/vs/mFSnsuJmsim0AI1RPDbLoCfM0jq78FRm8Vy10Sqx5ytV cd1kGiDg5JaWofT/KZjFlE+6AXOzv8uA1J1n24C4fewmv5V2IRnTfBu/EVKWFs1dITDn eL2e295fmX60JwEHrC9KPB8L4xwoYQNLjMNZNWlLkU9DeBiV1OQIj4rVtfrSvdjQNuih Wfk5/44qi8L7b/rt7KXS0aKpBmbEbWSGZMerrO5qJHKBQhbknl381YeawrR1DRIqJqmq Gs8c7IUOhjpt3HtVLtPIOdwvXyN1e1f3tFwPGfzACR6u3qItTjAmvkqYh9a7GM6mgy4g X6fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=Bs7BV2ns; 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 me19si3234133ejb.140.2020.04.28.23.41.57; Tue, 28 Apr 2020 23:42:21 -0700 (PDT) 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; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=Bs7BV2ns; 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 S1726503AbgD2GkR (ORCPT + 99 others); Wed, 29 Apr 2020 02:40:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726158AbgD2GkQ (ORCPT ); Wed, 29 Apr 2020 02:40:16 -0400 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14A84C03C1AE for ; Tue, 28 Apr 2020 23:40:15 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id k12so1010094qtm.4 for ; Tue, 28 Apr 2020 23:40:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=yG9vpPKDzpfRJJCk2llJaWFnWsJYaiICHL0xvUKSsXA=; b=Bs7BV2nsK5MflmzjP5qR1H1SKL2RyWuvjV5dRy4PwylwWd2puZuGbhRmxG2Tjfc7pK 6v1lAYPstBsxTH7gSPFHpwMI9kd5ppsETqxsuEkfbeNJu84FZXDqKGejIE50RbaBS1p8 YV+SxL9CDCR+XMf6lga3L5RTanyFYXyJ4Vk4RMYqZ1N9kgb//Wt0YHItFB79+qWRXg68 SHQhvxi088v7r8mtiNy4+ld8CCovMYlh0RezNiduUHlfZuF7sXVQrwUkSlGj3tlpiiOu zgYHvkt3wJw9UKbX8z2TDmXDcP0iWw9qnLHv6Fj/qnNbRyE3x82dH6Q9D/hREX60J0Ug 5vag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=yG9vpPKDzpfRJJCk2llJaWFnWsJYaiICHL0xvUKSsXA=; b=LPJfFqYvumQ/MPaex9a2lium1hVG/mtntAqZW70NdpUNLV4UasGlyoTtjtocB0i00y gbAodCn20BqArNL1KB5c1Yy8nDWjN9SEPXXXSBOvYrLI1TIGqjfAMnR793c0bf+khSUT 1KbtxSu2epEcD5klbp1AefZx4/ZCBmCnItFBYlTgKzfAHNIciDcKMc70sa5Ow93nHgg2 9mjW+9WJOIwMlPcgp3KRyXR7vSvOHjvVihMFUWTc7jxa7h92yoi7AEazmhL1KWkKoIqi VqbeCKbaIywcbSVMMLmoxASdOzDe/QlZtrLRyFcaO7XU+/8Q2+yRsmUUEkpHWE1ihMcK W8Kg== X-Gm-Message-State: AGi0PuaVfnt8Uh/xPf5mzvTpa6GyknhP4sK98Ek34aUsPUIDls0PvMQn nGqjcrZPxEsCY1Oip6gmALFpW9awaw1Ne19EmUoBDw== X-Received: by 2002:aed:2a43:: with SMTP id k3mr32657429qtf.208.1588142414184; Tue, 28 Apr 2020 23:40:14 -0700 (PDT) MIME-Version: 1.0 References: <20200320093125.23092-1-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Wed, 29 Apr 2020 08:40:03 +0200 Message-ID: Subject: Re: [PATCH] gpiolib: don't call sleeping functions with a spinlock taken To: Andy Shevchenko Cc: Linus Walleij , Bartosz Golaszewski , Geert Uytterhoeven , "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org wt., 28 kwi 2020 o 17:53 Andy Shevchenko napisa= =C5=82(a): > > On Tue, Apr 14, 2020 at 6:35 PM Bartosz Golaszewski > wrote: > > > > wt., 14 kwi 2020 o 14:00 Linus Walleij napis= a=C5=82(a): > > > > > > On Fri, Mar 20, 2020 at 10:31 AM Bartosz Golaszewski = wrote: > > > > > > > From: Bartosz Golaszewski > > > > > > > > We must not call pinctrl_gpio_can_use_line() with the gpio_lock tak= en > > > > as it takes a mutex internally. Let's move the call before taking t= he > > > > spinlock and store the return value. > > > > > > > > This isn't perfect - there's a moment between calling > > > > pinctrl_gpio_can_use_line() and taking the spinlock where the situa= tion > > > > can change but it isn't a regression either: previously this part w= asn't > > > > protected at all and it only affects the information user-space is > > > > seeing. > > It seems I have no original at hand, so, commenting here. > > It looks like we need a mutex less function which can be used here and > in the call you are considering racy. The thing is this mutex is in pinctrl - we'd need to export it too so that gpio can use it. Bart