From nobody Tue Feb 10 04:12:43 2026 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48DEE14B075 for ; Fri, 12 Apr 2024 15:13:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712934812; cv=none; b=eqGbGOjKkgbPpW91RhbsaMsy5dIOJLjV5aOSAIJSiA/a27mxce4SMz7S+K82snZblq1PzLP4mAAkYthTbUY8uXLE5qFXgC/ly1RnVSXUaEJoM3TVqPB2L3k1f9pOwz0SIyINEUwJa8vl873oJ1WanfAHeyHy/Tqeoy/m/Ph2kpU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712934812; c=relaxed/simple; bh=4fuc3osJ0CBfJf2wQwqPRjCvOxcrZi0VVEyxaNwFjus=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=R7HVZh/miAwWXDwEVNrxMLGGAnDBs2Y0wBd+Zi1yh97YlXfcKxcbZyOuzbtPQGDV6KmxJnW4agpNLtpsyjGOlBBwdqpeTSOAPY5dcG5d5aOeQ3D9sj1QJFrRaUoJt7RSVPn5S+9CCoIYwpj0IkKKzTSj7+gaD5qcFQBAUQ4l6FI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=Aip4F99a; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=Aip4F99a; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="Aip4F99a"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="Aip4F99a" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 859DE5FE6A; Fri, 12 Apr 2024 15:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1712934808; h=from:from:reply-to: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=MhbYkWyAf/ESm4SmbTrhfHb/LUX43QTDKtnj/G5DytA=; b=Aip4F99a4oJMUIZ6HReisZ2YSUbFppIqWt6Fga7A5bPQsK83oNwMNhwa0cxFParhGiMIvk u6ADHILCKujpTml+n6DR6jR+B6UJUYQyiFWeeXnZBSzZv2qbxcze5djgV93Skt8fMk8Opz VzkEDgw+kGKPIWBe6FVOwD1QOIiosuk= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1712934808; h=from:from:reply-to: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=MhbYkWyAf/ESm4SmbTrhfHb/LUX43QTDKtnj/G5DytA=; b=Aip4F99a4oJMUIZ6HReisZ2YSUbFppIqWt6Fga7A5bPQsK83oNwMNhwa0cxFParhGiMIvk u6ADHILCKujpTml+n6DR6jR+B6UJUYQyiFWeeXnZBSzZv2qbxcze5djgV93Skt8fMk8Opz VzkEDgw+kGKPIWBe6FVOwD1QOIiosuk= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 847541368B; Fri, 12 Apr 2024 15:13:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id mh/yF5VPGWa4AQAAD6G6ig (envelope-from ); Fri, 12 Apr 2024 15:13:25 +0000 From: Juergen Gross To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Juergen Gross , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" Subject: [PATCH v2 3/4] x86/pat: restructure _lookup_address_cpa() Date: Fri, 12 Apr 2024 17:12:57 +0200 Message-Id: <20240412151258.9171-4-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240412151258.9171-1-jgross@suse.com> References: <20240412151258.9171-1-jgross@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Flag: NO X-Spam-Score: 0.19 X-Spam-Level: X-Spamd-Result: default: False [0.19 / 50.00]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; BAYES_HAM(-0.01)[46.79%]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_SEVEN(0.00)[10]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.com:email] Content-Type: text/plain; charset="utf-8" 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 --- 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 addr= ess, 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 =3D pgd_offset_k(address); + else + pgd =3D cpa->pgd + pgd_index(address); =20 - return lookup_address(address, level); + return lookup_address_in_pgd(pgd, address, level); } =20 /* --=20 2.35.3