Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp173403lqs; Mon, 4 Mar 2024 20:39:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW+E602+TmNO9BsYGBgD5oysEeGdrVGZwC2kd32oqUjgUwJbgv7fdvzgUMDSH0JMRt+8MwRxBWURN36qiJL4CKdMs1TKWr8oSqBBnQqEQ== X-Google-Smtp-Source: AGHT+IH3wWf9qgWrkZFEaoJbIGcqceXMpTNuR1Sq6tEnn1qctHlkf1sXcHalb7a7gto6CEmo+yoM X-Received: by 2002:ac8:5bd0:0:b0:42e:f6b1:b801 with SMTP id b16-20020ac85bd0000000b0042ef6b1b801mr994389qtb.20.1709613542121; Mon, 04 Mar 2024 20:39:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709613542; cv=pass; d=google.com; s=arc-20160816; b=SOIADctIRsT3F920V6942BwoW4KTb0bcoZS0qGiPWrz9O8kJfM2pSBbvvZ5fBIT606 qfvNr/ZOlgMHQt5RR8yhrSdUNiXCO1KAbM16qB5+rKJC7GhP8tZcHlInJO29rnJTWCfy 82WVxvLEpARfJx7oKj1sm0ZiyKRxE9sX8d83eLKew0MpvFdzO5I8tEtRAvUK0nhmOm8L ci3a7J85GS/13VDa2c9ihieTym51vNOzGQx3k0otYTo1LFQtEarpug4HIUTfgUtDjMpK qnmnuiFnq0IRrcO4E6ZjrkfoldTRc82Bf47+whKEywickXdO1GjIi8v/HnOtHoBoRS5i ye4g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=wQELlyUs7anDgJZdnMYQOxHib3VjF76WGvD1MQVL6mE=; fh=O0RYiE98R0FSPgWTRwi36N/EaPgTL/DVQdvGX5vTETw=; b=smW+hWHKw5H3LmjqeV0H8l4DjNdpzQvNI44sxwgBf28GP0AsUdC/pgSS258dj/Kyxi O9RvR73B0zadYgOTV3Ap/Vj36GUkxZ2tfWkRX1ilIos1lHl2ER/mNW0i0PVT62f89lhu 4m7UoWCp/veAIL8CnpvyY/eZj8P/tRXqmhgzTO5d56begROXCrQoMuI9ZCCGSQr5WWiT tkgRiCtmgNOdMwqIbSgMFdxAjNhCBCUDOvm18DLmPfl9cibYgM6t7wqV2UrHgZBbZTMl H6e7D4oapNQXdS3chJTZ/bBr0hqCLyIpOOo2Q7xpY9hI+oL8K48GWv83osUO9pxwxMFm Hl2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="U1+/1n8Y"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-91669-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91669-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id cm9-20020a05622a250900b0042ef5f7845esi3611301qtb.4.2024.03.04.20.39.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 20:39:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91669-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="U1+/1n8Y"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-91669-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91669-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BFE511C23218 for ; Tue, 5 Mar 2024 04:39:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9209D41AAB; Tue, 5 Mar 2024 04:38:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="U1+/1n8Y" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 012827B3F8 for ; Tue, 5 Mar 2024 04:38:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709613509; cv=none; b=iDw14znSVIkBit1fh4PUKCRlNAviW3ks+tm65g6uYPSrZmjkn4PU6g4FT7sWVQ6Qz52jyi2J9Y63eiVzbOpM/qt0qSxqWb4nYxyYv9mnUIjsX+RlWVP/eFuFxNenvBpoQ1TO2oKq50xTQb+ufs1Myk+tU4899FHNaorFx+u7vZs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709613509; c=relaxed/simple; bh=PigeP/aQE3dr4cPZn/Hr67K00GWoXZT6FCSOJrcRLVc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EQT4MiT5FtYAgZylS6b6KHmxeYPp0Vg0ukKNNNAwkT5VdzZsHvYL6BzAqK+/fX0slRMIHXJIBp58bGz78c2mdFXHc9HoJaOmA0MGfLrcNMCuQPbovhRxW2jVDggtVpVwDxBnQxcurbwjM75Hc0dlLfVd+uiZHxB5EF+hFSpEwVA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=U1+/1n8Y; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709613506; 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=wQELlyUs7anDgJZdnMYQOxHib3VjF76WGvD1MQVL6mE=; b=U1+/1n8YXYlVlnoQLQuK+yWHg2akAkLkRqDyc3At3+veHUd1d68twJrXBKjBM/guOzqUqi QMBtzXufP3C4b/HmIi39RKsk1RqMFwsIXJzHX/wkAE2E/V87jolwW/jyG0MxHnhUE6ShvE qCWKnYHi9qOsklMmvBspxqm2xWxSsko= 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-486-trE7YXiKMfq_TvTRM_lEXA-1; Mon, 04 Mar 2024 23:38:23 -0500 X-MC-Unique: trE7YXiKMfq_TvTRM_lEXA-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 98922101A523; Tue, 5 Mar 2024 04:38:22 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C482C1F086; Tue, 5 Mar 2024 04:38:15 +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 03/10] mm/x86: Replace p4d_large() with p4d_leaf() Date: Tue, 5 Mar 2024 12:37:43 +0800 Message-ID: <20240305043750.93762-4-peterx@redhat.com> In-Reply-To: <20240305043750.93762-1-peterx@redhat.com> References: <20240305043750.93762-1-peterx@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 From: Peter Xu p4d_large() is always defined as p4d_leaf(). Merge their usages. Chose p4d_leaf() because p4d_leaf() is a global API, while p4d_large() is not. Only x86 has p4d_leaf() defined as of now. So it also means after this patch we removed all p4d_large() usages. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: x86@kernel.org Reviewed-by: Jason Gunthorpe Signed-off-by: Peter Xu --- arch/x86/mm/fault.c | 4 ++-- arch/x86/mm/init_64.c | 2 +- arch/x86/mm/pat/set_memory.c | 4 ++-- arch/x86/mm/pti.c | 2 +- arch/x86/power/hibernate.c | 2 +- arch/x86/xen/mmu_pv.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 679b09cfe241..8b69ce3f4115 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -368,7 +368,7 @@ static void dump_pagetable(unsigned long address) goto bad; pr_cont("P4D %lx ", p4d_val(*p4d)); - if (!p4d_present(*p4d) || p4d_large(*p4d)) + if (!p4d_present(*p4d) || p4d_leaf(*p4d)) goto out; pud = pud_offset(p4d, address); @@ -1039,7 +1039,7 @@ spurious_kernel_fault(unsigned long error_code, unsigned long address) if (!p4d_present(*p4d)) return 0; - if (p4d_large(*p4d)) + if (p4d_leaf(*p4d)) return spurious_kernel_fault_check(error_code, (pte_t *) p4d); pud = pud_offset(p4d, address); diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index ebdbcae48011..d691e7992a9a 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -1197,7 +1197,7 @@ remove_p4d_table(p4d_t *p4d_start, unsigned long addr, unsigned long end, if (!p4d_present(*p4d)) continue; - BUILD_BUG_ON(p4d_large(*p4d)); + BUILD_BUG_ON(p4d_leaf(*p4d)); pud_base = pud_offset(p4d, 0); remove_pud_table(pud_base, addr, next, altmap, direct); diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c index e9b448d1b1b7..5359a9c88099 100644 --- a/arch/x86/mm/pat/set_memory.c +++ b/arch/x86/mm/pat/set_memory.c @@ -676,7 +676,7 @@ pte_t *lookup_address_in_pgd(pgd_t *pgd, unsigned long address, return NULL; *level = PG_LEVEL_512G; - if (p4d_large(*p4d) || !p4d_present(*p4d)) + if (p4d_leaf(*p4d) || !p4d_present(*p4d)) return (pte_t *)p4d; pud = pud_offset(p4d, address); @@ -739,7 +739,7 @@ pmd_t *lookup_pmd_address(unsigned long address) return NULL; p4d = p4d_offset(pgd, address); - if (p4d_none(*p4d) || p4d_large(*p4d) || !p4d_present(*p4d)) + if (p4d_none(*p4d) || p4d_leaf(*p4d) || !p4d_present(*p4d)) return NULL; pud = pud_offset(p4d, address); diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index 669ba1c345b3..dc0a81f5f60e 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c @@ -206,7 +206,7 @@ static pmd_t *pti_user_pagetable_walk_pmd(unsigned long address) if (!p4d) return NULL; - BUILD_BUG_ON(p4d_large(*p4d) != 0); + BUILD_BUG_ON(p4d_leaf(*p4d) != 0); if (p4d_none(*p4d)) { unsigned long new_pud_page = __get_free_page(gfp); if (WARN_ON_ONCE(!new_pud_page)) diff --git a/arch/x86/power/hibernate.c b/arch/x86/power/hibernate.c index 6f955eb1e163..28153789f873 100644 --- a/arch/x86/power/hibernate.c +++ b/arch/x86/power/hibernate.c @@ -165,7 +165,7 @@ int relocate_restore_code(void) pgd = (pgd_t *)__va(read_cr3_pa()) + pgd_index(relocated_restore_code); p4d = p4d_offset(pgd, relocated_restore_code); - if (p4d_large(*p4d)) { + if (p4d_leaf(*p4d)) { set_p4d(p4d, __p4d(p4d_val(*p4d) & ~_PAGE_NX)); goto out; } diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c index e21974f2cf2d..12a43a4abebf 100644 --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -1104,7 +1104,7 @@ static void __init xen_cleanmfnmap_p4d(p4d_t *p4d, bool unpin) pud_t *pud_tbl; int i; - if (p4d_large(*p4d)) { + if (p4d_leaf(*p4d)) { pa = p4d_val(*p4d) & PHYSICAL_PAGE_MASK; xen_free_ro_pages(pa, P4D_SIZE); return; -- 2.44.0