The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Michal Schmidt <mschmidt@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Andreas Herrmann <andreas.herrmann3@amd.com>,
	Shaohua Li <shaohua.li@intel.com>, Ingo Molnar <mingo@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH 1/2] x86: fix keeping track of AMD C1E
Date: Tue, 13 Jul 2010 20:59:58 +0200	[thread overview]
Message-ID: <20100713185957.2866.50995.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100713185816.2866.17837.stgit@localhost.localdomain>

On my system with AMD Phenom II X6 I am seeing pauses at boot (usually during
udev startup) which require a key press to continue. It only happens if C1E is
enabled in the BIOS.

It's caused by the APIC timer's inability to wake up the CPU from C1E (AMD
erratum #400). Linux has a workaround for it, but it's not being applied
correctly in this case. Though c1e_idle() detects C1E just fine, by the time
acpi_idle ('processor.ko' module) takes over, it is forgotten.

After AMD C1E is detected, it is not sufficient to flag it in boot_cpu_data,
because the flag will get cleared in identify_cpu() when more CPUs are brought
up later. The fix is to mark the flag as forced.

The additional call to set_cpu_cap() is just to make sure the flag is set even
on the CPUs that are already up and /proc/cpuinfo shows 'amdc1e' on all.

Also fix indentation in the function.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
---

 arch/x86/kernel/process.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index e7e3521..f3520a8 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -589,7 +589,7 @@ static void c1e_idle(void)
 			if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
 				mark_tsc_unstable("TSC halt in AMD C1E");
 			printk(KERN_INFO "System has AMD C1E enabled\n");
-			set_cpu_cap(&boot_cpu_data, X86_FEATURE_AMDC1E);
+			setup_force_cpu_cap(X86_FEATURE_AMDC1E);
 		}
 	}
 
@@ -605,6 +605,7 @@ static void c1e_idle(void)
 					   &cpu);
 			printk(KERN_INFO "Switch to broadcast mode on CPU%d\n",
 			       cpu);
+			set_cpu_cap(&current_cpu_data, X86_FEATURE_AMDC1E);
 		}
 		clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
 
@@ -614,9 +615,9 @@ static void c1e_idle(void)
 		 * The switch back from broadcast mode needs to be
 		 * called with interrupts disabled.
 		 */
-		 local_irq_disable();
-		 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
-		 local_irq_enable();
+		local_irq_disable();
+		clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
+		local_irq_enable();
 	} else
 		default_idle();
 }


  reply	other threads:[~2010-07-13 19:11 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-13 18:59 [PATCH 0/2] x86: AMD C1E fix and cleanup Michal Schmidt
2010-07-13 18:59 ` Michal Schmidt [this message]
2010-07-13 20:05   ` [PATCH 1/2] x86: fix keeping track of AMD C1E H. Peter Anvin
2010-07-13 20:32     ` Borislav Petkov
2010-07-14 16:07   ` Borislav Petkov
2010-07-14 21:22     ` Michal Schmidt
2010-07-14 21:31       ` Michal Schmidt
2010-07-15 16:57         ` Borislav Petkov
2010-07-16  4:25         ` H. Peter Anvin
2010-07-16  6:39           ` Borislav Petkov
2010-07-15 21:56             ` H. Peter Anvin
2010-07-16  7:22               ` Borislav Petkov
2010-07-16 16:02                 ` H. Peter Anvin
2010-07-16 16:25                   ` Borislav Petkov
2010-07-16 22:28                     ` H. Peter Anvin
2010-07-17 10:21                       ` Borislav Petkov
2010-07-22 15:02                         ` Borislav Petkov
2010-07-18 16:22         ` Heinz Diehl
2010-07-18 18:17           ` Borislav Petkov
2010-07-19 19:34           ` Borislav Petkov
2010-07-20 15:14             ` Heinz Diehl
2010-09-08 20:29               ` Andreas Herrmann
2010-09-10  6:04                 ` Heinz Diehl
2010-07-18 16:39   ` Heinz Diehl
2010-07-13 19:00 ` [PATCH 2/2] x86: remove c1e_mask Michal Schmidt
     [not found] <909896077.345011279054483129.JavaMail.root@zmail02.collab.prod.int.phx2.redhat.com>
2010-07-13 21:01 ` [PATCH 1/2] x86: fix keeping track of AMD C1E Michal Schmidt
2010-07-14  1:36   ` john stultz
2010-07-18 14:48   ` Heinz Diehl
2010-07-18 16:24   ` Heinz Diehl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100713185957.2866.50995.stgit@localhost.localdomain \
    --to=mschmidt@redhat.com \
    --cc=andreas.herrmann3@amd.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=shaohua.li@intel.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox