Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp515196ybz; Fri, 17 Apr 2020 05:26:29 -0700 (PDT) X-Google-Smtp-Source: APiQypKEMi9kGFo/eeoHSAq1anIPHJHtQ8uFqHNXa0nnYkQnuW3BJdl2CBr8SXqtHHpWpomWhuCk X-Received: by 2002:a17:906:edc2:: with SMTP id sb2mr1652208ejb.129.1587126389708; Fri, 17 Apr 2020 05:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587126389; cv=none; d=google.com; s=arc-20160816; b=M9itILXEGgcIC0RKJrFvdW7Qa+ZgH1gJzDAtbDO8276B6veqLJ66UWcRyQFQUUTNwY kyHeYcQGD+RwEASicbCNBEOaJy/vzOUQ3ikq+y3Zx6eSaRCB3MlnN3s4D3tR0LioFOzm aHydgqIV3yOPLfZP/tMsPAjGi8WangbkIzAOLdXf5OZ56j9UzyexkRn3ZkTR8bP1H81s o5dDDvqAoTI5hFws5X/WGBZlvD/YmkCASkRs1aUM/vpNNrKwNqRHoSnaa0PfmioGl4mN 3izL0zShNyod63/jGq7c+sTURZ4NmB+1Ee4gz0dzO/k6xn9qYqSoyOyMKqrRxhpQr9aq UIXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=6SYQc5vlhk7XbIz6vBeT6lWe63ZtgKx7c9HrEfLpD3c=; b=Fdv3ax1UaU0bsfVoOT+5Won9e6/tPDOEkIe7ES1uoNQdXzlMTffEzAZwneWne5w2gu 55MIS60OegjeLKM7Pc2/aqNpGD2OIwYLIH0333aq10YK+wyWw9PH03T0nGelSkVkNbFB QVwYImU3lTKwotwo6MHK6Pu2hnqvQMo8mQ+erXrXu8JLub1DVlVWOQgdwySBhFg2k+lb CGGXHDcy0Di9xOGplIMpKqHovZa+vXvz8cyGz5e3e6edn5g6T7ZpT8ghMrvqtzwmPG5k I/tGd9ALXStt3IwkIoBzyR2oY6IxkwhQL6OXCsVSfR1x9g5yTzpZQvNGh+dmEasm65Vn v3eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y0FX8+rx; 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 k12si10137796edn.425.2020.04.17.05.26.06; Fri, 17 Apr 2020 05:26:29 -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=Y0FX8+rx; 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 S1728570AbgDQMZL (ORCPT + 99 others); Fri, 17 Apr 2020 08:25:11 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:35954 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727877AbgDQMZL (ORCPT ); Fri, 17 Apr 2020 08:25:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587126309; 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=6SYQc5vlhk7XbIz6vBeT6lWe63ZtgKx7c9HrEfLpD3c=; b=Y0FX8+rxNBDfOTW28czAyRkFFSZXdemRWyDZzdATfQdk7aooakAe9zQdRSxp/89H9DyU9f vbaIPHwpr0OJSbeoUSqicnYdGwJbXCPYv1k9UvdVtiPW4dbN9M35l1Gl+sH8EvribjbLhv xI1hucvAORareMfuuF5TLS+wdNMPcos= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-325-Gt_P8W8uPQ6ZMchoKq0_bQ-1; Fri, 17 Apr 2020 08:25:08 -0400 X-MC-Unique: Gt_P8W8uPQ6ZMchoKq0_bQ-1 Received: by mail-qv1-f69.google.com with SMTP id u5so2024969qvt.12 for ; Fri, 17 Apr 2020 05:25:08 -0700 (PDT) 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:content-transfer-encoding; bh=6SYQc5vlhk7XbIz6vBeT6lWe63ZtgKx7c9HrEfLpD3c=; b=T33a59It2KTOTInN6gV6XZ5yqvv3VJWdeZvBw4QGxsFpuU6qzzXFL887D3J8LGAi7X 2tVqMgYe7lxThX2MHwPYcQtfLqhDHXsA+a9HVXGOlQb1uTcYmL/uvLjAe1Lcagshbqjw dLD1wwoSlpioOTXu1oXzB+GsUyd/3yt95lPSTiHOvLMFUfff8kjB405LNfh83cCutn8q sdQZqt754KutrMePiGr0XW1jGxipmWWJXv/3Z6gqV0dMvnEP791x0hOniBodFey5P+RS H8u3Fs01Pmj1TYSE8biHLhLJJthx9tLZLYX7zubNK2hhNy7e5K9p2okgi7J8CYt4t52V rVSA== X-Gm-Message-State: AGi0PuauZbNkrgVYXXCko6xRkr347udTZlwJfRjux81r+veBXSzHV+6c LLuOOoUy0XFaOmvmLCAwTagHoIv/+CpMFh8WS8lFC+IWvBO/ughYWpLEG7KqGlxfH5cnyUF0hf6 gDnf7UquuJJo9V4eVyJX8FWov6YDNbKAK3VHV6i7h X-Received: by 2002:a37:7786:: with SMTP id s128mr2986057qkc.497.1587126307608; Fri, 17 Apr 2020 05:25:07 -0700 (PDT) X-Received: by 2002:a37:7786:: with SMTP id s128mr2986028qkc.497.1587126307322; Fri, 17 Apr 2020 05:25:07 -0700 (PDT) MIME-Version: 1.0 References: <20200416075643.27330-1-eperezma@redhat.com> <20200416075643.27330-6-eperezma@redhat.com> <20200416183244-mutt-send-email-mst@kernel.org> In-Reply-To: <20200416183244-mutt-send-email-mst@kernel.org> From: Eugenio Perez Martin Date: Fri, 17 Apr 2020 14:24:31 +0200 Message-ID: Subject: Re: [PATCH v2 5/8] tools/virtio: Use __vring_new_virtqueue in virtio_test.c To: "Michael S. Tsirkin" Cc: Stephen Rothwell , "virtualization@lists.linux-foundation.org" , Christian Borntraeger , Linux Next Mailing List , kvm list , Cornelia Huck , Halil Pasic , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 17, 2020 at 12:33 AM Michael S. Tsirkin wrote: > > On Thu, Apr 16, 2020 at 09:56:40AM +0200, Eugenio P=C3=A9rez wrote: > > As updated in ("2a2d1382fe9d virtio: Add improved queue allocation API"= ) > > > > Signed-off-by: Eugenio P=C3=A9rez > > Pls add motivation for these changes. > The original motivation was to make code as close as possible to virtio_net. Also, it skips a (probably not expensive) initialization in vring_new_virtqueue. With the recent events, I think that this could be useful to test when userspace and kernel use different struct layout, maybe with some sanitizer. I can drop it if you don't see it the same way (or if I didn't understand the problem and this does not help). Thanks! > > --- > > tools/virtio/virtio_test.c | 7 +++---- > > 1 file changed, 3 insertions(+), 4 deletions(-) > > > > diff --git a/tools/virtio/virtio_test.c b/tools/virtio/virtio_test.c > > index 1d5144590df6..d9827b640c21 100644 > > --- a/tools/virtio/virtio_test.c > > +++ b/tools/virtio/virtio_test.c > > @@ -106,10 +106,9 @@ static void vq_info_add(struct vdev_info *dev, int= num) > > assert(r >=3D 0); > > memset(info->ring, 0, vring_legacy_size(num, 4096)); > > vring_legacy_init(&info->vring, num, info->ring, 4096); > > - info->vq =3D vring_new_virtqueue(info->idx, > > - info->vring.num, 4096, &dev->vdev, > > - true, false, info->ring, > > - vq_notify, vq_callback, "test"); > > + info->vq =3D > > + __vring_new_virtqueue(info->idx, info->vring, &dev->vdev,= true, > > + false, vq_notify, vq_callback, "tes= t"); > > assert(info->vq); > > info->vq->priv =3D info; > > vhost_vq_setup(dev, info); > > -- > > 2.18.1 >