From nobody Mon Feb 9 23:39:54 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=1770199679; cv=none; d=zohomail.com; s=zohoarc; b=cD0sp3CvNkGWEDmmgZGgXhO8cTdcqbhq2ioMNk3mnPwzElS2d0XL6wnfU36Ckleoz3qXJyk1CPxkSRWxjUG0C5HLnr+oJfYrMN2fTWS9Y9SbbeEStSrdijO9z3oVU95B77h+DS7UmCXJdRmskkNKUNr7pRxIl2M4GrB4QAlQVT0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770199679; 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=GMe2H9Qo0iM7nYK0XlxnPgnO70S5mOa8wtlOBW9QH5Y=; b=WyOlLt2uxrSc33+/Z8JRORnEgHVF0xBQI7WoQl9+FOvA86MyAqydQqOFkx/R/q9pNGZxPl/VqwBUhdGIKQfOejuTZQtzzkJBWyPOeovmjmM/r5bKjlvocaIvEKVvI7P8pFy30b+o1922Ik17s3DFUSa+fV5HoE6CBpiQCYTFfPg= 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 1770199679820995.4551401198651; Wed, 4 Feb 2026 02:07:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vnZnJ-0006Gv-I2; Wed, 04 Feb 2026 05:07:33 -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 1vnZnI-0006Fz-2o for qemu-devel@nongnu.org; Wed, 04 Feb 2026 05:07:32 -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 1vnZnF-0004zg-LV for qemu-devel@nongnu.org; Wed, 04 Feb 2026 05:07:31 -0500 Received: from mx-prod-mc-08.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-516-AJc9Vf9kM0GyO_wSVahhFA-1; Wed, 04 Feb 2026 05:07:27 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2948D1800367; Wed, 4 Feb 2026 10:07:26 +0000 (UTC) Received: from localhost (unknown [10.45.242.6]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 22A901955D85; Wed, 4 Feb 2026 10:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770199648; 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=GMe2H9Qo0iM7nYK0XlxnPgnO70S5mOa8wtlOBW9QH5Y=; b=UuVx4CDX+XlMh26m/AES/JhrHv9TxtHO+CdEMK2W+VgUNSqMs3PGDQCZAlYwL9RqvLmXUH s2sbxNFqFZAaGwpYDp2Cr6yLIWOBfFRn3PGyAwfw81g+LhhnN7DR/2oZJZ3TR7KDpmwYna y6X4QtB8wRJ/PeQqctBOu86/Ya7cJP8= X-MC-Unique: AJc9Vf9kM0GyO_wSVahhFA-1 X-Mimecast-MFC-AGG-ID: AJc9Vf9kM0GyO_wSVahhFA_1770199646 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , kvm@vger.kernel.org, Alex Williamson , Paolo Bonzini , Ben Chaney , "Michael S. Tsirkin" , David Hildenbrand , Fabiano Rosas , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Kanda , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH 02/10] memory: drop RamDiscardListener::double_discard_supported Date: Wed, 4 Feb 2026 14:06:58 +0400 Message-ID: <20260204100708.724800-3-marcandre.lureau@redhat.com> In-Reply-To: <20260204100708.724800-1-marcandre.lureau@redhat.com> References: <20260204100708.724800-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.17 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.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_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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: 1770199682478154100 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 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.52.0