All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Don't override CONFIG_64BIT for ARCH={i386,x86_64} builds
@ 2009-02-11 17:11 David Woodhouse
  2009-02-11 17:22 ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: David Woodhouse @ 2009-02-11 17:11 UTC (permalink / raw)
  To: x86 maintainers; +Cc: linux-kernel

It is a steaming great pain in the arse when the value of CONFIG_64BIT
explicitly written in my .config file is overridden by the value of
$ARCH inferred from the environment.

If I have a 32-bit .config and I happen to build it without remembering
to put 'ARCH=i386' on the make command line, it shouldn't force
CONFIG_64BIT=y and reconfigure.

This patch should fix that, while still allowing defconfig to work as it
currently does for both 32-bit and 64-bit environments, and still giving
the default value of CONFIG_64BIT according to $ARCH. It's just that it
won't _force_ a change to CONFIG_64BIT when it's set to something other
than what $ARCH would imply.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 73f7fe8..516046d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -3,7 +3,7 @@ mainmenu "Linux Kernel Configuration for x86"
 
 # Select 32 or 64 bit
 config 64BIT
-	bool "64-bit kernel" if ARCH = "x86"
+	bool "64-bit kernel"
 	default ARCH = "x86_64"
 	help
 	  Say yes to build a 64-bit kernel - formerly known as x86_64

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


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

* Re: [PATCH] Don't override CONFIG_64BIT for ARCH={i386,x86_64} builds
  2009-02-11 17:11 [PATCH] Don't override CONFIG_64BIT for ARCH={i386,x86_64} builds David Woodhouse
@ 2009-02-11 17:22 ` Ingo Molnar
  2009-02-12  7:26   ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2009-02-11 17:22 UTC (permalink / raw)
  To: David Woodhouse; +Cc: x86 maintainers, linux-kernel


* David Woodhouse <dwmw2@infradead.org> wrote:

> It is a steaming great pain in the arse when the value of CONFIG_64BIT
> explicitly written in my .config file is overridden by the value of
> $ARCH inferred from the environment.
> 
> If I have a 32-bit .config and I happen to build it without remembering
> to put 'ARCH=i386' on the make command line, it shouldn't force
> CONFIG_64BIT=y and reconfigure.
> 
> This patch should fix that, while still allowing defconfig to work as it
> currently does for both 32-bit and 64-bit environments, and still giving
> the default value of CONFIG_64BIT according to $ARCH. It's just that it
> won't _force_ a change to CONFIG_64BIT when it's set to something other
> than what $ARCH would imply.
> 
> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

Applied to tip:x86/ugent, thanks David!

	Ingo

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

* Re: [PATCH] Don't override CONFIG_64BIT for ARCH={i386,x86_64} builds
  2009-02-11 17:22 ` Ingo Molnar
@ 2009-02-12  7:26   ` Ingo Molnar
  2009-02-12  8:36     ` David Woodhouse
  2009-06-30 11:10     ` David Woodhouse
  0 siblings, 2 replies; 7+ messages in thread
From: Ingo Molnar @ 2009-02-12  7:26 UTC (permalink / raw)
  To: David Woodhouse; +Cc: x86 maintainers, linux-kernel


* Ingo Molnar <mingo@elte.hu> wrote:

> 
> * David Woodhouse <dwmw2@infradead.org> wrote:
> 
> > It is a steaming great pain in the arse when the value of CONFIG_64BIT
> > explicitly written in my .config file is overridden by the value of
> > $ARCH inferred from the environment.
> > 
> > If I have a 32-bit .config and I happen to build it without remembering
> > to put 'ARCH=i386' on the make command line, it shouldn't force
> > CONFIG_64BIT=y and reconfigure.
> > 
> > This patch should fix that, while still allowing defconfig to work as it
> > currently does for both 32-bit and 64-bit environments, and still giving
> > the default value of CONFIG_64BIT according to $ARCH. It's just that it
> > won't _force_ a change to CONFIG_64BIT when it's set to something other
> > than what $ARCH would imply.
> > 
> > Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
> 
> Applied to tip:x86/ugent, thanks David!

i removed it again, because it regresses randconfig behavior:

 titan:~/tip> grep X86_32 .config; make ARCH=x86_64 randconfig; grep X86_32 .config
 # CONFIG_X86_32 is not set
 scripts/kconfig/conf -r arch/x86/Kconfig
 #
 # configuration written to .config
 #
 CONFIG_X86_32=y
 CONFIG_X86_32_SMP=y
 CONFIG_X86_32_LAZY_GS=y
 CONFIG_X86_32_ALWAYS_ON=y

I dont mind the change you are after, but randconfig should work as
expected too: if ARCH=x86_64 is passed it should generate a 64-bit
randconfig, not a 50% 32-bit one.

	Ingo

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

* Re: [PATCH] Don't override CONFIG_64BIT for ARCH={i386,x86_64} builds
  2009-02-12  7:26   ` Ingo Molnar
