From nobody Mon Feb 9 00:42:32 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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1660137974; cv=none; d=zohomail.com; s=zohoarc; b=QXQitmA/9/7Tx2r1zWrYiuGMJol+C3e5nQEAVsxeyPxE4l9GkiQTa185YXb0bkKGauq3nO23KpKSwMKscv6qZBtL291excTzLruIo4Eq9mNX2GAtp5TICvA7hQmuQ2duK2CRkHsyU9SP3jbT5agGgGQ5aMJvrxopHxYkg3Og3+Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660137974; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gmbpZNyavQxKDGbXfYJjxOfxf3liXSQeUKOUnbr0AeI=; b=lW0qq5aDWTsPw81wb2EJdpkdUncNXoP2JQokYRv0kq7zmlkK+PwZiOtT5wlPWd1x/La/av/AEmAiaKkSVfMeHwt4hSarnUsJi3jaemw9X4pzFbJKrkQ3aQ9JA6rDgQpDtiGUpfV/0lHzfiWS6ZYVNn5ZTQjcPyg3yLpm2tOJfm4= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660137974747848.6237573732377; Wed, 10 Aug 2022 06:26:14 -0700 (PDT) Received: from localhost ([::1]:59002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oLliv-0005Jx-JK for importer@patchew.org; Wed, 10 Aug 2022 09:26:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLlH9-0000AP-JW for qemu-devel@nongnu.org; Wed, 10 Aug 2022 08:57:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:59007) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLlH7-0000Zy-Fd for qemu-devel@nongnu.org; Wed, 10 Aug 2022 08:57:31 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-471-RgecRYx4MKKWmBku0-HBPA-1; Wed, 10 Aug 2022 08:57:27 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4255629ABA14; Wed, 10 Aug 2022 12:57:27 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 635EA40315F; Wed, 10 Aug 2022 12:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660136248; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gmbpZNyavQxKDGbXfYJjxOfxf3liXSQeUKOUnbr0AeI=; b=f7i536CmvBzaPNlM3HsFi/NakVse7ASs7TFZ8oW3ENvxXYrJU4ei9s+zs29gKidvkNE/Xm nGQJKSfDcgiDKWC+3NObm0IMRKeFudMDHVoe0C3TElhJuXtpp58I3PWok6ybCn0RoAuSmr kGkIqMat2LQ+HyNtMHGDQwYtIWmBDYQ= X-MC-Unique: RgecRYx4MKKWmBku0-HBPA-1 From: Thomas Huth To: qemu-devel@nongnu.org, David Hildenbrand , Igor Mammedov Cc: David Gibson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , qemu-s390x@nongnu.org, Claudio Imbrenda Subject: [PATCH v2 1/3] backends/hostmem: Fix support of memory-backend-memfd in qemu_maxrampagesize() Date: Wed, 10 Aug 2022 14:57:18 +0200 Message-Id: <20220810125720.3849835-2-thuth@redhat.com> In-Reply-To: <20220810125720.3849835-1-thuth@redhat.com> References: <20220810125720.3849835-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: 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: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660137976029100001 Content-Type: text/plain; charset="utf-8" It is currently not possible yet to use "memory-backend-memfd" on s390x with hugepages enabled. This problem is caused by qemu_maxrampagesize() not taking memory-backend-memfd objects into account yet, so the code in s390_memory_init() fails to enable the huge page support there via s390_set_max_pagesize(). Fix it by generalizing the code, so that it looks at qemu_ram_pagesize(memdev->mr.ram_block) instead of re-trying to get the information from the filesystem. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D2116496 Suggested-by: David Hildenbrand Signed-off-by: Thomas Huth Reviewed-by: Claudio Imbrenda Reviewed-by: David Hildenbrand --- backends/hostmem.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/backends/hostmem.c b/backends/hostmem.c index 624bb7ecd3..4428e06738 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -306,22 +306,12 @@ bool host_memory_backend_is_mapped(HostMemoryBackend = *backend) return backend->is_mapped; } =20 -#ifdef __linux__ size_t host_memory_backend_pagesize(HostMemoryBackend *memdev) { - Object *obj =3D OBJECT(memdev); - char *path =3D object_property_get_str(obj, "mem-path", NULL); - size_t pagesize =3D qemu_mempath_getpagesize(path); - - g_free(path); + size_t pagesize =3D qemu_ram_pagesize(memdev->mr.ram_block); + g_assert(pagesize >=3D qemu_real_host_page_size()); return pagesize; } -#else -size_t host_memory_backend_pagesize(HostMemoryBackend *memdev) -{ - return qemu_real_host_page_size(); -} -#endif =20 static void host_memory_backend_memory_complete(UserCreatable *uc, Error **errp) --=20 2.31.1