Re: [PATCH 2/2] x86: Add "make tinyconfig" to configure the tiniest possible kernel

2014-08-07 Thread Sam Ravnborg
> 
> > > diff --git a/arch/x86/configs/tiny.config b/arch/x86/configs/tiny.config
> > > new file mode 100644
> > > index 000..8f0e54c
> > > --- /dev/null
> > > +++ b/arch/x86/configs/tiny.config
> > > @@ -0,0 +1,5 @@
> > > +CONFIG_CC_OPTIMIZE_FOR_SIZE=y
> > > +CONFIG_KERNEL_XZ=y
> > > +CONFIG_NOHIGHMEM=y
> > > +CONFIG_OPTIMIZE_INLINING=y
> > > +CONFIG_SLOB=y
> > All the above are general options that apply equal to arm than to x86.
> 
> NOHIGHMEM isn't.
You are right - as it is x86 specific it should had been prefixed
with X86_ to document so.

As the symbol is only relevant for X86 it will not hurt anyone else,
so it is OK to have it.
But it would be nice to document in tiny.config that
this is a X86 specific symbol.

Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] x86: Add "make tinyconfig" to configure the tiniest possible kernel

2014-08-07 Thread Josh Triplett
On Thu, Aug 07, 2014 at 06:03:52PM +0200, Sam Ravnborg wrote:
> On Wed, Aug 06, 2014 at 03:31:54PM -0700, Josh Triplett wrote:
> > Since commit 5d2acfc7b974bbd3858b4dd3f2cdc6362dd8843a ("kconfig: make
> > allnoconfig disable options behind EMBEDDED and EXPERT") in 3.15-rc1,
> > "make allnoconfig" disables every possible config option.
> > 
> > However, a few configuration options (CC_OPTIMIZE_FOR_SIZE,
> > OPTIMIZE_INLINING) produce a smaller kernel when turned on, and a few
> > choices exist (compression, highmem, allocator) for which a non-default
> > option produces a smaller kernel.
> > 
> > Add a "tinyconfig" option, which starts from allnoconfig and then sets
> > these options to configure the tiniest possible kernel.  This provides a
> > better baseline for embedded systems or efforts to reduce kernel size.
> 
> In general I dislike the whole approach where we introduce makefile
> magic to support diverse config snippets.
> Another approch where we factor out this from the MAkefile seems much leaner.
> 
> And for this specific patch then this is not x86 specific at all.
> If we keep the logic in the makefiles than we should:
> 1) Make the infrastructure general
> 2) Document it
> 3) Find another home for the config snippets that are non-arch specific like 
> this one

I'll refactor this and resubmit.

> > diff --git a/arch/x86/configs/tiny.config b/arch/x86/configs/tiny.config
> > new file mode 100644
> > index 000..8f0e54c
> > --- /dev/null
> > +++ b/arch/x86/configs/tiny.config
> > @@ -0,0 +1,5 @@
> > +CONFIG_CC_OPTIMIZE_FOR_SIZE=y
> > +CONFIG_KERNEL_XZ=y
> > +CONFIG_NOHIGHMEM=y
> > +CONFIG_OPTIMIZE_INLINING=y
> > +CONFIG_SLOB=y
> All the above are general options that apply equal to arm than to x86.

NOHIGHMEM isn't.

- Josh Triplett
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] x86: Add "make tinyconfig" to configure the tiniest possible kernel

2014-08-07 Thread Sam Ravnborg
On Wed, Aug 06, 2014 at 03:31:54PM -0700, Josh Triplett wrote:
> Since commit 5d2acfc7b974bbd3858b4dd3f2cdc6362dd8843a ("kconfig: make
> allnoconfig disable options behind EMBEDDED and EXPERT") in 3.15-rc1,
> "make allnoconfig" disables every possible config option.
> 
> However, a few configuration options (CC_OPTIMIZE_FOR_SIZE,
> OPTIMIZE_INLINING) produce a smaller kernel when turned on, and a few
> choices exist (compression, highmem, allocator) for which a non-default
> option produces a smaller kernel.
> 
> Add a "tinyconfig" option, which starts from allnoconfig and then sets
> these options to configure the tiniest possible kernel.  This provides a
> better baseline for embedded systems or efforts to reduce kernel size.

In general I dislike the whole approach where we introduce makefile
magic to support diverse config snippets.
Another approch where we factor out this from the MAkefile seems much leaner.

And for this specific patch then this is not x86 specific at all.
If we keep the logic in the makefiles than we should:
1) Make the infrastructure general
2) Document it
3) Find another home for the config snippets that are non-arch specific like 
this one

Sam

> diff --git a/arch/x86/configs/tiny.config b/arch/x86/configs/tiny.config
> new file mode 100644
> index 000..8f0e54c
> --- /dev/null
> +++ b/arch/x86/configs/tiny.config
> @@ -0,0 +1,5 @@
> +CONFIG_CC_OPTIMIZE_FOR_SIZE=y
> +CONFIG_KERNEL_XZ=y
> +CONFIG_NOHIGHMEM=y
> +CONFIG_OPTIMIZE_INLINING=y
> +CONFIG_SLOB=y
All the above are general options that apply equal to arm than to x86.

Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] x86: Add "make tinyconfig" to configure the tiniest possible kernel

