From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934926AbXGUILk (ORCPT ); Sat, 21 Jul 2007 04:11:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760259AbXGUILY (ORCPT ); Sat, 21 Jul 2007 04:11:24 -0400 Received: from wa-out-1112.google.com ([209.85.146.180]:37198 "EHLO wa-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753079AbXGUILU (ORCPT ); Sat, 21 Jul 2007 04:11:20 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=bCwp2b2JXXXFUTCyoirEOLQw5/QcjR42D7T8QBW+TB9LXcFAAcNnrsyQm9WCaP+/KHu/ThwPkKBjkHNg2AanOsHulPPRVXXAVWU4ysYKOkK8aYiGpkU37prgQB2EiLb3ZqGEOovmi44le1Fxbtzriilem5uCHVlyZiRhZh1/swM= Message-ID: <6bffcb0e0707210111n41c1a193k7ce92aeee8e3047d@mail.gmail.com> Date: Sat, 21 Jul 2007 10:11:19 +0200 From: "Michal Piotrowski" To: "Satyam Sharma" Subject: Re: [broken-out-2007-07-20-00-22] kernel bug at kernel/params:570 Cc: "Greg KH" , "Andrew Morton" , rdunlap@xenotime.net, LKML In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <6bffcb0e0707200932p2b905e21g7970172ca7eb4da7@mail.gmail.com> <6bffcb0e0707201728u6deeccd1j453ff89d0767dccc@mail.gmail.com> <20070721010257.GA9561@suse.de> <20070720183733.c53b511b.akpm@linux-foundation.org> <20070721014419.GA10761@suse.de> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On 21/07/07, Satyam Sharma wrote: > Ok, this worked: > > > His .config has CONFIG_PROFILE_LIKELY=y > > which replaces unlikely() / likely() with do_check_likely() and forces > > gcc to clobber %eax with the condition itself, which in our case was > > (ret < 0) == TRUE, and thus, the "1" value we saw in %eax in the > > register dumps. > > The usage of unlikely() in BUG_ON and CONFIG_PROFILE_LIKELY=y > meant %eax that held `ret' from kobject_add() was being lost. > > With that turned off: > > 0xc136071b call 0xc1103744 > [ ret i.e. %eax = kobject_add() ] > 0xc1360720 test %eax,%eax > [ %eax = %eax && %eax = %eax ] > [ probably gcc thinks this is an efficient < 0 check on i386 :-) ] > 0xc1360722 jns 0xc1360728 > [ if false jump down below, else: ] > 0xc1360724 ud2a > [ invalid opcode exception. /* from BUG */ ] > 0xc1360726 jmp 0xc1360726 > [ for (;;) ; /* from BUG */ ] > > > We should probably document somewhere that CONFIG_PROFILE_LIKELY > > is not good for debugging. > > > > Hmmm ... thinking out aloud here, but probably I don't need to fix that > > libata breakage at all. I'll just put the BUG_ON(ret < 0) back in the > > code, deselect PROFILE_LIKELY, and this time we _will_ have the > > return of kobject_add() in %eax ... > > So %eax retained its value. I reproduced Michal's oops (without having > to select CONFIG_ATA, because param_sysfs_init() is called way > earlier than searching for root block device during boot -- which is what > my system didn't like without ATA), and yes, I saw: > > %eax == ffffffea == -22 == -EINVAL. > > But: > > When I replace the BUG_ON() with Greg's (or my modified) patch, > the kernel ignores that error as we wanted, but _still_ crashes before > finding the root block device (because ATA is not in kernel and my > system seems to require it). Unfortunately, lots of dmesg output > has scrolled up by then, and our "printk" is lost. Because of no > CONFIG_ATA, nothing gets written to disk either. I don't have a > serial cable around, netconsole not up yet at that point. Neither serial nor net console doesn't work, system hangs very early. > > Ugh, I'm running out of ideas. > > Satyam > Regards, Michal -- LOG http://www.stardust.webpages.pl/log/