Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2800935rwb; Fri, 11 Nov 2022 15:16:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf7tSjSSaNsqQr43bEbdJgvWHzr8+GeuPAfM4TjQ6wAXXapI+bS3ru+h1TpU560eii3OPMXg X-Received: by 2002:a17:902:ebc2:b0:176:a880:6d72 with SMTP id p2-20020a170902ebc200b00176a8806d72mr4563830plg.127.1668208613327; Fri, 11 Nov 2022 15:16:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668208613; cv=none; d=google.com; s=arc-20160816; b=lzii1fB0gIELiZkRYOVBFc3QrRum5JHJ1XKeZBo3qzTKtdI6clThrCAEOzDqhmlYD9 tw0akOxL7meOaTLGVMnHe+d5gBdamJnp1ffXXV15MTH5qnTN6WJ6ESVy1cKsKiD74Yhv xlKMdSU5HqpHLb9Z68zWvgBF6FI+O+3XFf9ZiD52GCUpucfwPnqzS/pemQLfSiT8lnpk F/6tcsyE9k4df9wo2avM+RlstYmZbmAxeVBZQ1kXB1x5HSMpE1s3P85HCQ98MkcQmnxH 4kgc/9QOP/r2u0EFO5aHHuNvsLVIbny6A1wFZIgMor4XQWhVFNm7Fjs0IuR4+CLvJIJC q3dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=SGgGlbfdurMC2pBRKArtAeovhNpLe8YLjfuZ9AY093Q=; b=PDZzBxGSOWa4afKQ74jzciCQAgAa9wvI3G1i6qWvLRPMTheCr22BoVqqYZmmA1wtHx Y98IUT4pdf+49IjLOyaGgMLP8Jbi05PHCngJhRzN1C/gQ+THoWHdTeypXLjJyQQs9lZa X+24dIOvhF5U5QKKHZYBU3W31Y5m/+ORjwxe0WLIkztW13YOlHON46qR+XhyVMjOJtDk i95dm9xyrAXVjnDEeuTPKQR9pQbZw3vggeejZEyxeShieK7pMCrdOEtfB5iVc1uexr0I 8AViKzzd54V2xRpqUNmd2kCXcZhtNDGl/VDOPBVVLi6rXO8e4FAPHSRNWENF1FmjNjAm L33Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Z2T/nebN"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h69-20020a638348000000b0046f56372127si3241011pge.468.2022.11.11.15.16.41; Fri, 11 Nov 2022 15:16:53 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Z2T/nebN"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233900AbiKKXHK (ORCPT + 90 others); Fri, 11 Nov 2022 18:07:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232825AbiKKXHI (ORCPT ); Fri, 11 Nov 2022 18:07:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A869A10043; Fri, 11 Nov 2022 15:07:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A186B8280A; Fri, 11 Nov 2022 23:07:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE5A9C433C1; Fri, 11 Nov 2022 23:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668208025; bh=AtyavD70yq8p5n3eMQenR0qcYb2AOclvoplL63PZfxg=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Z2T/nebNripLE2jgqC4NPNq7dEYBUxdPRp35UBsyyxz17ASisnasE89B6QgfLHwr5 X5ifsCBsEiqTqgKLNRQr7RzDvrZfZkvkMNsRNM78n0xwcq9ZoKYofUfjMNXxZPrDAY 3ootNH6aE+kUEYywHNfoB5K5VCC9pumOJkI0PFVHOUu38LvKUtkuzGxvP5+wqWC4Zf YNbydP7OMkKDlW5DqbnLxDdBhtoJG5YJrJ/IWFEz+sGP/D6ZSUlWpRCywMXJBAGsig 45eAyckmQWt8KCuSgeU3RcFCtcgYk+rcRwmfUTDXcjq4jUQDFJwrqvj5nMCao/HpuP yTwB+tKo1+8Pg== Date: Fri, 11 Nov 2022 17:07:03 -0600 From: Bjorn Helgaas To: "Longpeng(Mike)" Cc: bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, jianjay.zhou@huawei.com, zhuangshengen@huawei.com, arei.gonglei@huawei.com, yechuan@huawei.com, huangzhichao@huawei.com, xiehong@huawei.com Subject: Re: [RFC 0/4] pci/sriov: support VFs dynamic addition Message-ID: <20221111230703.GA759162@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221111142722.1172-1-longpeng2@huawei.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Fri, Nov 11, 2022 at 10:27:18PM +0800, Longpeng(Mike) wrote: > From: Longpeng > > We can enable SRIOV and add VFs by /sys/bus/pci/devices/..../sriov_numvfs, but > this operation needs to spend lots of time if there has a large amount of VFs. > > For example, if the machine has 10 PFs and 250 VFs per-PF, enable all the VFs > concurrently would cost about 200-250ms. However most of them are not need to be > used at the moment, so we can enable SRIOV first but add VFs on demand. > > This series introduces two interfaces: > 1. sriov_numvfs_no_scan: enable SRIOV without add the VFs. > 2. sriov_scan_vf_id: add a specific VF. > > Longpeng (4): > pci/sriov: extract sriov_numvfs common helper > pci/sriov: add vf_bitmap to mark the vf id allocation > pci/sriov: add sriov_numfs_no_scan interface > pci/sriov: add sriov_scan_vf_id interface When you respond to Leon's questions, please also spend a little time to look at the iov.c history and coding style and follow it, so we don't have to waste time commenting on or fixing trivial things. For example, there are no previous subject lines for that file that start with "pci/sriov". Don't make up a new prefix; use what's been done in the past. And follow the style of capitalizing the first word after the prefix. There are a few comments that look like they are more than 80 columns. Again unlike everything else in the file. The PCIe spec spells it "SR-IOV", not "sriov". Do the same in your commit logs and comments. Capitalize "VF" consistently. I see "VF" and "vf" used randomly. Sysfs changes require documention updates, e.g., in Documentation/ABI/testing/sysfs-bus-pci.