From: Ingo Molnar <mingo@kernel.org>
To: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>,
"H . Peter Anvin" <hpa@zytor.com>, Toshi Kani <toshi.kani@hp.com>,
linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
Borislav Petkov <bp@alien8.de>,
Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>,
stable@vger.kernel.org, Dave Hansen <dave.hansen@intel.com>
Subject: Re: [PATCH 1/6] x86/efi: PFN_ALIGN() _text and _end when calculating number of pages
Date: Thu, 26 Nov 2015 12:13:23 +0100 [thread overview]
Message-ID: <20151126111323.GA22863@gmail.com> (raw)
In-Reply-To: <20151124105556.GA2460@codeblueprint.co.uk>
* Matt Fleming <matt@codeblueprint.co.uk> wrote:
> On Tue, 24 Nov, at 09:23:23AM, Ingo Molnar wrote:
> >
> > Didn't we want to do the _end alignment linker script fix instead?
>
> I think we should do both. This patch is tagged for stable because it
> fixes a bug in the existing code. It's obvious and it's explicit and
> it's much easier to know when someone might want to backport it.
>
> Changing the linker script which indirectly fixes the above bug is a
> much more subtle solution, with much larger potential for fallout
> because it affects multiple chunks of kernel code.
>
> > Alignment assumptions are easy to make when symbols are well aligned typically (as
> > in this case), so we should guarantee the alignment property instead of
> > complicating the code.
>
> I don't agree that sprinkling PFN_ALIGN() complicates the code, it's a
> minimal change with a well known kernel idiom. But yes, aligning these
> symbols in the linker script is generally a good idea.
>
> The two patches are worthwhile, for different reasons; let's do both.
I disagree, this form:
npages = (_end - _text) >> PAGE_SHIFT;
is a lot clearer to read than:
npages = (PFN_ALIGN(_end) - PFN_ALIGN(_text)) >> PAGE_SHIFT;
especially once we ensure that _end and _text are page aligned. The latter form
will only result in cargo-cult carrying over of unnecessary PFN_ALIGN()
operations.
Section boundaries of the kernel should generally be page aligned, this is useful
for a number of other reasons as well.
As far as backporting goes, it would generally be _safer_ to backport the linker
script fix, in case there are other unrealized alignment bugs in the kernel.
Especially if upstream does the same.
Thanks,
Ingo
next prev parent reply other threads:[~2015-11-26 11:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 13:33 [GIT PULL v3 0/6] EFI page table isolation Matt Fleming
2015-11-23 13:33 ` [PATCH 1/6] x86/efi: PFN_ALIGN() _text and _end when calculating number of pages Matt Fleming
2015-11-24 8:23 ` Ingo Molnar
2015-11-24 10:55 ` Matt Fleming
2015-11-26 11:13 ` Ingo Molnar [this message]
2015-11-27 21:05 ` Matt Fleming
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=20151126111323.GA22863@gmail.com \
--to=mingo@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=hpa@zytor.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeblueprint.co.uk \
--cc=sai.praneeth.prakhya@intel.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=toshi.kani@hp.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).