2014-08-06 Thread Josh Triplett
On Wed, Aug 06, 2014 at 04:37:54PM -0700, David Rientjes wrote:
> On Wed, 6 Aug 2014, Josh Triplett wrote:
> > On Wed, Aug 06, 2014 at 03:38:56PM -0700, David Rientjes wrote:
> > > On Wed, 6 Aug 2014, Josh Triplett wrote:
> > > > diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> > > > index 1568678..2b5ca16 100644
> > > > --- a/arch/x86/Makefile
> > > > +++ b/arch/x86/Makefile
> > > > @@ -257,6 +257,10 @@ PHONY += kvmconfig
> > > >  kvmconfig:
> > > > $(call mergeconfig,kvm_guest)
> > > >  
> > > > +PHONY += tinyconfig
> > > > +tinyconfig: allnoconfig
> > > 
> > > Calling allnoconfig here makes "make tinyconfig" default to CONFIG_X86_32 
> > > even on 64 bit platforms and the caller would need to explicitly do
> > > "make ARCH=x86_64 tinyconfig" to avoid it.  It's not clear that this is 
> > > intended from the documentation of tinyconfig, that tiniest == 32 bit by 
> > > default.
> > 
> > Calling allnoconfig was quite intentional; this is intended to be the
> > smallest possible configuration, and unlike kvmconfig (which modifies an
> > existing configuration to make it suitable for a KVM guest), this
> > intentionally creates a specific new configuration from scratch.
> > 
> > 32-bit produces a far smaller kernel than 64-bit, so having that as the
> > default for tinyconfig seems quite appropriate.  As you showed, it's
> > easy enough to override it if needed.  I'd expect many potential users
> > of tinyconfig for embedded systems to start with tinyconfig and then
> > immediately use menuconfig to enable a pile of additional options.
> 
> In that case, any reason to make tinyconfig x86 only?

The set of configuration options may vary by architecture.  For
instance, NOHIGHMEM only exists on x86.  So, at a minimum, different
architectures will require different versions of tiny.config.

The target itself and the common options could theoretically be shared,
but that would require splitting the configuration, and it isn't obvious
where the non-arch-specific tiny.config would live.  There doesn't
appear to be any precedent for that kind of setup; only x86 has a
configuration other than defconfigs (specifically, kvm_guest.config).  I
don't think it's likely that new targets like this will pop up often in
the future, either.

Nonetheless, I could modify scripts/kconfig/Makefile to add this target
instead, if someone has a good suggestion for where the
non-arch-specific tiny.config should live.  (kernel/configs/ ?)

- Josh Triplett
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] x86: Add "make tinyconfig" to configure the tiniest possible kernel

2014-08-06 Thread David Rientjes
On Wed, 6 Aug 2014, Josh Triplett wrote:

> On Wed, Aug 06, 2014 at 03:38:56PM -0700, David Rientjes wrote:
> > On Wed, 6 Aug 2014, Josh Triplett wrote:
> > > diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> > > index 1568678..2b5ca16 100644
> > > --- a/arch/x86/Makefile
> > > +++ b/arch/x86/Makefile
> > > @@ -257,6 +257,10 @@ PHONY += kvmconfig
> > >  kvmconfig:
> > >   $(call mergeconfig,kvm_guest)
> > >  
> > > +PHONY += tinyconfig
> > > +tinyconfig: allnoconfig
> > 
> > Calling allnoconfig here makes "make tinyconfig" default to CONFIG_X86_32 
> > even on 64 bit platforms and the caller would need to explicitly do
> > "make ARCH=x86_64 tinyconfig" to avoid it.  It's not clear that this is 
> > intended from the documentation of tinyconfig, that tiniest == 32 bit by 
> > default.
> 
> Calling allnoconfig was quite intentional; this is intended to be the
> smallest possible configuration, and unlike kvmconfig (which modifies an
> existing configuration to make it suitable for a KVM guest), this
> intentionally creates a specific new configuration from scratch.
> 
> 32-bit produces a far smaller kernel than 64-bit, so having that as the
> default for tinyconfig seems quite appropriate.  As you showed, it's
> easy enough to override it if needed.  I'd expect many potential users
> of tinyconfig for embedded systems to start with tinyconfig and then
> immediately use menuconfig to enable a pile of additional options.
> 

In that case, any reason to make tinyconfig x86 only?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] x86: Add "make tinyconfig" to configure the tiniest possible kernel

2014-08-06 Thread Josh Triplett
On Wed, Aug 06, 2014 at 03:38:56PM -0700, David Rientjes wrote:
> On Wed, 6 Aug 2014, Josh Triplett wrote:
> > diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> > index 1568678..2b5ca16 100644
> > --- a/arch/x86/Makefile
> > +++ b/arch/x86/Makefile
> > @@ -257,6 +257,10 @@ PHONY += kvmconfig
> >  kvmconfig:
> > $(call mergeconfig,kvm_guest)
> >  
> > +PHONY += tinyconfig
> > +tinyconfig: allnoconfig
> 
> Calling allnoconfig here makes "make tinyconfig" default to CONFIG_X86_32 
> even on 64 bit platforms and the caller would need to explicitly do
> "make ARCH=x86_64 tinyconfig" to avoid it.  It's not clear that this is 
> intended from the documentation of tinyconfig, that tiniest == 32 bit by 
> default.

