linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arch/x86/realmode: make trampoline code conditional for x86-32
@ 2014-10-15 15:38 Jarkko Sakkinen
  2014-10-15 15:47 ` H. Peter Anvin
  0 siblings, 1 reply; 5+ messages in thread
From: Jarkko Sakkinen @ 2014-10-15 15:38 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: x86, linux-kernel, Jarkko Sakkinen

Trampoline code is only needed for SMP and in x86-64 for wakeup
code. Make it conditional in order to minimize the kernel size.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 arch/x86/realmode/rm/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/realmode/rm/Makefile b/arch/x86/realmode/rm/Makefile
index 7c0d7be..82b7312 100644
--- a/arch/x86/realmode/rm/Makefile
+++ b/arch/x86/realmode/rm/Makefile
@@ -20,7 +20,11 @@ wakeup-objs	+= video-vesa.o
 wakeup-objs	+= video-bios.o
 
 realmode-y			+= header.o
+ifdef CONFIG_X86_64
 realmode-y			+= trampoline_$(BITS).o
+else
+realmode-$(CONFIG_SMP)		+= trampoline_$(BITS).o
+endif
 realmode-y			+= stack.o
 realmode-y			+= reboot.o
 realmode-$(CONFIG_ACPI_SLEEP)	+= $(wakeup-objs)
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] arch/x86/realmode: make trampoline code conditional for x86-32
  2014-10-15 15:38 [PATCH] arch/x86/realmode: make trampoline code conditional for x86-32 Jarkko Sakkinen
@ 2014-10-15 15:47 ` H. Peter Anvin
  2014-10-16  6:59   ` Jarkko Sakkinen
  0 siblings, 1 reply; 5+ messages in thread
From: H. Peter Anvin @ 2014-10-15 15:47 UTC (permalink / raw)
  To: Jarkko Sakkinen, Thomas Gleixner, Ingo Molnar; +Cc: x86, linux-kernel

On 10/15/2014 08:38 AM, Jarkko Sakkinen wrote:
> Trampoline code is only needed for SMP and in x86-64 for wakeup
> code. Make it conditional in order to minimize the kernel size.
> 
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> ---
>  arch/x86/realmode/rm/Makefile | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/realmode/rm/Makefile b/arch/x86/realmode/rm/Makefile
> index 7c0d7be..82b7312 100644
> --- a/arch/x86/realmode/rm/Makefile
> +++ b/arch/x86/realmode/rm/Makefile
> @@ -20,7 +20,11 @@ wakeup-objs	+= video-vesa.o
>  wakeup-objs	+= video-bios.o
>  
>  realmode-y			+= header.o
> +ifdef CONFIG_X86_64
>  realmode-y			+= trampoline_$(BITS).o
> +else
> +realmode-$(CONFIG_SMP)		+= trampoline_$(BITS).o
> +endif
>  realmode-y			+= stack.o
>  realmode-y			+= reboot.o
>  realmode-$(CONFIG_ACPI_SLEEP)	+= $(wakeup-objs)
> 

It is usually preferred to make this a hidden config option (e.g.
CONFIG_X86_TRAMPOLINE) rather than use ifdef, especially since your
ifdef has another conditional inside it.

	-hpa


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arch/x86/realmode: make trampoline code conditional for x86-32
  2014-10-15 15:47 ` H. Peter Anvin
@ 2014-10-16  6:59   ` Jarkko Sakkinen
  0 siblings, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2014-10-16  6:59 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Thomas Gleixner, Ingo Molnar, x86, linux-kernel

On Wed, Oct 15, 2014 at 08:47:11AM -0700, H. Peter Anvin wrote:
> On 10/15/2014 08:38 AM, Jarkko Sakkinen wrote:
> > Trampoline code is only needed for SMP and in x86-64 for wakeup
> > code. Make it conditional in order to minimize the kernel size.
> > 
> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> > ---
> >  arch/x86/realmode/rm/Makefile | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/arch/x86/realmode/rm/Makefile b/arch/x86/realmode/rm/Makefile
> > index 7c0d7be..82b7312 100644
> > --- a/arch/x86/realmode/rm/Makefile
> > +++ b/arch/x86/realmode/rm/Makefile
> > @@ -20,7 +20,11 @@ wakeup-objs	+= video-vesa.o
> >  wakeup-objs	+= video-bios.o
> >  
> >  realmode-y			+= header.o
> > +ifdef CONFIG_X86_64
> >  realmode-y			+= trampoline_$(BITS).o
> > +else
> > +realmode-$(CONFIG_SMP)		+= trampoline_$(BITS).o
> > +endif
> >  realmode-y			+= stack.o
> >  realmode-y			+= reboot.o
> >  realmode-$(CONFIG_ACPI_SLEEP)	+= $(wakeup-objs)
> > 
> 
> It is usually preferred to make this a hidden config option (e.g.
> CONFIG_X86_TRAMPOLINE) rather than use ifdef, especially since your
> ifdef has another conditional inside it.

OK, I'll revise the patch, thanks.

> 	-hpa

/Jarkko

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] arch/x86/realmode: make trampoline code conditional for x86-32
@ 2014-10-16  9:05 Jarkko Sakkinen
  2014-10-16 20:03 ` Jarkko Sakkinen
  0 siblings, 1 reply; 5+ messages in thread
