From nobody Sat May 18 23:55:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491555567085168.62305974733238; Fri, 7 Apr 2017 01:59:27 -0700 (PDT) Received: from localhost ([::1]:49589 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwPjp-00068R-TX for importer@patchew.org; Fri, 07 Apr 2017 04:59:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwPik-0005QL-JN for qemu-devel@nongnu.org; Fri, 07 Apr 2017 04:58:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwPih-0006At-GY for qemu-devel@nongnu.org; Fri, 07 Apr 2017 04:58:18 -0400 Received: from out1.zte.com.cn ([202.103.147.172]:41297) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwPig-00069h-Ot for qemu-devel@nongnu.org; Fri, 07 Apr 2017 04:58:15 -0400 Received: from unknown (HELO mse01.zte.com.cn) (10.30.3.20) by localhost with (AES256-SHA encrypted) SMTP; 7 Apr 2017 08:51:21 -0000 Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id v378viQJ018747; Fri, 7 Apr 2017 16:57:44 +0800 (GMT-8) (envelope-from wang.guang55@zte.com.cn) Received: from localhost.localdomain ([10.74.120.79]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017040716575162-350427 ; Fri, 7 Apr 2017 16:57:51 +0800 X-scanvirus: By SEG_CYREN AntiVirus Engine X-scanresult: CLEAN X-MAILFROM: X-RCPTTO: X-FROMIP: 10.30.3.20 X-SEG-Scaned: 1 X-Received: unknown,10.30.3.20,20170407165121 From: Wang guang To: mst@redhat.com Date: Sat, 8 Apr 2017 09:16:23 +0800 Message-Id: <1491614183-4580-2-git-send-email-wang.guang55@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1491614183-4580-1-git-send-email-wang.guang55@zte.com.cn> References: <1491614183-4580-1-git-send-email-wang.guang55@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-04-07 16:57:51, Serialize by Router on notes_smtp/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-04-07 16:57:43, Serialize complete at 2017-04-07 16:57:43 X-MAIL: mse01.zte.com.cn v378viQJ018747 X-HQIP: 127.0.0.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 202.103.147.172 Subject: [Qemu-devel] [PATCH] vhost: skip RAM device memory sections 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: ZhiPeng Lu , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: ZhiPeng Lu A RAM device represents a mapping to a physical device, such as to a PCI * MMIO BAR of an vfio-pci assigned device. Vhost listens to this region,and increases the region's reference count while passthrough?for?network adapters (Physical Function, PF or Virtual Fu= nction, VF). After detaching network adapters with vhost backend dirver or vhost user= dirver, it unregister vhost listen function by memory_listener_unregister. After detaching the passthrough pf or vf, the RAM device region's reference by vhost listener increated can not be r= eleased, due to vhost listen function does not exist.So let's just skip RAM device m= emory. Signed-off-by: ZhiPeng Lu --- hw/virtio/vhost.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 613494d..c1ff98f 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -611,7 +611,8 @@ static void vhost_set_memory(MemoryListener *listener, static bool vhost_section(MemoryRegionSection *section) { return memory_region_is_ram(section->mr) && - !memory_region_is_rom(section->mr); + !memory_region_is_rom(section->mr) && + !memory_region_is_skip_dump(section->mr); } =20 static void vhost_begin(MemoryListener *listener) --=20 1.8.3.1