diff mbox series

[2/2] x86: disable CONFIG_GENERIC_HWEIGHT and remove __HAVE_ARCH_SW_HWEIGHT

Message ID 1550469571-25933-3-git-send-email-yamada.masahiro@socionext.com
State Superseded
Headers show
Series x86: turn off wrongly enabled CONFIG_GENERIC_HWEIGHT | expand

Commit Message

Masahiro Yamada Feb. 18, 2019, 5:59 a.m. UTC
arch/x86/include/asm/arch_hweight.h uses __sw_hweight{32,64} as
alternatives, but they are implemented in arch/x86/lib/hweight.S

x86 does not rely on the generic C implementation lib/hweight.c
at all, so CONFIG_GENERIC_HWEIGHT should be disabled.

__HAVE_ARCH_SW_HWEIGHT was unneeded in the first place.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

 arch/x86/Kconfig                    | 3 ---
 arch/x86/include/asm/arch_hweight.h | 2 --
 lib/hweight.c                       | 4 ----
 3 files changed, 9 deletions(-)

-- 
2.7.4

Comments

Borislav Petkov Feb. 18, 2019, 8:09 a.m. UTC | #1
On Mon, Feb 18, 2019 at 02:59:31PM +0900, Masahiro Yamada wrote:
> arch/x86/include/asm/arch_hweight.h uses __sw_hweight{32,64} as

> alternatives, but they are implemented in arch/x86/lib/hweight.S

> 

> x86 does not rely on the generic C implementation lib/hweight.c

> at all, so CONFIG_GENERIC_HWEIGHT should be disabled.

> 

> __HAVE_ARCH_SW_HWEIGHT was unneeded in the first place.


Well, it was needed because I didn't think of removing the selection of
GENERIC_HWEIGHT in arch/x86/ at the time:

ld: lib/built-in.o:/dev/shm/bpetkov/kernel/linux/lib/hweight.c:27: multiple definition of `__ksymtab___sw_hweight32'; arch/x86/built-in.o:/dev/shm/bpetkov/kernel/linux/arch/x86/kernel/x8664_ksyms_64.c:47: first defined here
ld: lib/built-in.o:/dev/shm/bpetkov/kernel/linux/lib/hweight.c:67: multiple definition of `__ksymtab___sw_hweight64'; arch/x86/built-in.o:/dev/shm/bpetkov/kernel/linux/arch/x86/kernel/x8664_ksyms_64.c:48: first defined here
ld: arch/x86/lib/built-in.o: in function `__sw_hweight32':
/dev/shm/bpetkov/kernel/linux/arch/x86/lib/hweight.S:12: multiple definition of `__sw_hweight32'; lib/built-in.o:/dev/shm/bpetkov/kernel/linux/lib/hweight.c:15: first defined here
ld: arch/x86/lib/built-in.o: in function `__sw_hweight64':
/dev/shm/bpetkov/kernel/linux/arch/x86/lib/hweight.S:38: multiple definition of `__sw_hweight64'; lib/built-in.o:/dev/shm/bpetkov/kernel/linux/lib/hweight.c:53: first defined here
make: *** [vmlinux] Error 1

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
Masahiro Yamada Feb. 19, 2019, 1:16 a.m. UTC | #2
On Mon, Feb 18, 2019 at 3:09 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>

> arch/x86/include/asm/arch_hweight.h uses __sw_hweight{32,64} as

> alternatives, but they are implemented in arch/x86/lib/hweight.S

>

> x86 does not rely on the generic C implementation lib/hweight.c

> at all, so CONFIG_GENERIC_HWEIGHT should be disabled.

>

> __HAVE_ARCH_SW_HWEIGHT was unneeded in the first place.

>

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>



Maintainers,

As I replied to 1/2,
please ignore this for now.


I will resend this later,
hopefully in the next development cycle.


> ---

>

>  arch/x86/Kconfig                    | 3 ---

>  arch/x86/include/asm/arch_hweight.h | 2 --

>  lib/hweight.c                       | 4 ----

>  3 files changed, 9 deletions(-)

>

> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig

> index 6826143..c2813af 100644

> --- a/arch/x86/Kconfig

> +++ b/arch/x86/Kconfig

> @@ -262,9 +262,6 @@ config GENERIC_BUG

>  config GENERIC_BUG_RELATIVE_POINTERS

