From patchwork Tue Mar 5 04:37:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13581597 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 B7395C54798 for ; Tue, 5 Mar 2024 04:38:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 546F5940009; Mon, 4 Mar 2024 23:38:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 51DFE940007; Mon, 4 Mar 2024 23:38:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43439940009; Mon, 4 Mar 2024 23:38:36 -0500 (EST) 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 2D3E8940007 for ; Mon, 4 Mar 2024 23:38:36 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 069B31A011E for ; Tue, 5 Mar 2024 04:38:36 +0000 (UTC) X-FDA: 81861729432.03.F5E5368 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 69BBC80009 for ; Tue, 5 Mar 2024 04:38:34 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dF3SKimy; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709613514; 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=RdT2Q0TeX0+DskPh7cQ9GWjsaXoSWZfTenFAEBHiO1c=; b=CKaDz/+8XNW9MFjL44NlI5W2x3Dx3QeOzh+YISHEXU1lqbpBP1C1y1EKfjJ4uzCQph8xvr r1dVeyyf4g4reyV3HXBBHAKk7Z+cMANRbZhlc+O1X+Z5KoA4UaO3jQ6jvEttZExcC8ZQ/r m8rfL49aP92wxtFSsLJu7Aoe3OnNuGE= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dF3SKimy; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709613514; a=rsa-sha256; cv=none; b=NTruSkpRQu2GAoE1a0ba7ePC+SNj/26AgZgr31EKeUosq5cu+61ZfI2a+7Z6k6T0UVEU4f LRJ2CegEXCbJxfE39Gvf4eHA6qbTo1AZH7aUoTmU40+fXZ9rNkMU96Pjn2ltOkhUxDGBNg eBFzgCbGsWjvCqUyIEO1F9i44opjvm0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709613513; 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=RdT2Q0TeX0+DskPh7cQ9GWjsaXoSWZfTenFAEBHiO1c=; b=dF3SKimyjo1oy+ArmDIWE86Ah/j5tXjufj1rTWrb+sXLS5hyLO2DAXyKNHd7iDB5GwMloF yORTTvaIVco74D2loqBiSJUyppCrzMk5vKyyuOUeOnKQ9TXU+S5W2YVnFSuYyH+dz1qnRq HFJ8S16kZwygZJVRPNBNFzz+g9f3uTE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-594-cAgx3rZoNfqMGBlxB6YwXw-1; Mon, 04 Mar 2024 23:38:31 -0500 X-MC-Unique: cAgx3rZoNfqMGBlxB6YwXw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 63FC0185AD0B; Tue, 5 Mar 2024 04:38:30 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 68DA5C1F086; Tue, 5 Mar 2024 04:38:23 +0000 (UTC) From: peterx@redhat.com To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Christophe Leroy , x86@kernel.org, "Kirill A . Shutemov" , Jason Gunthorpe , Yang Shi , peterx@redhat.com, Andrew Morton , linuxppc-dev@lists.ozlabs.org, Muchun Song , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen Subject: [PATCH v3 04/10] mm/x86: Replace pgd_large() with pgd_leaf() Date: Tue, 5 Mar 2024 12:37:44 +0800 Message-ID: <20240305043750.93762-5-peterx@redhat.com> In-Reply-To: <20240305043750.93762-1-peterx@redhat.com> References: <20240305043750.93762-1-peterx@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Rspam-User: X-Stat-Signature: nri1h9opjk1gih6kbrb4uxe3g9nwignc X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 69BBC80009 X-HE-Tag: 1709613514-413460 X-HE-Meta: U2FsdGVkX1/8cBAEpg5M/pH5tjOOKA9zSzptOQzv9KCXzwvQSVyLoLuM7u0neU4GJdHykxGWg6v7G1Se6g6k7m5Ua4QXRD+NkByD6gf1fQRNYY1AwqYvh6EzZ09NewI8Y8N/RmEqQZ6+5pUJqpHVCOTNL3VLVkF6O77Nq/T3Hj/ARN509fGt1QmONyTBu+7frt+Ih95G2AbsNabAjagsqBNDiQTHAtH7dpuhfixt89qco/FLeewT9D6TPydv0rcRWYrq++tMgAEtJCLy5rys3G7OjXqyxNMsIptG7MsFbMywIZcv3KscdXnAOeXqi69WpV1tw+ILfs++erbFVVuRoJdYDH9ELbK70yS0I0I9Brl0nHdCC5Jay/JhkZXh5hLNYPF/ilSUQQ+gZXJ8VEjW8Jrlj6FN/6ZtfpGqK64D4EmSOAyGxHQlXI5pXzSRlI9kWQtacLzJIEyl5OLi0Dah2+JcChXCn/FcuCizFu19DogMl6eI9yRF/KNHQeJdmYwQtn8OhCnAFm/YNgg1sQ2Qm9ABno73/I7Eg07YhRTez11SX3C9+D2GydKMAl3BbtTFnL4LCuDignDhy3/iM4pLTmo46KnVYuMq57lsJEtCrENPhzYV0UVSd/HdbzDdAXmLxtgRmmxtmZdcaCt6AgmAtH/dc8KXHKfypRn5VjAIGjBfwohiK6XqTi4Sfx1WohUUY/90ABPLKqxpTRoaCA6V++aDzPryCDee+N+c6xYvQ5TfRBSmkq7hRP9OW5MViAGjc6AMlOsFpEObRAvWtkBecXUXUUTUiT6WPe/xiyr6VxDtargyxKmIKVgXBCChqZXTLqO168dI1nfBgWYJJIA/hHp/hRZGjaMczoDShdeDtd6jKSeL86jSl6Tpgkd9D6f8nvhGuyWTTFD9Ntf+/HspgbKdNnBcnFgnGKhjqVX4aY9gn49/KTe1SkIyP7Qgs3pr 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: From: Peter Xu pgd_leaf() is a global API while pgd_large() is not. Always use the global pgd_leaf(), then drop pgd_large(). Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: x86@kernel.org Signed-off-by: Peter Xu Reviewed-by: Jason Gunthorpe Reviewed-by: Mike Rapoport (IBM) --- arch/x86/include/asm/pgtable.h | 4 ++-- arch/x86/mm/pti.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 69ed0ea0641b..d6e993a5659f 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1418,8 +1418,8 @@ static inline bool pgdp_maps_userspace(void *__ptr) return (((ptr & ~PAGE_MASK) / sizeof(pgd_t)) < PGD_KERNEL_START); } -#define pgd_leaf pgd_large -static inline int pgd_large(pgd_t pgd) { return 0; } +#define pgd_leaf pgd_leaf +static inline int pgd_leaf(pgd_t pgd) { return 0; } #ifdef CONFIG_PAGE_TABLE_ISOLATION /* diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index dc0a81f5f60e..c17aab24c1b3 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c @@ -185,7 +185,7 @@ static p4d_t *pti_user_pagetable_walk_p4d(unsigned long address) set_pgd(pgd, __pgd(_KERNPG_TABLE | __pa(new_p4d_page))); } - BUILD_BUG_ON(pgd_large(*pgd) != 0); + BUILD_BUG_ON(pgd_leaf(*pgd) != 0); return p4d_offset(pgd, address); }