Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1448086rdg; Sat, 12 Aug 2023 01:23:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHL75P2ElCJPsFrlsi4PpDI6qEVHnaDmXz9sOew3kakdBJF5Bo7Npe+aOpzUmzFU6NcRm5V X-Received: by 2002:a05:6a20:158e:b0:13e:7d3:61d1 with SMTP id h14-20020a056a20158e00b0013e07d361d1mr6191615pzj.12.1691828611533; Sat, 12 Aug 2023 01:23:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691828611; cv=none; d=google.com; s=arc-20160816; b=fUqw2yU8vhQ4QcJvP5RD8lQ0HJphBOaU3GCecqbC9Q1gx6qqXSC+rgW4QznEY12PJr BBmK5QdSgJS+UcDfxYB1Hi0lxTtFDLCGGiaqypw/o9LlagiI04TBoXPgBfqYlD9ywNlu Ytuukx0+XCTX1xmspm0xk35sT7e7CX6i2eqvSJAhwnlYDL4sNjlicVJ9DKLuBQCLyN8H +KatIsz/fllHgB4Bse11ax+gfL1g/n55bBXyOgMAf7F9Ri3e2H69gx6jZfLi2bTxiG/T WSTzXvfwZvNoYssuR8chES08vEAlxhSkwbz6ov1idUsalcEpBood0TIKnFvHHUv+7wH2 kMGQ== 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=3N7QK4waRk+OMSd8xeC9AoxIrjeLIbnWn/cEG786N/w=; fh=vt4nS14RXAem9QqVM48QhImxKJ8N/wowxrgqqZeuWns=; b=eufv04BpW/D2ZRGdbr+IxUQJtORCEoP+x4b9RQRSm3KWlmkBBVEfooS+nAg3pAT5mY U4uJlL40mT4C6Z2NcM1PmArCG5u71N8VOaaJt4wRccozdRfeMcpB7/2gzH+Ang0bjmhz 64pQ0fOL2xZiomxaQKVrJPPBbX6cGvrocRAiam+kmG9YtsnUwd4BZhQNA1n9kekkYdq3 7IXSbGEKI6uDy4LhtuipjLiY6ZHjuDTrgkWL/LKd1EkRmCu4mzpR7NenS2K2VV0ZWYNf vAmUyCWLmaDjpAE1bRfeOml4F0/1ddBf81BhuAMeMA4Gg00lnPSTEdf/edSHiMbvuPks DR3w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c4-20020a63ea04000000b0056482047ae0si4486165pgi.723.2023.08.12.01.23.18; Sat, 12 Aug 2023 01:23:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235541AbjHLIP0 (ORCPT + 99 others); Sat, 12 Aug 2023 04:15:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbjHLIPZ (ORCPT ); Sat, 12 Aug 2023 04:15:25 -0400 Received: from bmailout3.hostsharing.net (bmailout3.hostsharing.net [176.9.242.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83447CE; Sat, 12 Aug 2023 01:15:28 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL Global TLS RSA4096 SHA256 2022 CA1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id E7D42100DCEFD; Sat, 12 Aug 2023 10:15:26 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id AA336EA35; Sat, 12 Aug 2023 10:15:26 +0200 (CEST) Date: Sat, 12 Aug 2023 10:15:26 +0200 From: Lukas Wunner To: Alistair Francis Cc: bhelgaas@google.com, linux-pci@vger.kernel.org, Jonathan.Cameron@huawei.com, alex.williamson@redhat.com, christian.koenig@amd.com, kch@nvidia.com, gregkh@linuxfoundation.org, logang@deltatee.com, linux-kernel@vger.kernel.org, Alistair Francis Subject: Re: [PATCH v3] PCI/DOE: Expose the DOE protocols via sysfs Message-ID: <20230812081526.GC9469@wunner.de> References: <20230809232851.1004023-1-alistair.francis@wdc.com> <20230810073457.GA26246@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_NONE autolearn=no 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 On Thu, Aug 10, 2023 at 11:34:11AM -0400, Alistair Francis wrote: > On Thu, Aug 10, 2023 at 3:34???AM Lukas Wunner wrote: > > On Wed, Aug 09, 2023 at 07:28:51PM -0400, Alistair Francis wrote: > > > --- a/drivers/pci/pci-sysfs.c > > > +++ b/drivers/pci/pci-sysfs.c > > > @@ -1226,6 +1227,12 @@ static int pci_create_resource_files(struct pci_dev *pdev) > > > int i; > > > int retval; > > > > > > +#ifdef CONFIG_PCI_DOE > > > + retval = doe_sysfs_init(pdev); > > > + if (retval) > > > + return retval; > > > +#endif > > > + > > > > The preferred way to expose PCI sysfs attributes nowadays is to add them > > to pci_dev_attr_groups[] and use the ->is_visible callback to check > > whether they're applicable to a particular pci_dev. The alternative > > via pci_create_resource_files() has race conditions which I think > > still haven't been fixed. Bjorn recommended the ->is_visible approach > > in response to the most recent attempt to fix the race: > > > > https://lore.kernel.org/linux-pci/20230427161458.GA249886@bhelgaas/ > > The is_visible doen't seem to work in this case. > > AFAIK is_visible only applies to the attributes under the group. Which > means that every PCIe device will see a `doe_protos` directory, no > matter if DOE is supported. internal_create_group() in fs/sysfs/group.c does this: if (grp->name) { ... kn = kernfs_create_dir_ns(kobj->sd, grp->name, ... So I'm under the impression that if you set the ->name member of struct attribute_group, the attributes in that group appear under a directory of that name. In fact, the kernel-doc for struct attribute_group claims as much: * struct attribute_group - data structure used to declare an attribute group. * @name: Optional: Attribute group name * If specified, the attribute group will be created in * a new subdirectory with this name. So I don't quite understand why you think that "every PCIe device will see a `doe_protos` directory, no matter if DOE is supported"? Am I missing something? Thanks, Lukas