linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: finalize bitops unification
@ 2008-04-04 18:49 Alexander van Heukelum
  2008-04-04 18:51 ` [PATCH] Build fix for uml/i386 Alexander van Heukelum
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alexander van Heukelum @ 2008-04-04 18:49 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Andi Kleen, LKML, Alexander van Heukelum

x86: finalize bitops unification

include/asm-x86/bitops_32.h and include/asm-x86/bitops_64.h are now
almost identical. The 64-bit version sets ARCH_HAS_FAST_MULTIPLIER
and has an extra inline function set_bit_string. The define currently
has no influence on the generated code, but it can be argued that
setting it on i386 is the right thing to do anyhow. The addition
of the extra inline function on i386 does not hurt either.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>

---

Hi Ingo,

This patch finishes the bitops unification.

Greetings,
	Alexander

 include/asm-x86/bitops.h    |   38 +++++++++++++++++++++++++++++++++-----
 include/asm-x86/bitops_32.h |   30 ------------------------------
 include/asm-x86/bitops_64.h |   42 ------------------------------------------
 3 files changed, 33 insertions(+), 77 deletions(-)

diff --git a/include/asm-x86/bitops.h b/include/asm-x86/bitops.h
index a66143a..b81a4d4 100644
--- a/include/asm-x86/bitops.h
+++ b/include/asm-x86/bitops.h
@@ -401,10 +401,38 @@ static inline int fls(int x)
 #undef BIT_ADDR
 #undef ADDR
 
-#ifdef CONFIG_X86_32
-# include "bitops_32.h"
-#else
-# include "bitops_64.h"
-#endif
+static inline void set_bit_string(unsigned long *bitmap,
+		unsigned long i, int len)
+{
+	unsigned long end = i + len;
+	while (i < end) {
+		__set_bit(i, bitmap);
+		i++;
+	}
+}
+
+#ifdef __KERNEL__
+
+#include <asm-generic/bitops/sched.h>
+
+#define ARCH_HAS_FAST_MULTIPLIER 1
+
+#include <asm-generic/bitops/hweight.h>
 
+#endif /* __KERNEL__ */
+
+#include <asm-generic/bitops/fls64.h>
+
+#ifdef __KERNEL__
+
+#include <asm-generic/bitops/ext2-non-atomic.h>
+
+#define ext2_set_bit_atomic(lock, nr, addr)			\
+	test_and_set_bit((nr), (unsigned long *)(addr))
+#define ext2_clear_bit_atomic(lock, nr, addr)			\
+	test_and_clear_bit((nr), (unsigned long *)(addr))
+
+#include <asm-generic/bitops/minix.h>
+
+#endif /* __KERNEL__ */
 #endif	/* _ASM_X86_BITOPS_H */
diff --git a/include/asm-x86/bitops_32.h b/include/asm-x86/bitops_32.h
deleted file mode 100644
index 2e86302..0000000
--- a/include/asm-x86/bitops_32.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef _I386_BITOPS_H
-#define _I386_BITOPS_H
-
-/*
- * Copyright 1992, Linus Torvalds.
- */
-#ifdef __KERNEL__
-
-#include <asm-generic/bitops/sched.h>
-
-#include <asm-generic/bitops/hweight.h>
-
-#endif /* __KERNEL__ */
-
-#include <asm-generic/bitops/fls64.h>
-
-#ifdef __KERNEL__
-
-#include <asm-generic/bitops/ext2-non-atomic.h>
-
-#define ext2_set_bit_atomic(lock, nr, addr)			\
-	test_and_set_bit((nr), (unsigned long *)(addr))
-#define ext2_clear_bit_atomic(lock, nr, addr)			\
-	test_and_clear_bit((nr), (unsigned long *)(addr))
-
-#include <asm-generic/bitops/minix.h>
-
-#endif /* __KERNEL__ */
-
-#endif /* _I386_BITOPS_H */
diff --git a/include/asm-x86/bitops_64.h b/include/asm-x86/bitops_64.h
deleted file mode 100644
index cb23122..0000000
--- a/include/asm-x86/bitops_64.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef _X86_64_BITOPS_H
-#define _X86_64_BITOPS_H
-
-/*
- * Copyright 1992, Linus Torvalds.
- */
-static inline void set_bit_string(unsigned long *bitmap, unsigned long i,
-				  int len)
-{
-	unsigned long end = i + len;
-	while (i < end) {
-		__set_bit(i, bitmap);
-		i++;
-	}
-}
-
-#ifdef __KERNEL__
-
-#include <asm-generic/bitops/sched.h>
-
-#define ARCH_HAS_FAST_MULTIPLIER 1
-
-#include <asm-generic/bitops/hweight.h>
-
-#endif /* __KERNEL__ */
-
-#include <asm-generic/bitops/fls64.h>
-
-#ifdef __KERNEL__
-
-#include <asm-generic/bitops/ext2-non-atomic.h>
-
-#define ext2_set_bit_atomic(lock, nr, addr)			\
-	test_and_set_bit((nr), (unsigned long *)(addr))
-#define ext2_clear_bit_atomic(lock, nr, addr)			\
-	test_and_clear_bit((nr), (unsigned long *)(addr))
-
-#include <asm-generic/bitops/minix.h>
-
-#endif /* __KERNEL__ */
-
-#endif /* _X86_64_BITOPS_H */

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

* [PATCH] Build fix for uml/i386
  2008-04-04 18:49 [PATCH] x86: finalize bitops unification Alexander van Heukelum
@ 2008-04-04 18:51 ` Alexander van Heukelum
  2008-04-04 18:51 ` [PATCH] Build fix for uml/x86_64 Alexander van Heukelum
  2008-04-07  7:00 ` [PATCH] x86: finalize bitops unification Ingo Molnar
  2 siblings, 0 replies; 6+ messages in thread
