Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753019AbaBERAX (ORCPT ); Wed, 5 Feb 2014 12:00:23 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:45494 "EHLO e06smtp10.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752858AbaBERAW (ORCPT ); Wed, 5 Feb 2014 12:00:22 -0500 Message-ID: <52F26E21.8000101@linux.vnet.ibm.com> Date: Wed, 05 Feb 2014 18:00:17 +0100 From: Peter Oberparleiter MIME-Version: 1.0 To: Meelis Roos CC: Andrew Morton , Linux Kernel list , "H. Peter Anvin" Subject: Re: 3.13: BUG: unable to handle kernel paging request at 00000000b4343e88 References: <20140121141037.f76dba61212c5597ff733207@linux-foundation.org> <52E26EF3.1090901@linux.vnet.ibm.com> <52E68111.6010005@linux.vnet.ibm.com> <52E918C9.7030408@linux.vnet.ibm.com> <52EBC65C.5020404@linux.vnet.ibm.com> In-Reply-To: <52EBC65C.5020404@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14020517-4966-0000-0000-0000084B5B5B Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 31.01.2014 16:50, Peter Oberparleiter wrote: > On 29.01.2014 21:44, Meelis Roos wrote: >>>> I do not get very far - it still crashes on startuo. PNG attached. >>> >>> I tried to reproduce this behavior a couple of times with no success. >>> Could you post your kernel configuration? I've also modified the >>> debugging patch to ensure that the gcov_info structure passed to >>> gcov_init() is no longer accessed beyond displaying the first 64 >>> bytes. If you could apply this and send dmesg output, this might >>> hopefully provide a clue as to why the kernel cannot handle these >>> data structures correctly. >> >> This patch makes it boot. dmesg and config are below. > > Using your config I was able to reproduce the crash and locate the > cause. Commit d61931d89b, "x86: Add optimized popcnt variants" adds > option -fcall-saved-rdi to the compile flags of lib/hweight.c when > compiling for x86_64. Together with options --coverage and -O2, this > results in a broken constructor being generated by GCC for this object > file which in turn causes __gcov_init() to overwrite random memory > locations (a mutex in your case). 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. -- diff -Naurp a/arch/x86/include/asm/arch_hweight.h b/arch/x86/include/asm/arch_hweight.h --- a/arch/x86/include/asm/arch_hweight.h +++ b/arch/x86/include/asm/arch_hweight.h @@ -25,9 +25,18 @@ static inline unsigned int __arch_hweigh { unsigned int res = 0; +#ifdef CONFIG_X86_32 asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT) : "="REG_OUT (res) : REG_IN (w)); +#else + /* Tell gcc that %rdi is clobbered as an input operand */ + unsigned long dummy; + + asm (ALTERNATIVE("call __sw_hweight32", POPCNT32, X86_FEATURE_POPCNT) + : "="REG_OUT (res), "=D" (dummy) + : REG_IN (w)); +#endif /* CONFIG_X86_32 */ return res; } @@ -50,8 +59,11 @@ static inline unsigned long __arch_hweig return __arch_hweight32((u32)w) + __arch_hweight32((u32)(w >> 32)); #else + /* Tell gcc that %rdi is clobbered as an input operand */ + unsigned long dummy; + asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT) - : "="REG_OUT (res) + : "="REG_OUT (res), "=D" (dummy) : REG_IN (w)); #endif /* CONFIG_X86_32 */ diff -Naurp a/arch/x86/Kconfig b/arch/x86/Kconfig --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -254,7 +254,7 @@ config X86_32_LAZY_GS config ARCH_HWEIGHT_CFLAGS string default "-fcall-saved-ecx -fcall-saved-edx" if X86_32 - default "-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" if X86_64 + default "-fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" if X86_64 config ARCH_SUPPORTS_UPROBES def_bool y -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/