Re: 3.13: BUG: unable to handle kernel paging request at 00000000b4343e88

From: Peter Oberparleiter
Date: Thu Feb 06 2014 - 09:58:28 EST


On 05.02.2014 18:36, H. Peter Anvin wrote:
> On 02/05/2014 09:00 AM, Peter Oberparleiter wrote:
>>
>> Could you give this patch a try? It is a variation of the approach
>> proposed in the discussion mentioned earlier and fixes the problem
>> on my system.
>>
>
> I would rather suggest that we explicitly disable gcov etc. from these
> kinds of small, magic primitives. Honestly, you're just trying to put a
> bandaid on a gaping wound.
>
> The real thing here is that hweight.c is not a normal C file, and we
> shouldn't treat is as such. It is a constrained environment, and trying
> to tack crap like gcov to it is bound to lose, simply because gcov
> doesn't know the rules it has to play by.
>
> Even with the below change, if gcov clobbers, say, %rdx we're still screwed.

I'm fine with the proposed alternative of disabling gcov profiling for
lib/hweight.c. The patch below fixes the problem on my test system.

---
x86/hweight: Fix BUG when booting with CONFIG_GCOV_PROFILE_ALL=y

Commit d61931d89b, "x86: Add optimized popcnt variants" introduced
compile flag -fcall-saved-rdi for lib/hweight.c. When combined with
options -fprofile-arcs and -O2, this flag causes gcc to generate broken
constructor code. As a result, a 64 bit x86 kernel compiled with
CONFIG_GCOV_PROFILE_ALL=y prints message "gcov: could not create file"
and runs into sproadic BUGs during boot.

This patch avoids the bug by excluding lib/hweight.o from coverage
profiling.

Reported-by: Meelis Roos <mroos@xxxxxxxx>
Cc: H. Peter Anvin <hpa@xxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Peter Oberparleiter <oberpar@xxxxxxxxxxxxxxxxxx>
---
lib/Makefile | 1 +
1 file changed, 1 insertion(+)
diff -Naurp a/lib/Makefile b/lib/Makefile
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -43,6 +43,7 @@ obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o
obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o
obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o

+GCOV_PROFILE_hweight.o := n
CFLAGS_hweight.o = $(subst $(quote),,$(CONFIG_ARCH_HWEIGHT_CFLAGS))
obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o

--
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/