mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Cc: Juergen Gross <jgross@suse.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH v2 3/4] x86/pat: restructure _lookup_address_cpa()
Date: Fri, 12 Apr 2024 17:12:57 +0200	[thread overview]
Message-ID: <20240412151258.9171-4-jgross@suse.com> (raw)
In-Reply-To: <20240412151258.9171-1-jgross@suse.com>

Modify _lookup_address_cpa() to no longer use lookup_address(), but
only lookup_address_in_pgd().

This is done in preparation of using lookup_address_in_pgd_attr().

No functional change intended.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
V2:
- split off from V1 patch (Ingo Molnar)
---
 arch/x86/mm/pat/set_memory.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
index bfa0aae45d48..4ebccaf29bf2 100644
--- a/arch/x86/mm/pat/set_memory.c
+++ b/arch/x86/mm/pat/set_memory.c
@@ -744,11 +744,14 @@ EXPORT_SYMBOL_GPL(lookup_address);
 static pte_t *_lookup_address_cpa(struct cpa_data *cpa, unsigned long address,
 				  unsigned int *level)
 {
-	if (cpa->pgd)
-		return lookup_address_in_pgd(cpa->pgd + pgd_index(address),
-					       address, level);
+	pgd_t *pgd;
+
+	if (!cpa->pgd)
+		pgd = pgd_offset_k(address);
+	else
+		pgd = cpa->pgd + pgd_index(address);
 
-	return lookup_address(address, level);
+	return lookup_address_in_pgd(pgd, address, level);
 }
 
 /*
-- 
2.35.3


  parent reply	other threads:[~2024-04-12 15:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 15:12 [PATCH v2 0/4] x86: correctly handle NX and RW bit testing Juergen Gross
2024-04-12 15:12 ` [PATCH v2 1/4] x86/pat: introduce lookup_address_in_pgd_attr() Juergen Gross
2024-04-14 20:31   ` [tip: x86/mm] x86/pat: Introduce lookup_address_in_pgd_attr() tip-bot2 for Juergen Gross
2024-04-12 15:12 ` [PATCH v2 2/4] x86/mm: use lookup_address_in_pgd_attr() in show_fault_oops() Juergen Gross
2024-04-14 20:31   ` [tip: x86/mm] x86/mm: Use " tip-bot2 for Juergen Gross
2024-04-12 15:12 ` Juergen Gross [this message]
2024-04-14 20:31   ` [tip: x86/mm] x86/pat: Restructure _lookup_address_cpa() tip-bot2 for Juergen Gross
2024-04-12 15:12 ` [PATCH v2 4/4] x86/pat: fix W^X violation false-positives when running as Xen PV guest Juergen Gross
2024-04-14 20:30   ` [tip: x86/mm] x86/pat: Fix " tip-bot2 for Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240412151258.9171-4-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®