From: Jarkko Sakkinen @ 2014-10-16  9:05 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: x86, linux-kernel, Jarkko Sakkinen

Trampoline code is only needed for SMP and in x86-64 for wakeup
code. Make it conditional in order to minimize the kernel size.
Added a new hidden config option CONFIG_X86_TRAMPOLINE as
suggested by H. Peter Anvin.

The justification for this patch is tinyfication effort run by
Josh Triplett. In embedded world a 32-bit processor without SMP
is not uncommon phenomenon.

I think the trampoline code could be completely ripped off if
ACPI_SLEEP and INTEL_TXT are not enabled but did not want to
include that yet into this patch.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 arch/x86/Kconfig              |  4 ++++
 arch/x86/realmode/rm/Makefile | 10 +++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f2327e8..9603ca3 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2488,6 +2488,10 @@ config PMC_ATOM
 	def_bool y
         depends on PCI
 
+config X86_TRAMPOLINE
+	def_bool y
+	depends on X86_64 || SMP
+
 source "net/Kconfig"
 
 source "drivers/Kconfig"
diff --git a/arch/x86/realmode/rm/Makefile b/arch/x86/realmode/rm/Makefile
index 7c0d7be..299e450 100644
--- a/arch/x86/realmode/rm/Makefile
+++ b/arch/x86/realmode/rm/Makefile
@@ -19,11 +19,11 @@ wakeup-objs	+= video-vga.o
 wakeup-objs	+= video-vesa.o
 wakeup-objs	+= video-bios.o
 
-realmode-y			+= header.o
-realmode-y			+= trampoline_$(BITS).o
-realmode-y			+= stack.o
-realmode-y			+= reboot.o
-realmode-$(CONFIG_ACPI_SLEEP)	+= $(wakeup-objs)
+realmode-y				+= header.o
+realmode-$(CONFIG_X86_TRAMPOLINE)	+= trampoline_$(BITS).o
+realmode-y				+= stack.o
+realmode-y				+= reboot.o
+realmode-$(CONFIG_ACPI_SLEEP)		+= $(wakeup-objs)
 
 targets	+= $(realmode-y)
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] arch/x86/realmode: make trampoline code conditional for x86-32
  2014-10-16  9:05 Jarkko Sakkinen
@ 2014-10-16 20:03 ` Jarkko Sakkinen
  0 siblings, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2014-10-16 20:03 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin; +Cc: x86, linux-kernel

On Thu, Oct 16, 2014 at 11:05:50AM +0200, Jarkko Sakkinen wrote:
> Trampoline code is only needed for SMP and in x86-64 for wakeup
> code. Make it conditional in order to minimize the kernel size.
> Added a new hidden config option CONFIG_X86_TRAMPOLINE as
> suggested by H. Peter Anvin.
> 
> The justification for this patch is tinyfication effort run by
> Josh Triplett. In embedded world a 32-bit processor without SMP
> is not uncommon phenomenon.
> 
> I think the trampoline code could be completely ripped off if
> ACPI_SLEEP and INTEL_TXT are not enabled but did not want to
> include that yet into this patch.
> 
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> ---
>  arch/x86/Kconfig              |  4 ++++
>  arch/x86/realmode/rm/Makefile | 10 +++++-----
>  2 files changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index f2327e8..9603ca3 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -2488,6 +2488,10 @@ config PMC_ATOM
>  	def_bool y
>          depends on PCI
>  
> +config X86_TRAMPOLINE
> +	def_bool y
> +	depends on X86_64 || SMP

I think this could be just as well

  depends on (X86_64 && (INTEL_TXT || ACPI_SLEEP)) || SMP

Should I send an updated patch?

> +
>  source "net/Kconfig"
>  
>  source "drivers/Kconfig"
> diff --git a/arch/x86/realmode/rm/Makefile b/arch/x86/realmode/rm/Makefile
> index 7c0d7be..299e450 100644
> --- a/arch/x86/realmode/rm/Makefile
> +++ b/arch/x86/realmode/rm/Makefile
> @@ -19,11 +19,11 @@ wakeup-objs	+= video-vga.o
>  wakeup-objs	+= video-vesa.o
>  wakeup-objs	+= video-bios.o
>  
> -realmode-y			+= header.o
> -realmode-y			+= trampoline_$(BITS).o
> -realmode-y			+= stack.o
> -realmode-y			+= reboot.o
> -realmode-$(CONFIG_ACPI_SLEEP)	+= $(wakeup-objs)
> +realmode-y				+= header.o
> +realmode-$(CONFIG_X86_TRAMPOLINE)	+= trampoline_$(BITS).o
> +realmode-y				+= stack.o
> +realmode-y				+= reboot.o
> +realmode-$(CONFIG_ACPI_SLEEP)		+= $(wakeup-objs)
>  
>  targets	+= $(realmode-y)
>  
> -- 
> 2.1.0
> 

/Jarkko

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-16 20:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-15 15:38 [PATCH] arch/x86/realmode: make trampoline code conditional for x86-32 Jarkko Sakkinen
2014-10-15 15:47 ` H. Peter Anvin
2014-10-16  6:59   ` Jarkko Sakkinen
  -- strict thread matches above, loose matches on Subject: below --
2014-10-16  9:05 Jarkko Sakkinen
2014-10-16 20:03 ` Jarkko Sakkinen

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).