From nobody Fri Nov 7 00:45:55 2025 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.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544628365692668.4799503322006; Wed, 12 Dec 2018 07:26:05 -0800 (PST) Received: from localhost ([::1]:45572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Oi-0002J2-8Y for importer@patchew.org; Wed, 12 Dec 2018 10:26:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MO-0000f5-Es for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MI-0008V7-Qu for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:38 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:46520) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MG-0008Qh-Us for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:33 -0500 Received: by mail-wr1-x42a.google.com with SMTP id l9so18047166wrt.13 for ; Wed, 12 Dec 2018 07:23:30 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=ohNPlITjNo9ZpAsml58lXHZNCGfnAWqPmz2U8SwFAFA=; b=OgbguIwUiLniqEpRGDAzHiI2vDStkWPGROpXrMkXgX8zFdWT3S67BOiYAUlgLrIkTo RxYx36/S1f7LJTwoqbL6fazLon4ShZVF86wuXrHREjI+MDT0duqT9vY16SOIojTcwae7 sudwzn0yPbrT4ZXIiAamfrRjUK2JaQ+6C0rqPWZZESgDM/B6V7VjRQW+1J3fhcGUzQVw dzzkXH0pYNhdjGUcdcmQJarrm0G+b/SUiRAf+5rTCKhJ+htC6hdBtwC7X0qxV84sg6xd 3mZHeUDETKpm0et7Qt7Xh9UKYm4dO0dc4mSmdM0ZNbohW+sG0w1pljZSgIik5auOJUve f+Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=ohNPlITjNo9ZpAsml58lXHZNCGfnAWqPmz2U8SwFAFA=; b=DXZsEsFq0btG7fMcbkKJBVPRaWoFFn2Qwy5QVpliCRdlIeIgR1gVGROEXi6Op8mRhY 4HWGLytuDx8o4472V8FrzcqeDnoaVoHCzY8ofmlFnmKrOH30WZwP0VlTSdu3UN9+P3Md 0RnexWnK/kjJVJoisUtSP8bxmhc/7cz7DqZUYUQzaHtwdowmHTPk6HDrrDoqFGyZ3YPw 1gmSwbpkeE2pYj7ofXO2pIZgqUIFF9PoObKeD10HFQ61JWPwup0v60JBCGyaD8hVN9tI +6oKJshYjsJwd+Bq4uZj11mQ9yLIS5xAnzji4czR985wI4B7/BKeTLK4Dq9udq+CEFqt yQTQ== X-Gm-Message-State: AA+aEWaCdabsd8oaerzCMwGb/LrkTkleI04t+GBwle9JFoOr6hFrJEHj vTk03vl/6QKekzY7T1+Lu/PGkbdz X-Google-Smtp-Source: AFSGD/XrMxyyu3m3YE4UtDNb4toJE5NvgTmoyCMS8KFe59th4w1kTtpVJnEHR5+P96ao4SDvhCMseQ== X-Received: by 2002:adf:fe43:: with SMTP id m3mr17056367wrs.290.1544628209495; Wed, 12 Dec 2018 07:23:29 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:30 +0100 Message-Id: <1544628195-37728-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a Subject: [Qemu-devel] [PULL 09/54] memory: avoid unnecessary coalesced_io_del operations 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Store whether the FlatRange has had any coalesced I/O ranges applied, and if not avoid calling coalesced_io_del. This is useful in preparation for the next patch, which will call coalesced_io_del when rendering memory regions. Signed-off-by: Paolo Bonzini --- memory.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/memory.c b/memory.c index 119b6e4..072769a 100644 --- a/memory.c +++ b/memory.c @@ -217,6 +217,7 @@ struct FlatRange { bool romd_mode; bool readonly; bool nonvolatile; + bool has_coalesced_range; }; =20 #define FOR_EACH_FLAT_RANGE(var, view) \ @@ -650,6 +651,7 @@ static void render_memory_region(FlatView *view, fr.romd_mode =3D mr->romd_mode; fr.readonly =3D readonly; fr.nonvolatile =3D nonvolatile; + fr.has_coalesced_range =3D false; =20 /* Render the region itself into any gaps left by the current view. */ for (i =3D 0; i < view->nr && int128_nz(remain); ++i) { @@ -852,6 +854,10 @@ static void address_space_update_ioeventfds(AddressSpa= ce *as) =20 static void flat_range_coalesced_io_del(FlatRange *fr, AddressSpace *as) { + if (!fr->has_coalesced_range) { + return; + } + MEMORY_LISTENER_UPDATE_REGION(fr, as, Reverse, coalesced_io_del, int128_get64(fr->addr.start), int128_get64(fr->addr.size)); @@ -863,6 +869,11 @@ static void flat_range_coalesced_io_add(FlatRange *fr,= AddressSpace *as) CoalescedMemoryRange *cmr; AddrRange tmp; =20 + if (QTAILQ_EMPTY(&mr->coalesced)) { + return; + } + + fr->has_coalesced_range =3D true; QTAILQ_FOREACH(cmr, &mr->coalesced, link) { tmp =3D addrrange_shift(cmr->addr, int128_sub(fr->addr.start, --=20 1.8.3.1