From patchwork Tue May 10 16:03:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 9059841 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0394A9F1C1 for ; Tue, 10 May 2016 16:04:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61C3B20149 for ; Tue, 10 May 2016 16:04:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B2B8F2012B for ; Tue, 10 May 2016 16:04:34 +0000 (UTC) Received: from localhost ([::1]:47289 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0A9B-0006aB-QV for patchwork-qemu-devel@patchwork.kernel.org; Tue, 10 May 2016 12:04:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0A8r-0006Jg-FG for qemu-devel@nongnu.org; Tue, 10 May 2016 12:04:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0A8q-00078D-3N for qemu-devel@nongnu.org; Tue, 10 May 2016 12:04:13 -0400 Received: from mail-qg0-x22b.google.com ([2607:f8b0:400d:c04::22b]:33897) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0A8p-000784-Ut for qemu-devel@nongnu.org; Tue, 10 May 2016 12:04:12 -0400 Received: by mail-qg0-x22b.google.com with SMTP id 90so8965467qgz.1 for ; Tue, 10 May 2016 09:04:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=88PmUdVRrVatB278kCvs+/hfKV89/Yu4elAz+5OM5tM=; b=apK25AbU7uxbzNqJ+XRjy00cIvKSn0m/yhSPKFNlp4I7sqIu8f/5qb+hYnWIxPuPRI jT7yWTUpGZogLZ+MGhJAUOomz8hEgYUzibbkieghzHzmc3+EdjYZh3vHi7omxf9eY1jS epwoWJob/qUjYoiqRU4cQzE5FQdeRieMlpDZvKAHvLldcHXSztvVEtPMb27TAJgUwz7Y bRaW/quP11PxhfElASHm/TOL/QEN2EuiZb5y2tTMqi2Ui/vrv8ZecWbhV60NXkAPsBsN /c0s0lHfxNBJvz+oa306Wjq3Io+RYThlzyAQBxCqYcwp0SdZgHHIZQaIMtqIONq0lk5G Hr4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=88PmUdVRrVatB278kCvs+/hfKV89/Yu4elAz+5OM5tM=; b=S1XdhckrFTKzxGVrDhL+rwHLAH4EBanxioYbpu+fu/HcUV+ZQtVvVkZghsq8nScYEO oBsVSqewx0IohIfVvj/VHGvpbxFc2z5xbD9oqByhy2z2IhjawL2CD4fMYW9ACLebqrkk R+3/5DndMl7xbkKEFVIL+mCU+FtEIxmQkZbheQPocZ3zquAw2wrhcwwT5N9krQeRdqSi fT2LvVNLHYMcCFaC2wzhk6fxTlrD1RI6u93n5dIBvGdb8k0i9Lh8fV7jAa052j6d1/tR oBRs8J16C2W9vVbv37ierRqpL9DaqiQPJrywrQh6DSLVCi1uhtDxkb8Pg7TqpCLoy57V sQrQ== X-Gm-Message-State: AOPr4FWnZrDzX5kEQkd8vZxR+v3LOUsLt0EuYXG2ZEcAjBG7RXEfueB5djG/m3jFVGzhtQ== X-Received: by 10.140.19.6 with SMTP id 6mr42069417qgg.75.1462896251464; Tue, 10 May 2016 09:04:11 -0700 (PDT) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by smtp.gmail.com with ESMTPSA id h125sm1207186qke.21.2016.05.10.09.04.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 May 2016 09:04:10 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Tue, 10 May 2016 18:03:53 +0200 Message-Id: <1462896240-30999-4-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1462896240-30999-1-git-send-email-marcandre.lureau@redhat.com> References: <1462896240-30999-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c04::22b Subject: [Qemu-devel] [PATCH 03/10] vubr: workaround stale vring base X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yuanhan Liu , "Michael S . Tsirkin" , Ilya Maximets , jonshin@cisco.com, Tetsuya Mukawa , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau This patch is a similar solution to what Yuanhan Liu/Huawei Xie have suggested for DPDK. When vubr quits (killed or crashed), a restart of vubr would get stale vring base from QEMU. That would break the kernel virtio net completely, making it non-work any more, unless a driver reset is done. So, instead of getting the stale vring base from QEMU, Huawei suggested we could get a proper one from used->idx. This works because the queues packets are processed in order. Signed-off-by: Marc-André Lureau --- tests/vhost-user-bridge.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c index f907ce7..38963e4 100644 --- a/tests/vhost-user-bridge.c +++ b/tests/vhost-user-bridge.c @@ -946,6 +946,13 @@ vubr_set_vring_addr_exec(VubrDev *dev, VhostUserMsg *vmsg) DPRINT(" vring_avail at %p\n", vq->avail); vq->last_used_index = vq->used->idx; + + if (vq->last_avail_index != vq->used->idx) { + DPRINT("Last avail index != used index: %d != %d, resuming", + vq->last_avail_index, vq->used->idx); + vq->last_avail_index = vq->used->idx; + } + return 0; }