From: Jim Kukunas <james.t.kukunas@linux.intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
tom.zanussi@linux.intel.com,
Arjan van de Ven <arjan@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
tglx@linutronix.de, mingo@redhat.com, x86@kernel.org
Subject: Re: [PATCH 10/11] x86/xip: resolve alternative instructions at build
Date: Tue, 24 Mar 2015 17:50:49 -0700 [thread overview]
Message-ID: <20150325005049.GB2600@jtk-ivb.jf.intel.com> (raw)
In-Reply-To: <20150323083301.GA31992@pd.tnic>
[-- Attachment #1: Type: text/plain, Size: 2686 bytes --]
On Mon, Mar 23, 2015 at 09:33:02AM +0100, Borislav Petkov wrote:
> On Mon, Mar 23, 2015 at 12:46:39AM -0700, Jim Kukunas wrote:
> > Since the .text section can't be updated at run-time, remove the
> > .alternatives sections and update the .text at build time. To pick the
> > proper instructions, Kconfig options are exposed for each X86_FEATURE
> > that needed to be resolved. Each X86_FEATURE gets a corresponding
> > CONFIG_XIP_ENABLE_X86_FEATURE_ option. Based on whether this option
> > is set, a resolver macro is setup to either generate that instruction,
> > or the fallback. The resolver needs to be defined for each FEATURE, and
> > the proper one is chosen via preprocessor string pasting.
> >
> > This approach is horrific and ugly.
>
> You said it.
>
> And with XIP enabled - whatever that means, your announce message could
> explain a lot more and more verbosely what this whole patchset is all
> about - this kernel is not going to be generic anymore but it will be
> destined only for the machine it is being built for, correct?
Please see my response to Ingo for more information about the patchset.
Yes, regardless of how it's implemented, selecting alternatives at build
time will produce a non-generic kernel (unless all alternative instructions
are disabled and just the fallbacks are used).
> If that is so, how are distros supposed to ship one kernel with XIP or
> is this some obscure feature distros won't have to enable anyway?
XIP isn't a general feature that distros are going to be enabling. It's
designed for a very specific usage where people are building very custom
kernels.
> Concerning this particular patch, I'd suggest a switch which simply
> disables alternatives patching at run time so that you don't add this
> ifdeffery to alternative.c
I'll look into this.
> Btw, why do you even have to disable the alternatives? I see this in
> your patch 1/11:
>
> + location in RAM. As a result, when the kernel is located in storage
> + that is addressable by the CPU, the kernel text and read-only data
> + segments are never loaded into memory, thereby using less RAM.
>
> is this it? To save some memory? Probably embedded, maybe some light
> bulb running linux... Yuck.
Alternatives are disabled because the kernel text will be read-only. For
example, consider the kernel image being stored in and executing from
ROM. Cutting the kernel text and read-only data out of RAM really helps
Linux scale down to smaller systems.
So yes, it's for embedded. Linux has a lot to offer in that area.
Thanks.
--
Jim Kukunas
Intel Open Source Technology Center
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2015-03-25 0:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-23 7:46 [RFC] x86 XIP Jim Kukunas
2015-03-23 7:46 ` [PATCH 01/11] x86/xip: add XIP_KERNEL and XIP_BASE options Jim Kukunas
2015-03-23 7:46 ` [PATCH 02/11] x86/xip: Update address of sections in linker script Jim Kukunas
2015-03-23 7:46 ` [PATCH 03/11] x86/xip: copy writable sections into RAM Jim Kukunas
2015-03-23 7:46 ` [PATCH 04/11] x86/xip: XIP boot trampoline page tables Jim Kukunas
2015-03-23 7:46 ` [PATCH 05/11] x86/xip: reserve memblock for only data Jim Kukunas
2015-03-23 7:46 ` [PATCH 06/11] x86/xip: after paging trampoline, discard PMDs above _brk Jim Kukunas
2015-03-23 7:46 ` [PATCH 07/11] x86/xip: make e820_add_kernel_range() a NOP Jim Kukunas
2015-03-23 7:46 ` [PATCH 08/11] x86/xip: in setup_arch(), handle resource physical addr Jim Kukunas
2015-03-23 7:46 ` [PATCH 09/11] x86/xip: snip the kernel text out of the memory mapping Jim Kukunas
2015-03-23 7:46 ` [PATCH 10/11] x86/xip: resolve alternative instructions at build Jim Kukunas
2015-03-23 8:33 ` Borislav Petkov
2015-03-23 8:38 ` Borislav Petkov
2015-03-25 0:50 ` Jim Kukunas [this message]
2015-03-25 8:44 ` Borislav Petkov
2015-03-23 22:40 ` Paul Bolle
2015-03-23 7:46 ` [PATCH 11/11] x86/xip: update _va() and _pa() macros Jim Kukunas
2015-03-23 8:09 ` Ingo Molnar
2015-03-23 15:09 ` Borislav Petkov
2015-03-23 8:07 ` [RFC] x86 XIP Ingo Molnar
2015-03-25 0:14 ` Jim Kukunas
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=20150325005049.GB2600@jtk-ivb.jf.intel.com \
--to=james.t.kukunas@linux.intel.com \
--cc=arjan@linux.intel.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=tom.zanussi@linux.intel.com \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®