From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f169.google.com ([209.85.212.169]:33864 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753367AbbIHNQZ (ORCPT ); Tue, 8 Sep 2015 09:16:25 -0400 Received: by wicfx3 with SMTP id fx3so119842052wic.1 for ; Tue, 08 Sep 2015 06:16:24 -0700 (PDT) Date: Tue, 8 Sep 2015 14:16:22 +0100 From: Matt Fleming To: Ard Biesheuvel Cc: "linux-efi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , Matt Fleming , Borislav Petkov , Leif Lindholm , Peter Jones , James Bottomley , Matthew Garrett , "H. Peter Anvin" , Dave Young , "stable@vger.kernel.org" Subject: Re: [PATCH] x86/efi: Map EFI memmap entries in-order at runtime Message-ID: <20150908131622.GA2854@codeblueprint.co.uk> References: <1441372447-23439-1-git-send-email-matt@codeblueprint.co.uk> <20150904182307.GE2737@codeblueprint.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: stable-owner@vger.kernel.org List-ID: On Fri, 04 Sep, at 08:53:36PM, Ard Biesheuvel wrote: > On 4 September 2015 at 20:23, Matt Fleming wrote: > > On Fri, 04 Sep, at 03:24:21PM, Ard Biesheuvel wrote: > >> > >> Since the UEFI spec does not mandate an enumeration order for > >> GetMemoryMap(), it seems to me that you still need to sort its output > >> before laying out the VA space. Since you need to sort it anyway, why > >> not simply sort it in reverse order and keep all the original code? > >> Considering that this is meant for stable, that would keep the delta > >> *much* smaller. > > > > Hmm... that'd be a neat trick and while it would save on the diff > > size, I don't think it would be smaller in terms of change complexity. > > > > EDK2 sorts the memory map when EFI_PROPERTIES_TABLE is enabled, so we > > can be reasonably sure the entry order returned by GetMemoryMap() is > > compatible with the split regions, even if it's not mandated by the > > spec. > > > > EDK2 does sort it, but the spec does not mandate it so another > implementation may do something different entirely. Yeah, we should get that requirement added to the spec. > > For the non-EFI_PROPERTIES_TABLE case, things have been working fine > > without the sorting, so I'm reluctant to introduce it now (it's also > > much less of an issue there). > > > > I see. I do wonder, since the VA mapping preserves the modulo 2 MB > alignment of each region, aren't you using much more VA space when > mapping in reverse order as you are doing now? It doesn't enforce a 2MB alignment for every entry, just those that are actually 2MB aligned. This should be exactly what was done in the previous version of the code. Do you see a bug? -- Matt Fleming, Intel Open Source Technology Center