LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Alexander Koskovich <zvnexus@gmail.com>,
	arjan@linux.intel.com, jacob.jun.pan@linux.intel.com
Cc: zvnexus@gmail.com, Alexander Koskovich <zvnexus@outlook.com>,
	Zhang Rui <rui.zhang@intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Amit Kucheria <amit.kucheria@verdurent.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
	Petr Mladek <pmladek@suse.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] thermal/intel_powerclamp: Don't report an error for AMD CPUs
Date: Sat, 15 Feb 2020 12:58:19 +0100
Message-ID: <87wo8orrj8.fsf@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20200215160938.1025-1-zvnexus@outlook.com>

Alexander Koskovich <zvnexus@gmail.com> writes:

> Resolves dmesg error "intel_powerclamp: CPU does not support MWAIT".
>
> The error that is outputted in dmesg prior to this patch
> is innacurate, AMD Ryzen CPUs do support MWAIT. We could
> also add the AMD vendor to the MWAIT check, but even though
> AMD CPUs do support MWAIT, they fail the C-state package
> check so it's better just to bail out in the beginning.
>
> Signed-off-by: Alexander Koskovich <zvnexus@outlook.com>
> ---
>  drivers/thermal/intel/intel_powerclamp.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
> index 53216dcbe173..3c5b25bfa596 100644
> --- a/drivers/thermal/intel/intel_powerclamp.c
> +++ b/drivers/thermal/intel/intel_powerclamp.c
> @@ -650,6 +650,11 @@ static struct thermal_cooling_device_ops powerclamp_cooling_ops = {
>  	.set_cur_state = powerclamp_set_cur_state,
>  };
>  
> +static const struct x86_cpu_id amd_cpu[] = {
> +	{ X86_VENDOR_AMD },
> +	{},
> +};
> +
>  static const struct x86_cpu_id __initconst intel_powerclamp_ids[] = {
>  	{ X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_MWAIT },
>  	{}
> @@ -659,6 +664,11 @@ MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids);
>  static int __init powerclamp_probe(void)
>  {
>  
> +	if (x86_match_cpu(amd_cpu)) {
> +		pr_info("Intel PowerClamp does not support AMD CPUs\n");
> +		return -ENODEV;

This is still running into the same problem on all other non Intel
vendors, e.g. HYGON, VIA ....

> +	}
> +
>  	if (!x86_match_cpu(intel_powerclamp_ids)) {
>  		pr_err("CPU does not support MWAIT\n");
>  		return -ENODEV;

The right thing to do is to remove this silly pr_err(). It's not an
error when a CPU does not support MWAIT. It's a fact and even older
Intel CPUs do not have MWAIT.

We do not print "Machine does not have $FEATURE" in device drivers and
whatever code which depends on runtime detection either. dmesg would be
full of this.

Thanks,

        tglx

  reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-15 16:09 Alexander Koskovich
2020-02-15 11:58 ` Thomas Gleixner [this message]
2020-02-17  7:59 ` Zhang Rui

Reply instructions:

You may reply publically 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=87wo8orrj8.fsf@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=amit.kucheria@verdurent.com \
    --cc=arjan@linux.intel.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=pmladek@suse.com \
    --cc=rui.zhang@intel.com \
    --cc=zvnexus@gmail.com \
    --cc=zvnexus@outlook.com \
    /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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git