From nobody Sat Apr 11 23:02:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773088951; cv=none; d=zohomail.com; s=zohoarc; b=FurHa2qs8YXHtunymf5kcrT/e3RVYQJZmwauT278xk9KULDLR2stvG43Kx0gRilOAnuE4ecjtS3h0CNRlVl1TF31MtxtlPIitTIjAcvtzy0+uoirJa8ajP2XSCm+4VeKPXvF7KBtcUu2xe1wZHFwmm/QOg5wnQqpTs4p3LV+Uok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773088951; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=IKLe9iiWMkSZNOnyjvHZMWwPo4cDtCVEG53p9Vctsgk=; b=loAGaFjpI6QGvA+s83VL0gfc0UD0I1BTSR185ikPrMy8keAXvjqEDhKj4aLg0mdm3YY6PCctfR6dCiFuyXYOhNTRZjZoYMCOYm6Nc/6lm+Hn9S4Kzi3J+px4ZOn6httgXgEChTemQ7MaHlJU56CyFr3aiwuhzSuglrOcUFAdeEY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773088951120998.7527758300339; Mon, 9 Mar 2026 13:42:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vzhPH-0004ju-6j; Mon, 09 Mar 2026 16:40:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vzhP7-0004fd-Mh for qemu-devel@nongnu.org; Mon, 09 Mar 2026 16:40:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vzhP1-0007jw-Mv for qemu-devel@nongnu.org; Mon, 09 Mar 2026 16:40:39 -0400 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-542-L4sUBdSNMbut5Jt5xDe59g-1; Mon, 09 Mar 2026 16:40:33 -0400 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8cb6291d95aso4096430285a.1 for ; Mon, 09 Mar 2026 13:40:33 -0700 (PDT) Received: from x1.local (bras-vprn-aurron9134w-lp130-03-174-91-117-149.dsl.bell.ca. [174.91.117.149]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8cd8576db0esm332951885a.47.2026.03.09.13.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 13:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773088835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IKLe9iiWMkSZNOnyjvHZMWwPo4cDtCVEG53p9Vctsgk=; b=DnWcqIZ42PnUpCO1G1klbJ85eaq0JBVx1TtMIF+/nP2jBP+TwOhsPWPtYkMczzSV5jVCyQ XMJb/ydIOLoOhEjCdhlXADSISRnGj1laDYmPhyJegoCv25E36eLTt7JQiy8clVvC5Dg+Oq 1qzshxpfRMzlkihaDbq0MzU11Re57I8= X-MC-Unique: L4sUBdSNMbut5Jt5xDe59g-1 X-Mimecast-MFC-AGG-ID: L4sUBdSNMbut5Jt5xDe59g_1773088833 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773088833; x=1773693633; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IKLe9iiWMkSZNOnyjvHZMWwPo4cDtCVEG53p9Vctsgk=; b=Yfnoz97BVFxtLAHciHRMi3oc8JW3tjs/EYZI9FwoYl5cnTCZydPDo1+ODMwNH3p/L0 ryfWpHSO5sPAu4IB6EyDrKn16kmyaEEr64yFp/GRKKYBqCYPzo3WsRbviBw2Dy+cuANO PhfmoFDBc0WyqfUS/UI5IxyPaCz6lhJyZiK7q1I1Yr6HVzpGQRLp+wbAkTl1Ibt+M8sm RQD6KHp2PS6BR+9RZepZs4C+1RRJJfdPi7OCe082T+eLK5/DYG/0f7WglK5ZAYu57zng p4q2MW1qke/0nqk3pjmvHOLxNdJEtbLkzp1fhpww99m4TL8Dhf4mwQpIGNQkYSdiDh9v JIow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773088833; x=1773693633; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=IKLe9iiWMkSZNOnyjvHZMWwPo4cDtCVEG53p9Vctsgk=; b=s3CboqOEfOvTJJsspsWxyScG+E0/ygDhzUardJ9wgBfNpK8T5RmjfljpSAvLqf5DoH 8gL5QpMHALUBA7q6wN96wGxnh8PBolS1IhTBHjRkoIwNsARHFxbVdgbBStyBRheEqD3T 1rngfYcqI33JOEWqsPyCV0YH35CPnYcEWMdpNZloJeUgghv1KaLchYmYfrB45g/0BVs4 7pIlFlt3eKzd1Gg4UPYhX4gUKhSjYnuXCW+AHNOoKjcvQMgQ63tfd9VsqAo6WuiSUqml 6aFSc4Ja+9sDTTHtucpT67EngjQqL7RUU+uMKALrnHUk3O4gqQWaYAZQV015N3KMzv1F Ldkg== X-Gm-Message-State: AOJu0Yyz3azRNIIL6FMWNb8OnN9vJM5ce/7z3jSglwfm33HVxXVe7pbH ajXuuTKOkWkZQZgASB2zmYEJkVKYk0ZCWg5xsjr/o66Lps5sICMaMa4V9RBjWUet+0pOvTmTEbn nyzsRzFaqMHRKVi6IGsghi1xntExkorXQ+sVG0yfJJfF73UeHtdPKnpQD+PrwLAOQugIOwIdYn1 p5n06dhqb3WCIXpZ2YY7ay3O89KP8UkmEYRy0IMg== X-Gm-Gg: ATEYQzyzOXfuI83z1ZK+TrTUE9FM7HraefMPXKuiDPa6tHh1rnpEiMUSV8L9QaoGRWw C1B3vvhEOlB4PADQSLzlBWRzjZbD+MOGUU59wdi9OEpU2h3C9qqAPnwhVEcrEZMwWFK7KZ2IUKJ KkuEPyDitIsvyi3QMoLaEuWDY7Kl179hLG65Mmi/EXUHg6eFpzY99ZTZB3Vtl3sxxlmagL2ncKt iuI0j1qnKZqPuzQqEZLKwnonjVfdP+maoiE6yPkX1yWQQDLmxSQimKffbnb+2SW0alLRf8oikem cv97j08TqCMWPsi+2rCX/lZ1YCApXEe/izKVB7tlfujjlhN/EKjncLf9I1pIkb2VV5QWHnqzxVr i9t5Az9LmVNteuaLs//r+TrG8eGSqunumpnKSAOZLXDuomJe2wKQc/QjHDPQYtKObKyZ9hR8KJD 6WrukaTA== X-Received: by 2002:a05:620a:444d:b0:8cd:8a8b:8cf6 with SMTP id af79cd13be357-8cd8a8b9552mr537873285a.10.1773088832660; Mon, 09 Mar 2026 13:40:32 -0700 (PDT) X-Received: by 2002:a05:620a:444d:b0:8cd:8a8b:8cf6 with SMTP id af79cd13be357-8cd8a8b9552mr537868585a.10.1773088832024; Mon, 09 Mar 2026 13:40:32 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , "David Hildenbrand (Arm)" Subject: [PULL 11/18] memory: drop RamDiscardListener::double_discard_supported Date: Mon, 9 Mar 2026 16:40:00 -0400 Message-ID: <20260309204007.1709441-12-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260309204007.1709441-1-peterx@redhat.com> References: <20260309204007.1709441-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773088952854154100 From: Marc-Andr=C3=A9 Lureau This was never turned off, effectively some dead code. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Peter Xu Acked-by: David Hildenbrand (Arm) Link: https://lore.kernel.org/r/20260226140001.3622334-3-marcandre.lureau@r= edhat.com Signed-off-by: Peter Xu --- include/system/memory.h | 12 +----------- hw/vfio/listener.c | 2 +- hw/virtio/virtio-mem.c | 22 ++-------------------- system/ram-block-attributes.c | 23 +---------------------- 4 files changed, 5 insertions(+), 54 deletions(-) diff --git a/include/system/memory.h b/include/system/memory.h index d4793a08a7..d6b5ca13c2 100644 --- a/include/system/memory.h +++ b/include/system/memory.h @@ -580,26 +580,16 @@ struct RamDiscardListener { */ NotifyRamDiscard notify_discard; =20 - /* - * @double_discard_supported: - * - * The listener suppors getting @notify_discard notifications that span - * already discarded parts. - */ - bool double_discard_supported; - MemoryRegionSection *section; QLIST_ENTRY(RamDiscardListener) next; }; =20 static inline void ram_discard_listener_init(RamDiscardListener *rdl, NotifyRamPopulate populate_fn, - NotifyRamDiscard discard_fn, - bool double_discard_supported) + NotifyRamDiscard discard_fn) { rdl->notify_populate =3D populate_fn; rdl->notify_discard =3D discard_fn; - rdl->double_discard_supported =3D double_discard_supported; } =20 /** diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c index 1087fdc142..960da9e0a9 100644 --- a/hw/vfio/listener.c +++ b/hw/vfio/listener.c @@ -283,7 +283,7 @@ static bool vfio_ram_discard_register_listener(VFIOCont= ainer *bcontainer, =20 ram_discard_listener_init(&vrdl->listener, vfio_ram_discard_notify_populate, - vfio_ram_discard_notify_discard, true); + vfio_ram_discard_notify_discard); ram_discard_manager_register_listener(rdm, &vrdl->listener, section); QLIST_INSERT_HEAD(&bcontainer->vrdl_list, vrdl, next); =20 diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index c1e2defb68..251d1d50aa 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -331,14 +331,6 @@ static int virtio_mem_notify_populate_cb(MemoryRegionS= ection *s, void *arg) return rdl->notify_populate(rdl, s); } =20 -static int virtio_mem_notify_discard_cb(MemoryRegionSection *s, void *arg) -{ - RamDiscardListener *rdl =3D arg; - - rdl->notify_discard(rdl, s); - return 0; -} - static void virtio_mem_notify_unplug(VirtIOMEM *vmem, uint64_t offset, uint64_t size) { @@ -398,12 +390,7 @@ static void virtio_mem_notify_unplug_all(VirtIOMEM *vm= em) } =20 QLIST_FOREACH(rdl, &vmem->rdl_list, next) { - if (rdl->double_discard_supported) { - rdl->notify_discard(rdl, rdl->section); - } else { - virtio_mem_for_each_plugged_section(vmem, rdl->section, rdl, - virtio_mem_notify_discard_= cb); - } + rdl->notify_discard(rdl, rdl->section); } } =20 @@ -1824,12 +1811,7 @@ static void virtio_mem_rdm_unregister_listener(RamDi= scardManager *rdm, =20 g_assert(rdl->section->mr =3D=3D &vmem->memdev->mr); if (vmem->size) { - if (rdl->double_discard_supported) { - rdl->notify_discard(rdl, rdl->section); - } else { - virtio_mem_for_each_plugged_section(vmem, rdl->section, rdl, - virtio_mem_notify_discard_= cb); - } + rdl->notify_discard(rdl, rdl->section); } =20 memory_region_section_free_copy(rdl->section); diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c index 9f72a6b354..630b0fda12 100644 --- a/system/ram-block-attributes.c +++ b/system/ram-block-attributes.c @@ -61,16 +61,6 @@ ram_block_attributes_notify_populate_cb(MemoryRegionSect= ion *section, return rdl->notify_populate(rdl, section); } =20 -static int -ram_block_attributes_notify_discard_cb(MemoryRegionSection *section, - void *arg) -{ - RamDiscardListener *rdl =3D arg; - - rdl->notify_discard(rdl, section); - return 0; -} - static int ram_block_attributes_for_each_populated_section(const RamBlockAttributes *= attr, MemoryRegionSection *secti= on, @@ -191,22 +181,11 @@ ram_block_attributes_rdm_unregister_listener(RamDisca= rdManager *rdm, RamDiscardListener *rdl) { RamBlockAttributes *attr =3D RAM_BLOCK_ATTRIBUTES(rdm); - int ret; =20 g_assert(rdl->section); g_assert(rdl->section->mr =3D=3D attr->ram_block->mr); =20 - if (rdl->double_discard_supported) { - rdl->notify_discard(rdl, rdl->section); - } else { - ret =3D ram_block_attributes_for_each_populated_section(attr, - rdl->section, rdl, ram_block_attributes_notify_discard_cb); - if (ret) { - error_report("%s: Failed to unregister RAM discard listener: %= s", - __func__, strerror(-ret)); - exit(1); - } - } + rdl->notify_discard(rdl, rdl->section); =20 memory_region_section_free_copy(rdl->section); rdl->section =3D NULL; --=20 2.50.1