Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758269Ab2ECTHT (ORCPT ); Thu, 3 May 2012 15:07:19 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:46896 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755011Ab2ECTHR convert rfc822-to-8bit (ORCPT ); Thu, 3 May 2012 15:07:17 -0400 MIME-Version: 1.0 In-Reply-To: <4FA2CE5C.8000100@zytor.com> References: <1335788867.29087.19.camel@localhost> <20120501110024.GC6649@dhcp-172-17-9-228.mtv.corp.google.com> <1335875321.26671.15.camel@localhost> <20120503064722.GN6871@ZenIV.linux.org.uk> <4FA2CAD9.6010808@zytor.com> <4FA2CE5C.8000100@zytor.com> From: Linus Torvalds Date: Thu, 3 May 2012 12:06:56 -0700 X-Google-Sender-Auth: SzmKcH71yQxN4wC1fjnDwR41xBE Message-ID: Subject: Re: Oops with DCACHE_WORD_ACCESS and ocfs2, autofs4 To: "H. Peter Anvin" Cc: Al Viro , Nick Piggin , Jana Saout , Joel Becker , linux-kernel@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2036 Lines: 56 On Thu, May 3, 2012 at 11:28 AM, H. Peter Anvin wrote: > + ? ? ? ? ? ? ? "lea" __WORDSUFFIX " %2,%1\n\t" > + ? ? ? ? ? ? ? "and" __WORDSUFFIX " %4,%1\n\t" > + ? ? ? ? ? ? ? "shl" __WORDSUFFIX " $3,%1\n\t" > + ? ? ? ? ? ? ? "shr" __WORDSUFFIX " %b1,%0\n\t" > > Also, for this sequence of instructions using %ecx unconditionally is > actually better (avoids REX prefixes on 64 bits.) Ok, agreed, except for the last shr, which does need to be done in the full word width. But yes, we could do the calculations of "how many bits do we need to shift" in just 32 bits. And yes, it does look like we can just rely on the register names, so we can avoid all the WORDSUFFIX games, and make it be static inline unsigned long load_unaligned_zeropad(const void *addr) { unsigned long ret, dummy; asm( "1:\tmov %2,%0\n" "2:\n" ".section .fixup,\"ax\"\n" "3:\t" "lea %2,%1\n\t" "and %3,%1\n\t" "mov (%1),%0\n\t" "leal %2,%%ecx\n\t" "andl %4,%%ecx\n\t" "shll $3,%%ecx\n\t" "shr %%cl,%0\n\t" "jmp 2b\n" ".previous\n" _ASM_EXTABLE(1b, 3b) :"=&r" (ret),"=&c" (dummy) :"m" (*(unsigned long *)addr), "i" (-sizeof(unsigned long)), "i" (sizeof(unsigned long)-1)); return ret; } instead. And I'm running that with DEBUG_PAGEALLOC, and haven't seen anything odd yet. Not that it's easy to trigger the page crosser, but I've tried to do things like look up 4095-byte pathnames with the final components being just one character each, so I've *tried*. Linus -- 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/