From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 16:17:20 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ABFEA88B; Sat, 7 Mar 2015 16:17:20 +0000 (UTC) Received: from mail-ig0-x233.google.com (mail-ig0-x233.google.com [IPv6:2607:f8b0:4001:c05::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BED8309; Sat, 7 Mar 2015 16:17:20 +0000 (UTC) Received: by igal13 with SMTP id l13so11056838iga.5; Sat, 07 Mar 2015 08:17:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=9VcoxUtIix/O5xh/Sab0C/h80Fv6Xc0n5qlJdn4TDwM=; b=gl3ns/kaAHQwAJuTlxi+Z9RFyIlCjE6SH1AxT78sc3WIIC4NuktdYewQtCeV7EgCJD MLgnxwRkOEsm92amMKI6UCcmbbeQ3Hn31PF0qAhQCGNICbAd1UFLoiW+GBUf8PU5yZst OtfPHIaJ/kIg9hDVm22VbVRmtNuOFRAdTVsL0oI/aXlI1/DnaJBASkX+69sEDCy5dcdI pgj9Ygxj4ANNP34GgdkESI4zv7oYj4EuiG1LlHx39OguGhmdrFLF27MruoEhRpAKhdVL JPDJwV4AjYJDkColO+955FsJtBbvkz2ymeeUBh79s3WAzi5Y8jNdp4aQflXoHJbd1Kl/ 1XEg== MIME-Version: 1.0 X-Received: by 10.50.43.201 with SMTP id y9mr35200059igl.6.1425745039744; Sat, 07 Mar 2015 08:17:19 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.36.17.66 with HTTP; Sat, 7 Mar 2015 08:17:19 -0800 (PST) In-Reply-To: References: <201502282037.t1SKbdTI072217@svn.freebsd.org> Date: Sat, 7 Mar 2015 08:17:19 -0800 X-Google-Sender-Auth: qn1sUN-C0Yw5o8JZc0G8mS5rSS4 Message-ID: Subject: Re: svn commit: r279406 - in head/sys: amd64/amd64 i386/i386 From: Adrian Chadd To: Konstantin Belousov Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Mar 2015 16:17:20 -0000 Ugh, sorry to bring this up again, but I just updated to -HEAD and it started hanging again at the same spot. :( -adrian On 28 February 2015 at 14:08, Adrian Chadd wrote: > Thanks for promptly finding/fixing this! > > For the record, the CPU I have in this zenbook: > > CPU: Intel(R) Core(TM) i5-2467M CPU @ 1.60GHz (1596.41-MHz K8-class CPU) > > > > On 28 February 2015 at 12:37, Konstantin Belousov wrote: >> Author: kib >> Date: Sat Feb 28 20:37:38 2015 >> New Revision: 279406 >> URL: https://svnweb.freebsd.org/changeset/base/279406 >> >> Log: >> Supposed fix for some SandyBridge mobile CPUs hang on AP startup when >> x2APIC mode is detected and enabled. Current theory is that switching >> the APIC mode while an IPI is in flight might be the issue. >> >> Postpone switching to x2APIC mode until we are guaranteed that all >> starting IPIs are already send and aknowledged. Use aps_ready signal >> as an indication that the BSP is done with us. >> >> Tested by: adrian >> Sponsored by: The FreeBSD Foundation >> MFC after: 2 months >> >> Modified: >> head/sys/amd64/amd64/mp_machdep.c >> head/sys/i386/i386/mp_machdep.c >> >> Modified: head/sys/amd64/amd64/mp_machdep.c >> ============================================================================== >> --- head/sys/amd64/amd64/mp_machdep.c Sat Feb 28 20:30:29 2015 (r279405) >> +++ head/sys/amd64/amd64/mp_machdep.c Sat Feb 28 20:37:38 2015 (r279406) >> @@ -705,12 +705,6 @@ init_secondary(void) >> wrmsr(MSR_STAR, msr); >> wrmsr(MSR_SF_MASK, PSL_NT|PSL_T|PSL_I|PSL_C|PSL_D); >> >> - /* >> - * On real hardware, switch to x2apic mode if possible. >> - * Disable local APIC until BSP directed APs to run. >> - */ >> - lapic_xapic_mode(); >> - >> /* signal our startup to the BSP. */ >> mp_naps++; >> >> @@ -718,6 +712,14 @@ init_secondary(void) >> while (!aps_ready) >> ia32_pause(); >> >> + /* >> + * On real hardware, switch to x2apic mode if possible. Do it >> + * after aps_ready was signalled, to avoid manipulating the >> + * mode while BSP might still want to send some IPI to us >> + * (second startup IPI is ignored on modern hardware etc). >> + */ >> + lapic_xapic_mode(); >> + >> /* Initialize the PAT MSR. */ >> pmap_init_pat(); >> >> >> Modified: head/sys/i386/i386/mp_machdep.c >> ============================================================================== >> --- head/sys/i386/i386/mp_machdep.c Sat Feb 28 20:30:29 2015 (r279405) >> +++ head/sys/i386/i386/mp_machdep.c Sat Feb 28 20:37:38 2015 (r279406) >> @@ -719,12 +719,6 @@ init_secondary(void) >> load_cr0(cr0); >> CHECK_WRITE(0x38, 5); >> >> - /* >> - * On real hardware, switch to x2apic mode if possible. >> - * Disable local APIC until BSP directed APs to run. >> - */ >> - lapic_xapic_mode(); >> - >> /* signal our startup to the BSP. */ >> mp_naps++; >> CHECK_WRITE(0x39, 6); >> @@ -742,6 +736,14 @@ init_secondary(void) >> lidt(&r_idt); >> #endif >> >> + /* >> + * On real hardware, switch to x2apic mode if possible. Do it >> + * after aps_ready was signalled, to avoid manipulating the >> + * mode while BSP might still want to send some IPI to us >> + * (second startup IPI is ignored on modern hardware etc). >> + */ >> + lapic_xapic_mode(); >> + >> /* Initialize the PAT MSR if present. */ >> pmap_init_pat(); >> >>