From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E164C433F5 for ; Tue, 2 Nov 2021 07:25:41 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E28EC60724 for ; Tue, 2 Nov 2021 07:25:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E28EC60724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 8726140205; Tue, 2 Nov 2021 07:25:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NEjf-v-e4YxI; Tue, 2 Nov 2021 07:25:39 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id F41CB400C7; Tue, 2 Nov 2021 07:25:38 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D1327C0012; Tue, 2 Nov 2021 07:25:38 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 865E0C000E for ; Tue, 2 Nov 2021 07:25:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 60521402B5 for ; Tue, 2 Nov 2021 07:25:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q61VfNuHu1x7 for ; Tue, 2 Nov 2021 07:25:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 4BB55402AF for ; Tue, 2 Nov 2021 07:25:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635837933; h=from:from:reply-to: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=w7yffhPX+vho+28Gpi8r3quLL7PgmQ1wTBBSs+ie47U=; b=JWI4AmGLOdtj/4hfrB20eu8PJTeEPh/XdB6wzrVVKhr3mYDDpd9VPuYLcR3NbLLSGX7rQu Yr13mQuFrToNiX3UGBFaxtFoIkkDONZGDwOvu/865+3+F9O/oGPxMdtkIvfnMp0DjiPAAN P5I0t8+CfZXUXWpYxMI7gXlBjnDOhcc= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-22-RqMworSKMJSQ-vJbI5uQog-1; Tue, 02 Nov 2021 03:25:30 -0400 X-MC-Unique: RqMworSKMJSQ-vJbI5uQog-1 Received: by mail-wm1-f72.google.com with SMTP id z138-20020a1c7e90000000b003319c5f9164so688727wmc.7 for ; Tue, 02 Nov 2021 00:25:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:reply-to:date:message-id:mime-version :content-transfer-encoding; bh=oAW8XtcxK2uizmVJvFb6uSAJqsymalNgSqRqG6DzS6Q=; b=Oou5HzMzUU//HypusSJB8vjq3IFR9kcCGa83I8sSCL8RnqE+vj7hUBmSwIItc2tq4Q 8zT60vd1NW9q0yn/tIYIOYsZWI1WdxUuCmWgQHlkwEfUsEIJ2/cCtmyeKW1gjNi+TwS2 3xx1Z0Rx8Lh9uzEhGPEhb3DO1VSfeZtKoDWtHht8FCTYG0c43m2rujEJrFdMkkiHxdhJ RRWHE0Tp8ES3ceiQInjaj7PRTJKfNLaLrbPMWfAGQaRvfKyu7QpwoSTX2sJXKmvrz9VG hvKboGhZWKOpZhquJVcFVvG4efj8GjV7FJL1Xkbp3S9VMBl/if4NEWxrGg9FELdqxwWg 5BDw== X-Gm-Message-State: AOAM533LklruKKaj0VNn9mOJGac/1HjVlug34pZwbbvZjLRBCmat47k6 Me4BV3/Zg1pXYXyvP32V3KSWxnzhFRtpb7MZKGUjzC58U0EQQJdfqq3eVcSw3qzK5WoEAtejdD5 DJiOSBpNbB8Geqb9j68IecPjRgKJqLYcPR88QFpy9Cw== X-Received: by 2002:a7b:c764:: with SMTP id x4mr5007681wmk.78.1635837929451; Tue, 02 Nov 2021 00:25:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzY7mrnU1rMP3eWf4zK4fN2TqPgfcUIFlGftElm82BaXeWxJuZBQdoWj7ESLQ+ehdznORIIUg== X-Received: by 2002:a7b:c764:: with SMTP id x4mr5007664wmk.78.1635837929279; Tue, 02 Nov 2021 00:25:29 -0700 (PDT) Received: from localhost ([188.26.219.88]) by smtp.gmail.com with ESMTPSA id r15sm18248041wru.9.2021.11.02.00.25.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 00:25:28 -0700 (PDT) From: Juan Quintela To: Eugenio =?utf-8?Q?P=C3=A9rez?= Subject: Re: [RFC PATCH v5 02/26] vhost: Fix last queue index of devices with no cvq In-Reply-To: <20211029183525.1776416-3-eperezma@redhat.com> ("Eugenio =?utf-8?Q?P=C3=A9rez=22's?= message of "Fri, 29 Oct 2021 20:35:01 +0200") References: <20211029183525.1776416-1-eperezma@redhat.com> <20211029183525.1776416-3-eperezma@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Date: Tue, 02 Nov 2021 08:25:27 +0100 Message-ID: <87a6inow7s.fsf@secure.mitica> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: Laurent Vivier , Eduardo Habkost , "Michael S. Tsirkin" , Richard Henderson , qemu-devel@nongnu.org, Markus Armbruster , Stefan Hajnoczi , Xiao W Wang , Harpreet Singh Anand , Eli Cohen , Paolo Bonzini , Eric Blake , virtualization@lists.linux-foundation.org, Parav Pandit X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: quintela@redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" RXVnZW5pbyBQw6lyZXogPGVwZXJlem1hQHJlZGhhdC5jb20+IHdyb3RlOgo+IFRoZSAtMSBhc3N1 bWVzIHRoYXQgYWxsIGRldmljZXMgd2l0aCBubyBjdnEgaGF2ZSBhbiBzcGFyZSB2cSBhbGxvY2F0 ZWQKPiBmb3IgdGhlbSwgYnV0IHdpdGggbm8gb2ZmZXIgb2YgVklSVElPX05FVF9GX0NUUkxfVlEu IFRoaXMgbWF5IG5vdCBiZSB0aGUKPiBjYXNlLCBhbmQgdGh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gbGFzdF9pbmRleCAmPSB+MVVMTDsKPiAgICAg IH0KCkFzIGZhciBhcyBJIGNhbiBzZWUsIHRoYXQgaXMgYSBub3AuIGxhc3RfaW5kZXggaXMgZGVm aW5lZCBhcyBhbiBpbnQuCgokIGNhdCBray5jCiNpbmNsdWRlIDxzdGRpby5oPgoKaW50IG1haW4o dm9pZCkKewoJaW50IGkgPSA3OwoJaSAmPSAtMVVMTDsKCXByaW50ZigiJWRcbiIsIGkpOwoJaSA9 IDg7CglpICY9IC0xVUxMOwoJcHJpbnRmKCIlZFxuIiwgaSk7CglpID0gMDsKCWkgJj0gLTFVTEw7 CglwcmludGYoIiVkXG4iLCBpKTsKCWkgPSAtMjsKCWkgJj0gLTFVTEw7CglwcmludGYoIiVkXG4i LCBpKTsKCXJldHVybiAwOwp9CiQgLi9rawo3CjgKMAotMgoKX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KVmlydHVhbGl6YXRpb24gbWFpbGluZyBsaXN0ClZp cnR1YWxpemF0aW9uQGxpc3RzLmxpbnV4LWZvdW5kYXRpb24ub3JnCmh0dHBzOi8vbGlzdHMubGlu dXhmb3VuZGF0aW9uLm9yZy9tYWlsbWFuL2xpc3RpbmZvL3ZpcnR1YWxpemF0aW9u From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DDFDC433F5 for ; Tue, 2 Nov 2021 07:31:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C521460EB8 for ; Tue, 2 Nov 2021 07:31:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C521460EB8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:32810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhoGf-0003HJ-0B for qemu-devel@archiver.kernel.org; Tue, 02 Nov 2021 03:31:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhoAs-0007fs-Gl for qemu-devel@nongnu.org; Tue, 02 Nov 2021 03:25:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhoAo-0001QI-9Z for qemu-devel@nongnu.org; Tue, 02 Nov 2021 03:25:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635837931; h=from:from:reply-to: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=w7yffhPX+vho+28Gpi8r3quLL7PgmQ1wTBBSs+ie47U=; b=hYQ1MHgst6jQr72MZItqA6dR8cbTNdYke8uG/kX2WQMep5IjJbCthv5MtSquzQMQITUUJU W7Ic3GKvFKUwM1qDa0qOWz0oSQzU8CX++Cr3FigG+TmFg/wvQSh8vparzh3sD0qeAZP2ww ZQClIjjvLQy3JVu3X3mg26O1Hvji+QQ= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-532-qmKhj5fGO5egpFjUz-D4BQ-1; Tue, 02 Nov 2021 03:25:30 -0400 X-MC-Unique: qmKhj5fGO5egpFjUz-D4BQ-1 Received: by mail-wm1-f69.google.com with SMTP id 144-20020a1c0496000000b003305ac0e03aso688226wme.8 for ; Tue, 02 Nov 2021 00:25:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:reply-to:date:message-id:mime-version :content-transfer-encoding; bh=oAW8XtcxK2uizmVJvFb6uSAJqsymalNgSqRqG6DzS6Q=; b=AzqOCstNdTX3H31Fq1coGnZP5N+o/T/H0sam2MjoW/gsUlPFEZcju20kNOJCxdxqPt AEup8iak6DPflL1kXF/Xn5xJGyaTWhMO2ULYzzMdjwd4fEWoteujSR8jbexqfJn3XnI9 WFdQKBldagWmbWaA6zhou3ngGt/txPfVbXu5535YZvlkPjkB1MB8804Hh8BPpQWfDsqR 3e4hXTGxsr4JaxzUVWA8XEKGj9FjGrfPgV985F8QyYTvzinjQLaU0fwiV1fW9bmovQCm T8ojmq9FFGTJ5LR/KLURR1JWi68nTtrG5svbPg3Mw7rgUaXBKT1PASoRyVJ+R30m2aIv JkJw== X-Gm-Message-State: AOAM533SHWwc/E0dYyFGXM7Z2VJmFSV7vAu9JVeKd/Pku9XBXTOjnMqu cAulZIZaMcCLE23S9NKky2NN3z9XHMGf9H24wCUK1X7/tAjCjLr9VsH6VJxMvsLqN4GCF46R+qr XF7dt0pUwf+bBdKw= X-Received: by 2002:a7b:c764:: with SMTP id x4mr5007694wmk.78.1635837929475; Tue, 02 Nov 2021 00:25:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzY7mrnU1rMP3eWf4zK4fN2TqPgfcUIFlGftElm82BaXeWxJuZBQdoWj7ESLQ+ehdznORIIUg== X-Received: by 2002:a7b:c764:: with SMTP id x4mr5007664wmk.78.1635837929279; Tue, 02 Nov 2021 00:25:29 -0700 (PDT) Received: from localhost ([188.26.219.88]) by smtp.gmail.com with ESMTPSA id r15sm18248041wru.9.2021.11.02.00.25.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 00:25:28 -0700 (PDT) From: Juan Quintela To: Eugenio =?utf-8?Q?P=C3=A9rez?= Subject: Re: [RFC PATCH v5 02/26] vhost: Fix last queue index of devices with no cvq In-Reply-To: <20211029183525.1776416-3-eperezma@redhat.com> ("Eugenio =?utf-8?Q?P=C3=A9rez=22's?= message of "Fri, 29 Oct 2021 20:35:01 +0200") References: <20211029183525.1776416-1-eperezma@redhat.com> <20211029183525.1776416-3-eperezma@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Date: Tue, 02 Nov 2021 08:25:27 +0100 Message-ID: <87a6inow7s.fsf@secure.mitica> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.734, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: quintela@redhat.com Cc: Laurent Vivier , Eduardo Habkost , "Michael S. Tsirkin" , Jason Wang , Richard Henderson , qemu-devel@nongnu.org, Peter Xu , Markus Armbruster , Stefan Hajnoczi , Xiao W Wang , Harpreet Singh Anand , Eli Cohen , Paolo Bonzini , Stefano Garzarella , Eric Blake , virtualization@lists.linux-foundation.org, Parav Pandit Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Eugenio P=C3=A9rez wrote: > The -1 assumes that all devices with no cvq have an spare vq allocated > for them, but with no offer of VIRTIO_NET_F_CTRL_VQ. This may not be the > case, and the device may have a pair number of queues. ^^^^ even I know, I know, I am Spanish myself O:-) > To fix this, just resort to the lower even number of queues. I don't understand what you try to achieve here. > Fixes: 049eb15b5fc9 ("vhost: record the last virtqueue index for the > virtio device") > Signed-off-by: Eugenio P=C3=A9rez > --- > hw/net/vhost_net.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c > index 0d888f29a6..edf56a597f 100644 > --- a/hw/net/vhost_net.c > +++ b/hw/net/vhost_net.c > @@ -330,7 +330,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState= *ncs, > NetClientState *peer; > =20 > if (!cvq) { > - last_index -=3D 1; > + last_index &=3D ~1ULL; > } As far as I can see, that is a nop. last_index is defined as an int. $ cat kk.c #include int main(void) { =09int i =3D 7; =09i &=3D -1ULL; =09printf("%d\n", i); =09i =3D 8; =09i &=3D -1ULL; =09printf("%d\n", i); =09i =3D 0; =09i &=3D -1ULL; =09printf("%d\n", i); =09i =3D -2; =09i &=3D -1ULL; =09printf("%d\n", i); =09return 0; } $ ./kk 7 8 0 -2