From nobody Sun Apr 28 15:15:31 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 1491556111153719.9994233487151; Fri, 7 Apr 2017 02:08:31 -0700 (PDT) Received: from localhost ([::1]:49624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwPsb-0001Lt-Q2 for importer@patchew.org; Fri, 07 Apr 2017 05:08:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwPrW-0000m4-PH for qemu-devel@nongnu.org; Fri, 07 Apr 2017 05:07:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwPrT-0001c3-KW for qemu-devel@nongnu.org; Fri, 07 Apr 2017 05:07:22 -0400 Received: from mx7.zte.com.cn ([202.103.147.169]:36092) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwPrS-0001Zg-Mi for qemu-devel@nongnu.org; Fri, 07 Apr 2017 05:07:19 -0400 Received: from unknown (HELO mse01.zte.com.cn) (10.30.3.20) by localhost with (AES256-SHA encrypted) SMTP; 7 Apr 2017 09:03:10 -0000 Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id v3795njc040739; Fri, 7 Apr 2017 17:05:49 +0800 (GMT-8) (envelope-from lu.zhipeng@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 2017040717055656-351349 ; Fri, 7 Apr 2017 17:05:56 +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,20170407170310 From: ZhiPeng Lu To: mst@redhat.com Date: Sat, 8 Apr 2017 09:24:10 +0800 Message-Id: <1491614650-5144-1-git-send-email-lu.zhipeng@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-04-07 17:05:56, Serialize by Router on notes_smtp/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-04-07 17:05:48, Serialize complete at 2017-04-07 17:05:48 X-MAIL: mse01.zte.com.cn v3795njc040739 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.169 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, wang.guang55@zte.com.cn 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" 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