From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07AF9C11F6A for ; Fri, 2 Jul 2021 03:25:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D9414613F2 for ; Fri, 2 Jul 2021 03:25:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234874AbhGBD17 (ORCPT ); Thu, 1 Jul 2021 23:27:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51615 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234848AbhGBD16 (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-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-344-euWw4gr8NBSvz6Y7napqNw-1; Thu, 01 Jul 2021 23:25:26 -0400 X-MC-Unique: euWw4gr8NBSvz6Y7napqNw-1 Received: by mail-pg1-f199.google.com with SMTP id i189-20020a6387c60000b0290228552e3ac7so1523675pge.20 for ; Thu, 01 Jul 2021 20:25:25 -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=E0hIr1loWrPlmT9SM1IcIh2r2vx+vrn+JCBccWFfiOfUusM7jhZZc7/vp/LYhHFBQs yezeWPZ6DXeSdxifGbLqJDFc74FbwGrEg1TJ7Q7MKuHbQHC+LrgtqJHrNsfpkN01WO3Q TUaBvauaeCj4Kz/kjndIVNOQRPUqzNuggy90yRGXKdmNkHJ1udGqGrxHJ34MxBxczmNJ hLSymMyS4v68SuTZ0l9HmP0h7ipI7RrB/F30n4zJt8M9OGpBwOAJBEixXnBffmo0qY7W /ZtGyXyalo+ljfOPwCZSvqwHeLsEewOh5vignlYJmM9uhzgiDVyp2gQOSDf5Qx4lV6s4 wuLA== X-Gm-Message-State: AOAM530XEozhU3PohBjvzl9WYJ/ANCdEn7pU5nAyhWLa46uYOZo81ZwZ Yqkvc5QsmLT2t2pA37/u8ggNKQksS2zaiCbiX/tfUc7T1Ea1AECFNWKJZPrH2LTT0309T7aV0Rk Sc3tK3SKfyDQFXEa7VjfuFGKqRQ== X-Received: by 2002:a05:6a00:174e:b029:308:35eb:4593 with SMTP id j14-20020a056a00174eb029030835eb4593mr3353623pfc.8.1625196324986; Thu, 01 Jul 2021 20:25:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKMQl/tw5Kx6FHOmk54WvFeYF610dbfRRBBaUlCrS6TkxAlUSkb5jlHy46VzHh0+l9ZFtiag== 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-fsdevel@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 >