Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp682543ybv; Thu, 13 Feb 2020 07:41:55 -0800 (PST) X-Google-Smtp-Source: APXvYqxAOefujmF63EsYAaPdolhE4UotF0gAVeaDX7KqA+UYjfNmStIyRAQMmIbwxDkD2USKuIKY X-Received: by 2002:aca:f354:: with SMTP id r81mr3198809oih.90.1581608515207; Thu, 13 Feb 2020 07:41:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581608515; cv=none; d=google.com; s=arc-20160816; b=Mh0ZZznGbLSEdZeuOZxrywM5FvD731N3/4ms7LtDCVMm4O3zloXchRsIO+uwd/2jJu BgZ5W4Mm1lhtUQrs6VEC47Ag/Qkg0a2H4/ONd9NRj0YKe+UYu/OQJn1yQqJ68DY2Ac0F XDvRS6PZ0wdm+K3P0dC6mOf25yr3P2rqTm70Rfmt8FaLLIrqINkK6feQanU4cOHl3Ojt hs2mr6KH+rh1X7L1HemoUS6DYlF0frIr/9lI9G8nkjvcxez3O9HF4HqZbZf6kMMyIgmJ nfwRhFd2zaCcZipltSYZzm+ZEiupnpwQ/BmaUg3kii9aXDwye3ERj+Mm2UP2BxteQuIF SzLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=+ek7ovueQ1Zw26uD1wE6yB4d2TtRDHlkQXfHHqxBETA=; b=wcSY8uuf6gDgFX8pVwhAd7tJRKW4sC8o28tan9aflGu6etIHLgJvGXlcpJF7cdnlcs 7RnKc1VVP6sAt5sEf1ocd+PD1w2gsiVmwDjxjT7cETB6fAwY3/2CVTkaBErSA9k+ug7v D8fzpzCfgNpkHGIvXgCVYg8D7/h+l83k2dQLvqTh8SAZ/Ro5m9XVunoNTyojEGPO8VSp BwZ47MnnHgPwImFqlzZmNZXH97UK7KxxS7R7EdCqACm4eQAE8C/x6lKCaR2l4b8HRWlk JTHp86+3Pw7XuhVV5T7UiFX5IE8MVvw1FzSzmV/TvojW2Jva3v2TdvrDlcsI8cAYqz2+ WNNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="M9ZZ/+2R"; 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 h64si1272980oif.215.2020.02.13.07.41.42; Thu, 13 Feb 2020 07:41:55 -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="M9ZZ/+2R"; 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 S1729482AbgBMPlX (ORCPT + 99 others); Thu, 13 Feb 2020 10:41:23 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:29040 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729171AbgBMPlS (ORCPT ); Thu, 13 Feb 2020 10:41:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581608476; 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=+ek7ovueQ1Zw26uD1wE6yB4d2TtRDHlkQXfHHqxBETA=; b=M9ZZ/+2RA8byGXc2LRefLzUFeSzCIKDVa+St08NkNALS/D9Qgd3w+CU+76DW7l9F/Nsu+J VurU6yHRwXHSH5G4sS5CvyuPV1Pae6ukqFhyKX7N+3sK4xOolb68UNVoy0pYi0DjSeAW8q vqx9rPCSO3MMQ/Ozibjg9ieKiLVfi7U= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-332-6LzdxEqhMmixyCCeVboJcA-1; Thu, 13 Feb 2020 10:41:15 -0500 X-MC-Unique: 6LzdxEqhMmixyCCeVboJcA-1 Received: by mail-qt1-f199.google.com with SMTP id z25so3584268qto.8 for ; Thu, 13 Feb 2020 07:41:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=+ek7ovueQ1Zw26uD1wE6yB4d2TtRDHlkQXfHHqxBETA=; b=m7ikJzUhF7ZTHRXBAnTxMckIIMcO3PZF+km5yzAV6TNkHkcrCymzj95cKCj+G7zaXL vgt2IcD3Jna0Ix+jTJ4sde9ozOsUt1C+G78DusBCWYJvulx3IIDAgLnVUv59sziK5lVa ZziHkiC+QFnEl1JuE6LtugUZ2YYjf16l8yFoZ1g0wb9RSAAYEK334TPnPXktRVeke4q+ nr+Y+5GStsNdMP/XVjAY/G5VNuIMQiHerktJ5uoPEyg3QS5YhGR/lMyB34f8+T/bFY/J Eiiij5XytKYyv6k3I4QxXfoSWnuyI6HxBw7sIu73AhmH/PbpqLKmplQb1m1iTZfTWEgJ qOsA== X-Gm-Message-State: APjAAAXOskw+FWVt2X7+DcMou0LtS6OiyyPuVw5jFIMjS20/8nFW5ZEi 4swnXhRVSaW/MrQgrKjiA84Y/YXJsTJicupIDjBBii212FHVc7wmBhD8SAoQYVmVtwjp+DX9Ywq dL9TxmOztnr/VYHPRRmkWXGn1 X-Received: by 2002:ac8:73c7:: with SMTP id v7mr12288255qtp.269.1581608474719; Thu, 13 Feb 2020 07:41:14 -0800 (PST) X-Received: by 2002:ac8:73c7:: with SMTP id v7mr12288206qtp.269.1581608474439; Thu, 13 Feb 2020 07:41:14 -0800 (PST) Received: from redhat.com (bzq-79-176-28-95.red.bezeqint.net. [79.176.28.95]) by smtp.gmail.com with ESMTPSA id x41sm1711309qtj.52.2020.02.13.07.41.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Feb 2020 07:41:13 -0800 (PST) Date: Thu, 13 Feb 2020 10:41:06 -0500 From: "Michael S. Tsirkin" To: Jason Gunthorpe Cc: Jason Wang , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, tiwei.bie@intel.com, maxime.coquelin@redhat.com, cunming.liang@intel.com, zhihong.wang@intel.com, rob.miller@broadcom.com, xiao.w.wang@intel.com, haotian.wang@sifive.com, lingshan.zhu@intel.com, eperezma@redhat.com, lulu@redhat.com, parav@mellanox.com, kevin.tian@intel.com, stefanha@redhat.com, rdunlap@infradead.org, hch@infradead.org, aadam@redhat.com, jiri@mellanox.com, shahafs@mellanox.com, hanand@xilinx.com, mhabets@solarflare.com Subject: Re: [PATCH V2 3/5] vDPA: introduce vDPA bus Message-ID: <20200213103714-mutt-send-email-mst@kernel.org> References: <20200210035608.10002-1-jasowang@redhat.com> <20200210035608.10002-4-jasowang@redhat.com> <20200211134746.GI4271@mellanox.com> <20200212125108.GS4271@mellanox.com> <12775659-1589-39e4-e344-b7a2c792b0f3@redhat.com> <20200213134128.GV4271@mellanox.com> <20200213150542.GW4271@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200213150542.GW4271@mellanox.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 13, 2020 at 11:05:42AM -0400, Jason Gunthorpe wrote: > On Thu, Feb 13, 2020 at 10:58:44PM +0800, Jason Wang wrote: > > > > On 2020/2/13 下午9:41, Jason Gunthorpe wrote: > > > On Thu, Feb 13, 2020 at 11:34:10AM +0800, Jason Wang wrote: > > > > > > > > You have dev, type or > > > > > class to choose from. Type is rarely used and doesn't seem to be used > > > > > by vdpa, so class seems the right choice > > > > > > > > > > Jason > > > > Yes, but my understanding is class and bus are mutually exclusive. So we > > > > can't add a class to a device which is already attached on a bus. > > > While I suppose there are variations, typically 'class' devices are > > > user facing things and 'bus' devices are internal facing (ie like a > > > PCI device) > > > > > > Though all vDPA devices have the same programming interface, but the > > semantic is different. So it looks to me that use bus complies what > > class.rst said: > > > > " > > > > Each device class defines a set of semantics and a programming interface > > that devices of that class adhere to. Device drivers are the > > implementation of that programming interface for a particular device on > > a particular bus. > > > > " > > Here we are talking about the /dev/XX node that provides the > programming interface. All the vdpa devices have the same basic > chardev interface and discover any semantic variations 'in band' > > > > So why is this using a bus? VDPA is a user facing object, so the > > > driver should create a class vhost_vdpa device directly, and that > > > driver should live in the drivers/vhost/ directory. > > > > This is because we want vDPA to be generic for being used by different > > drivers which is not limited to vhost-vdpa. E.g in this series, it allows > > vDPA to be used by kernel virtio drivers. And in the future, we will > > probably introduce more drivers in the future. > > I don't see how that connects with using a bus. > > Every class of virtio traffic is going to need a special HW driver to > enable VDPA, that special driver can create the correct vhost side > class device. That's just a ton of useless code duplication, and a good chance to have minor variations in implementations confusing userspace. Instead, each device implement the same interface, and then vhost sits on top. > > > For the PCI VF case this driver would bind to a PCI device like > > > everything else > > > > > > For our future SF/ADI cases the driver would bind to some > > > SF/ADI/whatever device on a bus. > > > > All these driver will still be bound to their own bus (PCI or other). And > > what the driver needs is to present a vDPA device to virtual vDPA bus on > > top. > > Again, I can't see any reason to inject a 'vdpa virtual bus' on > top. That seems like mis-using the driver core. > > Jason That bus is exactly what Greg KH proposed. There are other ways to solve this I guess but this bikeshedding is getting tiring. Come on it's an internal kernel interface, if we feel it was a wrong direction to take we can change our minds later. Main thing is getting UAPI right. -- MST