Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933609AbdCWJUf (ORCPT ); Thu, 23 Mar 2017 05:20:35 -0400 Received: from terminus.zytor.com ([65.50.211.136]:44625 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932862AbdCWJUd (ORCPT ); Thu, 23 Mar 2017 05:20:33 -0400 Date: Thu, 23 Mar 2017 02:13:37 -0700 From: tip-bot for Andy Lutomirski Message-ID: Cc: jgross@suse.com, mingo@kernel.org, boris.ostrovsky@oracle.com, peterz@infradead.org, bp@alien8.de, brgerst@gmail.com, linux-kernel@vger.kernel.org, thgarnie@google.com, dvlasenk@redhat.com, jpoimboe@redhat.com, luto@kernel.org, tglx@linutronix.de, hpa@zytor.com, torvalds@linux-foundation.org Reply-To: torvalds@linux-foundation.org, hpa@zytor.com, jpoimboe@redhat.com, tglx@linutronix.de, luto@kernel.org, dvlasenk@redhat.com, linux-kernel@vger.kernel.org, thgarnie@google.com, bp@alien8.de, brgerst@gmail.com, boris.ostrovsky@oracle.com, mingo@kernel.org, peterz@infradead.org, jgross@suse.com In-Reply-To: <22e0069c29fba31998f193201e359eebfdac4960.1490218061.git.luto@kernel.org> References: <22e0069c29fba31998f193201e359eebfdac4960.1490218061.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mm] x86/gdt: Fix setup_fixmap_gdt() to use the correct PA Git-Commit-ID: aa4ea675528f3fa11e9663e5a32f55a81c34dcac X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2650 Lines: 68 Commit-ID: aa4ea675528f3fa11e9663e5a32f55a81c34dcac Gitweb: http://git.kernel.org/tip/aa4ea675528f3fa11e9663e5a32f55a81c34dcac Author: Andy Lutomirski AuthorDate: Wed, 22 Mar 2017 14:32:30 -0700 Committer: Ingo Molnar CommitDate: Thu, 23 Mar 2017 08:25:07 +0100 x86/gdt: Fix setup_fixmap_gdt() to use the correct PA __pa() cannot be used on percpu pointers because they may be virtually mapped. Use per_cpu_ptr_to_phys() instead. This fixes a boot crash on a some 32-bit configurations. I assume this is related to which allocation strategy is chosen by the percpu core. Signed-off-by: Andy Lutomirski Cc: Boris Ostrovsky Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Garnier Cc: Thomas Gleixner Fixes: 69218e47994d x86: ("Remap GDT tables in the fixmap section") Link: http://lkml.kernel.org/r/22e0069c29fba31998f193201e359eebfdac4960.1490218061.git.luto@kernel.org Signed-off-by: Ingo Molnar --- arch/x86/include/asm/desc.h | 6 ++++++ arch/x86/kernel/cpu/common.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h index ec05f9c..bde1169 100644 --- a/arch/x86/include/asm/desc.h +++ b/arch/x86/include/asm/desc.h @@ -98,6 +98,12 @@ static inline unsigned long get_current_gdt_ro_vaddr(void) return (unsigned long)get_current_gdt_ro(); } +/* Provide the physical address of the GDT page. */ +static inline phys_addr_t get_cpu_gdt_paddr(unsigned int cpu) +{ + return per_cpu_ptr_to_phys(get_cpu_gdt_rw(cpu)); +} + #ifdef CONFIG_X86_64 static inline void pack_gate(gate_desc *gate, unsigned type, unsigned long func, diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index f8e22db..f6e20e2 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -461,8 +461,8 @@ pgprot_t pg_fixmap_gdt_flags = PAGE_KERNEL; /* Setup the fixmap mapping only once per-processor */ static inline void setup_fixmap_gdt(int cpu) { - __set_fixmap(get_cpu_gdt_ro_index(cpu), - __pa(get_cpu_gdt_rw(cpu)), pg_fixmap_gdt_flags); + __set_fixmap(get_cpu_gdt_ro_index(cpu), get_cpu_gdt_paddr(cpu), + pg_fixmap_gdt_flags); } /* Load the original GDT from the per-cpu structure */