Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2737470rdh; Wed, 27 Sep 2023 11:05:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHyLBsomPTWxDST6jnDhuOOrKpWzEp+kLAqmiCdQRhXKPaqkBUtjdmGs4V4pEkPRNgJ72hh X-Received: by 2002:a17:90b:1915:b0:277:852:cf45 with SMTP id mp21-20020a17090b191500b002770852cf45mr2383251pjb.19.1695837901231; Wed, 27 Sep 2023 11:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695837901; cv=none; d=google.com; s=arc-20160816; b=ZH2Y96BWJu0jj2oQA/pQJG5v4TiWyn/ADfY1Qc59JkWF4ydnZfNWkaiq3ImrrqC8OV D4f7vmuDfgCgql2pxLFNeg6MlnpRy9131yWkLxU83utyzCQhlKo91PSkkPqzoDJV+abJ GDXPzOGRcZ8he41IZZBmj4fpmpmNYqOey7qqaQqDv7gokp0KFgbUEEtlT8X90EDPgiUL OPTqCGl+CQg08+ChcGWRRHBmbBRoBqkuzeDEEzbJ/6Kf+IHmx10bRKil+RpdHeFUWenp UjgnJRlUDOp7VC2x2txQYbCR1FcN48daXgyAdIZBO7KcEkohMzo3zGBIyOIFLaHTixuM dAhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+bu46Nnc5KiWOqP0iBU5OgSADQzvEFoHS7NZgYb78GE=; fh=+qzbUX1Cy1vKSroLUfYHXeWipfITdGkBg/2KVg/tGCU=; b=nEXTee920wVym1Xsy1Q+yoWrVjlZavyFsAroQhHD130iZ0Y0vIADZKd3NxnI7kdqLH 1S5I0/YV0XWuvIdgLf4Dl92kQ7d1b5ktP2tlU0LMItlA9Lka+tzl8iOc/YN8aTxUNR8d QLkoxeXlZTJNGvq5GMlbrbOdfz6GTbYjZHHU64mEWZXfMxdZ8PfePVr5HjYfPMjeBPem wq2DVlzCgH8o9BskacLYNTJOSM1FjUSvXqH0roiukcyULkp64IUd3e3bGo/cFSDNaKa2 rJHG/Et03oYlvsbmynNj36VpqOhmDe50ddXUynFBYgWO/a7ePk565aZVTx7GMen5Wu2V ZRjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=iYetDO6F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id r4-20020a17090b050400b00279054d0408si1073528pjz.95.2023.09.27.11.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 11:05:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=iYetDO6F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2E5CB8310D3C; Wed, 27 Sep 2023 00:01:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229550AbjI0HB2 (ORCPT + 99 others); Wed, 27 Sep 2023 03:01:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbjI0HB0 (ORCPT ); Wed, 27 Sep 2023 03:01:26 -0400 Received: from mail-vs1-xe35.google.com (mail-vs1-xe35.google.com [IPv6:2607:f8b0:4864:20::e35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64FDFDD for ; Wed, 27 Sep 2023 00:01:25 -0700 (PDT) Received: by mail-vs1-xe35.google.com with SMTP id ada2fe7eead31-44ee3a547adso4461012137.2 for ; Wed, 27 Sep 2023 00:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1695798084; x=1696402884; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+bu46Nnc5KiWOqP0iBU5OgSADQzvEFoHS7NZgYb78GE=; b=iYetDO6FIHX9BY/YomwCZYRI7v2zaWfonRVnvLhBb9EV7D1AqCRxzjj2fia43L1rvT aDpczhw1jRbkVIdpIsrJVdoCKyavSxACt0NcwmYt+Yi0wXE9+z0+7eUBh+MlVzFdQOuE 0dffzueDkywu/UQjDmWRAFKInKzrF3yLUt0YMPAqK2OtWultcfGePnf1l3ZQIQ/DUUou ZDSqvxBISRraYaEBc/BUTHYJ+gQeXFULRjrEbNcj2C9fQvdIPju+22GJwdTrJ2o/OxOJ KRnm7RVWQ9PlxNBwVNEI9uc6X2jf0ni3n1LttSsI2NG8lOcu/PFHimMxYB7Ua6WOnNd1 amRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695798084; x=1696402884; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+bu46Nnc5KiWOqP0iBU5OgSADQzvEFoHS7NZgYb78GE=; b=YCEVL64kf6sTI4JqTlsIFjBi0BexJgkGdcs2/n1d6gjGjrLf8tkhJErsqtowwEeKXM d3WX2yn+GUmtKq86OzdxbsVdrwV+3ojzf/EZkLnzdQ1zcjx+wMDWaYjVQ11pLJbK8eGo MLhZJepJ8sZ+8kjqUT3WsOfvIhRGJ7MRVY2Us3jIfEjHxxwAdKZOAdRQ5za4fM2Lch26 YPHh1XSDchYPv9UMTlgg8axdvIjAe8XJzvCTZYAri9YUaTh6QETZpti2JMnZyDDSLhzs Qf8J+YFFIgRSPS9aeufRUxPTPVcSvE7RwZj7HUtjpWn6+CGez5+udfU14IxdyPDwSJgC 6Xdg== X-Gm-Message-State: AOJu0Yy+fFJi0fxbp++rJcq8I5LbYyqBzM9Kr4IjTChLAADXE8Gk4VAw zauDrzBhqekxN+XUBY24jSjelHZj+B1+1Co3Z3xYkw== X-Received: by 2002:a05:6102:119:b0:44d:4b8d:31e5 with SMTP id z25-20020a056102011900b0044d4b8d31e5mr925106vsq.35.1695798084516; Wed, 27 Sep 2023 00:01:24 -0700 (PDT) MIME-Version: 1.0 References: <20230920085639.152441-1-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Wed, 27 Sep 2023 09:01:13 +0200 Message-ID: Subject: Re: [PATCH] gpiolib: extend the critical sections of lookup tables To: Linus Walleij Cc: Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 27 Sep 2023 00:01:38 -0700 (PDT) On Mon, Sep 25, 2023 at 4:24=E2=80=AFPM Bartosz Golaszewski = wrote: > > On Wed, Sep 20, 2023 at 2:51=E2=80=AFPM Bartosz Golaszewski wrote: > > > > On Wed, 20 Sep 2023 12:58:58 +0200, Linus Walleij said: > > > On Wed, Sep 20, 2023 at 11:33=E2=80=AFAM Bartosz Golaszewski wrote: > > >> On Wed, 20 Sep 2023 11:12:58 +0200, Linus Walleij > > >> said: > > >> > On Wed, Sep 20, 2023 at 10:56=E2=80=AFAM Bartosz Golaszewski wrote: > > > > > >> > Can we rename this function gpiod_find_lookup_table_locked() > > >> > as per precedents in the kernel, to indicate that it needs to be > > >> > called with a lock held? > > >> > > > >> > > >> I think you mean gpiod_find_lookup_table_unlocked() as with this cha= nge it > > >> will no longer take the lock? > > > > > > I think the pattern is the one I indicated: *_locked() means the func= tion > > > is to be called with the appropriate lock held, cf > > > arch/arm64/kvm/hyp/nvhe/mm.c > > > > > > pkvm_create_mappings() takes a lock and then calls > > > pkvm_create_mappings_locked() which even asserts that > > > the lock is held. > > > > > > > Ha! I always though the pattern is to call the functions that *DON'T* t= ake > > the lock _unlocked(). This is what I used in gpiolib-cdev.c or gpio-sim= .c. > > > > I guess both conventions make sense in some way. > > > > Bart > > I don't think I will be doing it just now. We don't use this > convention elsewhere in drivers/gpio/ and we'll have a lot of locking > reworked soon anyway. We may get to it when that is done. > > Bart If there are no objections, I'd like to queue it this week. Bart