@ 2009-02-12  8:36     ` David Woodhouse
  2009-02-12 20:09       ` H. Peter Anvin
  2009-06-30 11:10     ` David Woodhouse
  1 sibling, 1 reply; 7+ messages in thread
From: David Woodhouse @ 2009-02-12  8:36 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: x86 maintainers, linux-kernel

On Thu, 2009-02-12 at 08:26 +0100, Ingo Molnar wrote:
> * Ingo Molnar <mingo@elte.hu> wrote:
> 
> > 
> > * David Woodhouse <dwmw2@infradead.org> wrote:
> > 
> > > It is a steaming great pain in the arse when the value of CONFIG_64BIT
> > > explicitly written in my .config file is overridden by the value of
> > > $ARCH inferred from the environment.
> > > 
> > > If I have a 32-bit .config and I happen to build it without remembering
> > > to put 'ARCH=i386' on the make command line, it shouldn't force
> > > CONFIG_64BIT=y and reconfigure.
> > > 
> > > This patch should fix that, while still allowing defconfig to work as it
> > > currently does for both 32-bit and 64-bit environments, and still giving
> > > the default value of CONFIG_64BIT according to $ARCH. It's just that it
> > > won't _force_ a change to CONFIG_64BIT when it's set to something other
> > > than what $ARCH would imply.
> > > 
> > > Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
> > 
> > Applied to tip:x86/ugent, thanks David!
> 
> i removed it again, because it regresses randconfig behavior:

Ew, that's a nasty thing to be prioritising over day-to-day usability,
and the fact that I can't just do 'make bzImage' without it screwing up
and asking me to reconfigure.

Isn't there a CONFIG_RANDCONFIG option? We could make it
   bool "64-bit kernel" if !CONFIG_RANDCONFIG

Alternatively, we could just the top-level Makefile set ARCH=x86 when
it's inferred from the environment, and let people override it to i386
or x86_64 if they want to.

-- 
dwmw2


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

* Re: [PATCH] Don't override CONFIG_64BIT for ARCH={i386,x86_64} builds
  2009-02-12  8:36     ` David Woodhouse
@ 2009-02-12 20:09       ` H. Peter Anvin
  2009-02-13 11:12         ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: H. Peter Anvin @ 2009-02-12 20:09 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Ingo Molnar, x86 maintainers, linux-kernel

David Woodhouse wrote:
> 
> Ew, that's a nasty thing to be prioritising over day-to-day usability,
> and the fact that I can't just do 'make bzImage' without it screwing up
> and asking me to reconfigure.
> 
> Isn't there a CONFIG_RANDCONFIG option? We could make it
>    bool "64-bit kernel" if !CONFIG_RANDCONFIG
> 
> Alternatively, we could just the top-level Makefile set ARCH=x86 when
> it's inferred from the environment, and let people override it to i386
> or x86_64 if they want to.
> 

I think the fundamental problem here is that "make randconfig" is 
allowed to retain *any* information from the previous .config; the same 
is true for "make all*config", "make defconfig", etc.  These by 
definition should blast the current configuration away.

Now, "make randconfig" should ideally be able to generate either a 32- 
or a 64-bit configuration (which would have to be done correctly), but 
if ARCH is set we need to honor it.

	-hpa

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

* Re: [PATCH] Don't override CONFIG_64BIT for ARCH={i386,x86_64} builds
  2009-02-12 20:09       ` H. Peter Anvin
@ 2009-02-13 11:12         ` Ingo Molnar
  0 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2009-02-13 11:12 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: David Woodhouse, x86 maintainers, linux-kernel


* H. Peter Anvin <hpa@zytor.com> wrote:

> David Woodhouse wrote:
>>
>> Ew, that's a nasty thing to be prioritising over day-to-day usability,
>> and the fact that I can't just do 'make bzImage' without it screwing up
>> and asking me to reconfigure.

That argument is flawed because it could be used against just about any
regression that happens in the kernel: if only the new behavior is
deemed more important than the regression that it introduces.

As i said, there's no real problem here, i dont mind the change you are
proposing, but it needs to be done without introducing clearly
nonsensical regressions.

>> Isn't there a CONFIG_RANDCONFIG option? We could make it
>>    bool "64-bit kernel" if !CONFIG_RANDCONFIG
>>
>> Alternatively, we could just the top-level Makefile set ARCH=x86 when
>> it's inferred from the environment, and let people override it to i386
>> or x86_64 if they want to.
>>
>
> I think the fundamental problem here is that "make randconfig" is  
> allowed to retain *any* information from the previous .config; the same  
> is true for "make all*config", "make defconfig", etc.  These by  
> definition should blast the current configuration away.
>
> Now, "make randconfig" should ideally be able to generate either a 32-  
> or a 64-bit configuration (which would have to be done correctly), but  
> if ARCH is set we need to honor it.

Yep, as long as an explicit ARCH override is honored i dont mind some
side-effects on randconfig. (although people do have scripting around
randconfig so we need to make sure it's all sane.)

	Ingo

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

* Re: [PATCH] Don't override CONFIG_64BIT for ARCH={i386,x86_64} builds
  2009-02-12  7:26   ` Ingo Molnar
  2009-02-12  8:36     ` David Woodhouse
@ 2009-06-30 11:10     ` David Woodhouse
  1 sibling, 0 replies; 7+ messages in thread
