Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4002098pxv; Mon, 5 Jul 2021 11:00:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznoZDGzgix2KgoTgimNGvC4HTKaK3XyTjLSKNYm2SwpAJOXipiSNSdBDmZ6B9M5wYiIgHx X-Received: by 2002:a05:6e02:50c:: with SMTP id d12mr11618517ils.84.1625508026465; Mon, 05 Jul 2021 11:00:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625508026; cv=none; d=google.com; s=arc-20160816; b=AVWXMPnsmq9KdSgwflBNN4U0X14WbcLpAKd/Cc3TRmatmQJDBzlL2+CQcO63AjKBlq fh6Lql3BmdHtbPsOND4AABMNaFDOwjraTM9cj2RJ2W1hyPsLJd+u0kvfC6lb5Aa96AmW GBJEbmn3qbseVGxPDAU6cF/j9TpXGKDRlgvhmh0E7OYOlavw5mSGOT+vDDUjJnky3lUf 2mxiWNKmWGmGhnDitu99fQdUIaCtxVYe94MqsVMeXDuiAhS7eQwq4xZ69Wt15DEzkXRW z3LnNdZ18gm1C8iZpkJRy4IIx7qHh5gpReTiwVNZMGFmR/8hwq2Xzcj55h2qvBwD5O2V 4xOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=5H38ZiEbwdys/XKq02eU1KZlFMkGpzH6Mp6cE7wcdag=; b=tdL/vVEZsvy4PTy9YZVQFHcPJuvBuJH7m2i+8TW6nRvl62yO+21GKijGYueB4uaBxg iYll7eOaeEjikxDWrOF/T2Tj9xqDMsXO9j1iblqHO6AL0VgfK6SCCjbx0T2dhP87PTKd Gtxg0zZ4okAUmvxgfb5USl2UuPpGetMXMDOSgtoyrH20TcoCTnr2VaXtqJ3ZTcxsqL79 ZeTDZGOj1z58Opwn0iUb7TJvpkd8XJsB7G2vd/9IB41ecYLoPQ0W0z7ZSubD+W0Gaf3t Ku23JoPB45cr0zw5aKNlMKfcqeqFy2T+lX8Wi08D3E+V5cruFBDXXDT+OeTJG1PHzCqi NsGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MZ6mV90z; 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 k5si12149490ilr.142.2021.07.05.11.00.14; Mon, 05 Jul 2021 11:00:26 -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=MZ6mV90z; 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 S229829AbhGESCQ (ORCPT + 99 others); Mon, 5 Jul 2021 14:02:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46149 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229729AbhGESCP (ORCPT ); Mon, 5 Jul 2021 14:02:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625507978; 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=5H38ZiEbwdys/XKq02eU1KZlFMkGpzH6Mp6cE7wcdag=; b=MZ6mV90zngTbe5E1qSzQzx74mzrUuFRaZwoUPdVblmllRnXQyrDtEPwsGbTs/5RdT2qI62 kWgfQRg7XJaseZwJh2P2tDqEPiPv1TMkJ15o6AN1QaLxjorbou5sZXKU+h0tV7p4Mi+Nq8 uFPHtXFQEGYCF1LXhVp7qw9HtXplHE4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-599-EGCdp30HP7efRlwi7eSGow-1; Mon, 05 Jul 2021 13:59:37 -0400 X-MC-Unique: EGCdp30HP7efRlwi7eSGow-1 Received: by mail-wr1-f69.google.com with SMTP id d9-20020adffbc90000b029011a3b249b10so6387076wrs.3 for ; Mon, 05 Jul 2021 10:59:36 -0700 (PDT) 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=5H38ZiEbwdys/XKq02eU1KZlFMkGpzH6Mp6cE7wcdag=; b=svnvCgTF+S7WavRbws0yEgorVIOEgim2yQDlPHFqtWDKnG7UqhAGna7LmQ5729bZCY sGZwrwfjzYG6JJ9dA/SlmbTs7R+nfqo01foVIavshrMflEmH3JYImCdCEtwXMYBZt7Ae TUpAZ/I4AljL44KcIxYnp9mwVisBTptjUYzKvCX1ZQr4dJ+H0kmEH9Xb0/DRe3o4anDr H73CDt50det3F9NDsWvmcPJ0ngr8szRV784GixrNmWUwaoMyQ1evSqtiEWqliIqLv46U 9Ur0QcGH2D5krQKyYsFEz957585DWWdJ4pH7IObQpZCVLevsqhIAJldlmUBL9sVinG3h Zhfw== X-Gm-Message-State: AOAM533SmRgj/DvGOtHSL6h9c+jBIeHLQdffGYn78ABdxFUWU/rlw3dH ykwYUymndJOUibqZgpRxDsHxTu9e8F581Yw3ZHoi1AKxrMKxLovFcjsZSg9jySBn6t0FgxLPaJl vt0Z4sM4OJidh6+nd5fA7CXUN X-Received: by 2002:a5d:4c50:: with SMTP id n16mr17129685wrt.249.1625507975903; Mon, 05 Jul 2021 10:59:35 -0700 (PDT) X-Received: by 2002:a5d:4c50:: with SMTP id n16mr17129668wrt.249.1625507975669; Mon, 05 Jul 2021 10:59:35 -0700 (PDT) Received: from redhat.com ([2.55.8.91]) by smtp.gmail.com with ESMTPSA id s9sm3028372wrn.87.2021.07.05.10.59.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 10:59:34 -0700 (PDT) Date: Mon, 5 Jul 2021 13:59:31 -0400 From: "Michael S. Tsirkin" To: Jason Wang Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, xieyongji@bytedance.com, stefanha@redhat.com Subject: Re: [PATCH 2/2] vdpa: vp_vdpa: don't use hard-coded maximum virtqueue size Message-ID: <20210705065534-mutt-send-email-mst@kernel.org> References: <20210705071910.31965-1-jasowang@redhat.com> <20210705071910.31965-2-jasowang@redhat.com> <20210705032602-mutt-send-email-mst@kernel.org> <02139c5f-92c5-eda6-8d2d-8e1b6ac70f3e@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <02139c5f-92c5-eda6-8d2d-8e1b6ac70f3e@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 05, 2021 at 03:29:47PM +0800, Jason Wang wrote: > > 在 2021/7/5 下午3:26, Michael S. Tsirkin 写道: > > On Mon, Jul 05, 2021 at 03:19:10PM +0800, Jason Wang wrote: > > > This patch switch to read virtqueue size from the capability instead > > > of depending on the hardcoded value. This allows the per virtqueue > > > size could be advertised. > > > > > > Signed-off-by: Jason Wang > > So let's add an ioctl for this? It's really a bug we don't.. > > > As explained in patch 1. Qemu doesn't use VHOST_VDPA_GET_VRING_NUM actually. > Instead it checks the result VHOST_VDPA_SET_VRING_NUM. > > So I change VHOST_VDPA_GET_VRING_NUM to return the minimal size of all the > virtqueues. > > If you wish we can add a VHOST_VDPA_GET_VRING_NUM2, but I'm not sure it will > have a user or not. > > Thanks Question is how do we know returning the minimal and not e.g. the max size is the right thing to do? > > > > > > --- > > > drivers/vdpa/virtio_pci/vp_vdpa.c | 6 ++++-- > > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c > > > index 2926641fb586..198f7076e4d9 100644 > > > --- a/drivers/vdpa/virtio_pci/vp_vdpa.c > > > +++ b/drivers/vdpa/virtio_pci/vp_vdpa.c > > > @@ -18,7 +18,6 @@ > > > #include > > > #include > > > -#define VP_VDPA_QUEUE_MAX 256 > > > #define VP_VDPA_DRIVER_NAME "vp_vdpa" > > > #define VP_VDPA_NAME_SIZE 256 > > > @@ -197,7 +196,10 @@ static void vp_vdpa_set_status(struct vdpa_device *vdpa, u8 status) > > > static u16 vp_vdpa_get_vq_num_max(struct vdpa_device *vdpa, u16 qid) > > > { > > > - return VP_VDPA_QUEUE_MAX; > > > + struct vp_vdpa *vp_vdpa = vdpa_to_vp(vdpa); > > > + struct virtio_pci_modern_device *mdev = &vp_vdpa->mdev; > > > + > > > + return vp_modern_get_queue_size(mdev, qid); > > > } > > > static int vp_vdpa_get_vq_state(struct vdpa_device *vdpa, u16 qid, > > > -- > > > 2.25.1