From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965451AbbI2NxN (ORCPT ); Tue, 29 Sep 2015 09:53:13 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:37573 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965440AbbI2NxA (ORCPT ); Tue, 29 Sep 2015 09:53:00 -0400 Date: Tue, 29 Sep 2015 14:52:56 +0100 From: Matt Fleming To: Ingo Molnar Cc: Ard Biesheuvel , Thomas Gleixner , "H. Peter Anvin" , Matt Fleming , "linux-kernel@vger.kernel.org" , "linux-efi@vger.kernel.org" , "Lee, Chun-Yi" , Borislav Petkov , Leif Lindholm , Peter Jones , James Bottomley , Matthew Garrett , Dave Young , "stable@vger.kernel.org" , Linus Torvalds , Borislav Petkov , Andy Lutomirski , Denys Vlasenko , Brian Gerst , Andrew Morton Subject: Re: [PATCH 1/2] x86/efi: Map EFI memmap entries in-order at runtime Message-ID: <20150929135256.GA4401@codeblueprint.co.uk> References: <1443218539-7610-1-git-send-email-matt@codeblueprint.co.uk> <1443218539-7610-2-git-send-email-matt@codeblueprint.co.uk> <20150926055643.GA25877@gmail.com> <20150926134329.GA3144@codeblueprint.co.uk> <20150927070355.GB26125@gmail.com> <20150928082245.GA28796@gmail.com> <20150929091230.GA2023@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150929091230.GA2023@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 29 Sep, at 11:12:30AM, Ingo Molnar wrote: > > * Ard Biesheuvel wrote: > > > > except that I don't think > > > the condition on 64-bit makes any sense: > > > > > > + if (!efi_enabled(EFI_OLD_MEMMAP) && efi_enabled(EFI_64BIT)) { > > > > > > I can see us being nervous wrt. backported patches, but is there any strong reason > > > to not follow this up with a third (non-backported) patch that changes this to: > > > > > > + if (!efi_enabled(EFI_OLD_MEMMAP)) { > > > > > > for v4.4? > > > > > > > The 32-bit side essentially implements the old memmap only, which is the the > > bottom-up version. So old memmap will be implied by 32-bit but not set in the > > EFI flags, resulting in the reverse enumeration being used with the bottom-up > > mapping logic. The net result of that is that we create the same problem for > > 32-bit that we are trying to solve for 64-bit, i.e., the regions will end up in > > reverse order in the VA mapping. > > > > To deobfuscate this particular conditional, we could set EFI_OLD_MEMMAP > > unconditionally on 32-bit x86. Or we could reshuffle variables and conditionals > > in various other way. > > Setting EFI_OLD_MEMMAP would be fine, if doing that has no bad side effects. Right, I think that's a very good suggestion, because like Ard mentioned, since EFI_OLD_MEMMAP is implied for 32-bit (there's no other way to map stuff currently), so it makes sense to force set the bit. > > [...] I am not convinced that the overall end result will be any better though. > > That's not true, we change an obscure, implicit dependency on 32-bit detail to an > explicit EFI_OLD_MEMMAP flag that shows exactly what's happening. That's a clear > improvement. Agreed. -- Matt Fleming, Intel Open Source Technology Center From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Fleming Subject: Re: [PATCH 1/2] x86/efi: Map EFI memmap entries in-order at runtime Date: Tue, 29 Sep 2015 14:52:56 +0100 Message-ID: <20150929135256.GA4401@codeblueprint.co.uk> References: <1443218539-7610-1-git-send-email-matt@codeblueprint.co.uk> <1443218539-7610-2-git-send-email-matt@codeblueprint.co.uk> <20150926055643.GA25877@gmail.com> <20150926134329.GA3144@codeblueprint.co.uk> <20150927070355.GB26125@gmail.com> <20150928082245.GA28796@gmail.com> <20150929091230.GA2023@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20150929091230.GA2023-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: linux-efi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Ingo Molnar Cc: Ard Biesheuvel , Thomas Gleixner , "H. Peter Anvin" , Matt Fleming , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "Lee, Chun-Yi" , Borislav Petkov , Leif Lindholm , Peter Jones , James Bottomley , Matthew Garrett , Dave Young , "stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Linus Torvalds , Borislav Petkov , Andy Lutomirski , Denys Vlasenko , Brian Gerst , Andrew Morton List-Id: linux-efi@vger.kernel.org On Tue, 29 Sep, at 11:12:30AM, Ingo Molnar wrote: > > * Ard Biesheuvel wrote: > > > > except that I don't think > > > the condition on 64-bit makes any sense: > > > > > > + if (!efi_enabled(EFI_OLD_MEMMAP) && efi_enabled(EFI_64BIT)) { > > > > > > I can see us being nervous wrt. backported patches, but is there any strong reason > > > to not follow this up with a third (non-backported) patch that changes this to: > > > > > > + if (!efi_enabled(EFI_OLD_MEMMAP)) { > > > > > > for v4.4? > > > > > > > The 32-bit side essentially implements the old memmap only, which is the the > > bottom-up version. So old memmap will be implied by 32-bit but not set in the > > EFI flags, resulting in the reverse enumeration being used with the bottom-up > > mapping logic. The net result of that is that we create the same problem for > > 32-bit that we are trying to solve for 64-bit, i.e., the regions will end up in > > reverse order in the VA mapping. > > > > To deobfuscate this particular conditional, we could set EFI_OLD_MEMMAP > > unconditionally on 32-bit x86. Or we could reshuffle variables and conditionals > > in various other way. > > Setting EFI_OLD_MEMMAP would be fine, if doing that has no bad side effects. Right, I think that's a very good suggestion, because like Ard mentioned, since EFI_OLD_MEMMAP is implied for 32-bit (there's no other way to map stuff currently), so it makes sense to force set the bit. > > [...] I am not convinced that the overall end result will be any better though. > > That's not true, we change an obscure, implicit dependency on 32-bit detail to an > explicit EFI_OLD_MEMMAP flag that shows exactly what's happening. That's a clear > improvement. Agreed. -- Matt Fleming, Intel Open Source Technology Center