Message ID | 1472753640-18375-2-git-send-email-rkagan@virtuozzo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ED2B4607D2 for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 1 Sep 2016 18:15:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8CC61FFCA for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 1 Sep 2016 18:15:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD63329486; Thu, 1 Sep 2016 18:15:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 71C311FFCA for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 1 Sep 2016 18:15:14 +0000 (UTC) Received: from localhost ([::1]:38454 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org>) id 1bfWW9-000240-EW for patchwork-qemu-devel@patchwork.kernel.org; Thu, 01 Sep 2016 14:15:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <rkagan@virtuozzo.com>) id 1bfWVU-0001wb-Rs for qemu-devel@nongnu.org; Thu, 01 Sep 2016 14:14:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <rkagan@virtuozzo.com>) id 1bfWVL-00035j-3V for qemu-devel@nongnu.org; Thu, 01 Sep 2016 14:14:31 -0400 Received: from mail-ve1eur01on0116.outbound.protection.outlook.com ([104.47.1.116]:47724 helo=EUR01-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rkagan@virtuozzo.com>) id 1bfWVK-00035O-Rc for qemu-devel@nongnu.org; Thu, 01 Sep 2016 14:14:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=4revvg2Aqj2bcPNkadEvFXP0K1+GugHW2ELGu2Yzso4=; b=YzNUCj8f+s9uGX47/zx/RPD1v9BhoceHFuHzzH7i1p9LA1fAQSRpFmGQ1d+f3AufCicG+2+6tX+1ejXsozzZEGw2neMzCyiTmEXaZIGvDq75dOlGANleMpOckOtBCPP46m1NfMmZKYQ5CwO2G1O3sZFRSy0AMOApK4bwpas+GN8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (195.214.232.10) by DB6PR0802MB2469.eurprd08.prod.outlook.com (10.172.251.17) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.13; Thu, 1 Sep 2016 18:14:19 +0000 From: Roman Kagan <rkagan@virtuozzo.com> To: <qemu-devel@nongnu.org> Date: Thu, 1 Sep 2016 21:13:59 +0300 Message-ID: <1472753640-18375-2-git-send-email-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472753640-18375-1-git-send-email-rkagan@virtuozzo.com> References: <1472753640-18375-1-git-send-email-rkagan@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [195.214.232.10] X-ClientProxiedBy: AM5PR0501CA0039.eurprd05.prod.outlook.com (10.164.187.49) To DB6PR0802MB2469.eurprd08.prod.outlook.com (10.172.251.17) X-MS-Office365-Filtering-Correlation-Id: 6b37e674-c086-4d6a-7bdd-08d3d293cb70 X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2469; 2:OVcAWMbdLPKF2ML3q9xAU18MsGKN7ImglR3VEAUFtE/cvHXUlK5fiOZ5kpLfC4poGBirdQTYa45thX/CYkKfbDahehGPyQXUMFexY//HV8JSM2PNLSWlen/TzyO/L12BS0loJjpRdqdsCVMbHlcEuLaO1rcQPMS1pUlJHNfc/szPkNhZeRoeqef08vyvIx/q; 3:/GJWv7dE9qXvGJ4i0luIpmqGm3ubZ2QgHMvdDUp6OYf2G1OKHWqwBI2Q+HOVwBycCdugLTCLoBvDODHkBLOKvGqDAg+EgN2nsfF3qfmJg31R6ozo8p30zaoHxO4wk3Bj; 25:KbuS91ssRIBBRpLcA7QTipoDhUDHTrjEpOjnUc3xtM89iOoQfRnUSp4B6ydCQ1SnaQX8elUzsuecDoWyK8g9VDUfGPOpYTFXhbZ+RhB7G17o9W5CSMSRvg6n9CIeWmAc+76Mhrkd2wqNdyunhk9YxNQ29CSjeiO/PD+QSNoU3hjZHbW7nsYg4RU2iRhVO1VAdfnAX3ahaTiGtNNI1MWvt6kCOTyG9sbyvsKwrHjkEYo2ffARmC0uAM4TSQz5mqljUVg5T/Lk3jlGkPxPDiIUjKJ87KJMj1ioL+rZwsK9Cdj1gsOAiyjj9fQaBvCII8kp0IEjGn6j1VEEkdZonBARlh2xHRcD2Y0TZTMChmk8Bv6l/74b66oQPGrka/zYgX33Jv4ppfWdK6vNFfZNHNJgMQWcku46JeQV120/XPjPW70= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0802MB2469; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2469; 31:SyrHZkrmIKXlR3MJEHrFvv68ANtPlAD7xNJfEqBs0HCV0p/V+lHBZPdoyCGvKm12zJZDduW/Ll29IVNeWNJRqpIAhUM1q3HJbRH+wYi46jPWNxCVwuRxGv6bbND8DfcjYry7mIYS3iuKqcP7lQsnU7VKWs+eXxdXLBAeY9abkb9RU45aIt2wzVfYZOvUMNnBnF23uZes/fF8b2SAuyjJ9DUKGO4M2+GiIFWZtfbYoCE=; 4:sq5LyBHM/U+OMH8QKUDTX+AW48gA+ZKqF84hxIJ7p8yzW4bF2mQYW6qY28Ob33om02QifnkbE4SitZZxMlRZjgmaWfRXgx7GO7EOXsYLl9r0jAwWNpD9WQXIvQrZ66HkWtw739BJNrVCYV+7Q01nQ3ruh7v7SM+D/LLwIjVha1ILyNrqjeAASXRKbIVL2+gNQ2RNCyo9zI70fLtIh7oKWOCU5E78icWRrstdm+/B/SflsB9J/euaErW/0VyFedT+P7XuAfBAEV5qtXB5T+92UYTEKW+AbhQdpIuCnhApOc4xEZ5sPu5jpX7q68kHU0YI/hEeYHFPz5waxUqzOemARDCgxgzQu0waFN7B+lJwlV40MEIW9+wiWeb314EjIUSE7AQjnknES8IoryVEu/9hvzvhJ8+qy/mxy4xFs2kNdGe0dkquUePUj3JFcGbX1TJIKuXdoKfjzheHTZbZe8NrZQ== X-Microsoft-Antispam-PRVS: <DB6PR0802MB2469060DDE29317D5A423CDAC9E20@DB6PR0802MB2469.eurprd08.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(131327999870524); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6042046)(6043046); SRVR:DB6PR0802MB2469; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0802MB2469; X-Forefront-PRVS: 0052308DC6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(101416001)(92566002)(4326007)(305945005)(7846002)(5003940100001)(69596002)(50226002)(50466002)(8676002)(19580405001)(97736004)(36756003)(81156014)(2906002)(68736007)(66066001)(81166006)(47776003)(189998001)(48376002)(7736002)(5660300001)(229853001)(76176999)(2351001)(86362001)(6116002)(2950100001)(42186005)(19580395003)(3846002)(53416004)(586003)(110136002)(106356001)(50986999)(77096005)(33646002)(105586002); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0802MB2469; H:rkaganb.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0802MB2469; 23:SxpcAE6QUY+Qr+QLrIo66yoGv8a12oaHqAn455w?= =?us-ascii?Q?o68BPM1LEkE3Dka4PrVeAk0BTjYVANx3DVmZ5mUMmaL35dBVCvslOPOjFPJG?= =?us-ascii?Q?0NSBF3e5cpI1NqkWdD4cRf0IVQWqZlXDLAagXUzAlORfrXd3ivBlGbrkMlbe?= =?us-ascii?Q?q2eT3mleALrcUEenAVEWJq4d3uPuQFJg/C0BdtNuKAdj7CjbGJbQqSVB50bR?= =?us-ascii?Q?AIHSajHOqYUVqURwS7ENZZ201noYzNf+t8MgaalIfQzcn6p/PG5Lu3lfWws7?= =?us-ascii?Q?c0tatBNAXkPABxb+0f/IsjyNDvwAmjNs+h/himTQOgk4zT9lojjqnMrwJP3Q?= =?us-ascii?Q?8/fy9Xtzf35eYbyNrO4w3yYeOdvLaGoacEmJvd/K4MCoYsBJXJWKF/2iEVu3?= =?us-ascii?Q?EdRMET/+DWdRDj1KZ9BH69TFIX7hVxY09BbrT5a010uWUJHPWxbmEaKtTdTF?= =?us-ascii?Q?pSt7g6/siQUOIfhvhXWXXZeNMPJgzRsi4Fss3SIHZ58HN8RBJA5rlMthZ8+p?= =?us-ascii?Q?wiCxYRkGWdy57lTrZxArIRfQThbbYBRm/mgCq6Fgh8aRlGmRIQQpJfA6Lt0o?= =?us-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:99rOZYdC7Qo9oX25HHfLYVPMGrn0yDp69zXeRsvDtnDLGAoDiFKhAgOVYnxvV7WfJ9mJJVDp0/tlHYowcRejlKXqoSDwtllVp7hi/3Q4CuDaAjo2zd2HYYNahkqLAKeQLq1E0DsR7WebEHx8TqZcOg==; 24:5EPPZyC0z+TQmnt4sy5dHShh40L0sg0Er3QcQFnsr1P8KidZiIcp30oHhgszKgsIKOQA+sXa9ztD39SkdPvlGgyZFfM4rJ5BFuKK/4uQ+Ao=; 7:/5p6S0T6r/uLf6k4w9do5vybCyq4+u8uJxblxy5G990j4a3tcQ56EJGB7slW2vnHCJGESVBbwwc5amtTb29rgpIluZ8LenXtZfSZtbb/tLqk7MIFgVKqWxmrXkg8yidUPU6FkXtziXhes25VtlCtsO5FvIl8GWGTiGAskkAErYXUZBl1rTBtR4Jp8yRL7T4fUx3lHXe5KCLS7LC5sPFTUL+QjIG111fEUKo4FwTCuJYvf5T6RH+t/X7ikyRXMuuq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0802MB2469; 20:e/HfEfoCm+cn5tJa5wuPGTmUcsPAiSPuyPhITflexBon6UWasazsPbPzAHLBUiGrC+qLhGnenR5KCtcJEjmlgGPRwPiJjWvc0vAmBkTxMk1sYovgrufP7Sg8Vw173CQsRNXpnXkCibw8I7RuD6ty4TtIxac2lmB02M7pnxDtMVk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2016 18:14:19.9800 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2469 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.1.116 Subject: [Qemu-devel] [PATCH 1/2] virtio: add virtqueue_rewind X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: Ladi Prosek <lprosek@redhat.com>, Roman Kagan <rkagan@virtuozzo.com>, Stefan Hajnoczi <stefanha@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com> Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 74c085c..844d2a1 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -272,6 +272,12 @@ void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem, virtqueue_unmap_sg(vq, elem, len); } +void virtqueue_rewind(VirtQueue *vq) +{ + vq->last_avail_idx -= vq->inuse; + vq->inuse = 0; +} + void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem, unsigned int len, unsigned int idx) { diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index d2490c1..9f49fa4 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -154,6 +154,7 @@ void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem, void virtqueue_flush(VirtQueue *vq, unsigned int count); void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem, unsigned int len); +void virtqueue_rewind(VirtQueue *vq); void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem, unsigned int len, unsigned int idx);
If the in-use elements aren't migrated (like is the case with virtio-balloon stats vq), make virtqueue forget about them and pretend they haven't been popped yet, to allow to start over on load. Signed-off-by: Roman Kagan <rkagan@virtuozzo.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Ladi Prosek <lprosek@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> --- hw/virtio/virtio.c | 6 ++++++ include/hw/virtio/virtio.h | 1 + 2 files changed, 7 insertions(+)