Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3587831pxv; Mon, 5 Jul 2021 00:32:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTx+cP9B8isvtiG8vqHSonq8Zv0dy783HnhxzDmUIhaCNNl3pgd5FydMQCQVatCqYG5q+3 X-Received: by 2002:a02:3b29:: with SMTP id c41mr8493021jaa.31.1625470325500; Mon, 05 Jul 2021 00:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625470325; cv=none; d=google.com; s=arc-20160816; b=U/WdAb8AogKr287RcodoxkWneWJfWwHjoKY/SAAFKwuJ+nPkef3mwgeiFKXVk9Etm9 B6rgSzSqgj2tcI+bBvUI+u6WgKiE3mHZ17d5VRg6iAZi0v4Nrg5a20/DbmQ6BWas3l7v 6QydsgAVay7QuNY4DvTxix2P5eHNUcJiQsTYoH7ahqTdW4yFKqqMBTo+giQCbwJ1t4sl MXZxeeRaiYMcvsZOdxkNbmjDP4+U4fR7rfD6D8GELHmuj28+i+JTYDLAawHD82s1nFUC KmOVQMCk8ejb8S+AGY1AjHtWFSjIbkOwRPR9CJfA66/hZiCaNJGpw2i5+6YBU5moQxFs Tf6g== 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=TrSBmzvOS6/PS/ey8rda3qmHumcD6j+TIXTeJ0gyPEk=; b=ydORcpv5f7/7Nk7qu2BID3qIxyudWoHVY9gMPSkfQUoH/XN8fUJLQw8C7wJtt0P3vJ JTMHn9tNS8/CsrHIqHuvsmH+TK+QN3Lb7JALT6hMfZKipLxzqRDbdJ0C9rgQvKmLPPqd oAzTBULzdqB6oAZO664M7WBe01GfDiyxmFFf2LLQEAwVPvyEQh12Tc6RCQeEhz0Z6tQ1 5RWTRymZwPuOv2iGa15oIQ0Vq5VmAx5kZTpuzjcFTQsde2RY2hD81Hk5aeraasvv2JnG ihg1gnkMnLUi1ibw5vZvB6Tgd6JlS3rhfCZMlVvcBxgTuIsU9ZZjeX1I6xlYeLPmW2jZ NBZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BslUoJ2n; 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 d16si12793683ilf.112.2021.07.05.00.31.54; Mon, 05 Jul 2021 00:32:05 -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=BslUoJ2n; 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 S230009AbhGEHcf (ORCPT + 99 others); Mon, 5 Jul 2021 03:32:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58206 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229982AbhGEHce (ORCPT ); Mon, 5 Jul 2021 03:32:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625470198; 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=TrSBmzvOS6/PS/ey8rda3qmHumcD6j+TIXTeJ0gyPEk=; b=BslUoJ2n+c5ICoq+zmAWHxkPXeHlImCeMXh0mih86rbJIjYC1wiJw2/0+ELciLOdnUvMbq Rv+IQagi9kflh4Z/vYdUAVuSDhi2/r17ZKaafOGedp/WVcHEyeCb6G0iNxOSgxN1BT3KIH ZQwluFHGZ5nXofJbJvciLOKTvouVoS4= Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-38-BFHTaInEN4OXjVih5s6qkg-1; Mon, 05 Jul 2021 03:29:56 -0400 X-MC-Unique: BFHTaInEN4OXjVih5s6qkg-1 Received: by mail-pf1-f198.google.com with SMTP id d22-20020a056a0024d6b0290304cbae6fdcso11444086pfv.21 for ; Mon, 05 Jul 2021 00:29:56 -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=TrSBmzvOS6/PS/ey8rda3qmHumcD6j+TIXTeJ0gyPEk=; b=NXOS11YTI9lZ/jKJxZrydPC+Z+6u0P6RQKeLweEhr1WG1EFxiSXxBJOeR7PTa3jGBP je2BpiPG/Rbd1qOhidqx6KaWEn+ODQYXtfsMVSzcXB9aQbPb1G/pTPGS780WGPWiQjMG BoIwlntXxOMDFVHGtP0mxmgbfpg5Q4jRTB79TLa0Qa6Zg9myaPcVt5ur3AXtNpXaYacq ssfBWQ9EP3FHqKNIWmk9Cl3zMW48o6d9Y+QgGE6CEdxjbz9xeHeT873qu0QWe/FeQHq1 JbclqwJ5RSpmM0kU7D3VCBVs253tw3GswvGcoxia6C3kOG1OhrsFjMC6zwQxr5cXcBVb OCmQ== X-Gm-Message-State: AOAM53313bCMZtsEoWmNoXB4xEukQT5e2Z8jj1VcsuwFvcpjvf1U636J mQ9yDP9/JVQL1v747g3HmdyzmHv7u5aZzLsbHpIlwmLfGr4brIhSo70SA7xomqulk5CupOkIhC4 QR6nP4Q7SD3aeqV/zohGpIQzN X-Received: by 2002:a62:e40c:0:b029:317:3367:c5db with SMTP id r12-20020a62e40c0000b02903173367c5dbmr13828153pfh.62.1625470195672; Mon, 05 Jul 2021 00:29:55 -0700 (PDT) X-Received: by 2002:a62:e40c:0:b029:317:3367:c5db with SMTP id r12-20020a62e40c0000b02903173367c5dbmr13828142pfh.62.1625470195452; Mon, 05 Jul 2021 00:29:55 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id z76sm11997064pfc.173.2021.07.05.00.29.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Jul 2021 00:29:54 -0700 (PDT) Subject: Re: [PATCH 2/2] vdpa: vp_vdpa: don't use hard-coded maximum virtqueue size To: "Michael S. Tsirkin" 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 References: <20210705071910.31965-1-jasowang@redhat.com> <20210705071910.31965-2-jasowang@redhat.com> <20210705032602-mutt-send-email-mst@kernel.org> From: Jason Wang Message-ID: <02139c5f-92c5-eda6-8d2d-8e1b6ac70f3e@redhat.com> Date: Mon, 5 Jul 2021 15:29:47 +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: <20210705032602-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 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 > >> --- >> 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