>         bool

>

> -config GENERIC_HWEIGHT

> -       def_bool y

> -

>  config ARCH_MAY_HAVE_PC_FDC

>         def_bool y

>         depends on ISA_DMA_API

> diff --git a/arch/x86/include/asm/arch_hweight.h b/arch/x86/include/asm/arch_hweight.h

> index fc06935..ba88edd 100644

> --- a/arch/x86/include/asm/arch_hweight.h

> +++ b/arch/x86/include/asm/arch_hweight.h

> @@ -12,8 +12,6 @@

>  #define REG_OUT "a"

>  #endif

>

> -#define __HAVE_ARCH_SW_HWEIGHT

> -

>  static __always_inline unsigned int __arch_hweight32(unsigned int w)

>  {

>         unsigned int res;

> diff --git a/lib/hweight.c b/lib/hweight.c

> index 7660d88..c94586b 100644

> --- a/lib/hweight.c

> +++ b/lib/hweight.c

> @@ -10,7 +10,6 @@

>   * The Hamming Weight of a number is the total number of bits set in it.

>   */

>

> -#ifndef __HAVE_ARCH_SW_HWEIGHT

>  unsigned int __sw_hweight32(unsigned int w)

>  {

>  #ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER

> @@ -27,7 +26,6 @@ unsigned int __sw_hweight32(unsigned int w)

>  #endif

>  }

>  EXPORT_SYMBOL(__sw_hweight32);

> -#endif

>

>  unsigned int __sw_hweight16(unsigned int w)

>  {

> @@ -46,7 +44,6 @@ unsigned int __sw_hweight8(unsigned int w)

>  }

>  EXPORT_SYMBOL(__sw_hweight8);

>

> -#ifndef __HAVE_ARCH_SW_HWEIGHT

>  unsigned long __sw_hweight64(__u64 w)

>  {

>  #if BITS_PER_LONG == 32

> @@ -69,4 +66,3 @@ unsigned long __sw_hweight64(__u64 w)

>  #endif

>  }

>  EXPORT_SYMBOL(__sw_hweight64);

> -#endif

> --

> 2.7.4

>



-- 
Best Regards
Masahiro Yamada
diff mbox series

Patch

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 6826143..c2813af 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -262,9 +262,6 @@  config GENERIC_BUG
 config GENERIC_BUG_RELATIVE_POINTERS
 	bool
 
-config GENERIC_HWEIGHT
-	def_bool y
-
 config ARCH_MAY_HAVE_PC_FDC
 	def_bool y
 	depends on ISA_DMA_API
diff --git a/arch/x86/include/asm/arch_hweight.h b/arch/x86/include/asm/arch_hweight.h
index fc06935..ba88edd 100644
--- a/arch/x86/include/asm/arch_hweight.h
+++ b/arch/x86/include/asm/arch_hweight.h
@@ -12,8 +12,6 @@ 
 #define REG_OUT "a"
 #endif
 
-#define __HAVE_ARCH_SW_HWEIGHT
-
 static __always_inline unsigned int __arch_hweight32(unsigned int w)
 {
 	unsigned int res;
diff --git a/lib/hweight.c b/lib/hweight.c
index 7660d88..c94586b 100644
--- a/lib/hweight.c
+++ b/lib/hweight.c
@@ -10,7 +10,6 @@ 
  * The Hamming Weight of a number is the total number of bits set in it.
  */
 
-#ifndef __HAVE_ARCH_SW_HWEIGHT
 unsigned int __sw_hweight32(unsigned int w)
 {
 #ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER
@@ -27,7 +26,6 @@  unsigned int __sw_hweight32(unsigned int w)
 #endif
 }
 EXPORT_SYMBOL(__sw_hweight32);
-#endif
 
 unsigned int __sw_hweight16(unsigned int w)
 {
@@ -46,7 +44,6 @@  unsigned int __sw_hweight8(unsigned int w)
 }
 EXPORT_SYMBOL(__sw_hweight8);
 
-#ifndef __HAVE_ARCH_SW_HWEIGHT
 unsigned long __sw_hweight64(__u64 w)
 {
 #if BITS_PER_LONG == 32
@@ -69,4 +66,3 @@  unsigned long __sw_hweight64(__u64 w)
 #endif
 }
 EXPORT_SYMBOL(__sw_hweight64);
-#endif