Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1195283pxv; Thu, 1 Jul 2021 20:27:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDM5wOwvbn2tjiMIvFGvBlMxI44g/R9l2/zLCXeCN6z6O3OaXnseRVcIm5dTJSFJQyRdRT X-Received: by 2002:a05:6402:b7b:: with SMTP id cb27mr3937145edb.73.1625196444255; Thu, 01 Jul 2021 20:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625196444; cv=none; d=google.com; s=arc-20160816; b=wMWXTU9oToNY2VgSOMHG9WlXWyEnqFl3JOC1ww5xLledvYlcnyeu0pTC3/DwIauPDN 4xsNCUL87IeGu34/luxA/Y8va5uZ6JoytpBmDyMxXdjf4F6NC9pV4+TiPe8XrgHeIVw7 NlHOJqhEwSdO68xQcQPMcrR5PnkgqWHVLLBClpmIv+hYUJJKGB7z0KabLr3+6+i0HL7X Cjv2S2TNUnNdpIpneDa0lDSGrNzmfNV9CzVaWQTKyrYmWVRaoGF90BjGS37Gktvr3z7h qtF6WE/IE1zF3/ds6Wd7EQs+NAIr4APz8U+ie0VGyCWnw2HnNmBvtSlexdLVqHvHexL0 9ufA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=KnDTUBO/qel2LJGKzNIBMBJoNluIIwfxXdRX1zb5ugw=; b=xCvtZDOIgXFsUVIJP8svjLB62sxb/4X8HU2VklQnOltF1eAuVLxNHOdRn78QPbEADD UsyqkDP8YnEA29bjUaBYYaARWy6GsdvzWX9Yni40G4X1DcoB6VgwoXUGEBLuvJ2/aJQ8 r5x2hEovS+tXICGfAlqdJoHuXtoktCl/Xvnl9HSwbMPOUMzLsx6C8t967649Tob73EVW /dMsy5V495d0jEJmXqhxVhCuNZ4gBMlvC1PUxn2d/4tR8tSbvgJQlct2Cmite9esYbE8 KXAT1OTS3RdBaJqxdKW31gv5kcHeK/8x6wSVkbwwECwilk1YKr8KfVeLA/aFw/0HZjFA VtIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BwKbchla; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id cz9si1700082edb.398.2021.07.01.20.27.00; Thu, 01 Jul 2021 20:27:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BwKbchla; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S234848AbhGBD17 (ORCPT + 99 others); Thu, 1 Jul 2021 23:27:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60190 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234868AbhGBD16 (ORCPT ); Thu, 1 Jul 2021 23:27:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625196327; 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=KnDTUBO/qel2LJGKzNIBMBJoNluIIwfxXdRX1zb5ugw=; b=BwKbchlaUmuikYl4oojjCU4TUBykBYIj94wm8Id2MfOokQ1awVY7JBjvziP5icaTabCvMT CgrBAzf5Si9GkWvfOm5RgaEvrc1mH7pZnNipIyX+XnrrIAFUkVaKIepqxKuNnDmMBzZ6IF S5Cw+ulDyFrUAQGMoCgH6A7Yt8YIRe8= Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-356-gbjhwzQKNzu2692b9YPDkw-1; Thu, 01 Jul 2021 23:25:26 -0400 X-MC-Unique: gbjhwzQKNzu2692b9YPDkw-1 Received: by mail-pl1-f197.google.com with SMTP id d1-20020a1709027281b0290112c70b86f1so3895615pll.12 for ; Thu, 01 Jul 2021 20:25:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=KnDTUBO/qel2LJGKzNIBMBJoNluIIwfxXdRX1zb5ugw=; b=Mn/oNttJVB1wsFYbib5NKa8Y2kUhH+nQk2QGXMgEST/ZmD72btv+x9whGYxmEM9fab lvJBvjW1+tzRHaZWZ6KyWTfr4ret1jbz+KxTCIBAAqG7VsGznGUx9dzUnR7ZsUbT9LdG NSVgGfXE0z4FSMet76Ddh+RHeUYCGlFZHbKcEgFdTuoC1legflFHPLRkhhrwvpKau4Vs XC5BfCwAyC0p7eR/0QJ4nV3HQPq1ycwYb6ZZr96Fh5FEbJBkyq9Ty/1NVyaGMqvsY1OQ okuAF18kjNHfRugdFyUZSHN0SZmQSL2obFGc7lhGo5xKVc7yl89oPqKnvHEWfN/B3XvE 0FYQ== X-Gm-Message-State: AOAM533ctJSPfni5Yw6Chen5eR8Xb+B/IPMcn3dYjcIUBHFDgLTaW/Rb EtkEgbPlgtLLiWZlOsK/x6rbE49dP4HFX7YtSEUB8xddE3z/3hFCQD6jyD68GT1D/FHOXnJb0Ym xDapn7/lgegqF6sdgHY5rB9WoZQRJoEeYS1SjKYZkSE421NPo1OAQQPQv7jaXmqVYPct1JlWfH8 1Z X-Received: by 2002:a05:6a00:174e:b029:308:35eb:4593 with SMTP id j14-20020a056a00174eb029030835eb4593mr3353646pfc.8.1625196325067; Thu, 01 Jul 2021 20:25:25 -0700 (PDT) X-Received: by 2002:a05:6a00:174e:b029:308:35eb:4593 with SMTP id j14-20020a056a00174eb029030835eb4593mr3353600pfc.8.1625196324718; Thu, 01 Jul 2021 20:25:24 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id p17sm11147627pjg.54.2021.07.01.20.25.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Jul 2021 20:25:23 -0700 (PDT) Subject: Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace To: Yongji Xie Cc: Stefan Hajnoczi , "Michael S. Tsirkin" , Stefano Garzarella , Parav Pandit , Christoph Hellwig , Christian Brauner , Randy Dunlap , Matthew Wilcox , Al Viro , Jens Axboe , bcrl@kvack.org, Jonathan Corbet , =?UTF-8?Q?Mika_Penttil=c3=a4?= , Dan Carpenter , joro@8bytes.org, Greg KH , songmuchun@bytedance.com, virtualization , netdev@vger.kernel.org, kvm , linux-fsdevel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel References: <20210615141331.407-1-xieyongji@bytedance.com> <20210615141331.407-10-xieyongji@bytedance.com> <7264cb0b-7072-098e-3d22-2b7e89216545@redhat.com> From: Jason Wang Message-ID: Date: Fri, 2 Jul 2021 11:25:15 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/7/1 下午6:26, Yongji Xie 写道: > On Thu, Jul 1, 2021 at 3:55 PM Jason Wang wrote: >> >> 在 2021/7/1 下午2:50, Yongji Xie 写道: >>> On Wed, Jun 30, 2021 at 5:51 PM Stefan Hajnoczi wrote: >>>> On Tue, Jun 29, 2021 at 10:59:51AM +0800, Yongji Xie wrote: >>>>> On Mon, Jun 28, 2021 at 9:02 PM Stefan Hajnoczi wrote: >>>>>> On Tue, Jun 15, 2021 at 10:13:30PM +0800, Xie Yongji wrote: >>>>>>> +/* ioctls */ >>>>>>> + >>>>>>> +struct vduse_dev_config { >>>>>>> + char name[VDUSE_NAME_MAX]; /* vduse device name */ >>>>>>> + __u32 vendor_id; /* virtio vendor id */ >>>>>>> + __u32 device_id; /* virtio device id */ >>>>>>> + __u64 features; /* device features */ >>>>>>> + __u64 bounce_size; /* bounce buffer size for iommu */ >>>>>>> + __u16 vq_size_max; /* the max size of virtqueue */ >>>>>> The VIRTIO specification allows per-virtqueue sizes. A device can have >>>>>> two virtqueues, where the first one allows up to 1024 descriptors and >>>>>> the second one allows only 128 descriptors, for example. >>>>>> >>>>> Good point! But it looks like virtio-vdpa/virtio-pci doesn't support >>>>> that now. All virtqueues have the same maximum size. >>>> I see struct vpda_config_ops only supports a per-device max vq size: >>>> u16 (*get_vq_num_max)(struct vdpa_device *vdev); >>>> >>>> virtio-pci supports per-virtqueue sizes because the struct >>>> virtio_pci_common_cfg->queue_size register is per-queue (controlled by >>>> queue_select). >>>> >>> Oh, yes. I miss queue_select. >>> >>>> I guess this is a question for Jason: will vdpa will keep this limitation? >>>> If yes, then VDUSE can stick to it too without running into problems in >>>> the future. >> >> I think it's better to extend the get_vq_num_max() per virtqueue. >> >> Currently, vDPA assumes the parent to have a global max size. This seems >> to work on most of the parents but not vp-vDPA (which could be backed by >> QEMU, in that case cvq's size is smaller). >> >> Fortunately, we haven't enabled had cvq support in the userspace now. >> >> I can post the fixes. >> > OK. If so, it looks like we need to support the per-vq configuration. > I wonder if it's better to use something like: VDUSE_CREATE_DEVICE -> > VDUSE_SETUP_VQ -> VDUSE_SETUP_VQ -> ... -> VDUSE_ENABLE_DEVICE to do > initialization rather than only use VDUSE_CREATE_DEVICE. This should be fine. Thanks > > Thanks, > Yongji >