Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7460626rwb; Tue, 6 Dec 2022 06:09:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf5zkbJJfcTafK/1L0K/yS8vdcewlIlW+NOhGLOsgRv6Pe33+gaRT9i/tA51ldizYOHofkFJ X-Received: by 2002:a17:906:a050:b0:78d:47c8:e80f with SMTP id bg16-20020a170906a05000b0078d47c8e80fmr4383786ejb.700.1670335759315; Tue, 06 Dec 2022 06:09:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670335759; cv=none; d=google.com; s=arc-20160816; b=b1V93QpXvSgSDKwJ2Q/dPXVcc+lb4MbWMQbiGNbOcUMMj4N8HjD5cOAvMjZGBm63qs x6T8Crs4yzXh0NoqtNjsNHvE82kwiOw6Gzd65CK8Q8NlAAlx1DXu51RzOeIHeZ4eh7A2 5fMLg8Rwc/92tgkiTzsBYAiy1fwVylaxH38cLCZoDf/jna11gbL8ehf98oCLJk7WBst9 BVJKS2aAmR4A7/oLL1jKbOFwO6jr7WXR/JcSP6726LbbnAak7436ka9+ZkC4Lw5tP8hH VI82WzhA8dB7skYplWulfgcnvYHjcA7CG/LJ6+Y6Ec12BYXKVrYS+XdYCNiWAn7f/vUw /AEA== 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=aSgRaVWR8iZWB72ixyTeWX7EBz8XGfKB0f733gCuC0Y=; b=l6ipdwHk+O1Y+aeERYDDpSQ+RzE1j/PdsTjBeBxbqo34CmqKXpGI77lni0+iECIiH6 XWTpqfFL45IfSfDqJW/cZPE0y4S7AtlHEwFSSdfmvKxtfBIY/SXoGehzB56dom+I2lxR yB5VAnQ4C8qDQDCLe3VBdQL521Qvz48x5ufsu9vsxAnvXV3itUOs0s3PJmi/Aq3nPMTL hllRRzPRZXA/8vy2bzhiST6+ivL4VKDEgKH8DsBakUUYk/JjJFob82qf1YcEMTd5j4Sv Bo/oxXgeIpe06PEBRDHRU1NkcO8F5IMSOXTg/MUcK58iUMjFVy1KHbnIVJIpEEqYh0mG D9Rw== 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 sd8-20020a1709076e0800b007ae43ee86aesi14749790ejc.69.2022.12.06.06.08.59; Tue, 06 Dec 2022 06:09:19 -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; 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 S233978AbiLFN6X (ORCPT + 79 others); Tue, 6 Dec 2022 08:58:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230093AbiLFN6V (ORCPT ); Tue, 6 Dec 2022 08:58:21 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0881E203; Tue, 6 Dec 2022 05:58:19 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id DF0C268B05; Tue, 6 Dec 2022 14:58:10 +0100 (CET) Date: Tue, 6 Dec 2022 14:58:10 +0100 From: Christoph Hellwig To: Jason Gunthorpe Cc: Christoph Hellwig , Lei Rao , kbusch@kernel.org, axboe@fb.com, kch@nvidia.com, sagi@grimberg.me, alex.williamson@redhat.com, cohuck@redhat.com, yishaih@nvidia.com, shameerali.kolothum.thodi@huawei.com, kevin.tian@intel.com, mjrosato@linux.ibm.com, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, kvm@vger.kernel.org, eddie.dong@intel.com, yadong.li@intel.com, yi.l.liu@intel.com, Konrad.wilk@oracle.com, stephen@eideticom.com, hang.yuan@intel.com Subject: Re: [RFC PATCH 1/5] nvme-pci: add function nvme_submit_vf_cmd to issue admin commands for VF driver. Message-ID: <20221206135810.GA27689@lst.de> References: <20221206055816.292304-1-lei.rao@intel.com> <20221206055816.292304-2-lei.rao@intel.com> <20221206061940.GA6595@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 On Tue, Dec 06, 2022 at 09:44:08AM -0400, Jason Gunthorpe wrote: > Not speaking to NVMe - but this driver is clearly copying mlx5's live > migration driver, almost completely - including this basic function. Maybe that's not a good idea in an NVMe environment, and maybe that should have talked to the standards committee before spending their time on cargo cult engineering. Most importantly NVMe is very quiet on the relationship between VFs and PFs, and there is no way to guarantee that a PF is, at the NVMe level, much in control of a VF at all. In other words this concept really badly breaks NVMe abstractions. > Thus, mxl5 has the same sort of design where the VF VFIO driver > reaches into the PF kernel driver and asks the PF driver to perform > some commands targeting the PF's own VFs. The DMA is then done using > the RID of the PF, and reaches the kernel owned iommu_domain of the > PF. This way the entire operation is secure aginst meddling by the > guest. And the works for you because you have a clearly defined relationship. In NVMe we do not have this. We'd either need to define a way to query that relationship or find another way to deal with the problem. But in doubt the best design would be to drive VF live migration entirely from the PF, turn the lookup from controlled function to controlling function upside down, that is a list of controlled functions (which could very well be, and in some designs are, additional PFs and not VFs) by controlling function. In fact NVMe already has that list in it's architecture with the "Secondary Controller List".