Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp385030pxv; Wed, 30 Jun 2021 23:51:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcPuTbi0P3fYppojyUdDRPcr1N9Sppy3FKHvwTkisyXPYTh30tYk0ytVp0/fDr/7iCV9Vj X-Received: by 2002:aca:d413:: with SMTP id l19mr12555928oig.88.1625122288017; Wed, 30 Jun 2021 23:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625122288; cv=none; d=google.com; s=arc-20160816; b=BdWrU6KIM6xd7Vc5olwhxj3DD498rEUoSJEOroMNqKjcIc2CIxIOgxTt7zUmOMfB3t V65/kT03lH/hzSsL1EP8xnP/0NJcupiRGxZo7vschB5Wzuue5ujlK+I2nXLMDyRO3i0l 9Fgsp9CjhqxAWXuHKgUByljkfs9pNtoR9qHcsKkXQCCSnbVlz3ZUswIuQIPweAy+GBgR opgj77ne1WYUVv0RyO1ga6WR4+AFJQH5RreLwAFT3034hZeWIo+HvjVYkNtMHM9LW2wc B1WoLD3rc72QWCLi0QEGYMa1nsmDZ3LH8/xgyAoV/KTlkinm+IVW2lLAlThdmAm60THn qZIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=j02ToljqO7cRBUGAX2kOb5odUf1+MulKZRF56vB9XJw=; b=g82Ka5O5Osf2Vkxe5GLJ05yKHU6R45clyoaiIqcK+IrDZKgcA00IgIqj1dfMZS1CGZ Py5N/LedpYXDpVXvyE/987CwMucG2uvl+fz3oklIh7qvOC17jsMdXVxNuaL/P2vAGtQX p4uF7A8soS389lWlZwDDmMsIqtI9MrmaSmz1S9ozc0sHMhI/LbPSiQWnbTVxaRggvLXo V8dj3mpWF9LTrfsVGMvlM+83GRiz2JkO5hwzOoHksOCOZ66z+zlg0siCIrttRcFxyZYB sm2ak8TQryAVhj2giKyMvXZLNTpiZKlLGD4yg/ihft0XwDA7Ol8tkQM/1bvaYw303pOW A8UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=szPt3yjQ; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 187si25561716iow.86.2021.06.30.23.50.50; Wed, 30 Jun 2021 23:51:27 -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=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=szPt3yjQ; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234489AbhGAGws (ORCPT + 99 others); Thu, 1 Jul 2021 02:52:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234250AbhGAGwq (ORCPT ); Thu, 1 Jul 2021 02:52:46 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20196C0617AE for ; Wed, 30 Jun 2021 23:50:16 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id l24so8587634ejq.11 for ; Wed, 30 Jun 2021 23:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=j02ToljqO7cRBUGAX2kOb5odUf1+MulKZRF56vB9XJw=; b=szPt3yjQkK/eOHnZmjZxK4k+ezfPy7N6CPhm+x7EICOpDhKGVX0SiYPkZ71JWWvZoa 8pTmz5fIarGaEdAOZPXlqb3Ft+IEB/7WrLziKTUMgfJwbxqKu7WpgOrDt2jDUDrJtIWr cbeLlyv90jBAQgkaG5PcPMpKIESF32ydtpd5t9BVRkR/UxOzB7/03fJbEeEofSeS0xm4 nBRhtXHTm/IybqaRL0yZyrTa8PU3gB2gMQ79/soCsEBZSt5m98thaMV4L8/9brwhRN7o B363iYyE78ClSv8CfWaatXdNXexk42WbsmRlR9FUB8yp+pkqine3MzByepxq/Xp9WTk6 QDZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=j02ToljqO7cRBUGAX2kOb5odUf1+MulKZRF56vB9XJw=; b=sbTF0oh0nDJ8C+0ue/RVXDOWhw2rKLqOycMqeAommoUzrFeLvxuFXe+U6hRzfugeJl eVALU4owzFUIaSstDDB9iQnqVhlwwfoQlj0ACvDUN1uRFofc5D8Ov7MzUxn8Y84qclGN TSrszWv0VP93ZyoKEq3SoIL35Z7asBeG09jitCYTat//RqJizkMKoD5ZrWe3iW1mlO4e oH7xS/WGlZ1ZtobffZKv/iaHAdsI1uQK9SUszbhkoUaFfU4JBZOVUUJbTtaSXEHR9Qat JwwMhJenK1C00x/qmtH5XcAP56EI3FGKQ0XQjNYFw1B4ZSQzKi407h5M8jXexnLsoCbL NVgw== X-Gm-Message-State: AOAM530P4MUKFAjGf0tqsf9QnC6DEel7jedC/8ZZteuBLG+xsdNmc29A t4ZnpmmfNWWsHJeuonQTipe3pDHwA7DrVXmCq+wb X-Received: by 2002:a17:907:1b11:: with SMTP id mp17mr39880031ejc.1.1625122214373; Wed, 30 Jun 2021 23:50:14 -0700 (PDT) MIME-Version: 1.0 References: <20210615141331.407-1-xieyongji@bytedance.com> <20210615141331.407-10-xieyongji@bytedance.com> In-Reply-To: From: Yongji Xie Date: Thu, 1 Jul 2021 14:50:03 +0800 Message-ID: Subject: Re: Re: Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace To: Stefan Hajnoczi Cc: "Michael S. Tsirkin" , Jason Wang , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > > > > + __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. Thanks, Yongji