From: David Woodhouse @ 2009-06-30 11:10 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: x86 maintainers, linux-kernel

On Thu, 2009-02-12 at 08:26 +0100, Ingo Molnar wrote:
> 
> i removed it again, because it regresses randconfig behavior:
> 
>  titan:~/tip> grep X86_32 .config; make ARCH=x86_64 randconfig; grep
> X86_32 .config
>  # CONFIG_X86_32 is not set
>  scripts/kconfig/conf -r arch/x86/Kconfig
>  #
>  # configuration written to .config
>  #
>  CONFIG_X86_32=y
>  CONFIG_X86_32_SMP=y
>  CONFIG_X86_32_LAZY_GS=y
>  CONFIG_X86_32_ALWAYS_ON=y
> 
> I dont mind the change you are after, but randconfig should work as
> expected too: if ARCH=x86_64 is passed it should generate a 64-bit
> randconfig, not a 50% 32-bit one.

I still think that's a crap argument -- randconfig is _supposed_ to give
you a random config -- it's not as if you're going to boot it anyway.

If you want to have a _partially_ random config you should do that with
something like 'make CONFIG_FOO=y randconfig'. I think we should drop
the historical baggage of 'ARCH=i386' and 'ARCH=x86_64' completely.

But I've just spent a few days testing the wrong damn kernel because
'make oldconfig' silently changed architectures on the config I was
given to test -- a bug which you seem to think is _less_ important than
the 'bug' that randconfig actually gives you what you asked for.

So I'll have another go at fixing it in a way that preserves your silly
'make ARCH=x86_64 almost-random-config', this time by letting $(ARCH)
default to x86.

I didn't do it this way before, because I wanted 'make defconfig' to
give you a config which matched the architecture you're running on. I've
achieved that a different way now though.

For those using 'make config' from scratch, I made it default to x86_64
instead of i386. That's probably a saner choice, these days. 

--------------
Subject: Don't silently override CONFIG_64BIT in 'make oldconfig'

It is a steaming great pain in the arse when the value of CONFIG_64BIT
explicitly written in my .config file is overridden by the value of
$ARCH inferred from the environment.

If I have a 32-bit .config and I happen to build it without remembering
to put 'ARCH=i386' on the make command line, it shouldn't force
CONFIG_64BIT=y and reconfigure.
 
This patch should fix that, while still allowing defconfig to work as it
currently does for both 32-bit and 64-bit environments.

The default when running 'make config' is no longer automatic -- it's
set to 64-bit. It wasn't possible to preserve this behaviour without
also breaking things for the strange people who want 'make randconfig'
not to actually be completely random.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

diff --git a/Makefile b/Makefile
index d1216fe..c944d6e 100644
--- a/Makefile
+++ b/Makefile
@@ -157,7 +157,8 @@ export srctree objtree VPATH TOPDIR
 # then ARCH is assigned, getting whatever value it gets normally, and 
 # SUBARCH is subsequently ignored.
 
-SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
+				  -e s/sun4u/sparc64/ \
 				  -e s/arm.*/arm/ -e s/sa110/arm/ \
 				  -e s/s390x/s390/ -e s/parisc64/parisc/ \
 				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d1430ef..3f5bbfe 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -4,7 +4,7 @@ mainmenu "Linux Kernel Configuration for x86"
 # Select 32 or 64 bit
 config 64BIT
 	bool "64-bit kernel" if ARCH = "x86"
-	default ARCH = "x86_64"
+	default ARCH != "i386"
 	---help---
 	  Say yes to build a 64-bit kernel - formerly known as x86_64
 	  Say no to build a 32-bit kernel - formerly known as i386
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 1b68659..3c6c6ea 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -2,7 +2,11 @@
 
 # select defconfig based on actual architecture
 ifeq ($(ARCH),x86)
+  ifeq ($(shell uname -m),x86_64)
+        KBUILD_DEFCONFIG := x86_64_defconfig
+  else
         KBUILD_DEFCONFIG := i386_defconfig
+  endif
 else
         KBUILD_DEFCONFIG := $(ARCH)_defconfig
 endif

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


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

end of thread, other threads:[~2009-06-30 11:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-11 17:11 [PATCH] Don't override CONFIG_64BIT for ARCH={i386,x86_64} builds David Woodhouse
2009-02-11 17:22 ` Ingo Molnar
2009-02-12  7:26   ` Ingo Molnar
2009-02-12  8:36     ` David Woodhouse
2009-02-12 20:09       ` H. Peter Anvin
2009-02-13 11:12         ` Ingo Molnar
2009-06-30 11:10     ` David Woodhouse

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.