From: Alexander van Heukelum @ 2008-04-04 18:51 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Andi Kleen, LKML, Alexander van Heukelum

Build fix for uml/i386, which was broken by:
x86: remove x86-specific implementations of find_first_bit

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>

---

Hi Ingo,

I broke uml again :(

This patch fixes the problem for i386. These changes should
have been included in:

x86: generic versions of find_first_(zero_)bit, convert i386

Greetings,
	Alexander

 arch/um/Kconfig.i386      |    4 ++++
 arch/um/sys-i386/Makefile |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386
index 164d29c..f694cff 100644
--- a/arch/um/Kconfig.i386
+++ b/arch/um/Kconfig.i386
@@ -43,6 +43,10 @@ config ARCH_REUSE_HOST_VSYSCALL_AREA
 	bool
 	default y
 
+config GENERIC_FIND_FIRST_BIT
+	bool
+	default y
+
 config GENERIC_FIND_NEXT_BIT
 	bool
 	default y
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
index 964dc1a..598b5c1 100644
--- a/arch/um/sys-i386/Makefile
+++ b/arch/um/sys-i386/Makefile
@@ -6,7 +6,7 @@ obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
 	ptrace_user.o setjmp.o signal.o stub.o stub_segv.o syscalls.o sysrq.o \
 	sys_call_table.o tls.o
 
-subarch-obj-y = lib/bitops_32.o lib/semaphore_32.o lib/string_32.o
+subarch-obj-y = lib/semaphore_32.o lib/string_32.o
 subarch-obj-$(CONFIG_HIGHMEM) += mm/highmem_32.o
 subarch-obj-$(CONFIG_MODULES) += kernel/module_32.o
 


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

* [PATCH] Build fix for uml/x86_64
  2008-04-04 18:49 [PATCH] x86: finalize bitops unification Alexander van Heukelum
  2008-04-04 18:51 ` [PATCH] Build fix for uml/i386 Alexander van Heukelum
@ 2008-04-04 18:51 ` Alexander van Heukelum
  2008-04-04 19:00   ` Harvey Harrison
  2008-04-07  7:00 ` [PATCH] x86: finalize bitops unification Ingo Molnar
  2 siblings, 1 reply; 6+ messages in thread
From: Alexander van Heukelum @ 2008-04-04 18:51 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Andi Kleen, LKML, Alexander van Heukelum

Build fix for uml/x86_64, which was broken by:
x86: remove x86-specific implementations of find_first_bit

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>

---

Hi Ingo,

I broke uml again :(

This patch fixes the problem for x86_64. These changes
should have been included in:

x86: switch x86_64 to generic find_first_bit

Greetings,
        Alexander

 arch/um/Kconfig.x86_64      |    4 ++++
 arch/um/sys-x86_64/Makefile |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/um/Kconfig.x86_64 b/arch/um/Kconfig.x86_64
index a29f545..84cefd5 100644
--- a/arch/um/Kconfig.x86_64
+++ b/arch/um/Kconfig.x86_64
@@ -31,6 +31,10 @@ config SMP_BROKEN
 	bool
 	default y
 
+config GENERIC_FIND_FIRST_BIT
+	bool
+	default y
+
 config GENERIC_FIND_NEXT_BIT
 	bool
 	default y
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
index 3c22de5..c8b4cce 100644
--- a/arch/um/sys-x86_64/Makefile
+++ b/arch/um/sys-x86_64/Makefile
@@ -10,7 +10,7 @@ obj-y = bug.o bugs.o delay.o fault.o ldt.o mem.o ptrace.o ptrace_user.o \
 
 obj-$(CONFIG_MODULES) += um_module.o
 
-subarch-obj-y = lib/bitops_64.o lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o
+subarch-obj-y = lib/csum-partial_64.o lib/memcpy_64.o lib/thunk_64.o
 subarch-obj-$(CONFIG_MODULES) += kernel/module_64.o
 
 ldt-y = ../sys-i386/ldt.o

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

* Re: [PATCH] Build fix for uml/x86_64
  2008-04-04 18:51 ` [PATCH] Build fix for uml/x86_64 Alexander van Heukelum
@ 2008-04-04 19:00   ` Harvey Harrison
  2008-04-04 20:40     ` [PATCH] uml: cleanup: use def_bool in Kconfig files Alexander van Heukelum
  0 siblings, 1 reply; 6+ messages in thread
From: Harvey Harrison @ 2008-04-04 19:00 UTC (permalink / raw)
  To: Alexander van Heukelum
  Cc: Ingo Molnar, Andi Kleen, LKML, Alexander van Heukelum

On Fri, 2008-04-04 at 20:51 +0200, Alexander van Heukelum wrote:
> Build fix for uml/x86_64, which was broken by:
> x86: remove x86-specific implementations of find_first_bit
> 
> Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
> 
> ---
> 
> Hi Ingo,
> 
> I broke uml again :(
> 
> This patch fixes the problem for x86_64. These changes
> should have been included in:
> 
> x86: switch x86_64 to generic find_first_bit
> 
> Greetings,
>         Alexander
> 
>  arch/um/Kconfig.x86_64      |    4 ++++
>  arch/um/sys-x86_64/Makefile |    2 +-
>  2 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/um/Kconfig.x86_64 b/arch/um/Kconfig.x86_64
> index a29f545..84cefd5 100644
> --- a/arch/um/Kconfig.x86_64
> +++ b/arch/um/Kconfig.x86_64
> @@ -31,6 +31,10 @@ config SMP_BROKEN
>  	bool
>  	default y
>  
> +config GENERIC_FIND_FIRST_BIT
> +	bool
> +	default y
> +
	def_bool y

Cheers,

Harvey



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

* [PATCH] uml: cleanup: use def_bool in Kconfig files
  2008-04-04 19:00   ` Harvey Harrison
@ 2008-04-04 20:40     ` Alexander van Heukelum
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander van Heukelum @ 2008-04-04 20:40 UTC (permalink / raw)
  To: Harvey Harrison, Ingo Molnar, Jeff Dike
  Cc: Andi Kleen, LKML, Alexander van Heukelum

Cleanup: use def_bool in User-mode Linux' Kconfig files.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>

---

Harvey Harrison wrote:
> > +config GENERIC_FIND_FIRST_BIT
> > +	bool
> > +	default y
> > +
> 	def_bool y

Indeed! But it is hardly the only occurence of the long version.
Should we add this patch? If so, should it go via the -x86 tree,
as this depends on changes I introduced for the bitops unification?

Greetings,
	Alexander

 arch/um/Kconfig        |   50 +++++++++++++++++------------------------------
 arch/um/Kconfig.char   |    6 +---
 arch/um/Kconfig.i386   |   27 ++++++++-----------------
 arch/um/Kconfig.x86_64 |   33 ++++++++++---------------------
 4 files changed, 40 insertions(+), 76 deletions(-)

diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index dba8e05..bbbc198 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -5,16 +5,13 @@ config DEFCONFIG_LIST
 
 # UML uses the generic IRQ subsystem
 config GENERIC_HARDIRQS
-	bool
-	default y
+	def_bool y
 
 config UML
-	bool
-	default y
+	def_bool y
 
 config MMU
-	bool
-	default y
+	def_bool y
 
 config NO_IOMEM
 	def_bool y
@@ -22,51 +19,43 @@ config NO_IOMEM
 mainmenu "Linux/Usermode Kernel Configuration"
 
 config ISA
-	bool
+	def_bool n
 
 config SBUS
-	bool
+	def_bool n
 
 config PCI
-	bool
+	def_bool n
 
 config PCMCIA
-	bool
+	def_bool n
 
 # Yet to do!
 config TRACE_IRQFLAGS_SUPPORT
-	bool
-	default n
+	def_bool n
 
 config LOCKDEP_SUPPORT
-	bool
-	default y
+	def_bool y
 
 config STACKTRACE_SUPPORT
-	bool
-	default n
+	def_bool n
 
 config GENERIC_CALIBRATE_DELAY
-	bool
-	default y
+	def_bool y
 
 config GENERIC_BUG
-	bool
-	default y
+	def_bool y
 	depends on BUG
 
 config GENERIC_TIME
-	bool
-	default y
+	def_bool y
 
 config GENERIC_CLOCKEVENTS
-	bool
-	default y
+	def_bool y
 
 # Used in kernel/irq/manage.c and include/linux/irq.h
 config IRQ_RELEASE_METHOD
-	bool
-	default y
+	def_bool y
 
 config HZ
 	int
@@ -90,13 +79,11 @@ source "mm/Kconfig"
 source "kernel/time/Kconfig"
 
 config LD_SCRIPT_STATIC
-	bool
-	default y
+	def_bool y
 	depends on STATIC_LINK
 
 config LD_SCRIPT_DYN
-	bool
-	default y
+	def_bool y
 	depends on !LD_SCRIPT_STATIC
 
 source "fs/Kconfig.binfmt"
@@ -261,7 +248,6 @@ endif
 
 #This is just to shut up some Kconfig warnings, so no prompt.
 config INPUT
-	bool
-	default n
+	def_bool n
 
 source "arch/um/Kconfig.debug"
diff --git a/arch/um/Kconfig.char b/arch/um/Kconfig.char
index 3a4b396..c51b3b3 100644
--- a/arch/um/Kconfig.char
+++ b/arch/um/Kconfig.char
@@ -8,8 +8,7 @@ config STDERR_CONSOLE
 	  console driver which dumps all printk messages to stderr.
 
 config STDIO_CONSOLE
-	bool
-	default y
+	def_bool y
 
 config SSL
 	bool "Virtual serial line"
@@ -68,8 +67,7 @@ config XTERM_CHAN
           It is safe to say 'Y' here.
 
 config NOCONFIG_CHAN
-	bool
-	default !(XTERM_CHAN && TTY_CHAN && PTY_CHAN && PORT_CHAN && NULL_CHAN)
+	def_bool !(XTERM_CHAN && TTY_CHAN && PTY_CHAN && PORT_CHAN && NULL_CHAN)
 
 config CON_ZERO_CHAN
 	string "Default main console channel initialization"
diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386
index f694cff..4d36f66 100644
--- a/arch/um/Kconfig.i386
+++ b/arch/um/Kconfig.i386
@@ -5,23 +5,19 @@ source "arch/x86/Kconfig.cpu"
 endmenu
 
 config UML_X86
-	bool
-	default y
+	def_bool y
 
 config X86_32
-       bool
-       default y
+       def_bool y
 
 config RWSEM_XCHGADD_ALGORITHM
 	def_bool y
 
 config 64BIT
-	bool
-	default n
+	def_bool n
 
 config SEMAPHORE_SLEEPERS
-	bool
-	default y
+	def_bool y
 
 config 3_LEVEL_PGTABLES
 	bool "Three-level pagetables (EXPERIMENTAL)"
@@ -36,24 +32,19 @@ config 3_LEVEL_PGTABLES
 	N (on x86-64 it's automatically enabled, instead, as it's safe there).
 
 config ARCH_HAS_SC_SIGNALS
-	bool
-	default y
+	def_bool y
 
 config ARCH_REUSE_HOST_VSYSCALL_AREA
-	bool
-	default y
+	def_bool y
 
 config GENERIC_FIND_FIRST_BIT
-	bool
-	default y
+	def_bool y
 
 config GENERIC_FIND_NEXT_BIT
-	bool
-	default y
+	def_bool y
 
 config GENERIC_HWEIGHT
-	bool
-	default y
+	def_bool y
 
 config ARCH_SUPPORTS_AOUT
 	def_bool y
diff --git a/arch/um/Kconfig.x86_64 b/arch/um/Kconfig.x86_64
index 84cefd5..42131b2 100644
--- a/arch/um/Kconfig.x86_64
+++ b/arch/um/Kconfig.x86_64
@@ -1,47 +1,36 @@
 config UML_X86
-	bool
-	default y
+	def_bool y
 
 config 64BIT
-	bool
-	default y
+	def_bool y
 
 #XXX: this is so in the underlying arch, but it's wrong!!!
 config RWSEM_GENERIC_SPINLOCK
-	bool
-	default y
+	def_bool y
 
 config SEMAPHORE_SLEEPERS
-	bool
-	default y
+	def_bool y
 
 config 3_LEVEL_PGTABLES
-       bool
-       default y
+       def_bool y
 
 config ARCH_HAS_SC_SIGNALS
-	bool
-	default n
+	def_bool n
 
 config ARCH_REUSE_HOST_VSYSCALL_AREA
-	bool
-	default n
+	def_bool n
 
 config SMP_BROKEN
-	bool
-	default y
+	def_bool y
 
 config GENERIC_FIND_FIRST_BIT
-	bool
-	default y
+	def_bool y
 
 config GENERIC_FIND_NEXT_BIT
-	bool
-	default y
+	def_bool y
 
 config GENERIC_HWEIGHT
-	bool
-	default y
+	def_bool y
 
 config ARCH_SUPPORTS_AOUT
 	def_bool y


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

* Re: [PATCH] x86: finalize bitops unification
  2008-04-04 18:49 [PATCH] x86: finalize bitops unification Alexander van Heukelum
  2008-04-04 18:51 ` [PATCH] Build fix for uml/i386 Alexander van Heukelum
  2008-04-04 18:51 ` [PATCH] Build fix for uml/x86_64 Alexander van Heukelum
@ 2008-04-07  7:00 ` Ingo Molnar
  2 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2008-04-07  7:00 UTC (permalink / raw)
  To: Alexander van Heukelum
  Cc: Andi Kleen, LKML, Alexander van Heukelum, Thomas Gleixner,
	H. Peter Anvin


* Alexander van Heukelum <heukelum@mailshack.com> wrote:

> Hi Ingo,
> 
> This patch finishes the bitops unification.

thanks Alexander, applied.

	Ingo

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

end of thread, other threads:[~2008-04-07  7:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-04 18:49 [PATCH] x86: finalize bitops unification Alexander van Heukelum
2008-04-04 18:51 ` [PATCH] Build fix for uml/i386 Alexander van Heukelum
2008-04-04 18:51 ` [PATCH] Build fix for uml/x86_64 Alexander van Heukelum
2008-04-04 19:00   ` Harvey Harrison
2008-04-04 20:40     ` [PATCH] uml: cleanup: use def_bool in Kconfig files Alexander van Heukelum
2008-04-07  7:00 ` [PATCH] x86: finalize bitops unification Ingo Molnar

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