All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
To: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: "linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Matt Fleming
	<matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Borislav Petkov <bp-l3A5Bk7waGM@public.gmane.org>,
	Leif Lindholm
	<leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Peter Jones <pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	James Bottomley <JBottomley-wo1vFcy6AUs@public.gmane.org>,
	Matthew Garrett <mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>,
	"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
	Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] x86/efi: Map EFI memmap entries in-order at runtime
Date: Tue, 8 Sep 2015 14:16:22 +0100	[thread overview]
Message-ID: <20150908131622.GA2854@codeblueprint.co.uk> (raw)
In-Reply-To: <CAKv+Gu-AQdgJNOtrgtEtqxsaSC_L=EANpC3pT8b6X2jmZ5qO_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Fri, 04 Sep, at 08:53:36PM, Ard Biesheuvel wrote:
> On 4 September 2015 at 20:23, Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org> 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

WARNING: multiple messages have this Message-ID (diff)
From: Matt Fleming <matt@codeblueprint.co.uk>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: "linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	Matt Fleming <matt.fleming@intel.com>,
	Borislav Petkov <bp@suse.de>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	Peter Jones <pjones@redhat.com>,
	James Bottomley <JBottomley@odin.com>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	"H. Peter Anvin" <hpa@zytor.com>, Dave Young <dyoung@redhat.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH] x86/efi: Map EFI memmap entries in-order at runtime
Date: Tue, 8 Sep 2015 14:16:22 +0100	[thread overview]
Message-ID: <20150908131622.GA2854@codeblueprint.co.uk> (raw)
In-Reply-To: <CAKv+Gu-AQdgJNOtrgtEtqxsaSC_L=EANpC3pT8b6X2jmZ5qO_Q@mail.gmail.com>

On Fri, 04 Sep, at 08:53:36PM, Ard Biesheuvel wrote:
> On 4 September 2015 at 20:23, Matt Fleming <matt@codeblueprint.co.uk> 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

  parent reply	other threads:[~2015-09-08 13:16 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-04 13:14 [PATCH] x86/efi: Map EFI memmap entries in-order at runtime Matt Fleming
2015-09-04 13:14 ` Matt Fleming
2015-09-04 13:24 ` Ard Biesheuvel
     [not found]   ` <CAKv+Gu9bGcSVWuMkPVJGDkCPmWvFpjhh4odLWPBZ-wX3=LgGaw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-04 18:23     ` Matt Fleming
2015-09-04 18:23       ` Matt Fleming
2015-09-04 18:53       ` Ard Biesheuvel
2015-09-06 14:06         ` Ard Biesheuvel
     [not found]         ` <CAKv+Gu-AQdgJNOtrgtEtqxsaSC_L=EANpC3pT8b6X2jmZ5qO_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-08 13:16           ` Matt Fleming [this message]
2015-09-08 13:16             ` Matt Fleming
2015-09-08 13:21             ` Ard Biesheuvel
     [not found]               ` <CAKv+Gu_us3Nu_gMd4GxPe7z0eqtMfM4DM_UEmGW2MTqVDxg5vA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-08 20:37                 ` Matt Fleming
2015-09-08 20:37                   ` Matt Fleming
     [not found]                   ` <20150908203630.GB2854-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2015-09-09  7:37                     ` Ard Biesheuvel
2015-09-09  7:37                       ` Ard Biesheuvel
2015-09-09  9:58                       ` Matt Fleming
     [not found]                         ` <20150909095806.GA4973-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2015-09-09  9:59                           ` Ard Biesheuvel
2015-09-09  9:59                             ` Ard Biesheuvel
     [not found] ` <1441372447-23439-1-git-send-email-matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2015-09-07  4:07   ` joeyli
2015-09-07  4:07     ` joeyli
2015-09-08 20:41     ` Matt Fleming
2015-09-09  0:33       ` joeyli
2015-09-09 11:21         ` Matt Fleming
     [not found]           ` <20150909112123.GB4973-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2015-09-10  3:38             ` joeyli
2015-09-10  3:38               ` joeyli
2015-09-16 10:08           ` Borislav Petkov
     [not found]             ` <20150916100820.GA7077-K5JNixvcfoxupOikMc4+xw@public.gmane.org>
2015-09-16 11:25               ` Ard Biesheuvel
2015-09-16 11:25                 ` Ard Biesheuvel
     [not found]                 ` <CAKv+Gu-Q_g4YtbZ7X1S1g3RaMZC6HQCVza+oqv26mXbrDjTc5w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-16 13:28                   ` Borislav Petkov
2015-09-16 13:28                     ` Borislav Petkov
2015-09-16 13:38                     ` Ard Biesheuvel
2015-09-17  8:05                       ` Borislav Petkov
2015-09-16 13:37                 ` James Bottomley
2015-09-16 13:37                   ` James Bottomley
2015-09-16 14:07                   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150908131622.GA2854@codeblueprint.co.uk \
    --to=matt-mf/unelci9gs6ibeejttw/xrex20p6io@public.gmane.org \
    --cc=JBottomley-wo1vFcy6AUs@public.gmane.org \
    --cc=ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=bp-l3A5Bk7waGM@public.gmane.org \
    --cc=dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
    --cc=leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org \
    --cc=pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.