From nobody Sun Feb 8 14:52:49 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=1661881978; cv=none; d=zohomail.com; s=zohoarc; b=n4LccwkYOSGawwPTqa6Mj1sIdDEUcvdKrURiM01S95Z2Kxa5/1GIVWwyTHHCrayvzWwrMbx7XB9XrlfIcVJRUUtOmgLiPqRgiWUM/sSLyeFr3ENx15v4n9CA4bHNkkPFlVRDCYPqZM4DB9hHwaVP4ueDLc7ANATD+Jn48o+gaRU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661881978; 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=m8h79wOHIduyozIw5k3sBr2NCR28mUsun9GVxHQ/fUo=; b=ILiELKzpfRLBetlGeqj/aGKeFBbLGMPydChYokzAqYW9b0qlOVgkCvgoRnwPHsxPDsyEGRPcZw3sEWq5opWuzRQjsVR6Riy2lyubOspU2e6CqCNbZLQ0TjnF6es5q2q24JDz7IeXq2ylck3FXs+35FkxF/tVIqsxlQm3msbqMz4= 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 1661881978143993.9888245148948; Tue, 30 Aug 2022 10:52:58 -0700 (PDT) Received: from localhost ([::1]:34876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oT5Q0-0002VG-K7 for importer@patchew.org; Tue, 30 Aug 2022 13:52:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT4uC-0006Pi-S7 for qemu-devel@nongnu.org; Tue, 30 Aug 2022 13:20:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:31466) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT4uB-0005jM-5k for qemu-devel@nongnu.org; Tue, 30 Aug 2022 13:20:04 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-38HAFJEEPoabkS8XcKq8EQ-1; Tue, 30 Aug 2022 13:19:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A4C38803916; Tue, 30 Aug 2022 17:19:57 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70A411121314; Tue, 30 Aug 2022 17:19:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661880001; 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=m8h79wOHIduyozIw5k3sBr2NCR28mUsun9GVxHQ/fUo=; b=MGNKcFdrOEpxaAUpRU572t2fYL8QeK3pMGphfzgDfz46PguwAg0Gbty/D2xgXQ1POuPNua 3PiGjwo/eM3O4lUoy9Pg9QF3ia0j+t4Ln05WKPWQFiQrJ7A6tZlZnFX57cYtkk6F8X70RH Kg5UlAEodZdY3wEhPmiKVekVOYucHeU= X-MC-Unique: 38HAFJEEPoabkS8XcKq8EQ-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson , Peter Maydell Cc: qemu-s390x@nongnu.org Subject: [PULL 4/6] backends/hostmem: Fix support of memory-backend-memfd in qemu_maxrampagesize() Date: Tue, 30 Aug 2022 19:19:45 +0200 Message-Id: <20220830171947.71464-5-thuth@redhat.com> In-Reply-To: <20220830171947.71464-1-thuth@redhat.com> References: <20220830171947.71464-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_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: 1661881979420100001 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. Suggested-by: David Hildenbrand Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D2116496 Message-Id: <20220810125720.3849835-2-thuth@redhat.com> Reviewed-by: David Hildenbrand Reviewed-by: Claudio Imbrenda Signed-off-by: Thomas Huth --- 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