Re: [tip:x86/urgent] x86, hweight: Fix UML boot crash

From: H. Peter Anvin
Date: Wed Jun 09 2010 - 18:43:16 EST


Note: I have applied this because it fixes a regression, but it bugs
the living bejeezus out of me that the saner patch:

diff --git a/arch/um/include/asm/arch_hweight.h
b/arch/um/include/asm/arch_hweight.h
new file mode 100644
index 0000000..c656cf4
--- /dev/null
+++ b/arch/um/include/asm/arch_hweight.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_UM_HWEIGHT_H
+#define _ASM_UM_HWEIGHT_H
+
+#include <asm-generic/bitops/arch_hweight.h>
+
+#endif

... supposedly didn't work. As such, I consider this a temporary kluge
until a proper solution is found. From a code-cleanliness perspective,
this patch is awful.

-hpa


On 06/09/2010 03:07 PM, tip-bot for Borislav Petkov wrote:
> Commit-ID: cc7f0a7b3004a4ca0bfef0e1ca79f2e0da6ca1b0
> Gitweb: http://git.kernel.org/tip/cc7f0a7b3004a4ca0bfef0e1ca79f2e0da6ca1b0
> Author: Borislav Petkov <bp@xxxxxxxxx>
> AuthorDate: Sun, 30 May 2010 19:03:46 +0200
> Committer: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
> CommitDate: Wed, 9 Jun 2010 14:23:29 -0700
>
> x86, hweight: Fix UML boot crash
>
> UML apparently cannot stomach callee reg-saving trickery introduced
> with d61931d89be506372d01a90d1755f6d0a9fafe2d (x86: Add optimized
> popcnt variants) for reasons currently unknown, and oopses during
> boot: http://marc.info/?l=linux-kernel&m=127522065202435&w=2
>
> Go ahead and fall back to the software hweight* routines on UML.
>
> LKML-Reference: <201005271944.09541.toralf.foerster@xxxxxx>
> Tested-by: Toralf FÃrster <toralf.foerster@xxxxxx>
> Tested-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> LKML-Reference: <20100530170346.GC1565@xxxxxxxxxxxx>
> Signed-off-by: Borislav Petkov <bp@xxxxxxxxx>
> Signed-off-by: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
> Cc: Boaz Harrosh <bharrosh@xxxxxxxxxxx>
> Cc: Jeff Dike <jdike@xxxxxxxxxxx>
> Cc: Andrew Morgon <akpm@xxxxxxxxxxxxxxxxxxxx>
> ---
> arch/x86/include/asm/bitops.h | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
> index 545776e..c9dad12 100644
> --- a/arch/x86/include/asm/bitops.h
> +++ b/arch/x86/include/asm/bitops.h
> @@ -444,7 +444,11 @@ static inline int fls(int x)
>
> #define ARCH_HAS_FAST_MULTIPLIER 1
>
> +#ifdef CONFIG_UML
> +#include <asm-generic/bitops/arch_hweight.h>
> +#else
> #include <asm/arch_hweight.h>
> +#endif
>
> #include <asm-generic/bitops/const_hweight.h>
>

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