public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes-kernel@saeurebad.de>
To: Eduard-Gabriel Munteanu <eduard.munteanu@linux360.ro>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Option to disable AMD C1E (allows dynticks to work)
Date: Thu, 13 Dec 2007 23:58:50 +0100	[thread overview]
Message-ID: <x77ijiryl1.fsf@saeurebad.de> (raw)
In-Reply-To: <20071214004710.03f37774@linux360.ro> (Eduard-Gabriel Munteanu's message of "Fri, 14 Dec 2007 00:47:10 +0200")

Hi,

Eduard-Gabriel Munteanu <eduard.munteanu@linux360.ro> writes:

> diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
> index 30d94d1..15556a0 100644
> --- a/arch/x86/kernel/setup_64.c
> +++ b/arch/x86/kernel/setup_64.c
> @@ -583,6 +583,17 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
>  #endif
>  }
>  
> +#ifdef CONFIG_X86_AMD_C1E_WORKAROUND
> +static int __cpuinit disable_amd_c1e = 1;
> +
> +static int __cpuinit force_amd_c1e(char *str) {
> +	disable_amd_c1e = 0;
> +	return 1;
> +}
> +
> +__setup("force_amd_c1e", force_amd_c1e);
> +#endif /* CONFIG_X86_AMD_C1E_WORKAROUND */
> +
>  #define ENABLE_C1E_MASK		0x18000000
>  #define CPUID_PROCESSOR_SIGNATURE	1
>  #define CPUID_XFAM		0x0ff00000
> @@ -597,6 +608,7 @@ static __cpuinit int amd_apic_timer_broken(void)
>  {
>  	u32 lo, hi;
>  	u32 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
> +
>  	switch (eax & CPUID_XFAM) {
>  	case CPUID_XFAM_K8:
>  		if ((eax & CPUID_XMOD) < CPUID_XMOD_REV_F)
> @@ -604,8 +616,19 @@ static __cpuinit int amd_apic_timer_broken(void)
>  	case CPUID_XFAM_10H:
>  	case CPUID_XFAM_11H:
>  		rdmsr(MSR_K8_ENABLE_C1E, lo, hi);
> -		if (lo & ENABLE_C1E_MASK)
> -			return 1;
> +#ifdef CONFIG_X86_AMD_C1E_WORKAROUND
> +		if ((lo & ENABLE_C1E_MASK) && disable_amd_c1e) {
> +			printk(KERN_INFO "Disabling AMD C1E on CPU %d\n",
> +			       smp_processor_id());
> +			/* 
> +			 * See AMD's "BIOS and Kernel Developer's Guide for AMD
> +			 * NPT Family 0Fh Processors", publication #32559,
> +			 * for details.
> +			 */
> +			wrmsr(MSR_K8_ENABLE_C1E, lo & ~ENABLE_C1E_MASK, hi); 
> +		} else 
> +#endif /* CONFIG_X86_AMD_C1E_WORKAROUND */
> +		if (lo & ENABLE_C1E_MASK) return 1;

I would find this way more readable:

	if (lo & ENABLE_C1E_MASK) {
#ifdef CONFIG_X86_AMD_C1E_WORKAROUND
		if (disable_amd_c1e) {
			...
#else
		return 1;
#endif
	}

Why does it require to be enabled by compile-time AND run-time?  Is that
something you might want to decide on every boot?  Could we make it
settable at boot-time xor at compile-time?

	Hannes

  reply	other threads:[~2007-12-13 22:59 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-13 22:47 [PATCH] Option to disable AMD C1E (allows dynticks to work) Eduard-Gabriel Munteanu
2007-12-13 22:58 ` Johannes Weiner [this message]
2007-12-14 12:48   ` Eduard-Gabriel Munteanu
2007-12-18 15:43 ` Pavel Machek
2007-12-18 17:11   ` Eduard-Gabriel Munteanu
  -- strict thread matches above, loose matches on Subject: below --
2007-12-29 14:43 David P. Reed
2007-12-29 22:28 ` Islam Amer
2007-12-30  0:35   ` Islam Amer
2007-12-30 12:57     ` Ingo Molnar
2007-12-30  1:38   ` Rene Herman
2007-12-30  1:49     ` Islam Amer
2007-12-30  3:24       ` Rene Herman
2007-12-30 10:17       ` Eduard-Gabriel Munteanu
2007-12-30 14:42         ` Andi Kleen
2007-12-30 21:12           ` Eduard-Gabriel Munteanu
2007-12-31  2:34             ` Andi Kleen
2007-12-30 20:57         ` Richard Harman
2007-12-30 21:18           ` Eduard-Gabriel Munteanu
2007-12-30 13:36             ` Richard Harman
2007-12-30 23:32               ` Eduard-Gabriel Munteanu
2007-12-31  0:30               ` David P. Reed
     [not found] <47754735.1050009@richardharman.com>
2007-12-29  7:52 ` Eduard-Gabriel Munteanu
2007-12-29  9:09   ` Richard Harman
2007-12-29 11:19     ` Eduard-Gabriel Munteanu
2007-12-29 11:46     ` Islam Amer
2007-12-30 20:45     ` Rene Herman
2007-12-14  0:14 Mikhail Kshevetskiy
2007-12-13 22:44 Eduard-Gabriel Munteanu
2007-12-13 22:33 ` Andi Kleen
2007-12-14 12:39   ` Eduard-Gabriel Munteanu
2007-12-14 10:17     ` Andi Kleen
2007-12-14 13:41       ` Eduard-Gabriel Munteanu
2007-12-14 12:20         ` Andi Kleen
2007-12-14 16:01           ` Eduard-Gabriel Munteanu
2007-12-14 18:07             ` Thomas Gleixner
2007-12-14 18:12               ` Andi Kleen
2007-12-14 19:57                 ` Thomas Gleixner
2007-12-14 20:06                   ` Andi Kleen
2007-12-14 19:58                 ` Eduard-Gabriel Munteanu
2007-12-14 18:10             ` Andi Kleen
2007-12-14 19:53               ` Thomas Gleixner
2007-12-14 22:35       ` Chuck Ebbert
2007-12-15  0:10         ` Eduard-Gabriel Munteanu
2007-12-15 12:41         ` Andi Kleen

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=x77ijiryl1.fsf@saeurebad.de \
    --to=hannes-kernel@saeurebad.de \
    --cc=eduard.munteanu@linux360.ro \
    --cc=linux-kernel@vger.kernel.org \
    --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