From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43B3419FA87 for ; Thu, 20 Jun 2024 09:01:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718874082; cv=none; b=PR/xwkOQixei1rFHc/7woEzHKtqLxkxYANTpPbWNkLIVDs6mzXTdCThoRxplpWs7saZpGtCuvxh+Qz9NhW34ZolgUT8mbqqV5D3vXpHKFq0dlxTPiwtorfcCWBng2GkM1PXKAVsU9mKC7VzOM/bl5cQiK3VYXl8q+naZ4Ui3oOk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718874082; c=relaxed/simple; bh=2nMCQx2fyhNhl3V6Bsvj0nvtFHLSOUGt0buGaTs+hAM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Se1+2FqB78xRskxxY3ByYauR+ple3B1feJygnq4/tCyNEI5aUuNpftgzTc/+wwRSbD4Zy8BqyQ2Xq04+5kypxfjYucP6nPcESDdfxbcVD5B6fDr2zqqgWbOOmAH9a2hpZvKPaq7AY1mmTFmUM488G3o7j64CPkktFmeVeeOWxsw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=N3syoL08; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="N3syoL08" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718874080; 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: in-reply-to:in-reply-to:references:references; bh=XR61vx35OTZX9XFWt8YdyvsDaIUHY+xQKab0QtNP4Qc=; b=N3syoL08axAu/27ikE0mcPPieaVM5gAKPenEQt4EIsxjsxd09btem1naJtDph7AUOo5ZHa 3mER97y7/mQMbaDyiwIMvjW1rH2/pwWWQJ0PCCWiPJf8rwIMfJk170Od6dwSoKlBY63QzY BAwUbcDdtYTWo8LO7QUaEb1LeRBz9m0= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-696-cEjJdnJBP8C-oiX0-89xlw-1; Thu, 20 Jun 2024 05:01:17 -0400 X-MC-Unique: cEjJdnJBP8C-oiX0-89xlw-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a6f0ed4c213so28448266b.3 for ; Thu, 20 Jun 2024 02:01:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718874076; x=1719478876; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XR61vx35OTZX9XFWt8YdyvsDaIUHY+xQKab0QtNP4Qc=; b=FOndDOIGSonI3oSIU48ZUof8bwW2cfXgm1sbnL1RZHE9/x8q3bl8uebf7YO4iBC/n0 VKgRM4yr4/4888zNx0ck44Mijch9OSGx56aGly6Pb/RFykdTUtZGeTwuSGkD73xURVHF /fxi9b4DtJgsJFTtD79M4H8KLNtqVHXCM2OMDnEi098HyypOQroX6khEe/8Vl96jYJ2F Z5XB2KZgZ59DUFfBp2pRjqbZ/JaEUEyKMPbmKccbDJsE/4RtKgjaHPy0m/bpEgzqJ2J6 Gwi2SMyZRNDak/3hmHrZqkwutqyrC7wddNNN4R52aJGcqKmfCnC3w3Lg1PApRQwl0whY aXsA== X-Forwarded-Encrypted: i=1; AJvYcCXL+6BNeVCiRU+OVXGsL404Vxujjla9r4u7j88pKvADiUSNHUtUlPAspclAaYPazve6GuSbJdPpEYNMgNEXJN8x5z/R X-Gm-Message-State: AOJu0YxYASIdl6pnPSZU9Gjn885DyPfL/TNRNB5Te53+zWGFMJm3dNzb x5ptoGDJrC13e3BNS7v+OUGmhPRxrn93AAM47FBSjgFUi+MlNBMZ6nsT4oLkRm8H9v5ASIW5fXN DDTxFtt/cVYVvLvp3rXRwmhGLBtrZck84I3ujJLCDek4p4E+Skg== X-Received: by 2002:a17:907:c805:b0:a68:b73d:30d0 with SMTP id a640c23a62f3a-a6fab609e47mr400229766b.6.1718874076410; Thu, 20 Jun 2024 02:01:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH5+F4gugdmHhB163V4ULVbHnYMOFq3eTuk1V982iZ6yAjow4HL/6ytgFaWqg7nTSdPpnke9w== X-Received: by 2002:a17:907:c805:b0:a68:b73d:30d0 with SMTP id a640c23a62f3a-a6fab609e47mr400225566b.6.1718874075875; Thu, 20 Jun 2024 02:01:15 -0700 (PDT) Received: from redhat.com ([2.52.146.100]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56da3356sm742953866b.40.2024.06.20.02.01.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 02:01:14 -0700 (PDT) Date: Thu, 20 Jun 2024 05:01:08 -0400 From: "Michael S. Tsirkin" To: Xuan Zhuo Cc: virtualization@lists.linux.dev, Richard Weinberger , Anton Ivanov , Johannes Berg , Hans de Goede , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , Vadim Pasternak , Bjorn Andersson , Mathieu Poirier , Cornelia Huck , Halil Pasic , Eric Farman , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , David Hildenbrand , Jason Wang , linux-um@lists.infradead.org, platform-driver-x86@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH vhost v9 2/6] virtio: remove support for names array entries being null. Message-ID: <20240620044839-mutt-send-email-mst@kernel.org> References: <20240424091533.86949-1-xuanzhuo@linux.alibaba.com> <20240424091533.86949-3-xuanzhuo@linux.alibaba.com> <20240620035749-mutt-send-email-mst@kernel.org> <1718872778.4831812-1-xuanzhuo@linux.alibaba.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1718872778.4831812-1-xuanzhuo@linux.alibaba.com> On Thu, Jun 20, 2024 at 04:39:38PM +0800, Xuan Zhuo wrote: > On Thu, 20 Jun 2024 04:02:45 -0400, "Michael S. Tsirkin" wrote: > > On Wed, Apr 24, 2024 at 05:15:29PM +0800, Xuan Zhuo wrote: > > > commit 6457f126c888 ("virtio: support reserved vqs") introduced this > > > support. Multiqueue virtio-net use 2N as ctrl vq finally, so the logic > > > doesn't apply. And not one uses this. > > > > > > On the other side, that makes some trouble for us to refactor the > > > find_vqs() params. > > > > > > So I remove this support. > > > > > > Signed-off-by: Xuan Zhuo > > > Acked-by: Jason Wang > > > Acked-by: Eric Farman # s390 > > > Acked-by: Halil Pasic > > > > > > I don't mind, but this patchset is too big already. > > Why do we need to make this part of this patchset? > > > If some the pointers of the names is NULL, then in the virtio ring, > we will have a trouble to index from the arrays(names, callbacks...). > Becasue that the idx of the vq is not the index of these arrays. > > If the names is [NULL, "rx", "tx"], the first vq is the "rx", but index of the > vq is zero, but the index of the info of this vq inside the arrays is 1. Ah. So actually, it used to work. What this should refer to is commit ddbeac07a39a81d82331a312d0578fab94fccbf1 Author: Wei Wang Date: Fri Dec 28 10:26:25 2018 +0800 virtio_pci: use queue idx instead of array idx to set up the vq When find_vqs, there will be no vq[i] allocation if its corresponding names[i] is NULL. For example, the caller may pass in names[i] (i=4) with names[2] being NULL because the related feature bit is turned off, so technically there are 3 queues on the device, and name[4] should correspond to the 3rd queue on the device. So we use queue_idx as the queue index, which is increased only when the queue exists. Signed-off-by: Wei Wang Signed-off-by: Michael S. Tsirkin Which made it so setting names NULL actually does not reserve a vq. But I worry about non pci transports - there's a chance they used a different index with the balloon. Did you test some of these? -- MST