Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp900563rwl; Wed, 29 Mar 2023 09:50:10 -0700 (PDT) X-Google-Smtp-Source: AKy350ZuKDrMdE3Vd0W2WgIPXvpK4uZXjzcAr3Zdl2Y0vnlqdcyKzBMxN7mzXqg7SOKXBNBJwzbi X-Received: by 2002:a62:8413:0:b0:624:d72e:e629 with SMTP id k19-20020a628413000000b00624d72ee629mr19217422pfd.8.1680108610395; Wed, 29 Mar 2023 09:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680108610; cv=none; d=google.com; s=arc-20160816; b=e8847o5tvPxt9tfO+FnBpk3XfZh3EtvieX/tC0H2GXfV0DfCvPxMwSO0NGon5YKPzV 1/6E2fo0/dHMQHiCrv2SJlUST8gqZkuXdOWFkVI4B7ky8heXfX8mD7ImnThdVYlL66C5 NS3WDp/BqNGrlBK4igtfb7HyK3pIXpoV+aXzg3dRbCgF9ZtXzbL8cZRJ94os6Axt8oc4 7z/5+YBhqbt4e/ETVvuJuJo3MBBU2T80B0YN7HJxSIMSokMTMzwvpH97ozLn0NfXSOlM V5qm63r/aJAIuJi1EXWQCGWQlC2s96ocC0Z4/vG2IAtRvzFtgbjXZo9jRxtSRfenfefJ MbPg== 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-transfer-encoding :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=J61XrP8xpB6kcF0UL45ms8J9snB8FAgB1lrlOuTJE70=; b=zWI7Qd/4lGF2N1Ff+wBQ2vVwSl5LUflxDM/WsIgfLOIOV3QXF1KMBu+Xf+BgQscvSo 9fVJTvjZexWsZYy7DpaKcH8M/I0+oJDu+jIwG86q4irxeuVLqyLJQWRvctWYWF51JcmW giNvLtEaq2BN01bcz1FdTQ4XeB+sQSmQZJY34XxOyDp4G2ZQjdrVP0VA3L9t1eVQEJ4T c9qOmvJt5pvAqshSwt3dXIKAo+d705NlDBeVjt5qq36IzaKGhs+RyQvLCFD+MusjQdWM ibJewZ8GLDZgfg3qpXjIidX3SgBBKnAmnDaTjkyJrCAMwjvGRL6twotxfYI9a6vMGN21 qeWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PykEtgb+; 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 n127-20020a632785000000b00508de5eb602si32689720pgn.311.2023.03.29.09.49.58; Wed, 29 Mar 2023 09:50:10 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PykEtgb+; 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 S230109AbjC2Qby (ORCPT + 99 others); Wed, 29 Mar 2023 12:31:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230173AbjC2Qbj (ORCPT ); Wed, 29 Mar 2023 12:31:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E7526EB3; Wed, 29 Mar 2023 09:31:12 -0700 (PDT) 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 8897BB81E4A; Wed, 29 Mar 2023 16:31:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DD9EC433D2; Wed, 29 Mar 2023 16:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680107469; bh=k3b3Fe0T8t6/PcyzgMQf12MeXwh+Qk1B1rqKQei5AEE=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=PykEtgb+jW+5qbJfga44DjFfiiIN58EAKI5oRPDhsiTR3aVgIN51ES4CIhhhi9Ett 4i96MeY1pSx9OdAAQui+kyz2vis5gSYe1wME4/Dpsqi93pMsHp66H4WIjMt4C2sLtZ PBVJpYucYFfTgnX/XZlpKER0xN5Q/mhrm3/A4+SkEHfd0Wi2d5XOOx1ynZc0WOnswu +e4onW0QuTND/zQI6KLiDA4qNeEM62H+oHvlOostDarDby3m8ZDupPRpIvRv2KxgQn 535sOW8WGQafHrzWparz2CX3pBLVdzx2YJZJ6hFNYo2jglTTwy6MjElmwVq0kIxSCF 7unoKNId+7O1g== Date: Wed, 29 Mar 2023 11:31:07 -0500 From: Bjorn Helgaas To: Xinghui Li Cc: nirmal.patel@linux.intel.com, kbusch@kernel.org, jonathan.derrick@linux.dev, lpieralisi@kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Xinghui Li Subject: Re: [PATCH v4] PCI: vmd: Add the module param to adjust MSI mode Message-ID: <20230329163107.GA3061927@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 Wed, Mar 29, 2023 at 04:57:08PM +0800, Xinghui Li wrote: > On Wed, Mar 29, 2023 at 5:34 AM Bjorn Helgaas wrote: > > It would also be nice to include a hint about why a user would choose > > "on" or "off". What is the performance effect? What sort of I/O > > scenario would lead you to choose "on" vs "off"? > > > Before this patch, I sent the patch named : > PCI: vmd: Do not disable MSI-X remapping in VMD 28C0 controller > (patchwork link: > https://patchwork.kernel.org/project/linux-pci/patch/20221222072603.1175248-1-korantwork@gmail.com/) > We found the 4k rand read's iops could drop 50% if 4 NVMEs were > mounted in one PCIE port with VMD MSI bypass. > I suppose this is because the VMD Controller can aggregate interrupts. > But those test result is so long that I didn't add them to this patch > commit log. > If you believe it is necessary, I will try to add some simple instructions I don't think we need detailed performance numbers, but we need something like: - "msi_remap=off" improves interrupt handling performance by avoiding the VMD MSI-X domain interrupt handler - But "msi_remap=on" is needed when ...? > > ee81ee84f873 ("PCI: vmd: Disable MSI-X remapping when possible") > > suggests that MSI-X remapping (I assume the "msi_remap=on" case): > > > > - Limits the number MSI-X vectors available to child devices to the > > number of VMD MSI-X vectors. > > > > - Reduces interrupt handling performance because child device > > interrupts have to go through the VMD MSI-X domain interrupt > > handler. > > > > So I assume "msi_remap=off" would remove that MSI-X vector limit and > > improve interrupt handling performance? > > > > But obviously there's more to consider because those are both good > > things and if we could do that all the time, we would. So there must > > be cases where we *have* to remap. ee81ee84f873 suggests that not all > > VMD devices support disabling remap. There's also a hint that some > > virt configs require it. > > > I used to just want to disable 28C0's VMD MSI bypass by default. > But Nirmal suggested the current method by adjusting the param. > Because he and other reviewers worry there are some other scenarios we > didn't consider. > Adding a method to adjust VMD'S MSI-X mode is better. This commit log doesn't outline any of those other scenarios, and it doesn't say anything about when "msi_remap=on" or "msi_remap=off" would be necessary or desired, so I have no idea how users are supposed to figure out whether or not to use this parameter. > > This patch doesn't enforce either of those things. What happens if > > the user gets it wrong? > > If I am wrong, please feel free to correct me at any time. > I place the "vmd_config_msi_remap_param" that is VMD MSI-X's mode > param configuring helper front > "vmd_enable_domain". So, It will not change the logic disabling > remapping from ee81ee84f873, such as > "Currently MSI remapping must be enabled in guest passthrough mode". > So, if the user config the wrong type, it will not work, and they can > find it by dmesg. That's kind of a problem. I'm not in favor of something failing and the user having to debug it via dmesg. That causes user frustration and problem reports. I don't know what "guest passthrough mode" is. Can you detect that automatically? Bjorn