From patchwork Fri Jul 26 15:07:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13742872 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D62DBC3DA49 for ; Fri, 26 Jul 2024 15:08:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6293E6B00A6; Fri, 26 Jul 2024 11:08:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D96D6B00A8; Fri, 26 Jul 2024 11:08:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A3126B00A9; Fri, 26 Jul 2024 11:08:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2D8636B00A6 for ; Fri, 26 Jul 2024 11:08:22 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id BB9E541845 for ; Fri, 26 Jul 2024 15:08:21 +0000 (UTC) X-FDA: 82382234802.15.E337A5E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf25.hostedemail.com (Postfix) with ESMTP id DB67EA0029 for ; Fri, 26 Jul 2024 15:08:19 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=bdWqnRG5; spf=pass (imf25.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722006475; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=h2hZ5iaP0GGncGDVruB29gu4r9/BL7FMsu+FThy8pbQ=; b=fEQR3Pu46d0pVbPWKtg0XFmXmsKTEEalBeruJFpm9aMHH4dYte+DsB/8prsmSv0OWkgofP QQ8Lau4hYxY+pBd3IhAyIFOD9mkipEYe1Bkd76CKzq2XO1XsC4v/UHd3xsB4T1NyceTkIZ abPpAD5LUje1ivzi4DsEuJrcbbC5XzU= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=bdWqnRG5; spf=pass (imf25.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722006475; a=rsa-sha256; cv=none; b=E56lPt+SBBf6drewOtNrUaTc9eFjFxEkJShyZ9OGgGzTicGJVRpYFg4e0O2nlbxBrZwxux F5eEh2eK3zs+422dWNb4oNGpAGEtZCIZQjTfsrOckMboXzLeKVeIVWoK0ZQ91GFxrscUOy 0DwnHifG7ydH/nV1nur5uc9gwhInzOI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722006499; 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=h2hZ5iaP0GGncGDVruB29gu4r9/BL7FMsu+FThy8pbQ=; b=bdWqnRG5VTTzON3T4WySGYoMF5AhOmjcHnPePsuNj4C8kgsaImDSxHHSYnjyVF3ekeOWAE 2/J986piuzF7NBssMUmAlAQB2eZHLJpmBYbwQEgy+lSxjs+141xly3P3bwSRDzATO6lL+S 0PWhkAn2/edraPIR3uasruGFi4DrUj0= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-672-HOHS8bHhPF-HxdWbNQ7urA-1; Fri, 26 Jul 2024 11:08:13 -0400 X-MC-Unique: HOHS8bHhPF-HxdWbNQ7urA-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1CD891955BF7; Fri, 26 Jul 2024 15:08:10 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.193.153]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BB2841955D48; Fri, 26 Jul 2024 15:08:00 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, xen-devel@lists.xenproject.org, linux-fsdevel@vger.kernel.org, David Hildenbrand , Andrew Morton , Oscar Salvador , Peter Xu , Muchun Song , Russell King , Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Naveen N. Rao" , Juergen Gross , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Alexander Viro , Christian Brauner Subject: [PATCH v1 3/3] powerpc/8xx: document and enforce that split PT locks are not used Date: Fri, 26 Jul 2024 17:07:28 +0200 Message-ID: <20240726150728.3159964-4-david@redhat.com> In-Reply-To: <20240726150728.3159964-1-david@redhat.com> References: <20240726150728.3159964-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: DB67EA0029 X-Stat-Signature: 9oep1oob8pgfpsqk6si9txhmgg35yng4 X-HE-Tag: 1722006499-914171 X-HE-Meta: U2FsdGVkX1+fINaVKAFoX8fulvW65R2XXIikjQbR2ZNjE3OeasligrvEsO25yhap4mB7DkIujscKe2srL8SXn4PI8ORtTmnQxMbXgZ1clKy0IFSOF5jFexPcmT4OK4qn+/HBadIYC+KrYAiUurP+1Q3kqmzm3QvLcrLBl/uw9C4qPZvtE1mZ78z+3HtIpwEkx33IzWgJn8TaeTuPBLzFLaGuF2qq0vfW+qv9vHbekazMRKKOA/6BPlzYhQ8+G/RmOEeX1RzYdLKguia0Y0/WHsnBEPO5M7fAmEXBTPpm/K3BYt2JXRd5W3aVy2pLw5/TWTFMl8Cpm74uH+4Jh3FImo7niYF+2SWgVL8Kf4ayrtBLvJB65mvZEQ0HsCPwVYX4OAgYHjT13RgP1VJ/cZYc/DMVcRv5kXPkzI7nLxyZT7kEWJ1c+y0oz2Lb57eoMG8owY6VnkNaiWGNyxmmI7XDW+Rn9sx2g7jOfjgKEdoe1+Ra74Acp/O4k3nVUE6j+37olh3J8y8w+1CGsjz8SYkxSgY62DXTkDWYKZcpZhoE8zaL2Of9RCkpHR0cDt5bdTNmjOTi9xPhQ5tUUuaVzJMuFYWHSedYQlphT36RtTjfnUwTg2Xwn+wHzxNoFqzYQ9VmRbrzCCUq05VletU2oYPLu3iFXmBJ59K4WG5S5bDY43Qg6/K3ch5ys/PHwFmF68Y/iMVowWysTno0vfEnqopmyoOXYMX7GbSayTf0CmrKfTekWQ3cwqX+BUP3/U0YTNxe6nWwI1LQVAiRA4valOd81Clmf/k9UZEhpT+WHMy8bfhwfshk3SLInGCSe5vvRJ3V60tw6xpnJyXtp5E2SOvn9RAURqTo96dk2cSsbKx9xjhZ1GwXivXJPbv5YvW70et25aBUpv/My3ZxctOLe9G1H55JXtaWsKeeB018DVnHY1uLIcumhy9sksKI8iYOtnLHdp/oC7hhAaBvM9twhXt SidWDx5X G4L0ZBPTT3Hg273MDs2tNiCmhc9rT9i41w/cwzHfYbWngzz1GNqF1a5NxlR9sAahNI1T69/21OlQlikz1+O2N8dCkkQzUpDjdZZgiiwADlUbI/3do5s8gtqjkGImZ2oGrZaZ+REWxgfJiOWMBKg6eV/X4OgwLKjXDguVwFqAw1ZojPl0OlZP2V8unV/dMVdvbP8/aQhL5E/vPQXX5oi3MvnPetcg/o5JiTPmhPOOh/gAWy/UuNETTfR1XopE1a3axiq3gLfOJTbZk5jybxxhf1cJGG3n6si67nPcsPAXAQZ7vBlU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Right now, we cannot have split PT locks because 8xx does not support SMP. But for the sake of documentation *why* 8xx is fine regarding what we documented in huge_pte_lockptr(), let's just add code to enforce it at the same time as documenting it. This should also make everybody who wants to copy from the 8xx approach of supporting such unusual ways of mapping hugetlb folios aware that it gets tricky once multiple page tables are involved. Signed-off-by: David Hildenbrand --- arch/powerpc/mm/pgtable.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c index ab0656115424f..7316396e452d8 100644 --- a/arch/powerpc/mm/pgtable.c +++ b/arch/powerpc/mm/pgtable.c @@ -297,6 +297,12 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma, } #if defined(CONFIG_PPC_8xx) + +#if defined(CONFIG_SPLIT_PTE_PTLOCKS) || defined(CONFIG_SPLIT_PMD_PTLOCKS) +/* We need the same lock to protect the PMD table and the two PTE tables. */ +#error "8M hugetlb folios are incompatible with split page table locks" +#endif + static void __set_huge_pte_at(pmd_t *pmd, pte_t *ptep, pte_basic_t val) { pte_basic_t *entry = (pte_basic_t *)ptep;