From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753107AbdKTUzZ (ORCPT ); Mon, 20 Nov 2017 15:55:25 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:60323 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752902AbdKTUzX (ORCPT ); Mon, 20 Nov 2017 15:55:23 -0500 Date: Mon, 20 Nov 2017 21:55:21 +0100 (CET) From: Thomas Gleixner To: Andy Lutomirski cc: Dave Hansen , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , moritz.lipp@iaik.tugraz.at, Daniel Gruss , michael.schwarz@iaik.tugraz.at, richard.fellner@student.tugraz.at, Linus Torvalds , Kees Cook , Hugh Dickins , X86 ML Subject: Re: [PATCH 12/30] x86, kaiser: map GDT into user page tables In-Reply-To: Message-ID: References: <20171110193058.BECA7D88@viggo.jf.intel.com> <20171110193125.EBF58596@viggo.jf.intel.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 20 Nov 2017, Andy Lutomirski wrote: > On Mon, Nov 20, 2017 at 12:22 PM, Thomas Gleixner wrote: > > On Fri, 10 Nov 2017, Dave Hansen wrote: > >> __set_fixmap(get_cpu_gdt_ro_index(cpu), get_cpu_gdt_paddr(cpu), prot); > >> + > >> + /* CPU 0's mapping is done in kaiser_init() */ > >> + if (cpu) { > >> + int ret; > >> + > >> + ret = kaiser_add_mapping((unsigned long) get_cpu_gdt_ro(cpu), > >> + PAGE_SIZE, __PAGE_KERNEL_RO); > >> + /* > >> + * We do not have a good way to fail CPU bringup. > >> + * Just WARN about it and hope we boot far enough > >> + * to get a good log out. > >> + */ > > > > The GDT fixmap can be set up before the CPU is started. There is no reason > > to do that in cpu_init(). > > > >> + > >> + /* > >> + * We could theoretically do this in setup_fixmap_gdt(). > >> + * But, we would need to rewrite the above page table > >> + * allocation code to use the bootmem allocator. The > >> + * buddy allocator is not available at the time that we > >> + * call setup_fixmap_gdt() for CPU 0. > >> + */ > >> + kaiser_add_user_map_early(get_cpu_gdt_ro(0), PAGE_SIZE, > >> + __PAGE_KERNEL_RO | _PAGE_GLOBAL); > > > > This one is needs to stay. > > When you rebase on to my latest version, this should change to mapping > the entire cpu_entry_area. Too much flux left and right :)