mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Laura Abbott <labbott@fedoraproject.org>
Cc: Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Borislav Petkov <bp@alien8.de>,
	Andy Lutomirski <luto@amacapital.net>
Subject: Re: [PATCHv2] x86, CPU: Restore MSR_IA32_ENERGY_PERF_BIAS after resume
Date: Fri, 17 Jul 2015 22:39:25 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.11.1507172215450.18576@nanos> (raw)
In-Reply-To: <1437157964-19389-1-git-send-email-labbott@fedoraproject.org>

On Fri, 17 Jul 2015, Laura Abbott wrote:
> v2: Tweaked a few names to be more descriptive

Descriptive by some definition of descriptive. See below.

> +static void init_intel_energy_perf(struct cpuinfo_x86 *c)
> +{
> +	/*
> +	 * Initialize MSR_IA32_ENERGY_PERF_BIAS if BIOS did not.
> +	 * x86_energy_perf_policy(8) is available to change it at run-time
> +	 */
> +	if (cpu_has(c, X86_FEATURE_EPB)) {

Make this 

	if (!cpu_has(c, X86_FEATURE_EPB))
	   	return;

and spare the extra indentation level.

> +		u64 epb;
> +		rdmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
> +		if ((epb & 0xF) == ENERGY_PERF_BIAS_PERFORMANCE) {

Ditto

> +			pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");
> +			pr_warn_once("ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)\n");
> +			epb = (epb & ~0xF) | ENERGY_PERF_BIAS_NORMAL;
> +			wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
> +		}
> +	}
> +}
>  #ifdef CONFIG_X86_32
> @@ -747,6 +752,7 @@ static const struct cpu_dev intel_cpu_dev = {
>  	.c_detect_tlb	= intel_detect_tlb,
>  	.c_early_init   = early_init_intel,
>  	.c_init		= init_intel,
> +	.c_bsp_resume	= init_intel_energy_perf,

Looking at the resulting code I have no idea WHY
init_intel_energy_perf is set here. So much for descriptive.

This really wants to be bsp_resume() or something like this (add the
pointless intel prefix if it makes your managers happy). That _IS_
actually descriptive.

static void bsp_resume(struct cpuinfo_x86 *c)
{
	/*
	 * Some reasonable comment WHY we call this here.
	 */
	 init_intel_energy_perf(c);
}

Aside of documenting what that resume thing is for and why
init_intel_energy_perf() needs to be called, I'm quite sure that this
will fill up pretty fast with other stuff which gets lost across S/R.

Thanks,

	tglx

  reply	other threads:[~2015-07-17 20:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-17 18:32 Laura Abbott
2015-07-17 20:39 ` Thomas Gleixner [this message]
2015-07-18  5:16   ` Borislav Petkov

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=alpine.DEB.2.11.1507172215450.18576@nanos \
    --to=tglx@linutronix.de \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=labbott@fedoraproject.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®