Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754280AbeALHTg (ORCPT + 1 other); Fri, 12 Jan 2018 02:19:36 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:52130 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750714AbeALHTf (ORCPT ); Fri, 12 Jan 2018 02:19:35 -0500 Date: Fri, 12 Jan 2018 08:19:34 +0100 From: Greg Kroah-Hartman To: Thomas Gleixner Cc: Linus Torvalds , Pavel Tatashin , Andy Lutomirski , Hugh Dickins , Thomas Voegtle , Linux Kernel Mailing List , Andrew Morton , Guenter Roeck , Shuah Khan , patches@kernelci.org, Ben Hutchings , lkft-triage@lists.linaro.org, stable , Steve Sistare , Matt Fleming , Borislav Petkov Subject: Re: [PATCH 4.4 00/37] 4.4.110-stable review Message-ID: <20180112071934.GB25517@kroah.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Fri, Jan 12, 2018 at 12:03:10AM +0100, Thomas Gleixner wrote: > On Thu, 11 Jan 2018, Thomas Gleixner wrote: > > On Thu, 11 Jan 2018, Thomas Gleixner wrote: > > > On Thu, 11 Jan 2018, Linus Torvalds wrote: > > > > > > > On Thu, Jan 11, 2018 at 12:37 PM, Thomas Gleixner wrote: > > > > > > > > > > 67a9108ed431 ("x86/efi: Build our own page table structures") > > > > > > > > > > got rid of EFI depending on real_mode_header->trampoline_pgd > > > > > > > > So I think it only got rid of by default - the codepath is still > > > > there, the allocation is still there, it's just that it's not actually > > > > used unless somebody does that "efi=old_mmap" thing. > > > > > > Yes, the trampoline_pgd is still around, but I can't figure out how it > > > would be used after boot. Confused, digging more. > > > > So coming back to the same commit. From the changelog: > > > > This is caused by mapping EFI regions with RWX permissions. > > There isn't much we can do to restrict the permissions for these > > regions due to the way the firmware toolchains mix code and > > data, but we can at least isolate these mappings so that they do > > not appear in the regular kernel page tables. > > > > In commit d2f7cbe7b26a ("x86/efi: Runtime services virtual > > mapping") we started using 'trampoline_pgd' to map the EFI > > regions because there was an existing identity mapping there > > which we use during the SetVirtualAddressMap() call and for > > broken firmware that accesses those addresses. > > > > So this very commit gets rid of the (ab)use of trampoline_pgd and allocates > > efi_pgd, which we made use the proper size. > > > > trampoline_pgd is since then only used to get into long mode in > > realmode/rm/trampoline_64.S and for reboot in machine_real_restart(). > > > > The runtime services stuff does not use it in kernel versions >= 4.6 > > But there is one very well hidden user for it after boot: > > It's used for booting secondary CPUs from real mode > > So the transition to long mode for secondaries uses the trampoline pgd for > long mode transition and then jumping to secondary_startup_64 where CR3 is > set to the real kernel page tables. Ok, so the summary is that this patch is only needed for the 4.4 and 4.9 kernels, and _NOT_ for Linus's tree and 4.14, right? thanks, greg k-h