From patchwork Mon Mar 31 08:13:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 14033789 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 8457AC36011 for ; Mon, 31 Mar 2025 16:29:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 825CB280004; Mon, 31 Mar 2025 12:29:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D785280001; Mon, 31 Mar 2025 12:29:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 69D7E280004; Mon, 31 Mar 2025 12:29:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 495C9280001 for ; Mon, 31 Mar 2025 12:29:32 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 69DE4C0D19 for ; Mon, 31 Mar 2025 08:14:05 +0000 (UTC) X-FDA: 83281133250.05.912425B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf06.hostedemail.com (Postfix) with ESMTP id AA476180007 for ; Mon, 31 Mar 2025 08:14:03 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Le218nlN; spf=pass (imf06.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743408843; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PPZQrdeQpegE/jTUY4XQbbWwgsN0SFY5JA/aTu23ar8=; b=yOJexZGONCbTnFT8NGxONreCrDPbK2PdCKElk8lXFHD+2TmG+u3S9gLTHaJ9nTkxpFv5fm 9ivX+S0z5Tr7voP0jA45RB7TJXoH5LXyd+0Bc+EOTrA9OKd6vZHqe+iKyc/FWY7AVHceAN WNh8bibx3teV9A+JVYlmcMhRx8+F5Gg= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Le218nlN; spf=pass (imf06.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743408843; a=rsa-sha256; cv=none; b=uvPE9b/GeXh9PLK6W+MBmfK4LwanspCksS/iKHSxxunmhBUTQPXCvVOasu5LwlqUPLij0C /ZznzYe7FY/8dxT6Z561mcsxCo94pyxHqIMx6Vei2fOePqm/PrLZuQh34OYBCQnDXRfU9+ g1LS1jGuclHt5nxJSAab4qPMDuTBjfU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743408843; 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=PPZQrdeQpegE/jTUY4XQbbWwgsN0SFY5JA/aTu23ar8=; b=Le218nlNJu1/RaOd1GS9zte31yEuE6nPcTQWjG06nzqjEddfD/tvmwjimvwOvAut1Pg0zr Zs3XKuoh3hwbo5Yc+7+55z6EGtrMykwzyqIgAVHTie5500rzMR5KvL6zLGwanh7NV4/X9r /ybq+SO/WE9szJ5YUjbwdJJkJw81uf8= Received: from mx-prod-mc-03.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-529-bLJlnPblMYyLaxsQv9gwtA-1; Mon, 31 Mar 2025 04:13:57 -0400 X-MC-Unique: bLJlnPblMYyLaxsQv9gwtA-1 X-Mimecast-MFC-AGG-ID: bLJlnPblMYyLaxsQv9gwtA_1743408836 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C468019560B6; Mon, 31 Mar 2025 08:13:55 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.9]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4D8321955BF1; Mon, 31 Mar 2025 08:13:51 +0000 (UTC) From: Baoquan He To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, yanjun.zhu@linux.dev, Baoquan He , x86@kernel.org Subject: [PATCH v2 5/7] x86/mm: remove pgd_leaf definition in arch Date: Mon, 31 Mar 2025 16:13:25 +0800 Message-ID: <20250331081327.256412-6-bhe@redhat.com> In-Reply-To: <20250331081327.256412-1-bhe@redhat.com> References: <20250331081327.256412-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: AA476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L3aa9052U5sjIo3mcDK8xRLtC/QV5y9OGLfJkC75gJtvZUTqMcWNui/7z2txqh05lHngSIDkSHh21c0ZspTnIzU9ubngzWIyr892PgOncj6k/jzWFQEs47sDYBAs7EeRmwqhblbCShVYmScC+CbUaPD1urtVpvZB7qUE5nS1sZzcKXS7Htt70wAv7GvVdYeBLjamUyhTh/ilcPgasxT7i7NycuT2TwD6yIe/1doeQ+b6XU/Py+Vg6dz+eegMgJ7/pHCXg1FAXxRUaQIDefdPz7BkP3PZOA3XUsLYV7lEvHf86lM0C4tfDFVaLO6sLvDIvduELml+Uh+zrE8PpSztPK9/GQArmWxv7g3NizxYq/yg6iZzOYWi1j3ZXF4M7ElZBcpszW5eIisP9g== 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: pgd huge page is not supported yet, let's use the generic definition in linux/pgtable.h. And also update the BUILD_BUG_ON() checking for pgd_leaf() in pti_user_pagetable_walk_p4d() because pgd_leaf() returns boolean value. Signed-off-by: Baoquan He Cc: x86@kernel.org Acked-by: David Hildenbrand Reviewed-by: Oscar Salvador --- arch/x86/include/asm/pgtable.h | 3 --- arch/x86/mm/pti.c | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 7bd6bd6df4a1..5f4fcc0eea17 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1472,9 +1472,6 @@ static inline bool pgdp_maps_userspace(void *__ptr) return (((ptr & ~PAGE_MASK) / sizeof(pgd_t)) < PGD_KERNEL_START); } -#define pgd_leaf pgd_leaf -static inline bool pgd_leaf(pgd_t pgd) { return false; } - #ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION /* * All top-level MITIGATION_PAGE_TABLE_ISOLATION page tables are order-1 pages diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index 5f0d579932c6..c2e1de40136f 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_leaf(*pgd) != 0); + BUILD_BUG_ON(pgd_leaf(*pgd)); return p4d_offset(pgd, address); }