Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3282450ybv; Mon, 24 Feb 2020 22:11:08 -0800 (PST) X-Google-Smtp-Source: APXvYqwN0QxzzGg4DNNslasQ/FX+LjXCw7turFWHkgTw6zS7qACyg9/qrOc1OPUAqD/YRb8cyqeH X-Received: by 2002:a9d:64b:: with SMTP id 69mr41558205otn.237.1582611068213; Mon, 24 Feb 2020 22:11:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582611068; cv=none; d=google.com; s=arc-20160816; b=C/0MFlyHJNdsl69kvFblnhZfMIW93u058nnAdEpM1sZNB7at0E7QVg9uc9Oe5wQI46 8lCtg77yOQZmCDFAaPI9JhJH7lZxFRlgNW+rsXKdSAYIE9VB54NijxitENw172Sx/e8y qRsUwX+0jt/+5zP8Zp/HND2C5lUpAwUjj0Z7InmaLBxe9mkmvWwhXieOkGCJauZyktmC 7E7jPY/hcm2N2CdkCUBKRhzHY0cz++eKM2PDqxdGt1ujP583mLbUngpoqISukLmkT1Sg iW478aPg3No5ntUkUq3vSVxtvp8rvCxw2ujlW6EdRVxsf+uSs+huoZ5fN2XCI6F9OFAT wHWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=0IoUDI0r2nKt/KLH2gl0wTcdvg0oCDvDokn7okiLyHg=; b=QyiB8K6K2vO+4OCcsFyAnj+qwzy9eZkmwD0Upxk+yosYhMecwxlRW3g8P/OXddVYU2 r0purKyA5nDKGsIU5O6XNIhHM4M9Mq10PASewgCYX5oYBGe5eqGeg0ybzjrZ8L/x2kwg u8JKpixT2Zq7WSCNdx/r/8Re5NJjsCD/lYQrVsfZYozNmkDaglpTQ5suiP5gFAtrDDWB rp0n/eGU6nmQII8KQXLY4sxXo9LZDfqjBUwcY7qqzGsGjq93zOcOy9rppwF8HfeiBQE/ R4clfy7MQ4Cr0d+rncsuNmbyrFusA9mAqqE5O7rdxwfaFWSVoqkWe7qJlNN1XNYy9bKl KRuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R4Kf+dOo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k3si7670194otn.288.2020.02.24.22.10.56; Mon, 24 Feb 2020 22:11:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R4Kf+dOo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728846AbgBYGJZ (ORCPT + 99 others); Tue, 25 Feb 2020 01:09:25 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:20487 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726019AbgBYGJZ (ORCPT ); Tue, 25 Feb 2020 01:09:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582610964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0IoUDI0r2nKt/KLH2gl0wTcdvg0oCDvDokn7okiLyHg=; b=R4Kf+dOoIrZfig0mugI2di0BsODBOtZtaylwB/xm/qf3avyTjlsveNw53EQoQv4W2cg9of QdTKyFpouMVjtJlUu+iQvv3Wv4pcHznNe7TQPkYnxYDYSIxOLE5B8sn4iAD3hxytv9ipfk I1AxJymjBV4hsiENLb+V79YWeU4BhMQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-323-KEF-yYO0OPWKOZhO7cB7og-1; Tue, 25 Feb 2020 01:09:20 -0500 X-MC-Unique: KEF-yYO0OPWKOZhO7cB7og-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1FB92107ACC5; Tue, 25 Feb 2020 06:09:19 +0000 (UTC) Received: from [10.72.13.170] (ovpn-13-170.pek2.redhat.com [10.72.13.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA7141001902; Tue, 25 Feb 2020 06:09:09 +0000 (UTC) Subject: Re: [PATCH v2 0/7] vfio/pci: SR-IOV support To: "Tian, Kevin" , Alex Williamson , "kvm@vger.kernel.org" Cc: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "dev@dpdk.org" , "mtosatti@redhat.com" , "thomas@monjalon.net" , "bluca@debian.org" , "jerinjacobk@gmail.com" , "Richardson, Bruce" , "cohuck@redhat.com" References: <158213716959.17090.8399427017403507114.stgit@gimli.home> From: Jason Wang Message-ID: Date: Tue, 25 Feb 2020 14:09:07 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/2/25 =E4=B8=8A=E5=8D=8810:33, Tian, Kevin wrote: >> From: Alex Williamson >> Sent: Thursday, February 20, 2020 2:54 AM >> >> Changes since v1 are primarily to patch 3/7 where the commit log is >> rewritten, along with option parsing and failure logging based on >> upstream discussions. The primary user visible difference is that >> option parsing is now much more strict. If a vf_token option is >> provided that cannot be used, we generate an error. As a result of >> this, opening a PF with a vf_token option will serve as a mechanism of >> setting the vf_token. This seems like a more user friendly API than >> the alternative of sometimes requiring the option (VFs in use) and >> sometimes rejecting it, and upholds our desire that the option is >> always either used or rejected. >> >> This also means that the VFIO_DEVICE_FEATURE ioctl is not the only >> means of setting the VF token, which might call into question whether >> we absolutely need this new ioctl. Currently I'm keeping it because I >> can imagine use cases, for example if a hypervisor were to support >> SR-IOV, the PF device might be opened without consideration for a VF >> token and we'd require the hypservisor to close and re-open the PF in >> order to set a known VF token, which is impractical. >> >> Series overview (same as provided with v1): > Thanks for doing this! > >> The synopsis of this series is that we have an ongoing desire to drive >> PCIe SR-IOV PFs from userspace with VFIO. There's an immediate need >> for this with DPDK drivers and potentially interesting future use > Can you provide a link to the DPDK discussion? > >> cases in virtualization. We've been reluctant to add this support >> previously due to the dependency and trust relationship between the >> VF device and PF driver. Minimally the PF driver can induce a denial >> of service to the VF, but depending on the specific implementation, >> the PF driver might also be responsible for moving data between VFs >> or have direct access to the state of the VF, including data or state >> otherwise private to the VF or VF driver. > Just a loud thinking. While the motivation of VF token sounds reasonabl= e > to me, I'm curious why the same concern is not raised in other usages. > For example, there is no such design in virtio framework, where the > virtio device could also be restarted, putting in separate process (vho= st-user), > and even in separate VM (virtio-vhost-user), etc. AFAIK, the restart could only be triggered by either VM or qemu. But=20 yes, the datapath could be offloaded. But I'm not sure introducing another dedicated mechanism is better than=20 using the exist generic POSIX mechanism to make sure the connection=20 (AF_UINX) is secure. > Of course the para- > virtualized attribute of virtio implies some degree of trust, but as yo= u > mentioned many SR-IOV implementations support VF->PF communication > which also implies some level of trust. It's perfectly fine if VFIO jus= t tries > to do better than other sub-systems, but knowing how other people > tackle the similar problem may make the whole picture clearer. =F0=9F=98= =8A > > +Jason. I'm not quite sure e.g allowing userspace PF driver with kernel VF=20 driver would not break the assumption of kernel security model. At least=20 we should forbid a unprivileged PF driver running in userspace. Thanks