Calling allnoconfig was quite intentional; this is intended to be the
smallest possible configuration, and unlike kvmconfig (which modifies an
existing configuration to make it suitable for a KVM guest), this
intentionally creates a specific new configuration from scratch.

32-bit produces a far smaller kernel than 64-bit, so having that as the
default for tinyconfig seems quite appropriate.  As you showed, it's
easy enough to override it if needed.  I'd expect many potential users
of tinyconfig for embedded systems to start with tinyconfig and then
immediately use menuconfig to enable a pile of additional options.

- Josh Triplett
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] x86: Add "make tinyconfig" to configure the tiniest possible kernel

2014-08-06 Thread David Rientjes
On Wed, 6 Aug 2014, Josh Triplett wrote:

> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index 1568678..2b5ca16 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -257,6 +257,10 @@ PHONY += kvmconfig
>  kvmconfig:
>   $(call mergeconfig,kvm_guest)
>  
> +PHONY += tinyconfig
> +tinyconfig: allnoconfig

Calling allnoconfig here makes "make tinyconfig" default to CONFIG_X86_32 
even on 64 bit platforms and the caller would need to explicitly do
"make ARCH=x86_64 tinyconfig" to avoid it.  It's not clear that this is 
intended from the documentation of tinyconfig, that tiniest == 32 bit by 
default.

> + $(call mergeconfig,tiny)
> +
>  define archhelp
>echo  '* bzImage  - Compressed kernel image (arch/x86/boot/bzImage)'
>echo  '  install  - Install kernel using'
> @@ -271,4 +275,5 @@ define archhelp
>echo  '  FDARGS="..."  arguments for the booted kernel'
>echo  '  FDINITRD=file initrd for the booted kernel'
>echo  '  kvmconfig - Enable additional options for guest kernel support'
> +  echo  '  tinyconfig   - Configure the tiniest possible kernel'
>  endef
> diff --git a/arch/x86/configs/tiny.config b/arch/x86/configs/tiny.config
> new file mode 100644
> index 000..8f0e54c
> --- /dev/null
> +++ b/arch/x86/configs/tiny.config
> @@ -0,0 +1,5 @@
> +CONFIG_CC_OPTIMIZE_FOR_SIZE=y
> +CONFIG_KERNEL_XZ=y
> +CONFIG_NOHIGHMEM=y
> +CONFIG_OPTIMIZE_INLINING=y
> +CONFIG_SLOB=y
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] x86: Add "make tinyconfig" to configure the tiniest possible kernel

2014-08-06 Thread Josh Triplett
Since commit 5d2acfc7b974bbd3858b4dd3f2cdc6362dd8843a ("kconfig: make
allnoconfig disable options behind EMBEDDED and EXPERT") in 3.15-rc1,
"make allnoconfig" disables every possible config option.

However, a few configuration options (CC_OPTIMIZE_FOR_SIZE,
OPTIMIZE_INLINING) produce a smaller kernel when turned on, and a few
choices exist (compression, highmem, allocator) for which a non-default
option produces a smaller kernel.

Add a "tinyconfig" option, which starts from allnoconfig and then sets
these options to configure the tiniest possible kernel.  This provides a
better baseline for embedded systems or efforts to reduce kernel size.

Signed-off-by: Josh Triplett 
---

v2: Based this on Luis's helper, added in patch 1/2, which eliminates
the previously duplicated implementation from kvmconfig.

 arch/x86/Makefile| 5 +
 arch/x86/configs/tiny.config | 5 +
 2 files changed, 10 insertions(+)
 create mode 100644 arch/x86/configs/tiny.config

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 1568678..2b5ca16 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -257,6 +257,10 @@ PHONY += kvmconfig
 kvmconfig:
$(call mergeconfig,kvm_guest)
 
+PHONY += tinyconfig
+tinyconfig: allnoconfig
+   $(call mergeconfig,tiny)
+
 define archhelp
   echo  '* bzImage  - Compressed kernel image (arch/x86/boot/bzImage)'
   echo  '  install  - Install kernel using'
@@ -271,4 +275,5 @@ define archhelp
   echo  '  FDARGS="..."  arguments for the booted kernel'
   echo  '  FDINITRD=file initrd for the booted kernel'
   echo  '  kvmconfig   - Enable additional options for guest kernel support'
+  echo  '  tinyconfig   - Configure the tiniest possible kernel'
 endef
diff --git a/arch/x86/configs/tiny.config b/arch/x86/configs/tiny.config
new file mode 100644
index 000..8f0e54c
--- /dev/null
+++ b/arch/x86/configs/tiny.config
@@ -0,0 +1,5 @@
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_KERNEL_XZ=y
+CONFIG_NOHIGHMEM=y
+CONFIG_OPTIMIZE_INLINING=y
+CONFIG_SLOB=y
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/