From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754132AbZFGTXx (ORCPT ); Sun, 7 Jun 2009 15:23:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752897AbZFGTXq (ORCPT ); Sun, 7 Jun 2009 15:23:46 -0400 Received: from yw-out-2324.google.com ([74.125.46.31]:30581 "EHLO yw-out-2324.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751476AbZFGTXp convert rfc822-to-8bit (ORCPT ); Sun, 7 Jun 2009 15:23:45 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=DkopL+m/tElrWBzKhHe5LrBH2lJ4NkwlBZdZjsOqpj4mymGQTGU1HcB1KBbeqT+VKe UhOtu6nmsqtuGQ8ceJmvz7PuM0tNhYq/3Q9aRqukMXr1ryWeSRZ4z1imMzQ+yvRJUCGp 8ehdvRKU6XZOEwDDI8t31djtjaiPYuoHmpGHw= MIME-Version: 1.0 In-Reply-To: References: <20090607124840.GD4547@lenovo> Date: Sun, 7 Jun 2009 12:23:47 -0700 Message-ID: <86802c440906071223w3116f452n7ccd028d52f11c77@mail.gmail.com> Subject: Re: [tip:irq/numa] x86, apic: Fix dummy apic read operation together with broken MP handling From: Yinghai Lu To: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org, gorcunov@openvz.org, yinghai@kernel.org, tglx@linutronix.de, mingo@elte.hu Cc: linux-tip-commits@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 On Sun, Jun 7, 2009 at 7:24 AM, tip-bot for Cyrill Gorcunov wrote: > Commit-ID:  103428e57be323c3c5545db8ad12667099bc6005 > Gitweb:     http://git.kernel.org/tip/103428e57be323c3c5545db8ad12667099bc6005 > Author:     Cyrill Gorcunov > AuthorDate: Sun, 7 Jun 2009 16:48:40 +0400 > Committer:  Ingo Molnar > CommitDate: Sun, 7 Jun 2009 16:08:05 +0200 > > x86, apic: Fix dummy apic read operation together with broken MP handling > > Ingo Molnar reported that read_apic is buggy novadays: > > [    0.000000] Using APIC driver default > [    0.000000] SMP: Allowing 1 CPUs, 0 hotplug CPUs > [    0.000000] Local APIC disabled by BIOS -- you can enable it with "lapic" > [    0.000000] APIC: disable apic facility > [    0.000000] ------------[ cut here ]------------ > [    0.000000] WARNING: at arch/x86/kernel/apic/apic.c:254 native_apic_read_dummy+0x2d/0x3b() > [    0.000000] Hardware name: HP OmniBook PC > > Indeed we still rely on apic->read operation for SMP compiled > kernel. And instead of disfigure the SMP code with #ifdef we > allow to call apic->read. To capture any unexpected results > we check for apic->read being called for sane reason via > WARN_ON_ONCE but(!) instead of OR we should use AND logical > operation (thanks Yinghai for spotting the root of the problem). > > Along with that we could be have bad MP table and we are > to fix it that way no SMP started and no complains about > BIOS bug if apic was just disabled via command line. > > Signed-off-by: Cyrill Gorcunov > Cc: Yinghai Lu > LKML-Reference: <20090607124840.GD4547@lenovo> > Signed-off-by: Ingo Molnar > > > --- >  arch/x86/kernel/apic/apic.c |    9 ++++++++- >  arch/x86/kernel/smpboot.c   |    8 +++++--- >  2 files changed, 13 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c > index e82488d..a4c9cf0 100644 > --- a/arch/x86/kernel/apic/apic.c > +++ b/arch/x86/kernel/apic/apic.c > @@ -249,7 +249,7 @@ static void native_apic_write_dummy(u32 reg, u32 v) > >  static u32 native_apic_read_dummy(u32 reg) >  { > -       WARN_ON_ONCE((cpu_has_apic || !disable_apic)); > +       WARN_ON_ONCE((cpu_has_apic && !disable_apic)); >        return 0; >  } > > @@ -1609,6 +1609,13 @@ void __init init_apic_mappings(void) >        new_apicid = read_apic_id(); >        if (boot_cpu_physical_apicid != new_apicid) { >                boot_cpu_physical_apicid = new_apicid; > +               /* > +                * yeah -- we lie about apic_version > +                * in case if apic was disabled via boot option > +                * but it's not a problem for SMP compiled kernel > +                * since smp_sanity_check is prepared for such a case > +                * and disable smp mode > +                */ >                apic_version[new_apicid] = >                         GET_APIC_VERSION(apic_read(APIC_LVR)); >        } > diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c > index d2e8de9..7c80007 100644 > --- a/arch/x86/kernel/smpboot.c > +++ b/arch/x86/kernel/smpboot.c > @@ -992,10 +992,12 @@ static int __init smp_sanity_check(unsigned max_cpus) >         */ >        if (APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid]) && >            !cpu_has_apic) { > -               printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n", > -                       boot_cpu_physical_apicid); > -               printk(KERN_ERR "... forcing use of dummy APIC emulation." > +               if (!disable_apic) { > +                       pr_err("BIOS bug, local APIC #%d not detected!...\n", > +                               boot_cpu_physical_apicid); > +                       pr_err("... forcing use of dummy APIC emulation." >                                "(tell your hw vendor)\n"); > +               } It seems we don't need this check here. when we have disable_apic, cpu_has_apic is cleared forcely. YH