Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933288Ab0KORk6 (ORCPT ); Mon, 15 Nov 2010 12:40:58 -0500 Received: from smtp-vbr1.xs4all.nl ([194.109.24.21]:1571 "EHLO smtp-vbr1.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933261Ab0KORk4 (ORCPT ); Mon, 15 Nov 2010 12:40:56 -0500 Message-ID: <4CE17098.8090000@xs4all.nl> Date: Mon, 15 Nov 2010 18:40:40 +0100 From: Jim Bos User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.11) Gecko/20101020 Thunderbird/3.1.5 MIME-Version: 1.0 To: Linus Torvalds CC: Jakub Jelinek , Andi Kleen , James Cloos , Linux Kernel Mailing List , Andreas Schwab , Michael Matz , Dave Korn , Richard Guenther , gcc@gcc.gnu.org Subject: Re: gcc 4.5.1 / as 2.20.51.0.11 miscompiling drivers/char/i8k.c ? References: <4CD843DC.10106@gmail.com> <20101109134816.GB29433@basil.fritz.box> <4CD97A3D.1040602@xs4all.nl> <20101115085605.GE2583@sunsite.ms.mff.cuni.cz> <20101115100331.GG2583@sunsite.ms.mff.cuni.cz> <20101115105446.GD7269@basil.fritz.box> <20101115111642.GU29412@tyan-ft48-01.lab.bos.redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1818 Lines: 44 On 11/15/2010 05:04 PM, Linus Torvalds wrote: > On Mon, Nov 15, 2010 at 3:16 AM, Jakub Jelinek wrote: >> >> I don't see any problems on the assembly level. i8k_smm is >> not inlined in this case and checks all 3 conditions. > > If it really is related to gcc not understanding that "*regs" has > changed due to the memory being an automatic variable, and passing in > "regs" itself as a pointer to that automatic variable together with > the "memory" clobber not being sufficient, than I think it's the lack > of inlining that will automatically hide the bug. > > (Side note: and I think this does show how much of a gcc bug it is not > to consider "memory" together with passing in a pointer to an asm to > always be a clobber). > > Because if it isn't inlined, then "regs" will be seen a a real pointer > to some external memory (the caller) rather than being optimized to > just be the auto structure on the stack. Because *mem is auto only > within the context of the caller. > > Which actually points to a possible simpler: > - remove the "+m" since it adds too much register pressure > - mark the i8k_smm() as "noinline" instead. > > Quite frankly, I'd hate to add even more crud to that inline asm (to > save/restore the registers manually). It's already not the prettiest > thing around. > > So does the attached patch work for everybody? > > Linus Hmm, that doesn't work. [ Not sure if you read to whole thread but initial workaround was to change the asm(..) to asm volatile(..) which did work. ] Jim. -- 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/