From nobody Mon Mar 2 11:03:19 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=1772114458; cv=none; d=zohomail.com; s=zohoarc; b=G7GlRG5zb9MX/G+fAVXQMFbFydxMUvfdm13gSXYYl9LCmN3AO8LtCamh1PGvg0y1l7TLTxTtMvTpXgFebvM8yrQneoU+vcDSaNwxdIyN5NibBeVeVYXuzCHTKF88i5xkYXJshmyaPUb2ggsrDIbGRyqtXO8U2uW1+cwx1fmk7dI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772114458; 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=fHe9iQ+1P8ZlO5xByO1a0ChmR22YDJBfDZShZX5olz8=; b=T4HH2sNtDXXEDQqOnoCiG1lT7oZvkeY3jrsnmAmMhM75IJy0gdazXI7wGPsfn3m9IvcB+uxptJv9uIcLbdrwTx+K0aCXK9uVkVledvKl/K3xA39TfOz1GpTe6EfgbG0HVfiUehUVDAjX8nvQWXueqKHDuXkGvulAzLwk1UWM3jU= 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 1772114458596943.9791887378707; Thu, 26 Feb 2026 06:00:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vvbug-0002c4-Gi; Thu, 26 Feb 2026 09:00:22 -0500 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 1vvbue-0002bn-C4 for qemu-devel@nongnu.org; Thu, 26 Feb 2026 09:00:20 -0500 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 1vvbuc-0006Hw-Kp for qemu-devel@nongnu.org; Thu, 26 Feb 2026 09:00:20 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-220-hcP5uesGOUi3WMeofA4mnQ-1; Thu, 26 Feb 2026 09:00:14 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1A71818005BC; Thu, 26 Feb 2026 14:00:13 +0000 (UTC) Received: from localhost (unknown [10.45.242.29]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9820D19560B5; Thu, 26 Feb 2026 14:00:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772114417; 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=fHe9iQ+1P8ZlO5xByO1a0ChmR22YDJBfDZShZX5olz8=; b=E1g/8G1HBalt/7T53Udm217Y8Y+oFsNTwnM54KQXDS4Ry8/tOgxt0T5647LEwaNKEEd2SZ 30skElX+SMLvrws1imr5hJkFk3t1bigFajQ5GDRk74iRgXsYmpP+CyuFJ3A5IYg1DXui5D FcCnXK+oI4w90VjmU0CCn2jUiDRhWyM= X-MC-Unique: hcP5uesGOUi3WMeofA4mnQ-1 X-Mimecast-MFC-AGG-ID: hcP5uesGOUi3WMeofA4mnQ_1772114413 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Ben Chaney , "Michael S. Tsirkin" , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Paolo Bonzini , Alex Williamson , Fabiano Rosas , David Hildenbrand , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Xu , kvm@vger.kernel.org, Mark Kanda , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH v3 02/15] memory: drop RamDiscardListener::double_discard_supported Date: Thu, 26 Feb 2026 14:59:47 +0100 Message-ID: <20260226140001.3622334-3-marcandre.lureau@redhat.com> In-Reply-To: <20260226140001.3622334-1-marcandre.lureau@redhat.com> References: <20260226140001.3622334-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 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.306, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.668, 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: 1772114459551158500 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 Acked-by: David Hildenbrand (Arm) --- 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 0562af31361..be36fd93dc0 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 1087fdc142e..960da9e0a93 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 c1e2defb68e..251d1d50aaa 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 9f72a6b3545..630b0fda126 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.53.0