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 7AB60C11F6A for ; Thu, 1 Jul 2021 07:56:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 60B9261462 for ; Thu, 1 Jul 2021 07:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234907AbhGAH6Y (ORCPT ); Thu, 1 Jul 2021 03:58:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51973 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234685AbhGAH6Y (ORCPT ); Thu, 1 Jul 2021 03:58:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625126153; 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=3kkO+UX+kTqcYTfctkZezZWjIyhRJe4+TF27ND409mQ=; b=jHLWW9mKaiIBq4ooDnWmNq2ZVMEIEwm193hJjk11OAmBtTv4vXADaVQEV8gNwru1vonUks vHjmivUcl79+Ze+lVQEMLS4KjDu7wqaI/qwO3zm7WKcIjH5saMeDYZqNY9yYGXW3c2LatM g3FpI80j/kdOcpf2ib0XbYLfptxd1lc= 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-392-9-a86Jv5Pp-CBocUFzY2hw-1; Thu, 01 Jul 2021 03:55:52 -0400 X-MC-Unique: 9-a86Jv5Pp-CBocUFzY2hw-1 Received: by mail-pg1-f199.google.com with SMTP id 4-20020a6315440000b029022154a87a57so3617442pgv.13 for ; Thu, 01 Jul 2021 00:55:52 -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=3kkO+UX+kTqcYTfctkZezZWjIyhRJe4+TF27ND409mQ=; b=dWbi/bv+zR+nnt8DimeeJxI8fk6M1JKSQJ59fgPnm79Ky3TkK6ddDLncntWY3eTtWc 6VI7/NPdt5nVNSYjYZsvyt/GaJouOUI7i4et6XCto0urb5NtJRv34PRU9ksklsM9vKC4 0PdjoKXVtouhMgSPgxKOYYCdUN6OPIrNq6jOAC0axZ5FZ0NqwkZqqZLcGKEc0ePPFFNo 7rhCePpjoEHqalsP/mQaD48JiAikqKmGwTlZCsaV3WM54pZJCAcmAS7QJB13wplIZdL4 Nb/iVhJg87Kl2pClRralXEKqPmZZadX2LKY+cpaK49JSdjibxvHs7wndiQRVebQrLJCY cNPw== X-Gm-Message-State: AOAM530Q8wx+A7ngy5SVWy7y9Wr+/mmHV1oTEfyEUhSGia2kV14lIzp9 SeQIKddn4uE0rfy7ywhMl/CM78CxVBY6TvziC45RGMDiFM6I49jEBb9QQOAc+3XA5fAPYw01iir /Q2zFzPjLWqBW X-Received: by 2002:a63:794:: with SMTP id 142mr6983323pgh.198.1625126151677; Thu, 01 Jul 2021 00:55:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+FJQkpNj2SGJqmkRE0B+JqnTbGGKE300PtWwx2ZJ5+wT2j2YuZ2VlEIodQZCrR0j2AFzwoQ== X-Received: by 2002:a63:794:: with SMTP id 142mr6983291pgh.198.1625126151412; Thu, 01 Jul 2021 00:55:51 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id a6sm23966070pfo.212.2021.07.01.00.55.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Jul 2021 00:55:50 -0700 (PDT) Subject: Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace To: Yongji Xie , Stefan Hajnoczi Cc: "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> From: Jason Wang Message-ID: <7264cb0b-7072-098e-3d22-2b7e89216545@redhat.com> Date: Thu, 1 Jul 2021 15:55:36 +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: kvm@vger.kernel.org 在 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. >> >>>>> + __u16 padding; /* padding */ >>>>> + __u32 vq_num; /* the number of virtqueues */ >>>>> + __u32 vq_align; /* the allocation alignment of virtqueue's metadata */ >>>> I'm not sure what this is? >>>> >>> This will be used by vring_create_virtqueue() too. >> If there is no official definition for the meaning of this value then >> "/* same as vring_create_virtqueue()'s vring_align parameter */" would >> be clearer. That way the reader knows what to research in order to >> understand how this field works. >> > OK. > >> I don't remember but maybe it was used to support vrings when the >> host/guest have non-4KB page sizes. I wonder if anyone has an official >> definition for this value? > Not sure. Maybe we might need some alignment which is less than > PAGE_SIZE sometimes. So I see CCW always use 4096, but I'm not sure whether or not it's smaller than PAGE_SIZE. Thanks > > Thanks, > Yongji >