public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: "David E. Box" <david.e.box@linux.intel.com>,
	hdegoede@redhat.com,  ilpo.jarvinen@linux.intel.com,
	rjw@rjwysocki.net,  platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org,  linux-pm@vger.kernel.org
Cc: ricardo.neri-calderon@linux.intel.com
Subject: Re: [PATCH V2 2/2] platform/x86/intel/pmc: Disable C1 auto-demotion during suspend
Date: Sat, 12 Oct 2024 17:40:11 -0700	[thread overview]
Message-ID: <ab13c87c800fe03d5045ae3fb7442a7f050be9ba.camel@linux.intel.com> (raw)
In-Reply-To: <20241011003640.1613812-2-david.e.box@linux.intel.com>

+Ricardo

On Thu, 2024-10-10 at 17:36 -0700, David E. Box wrote:
> On some platforms, aggressive C1 auto-demotion may lead to failure to
> enter
> the deepest C-state during suspend-to-idle, causing high power
> consumption.
> To prevent this, disable C1 auto-demotion during suspend and re-
> enable on
> resume.
> 
> Signed-off-by: David E. Box <david.e.box@linux.intel.com>
> ---
> 

[...]


>  void cnl_suspend(struct pmc_dev *pmcdev)
>  {
> +	if (!pm_suspend_via_firmware()) {
> +		preempt_disable();
> +		disable_c1_auto_demote(NULL);
> +		smp_call_function(disable_c1_auto_demote, NULL, 0);
> +		preempt_enable();
> +	}
> 
As suggested by Ricardo using the following will work avoiding separate
local CPU call. Preemption will be disabled, no need separate call.
Also cpu_online_mask can't be changed during these callbacks.

if (!pm_suspend_via_firmware())
	on_each_cpu(disable_c1_auto_demote, NULL, true);

I think you need wait=true. I have seen on some occasions you will miss
msr write as we called mwait before before async calls finished. 


Thanks,
Srinivas

> +
>  	/*
>  	 * Due to a hardware limitation, the GBE LTR blocks PC10
>  	 * when a cable is attached. To unblock PC10 during suspend,
> @@ -218,6 +264,13 @@ void cnl_suspend(struct pmc_dev *pmcdev)
>  
>  int cnl_resume(struct pmc_dev *pmcdev)
>  {
> +	if (!pm_suspend_via_firmware()) {
> +		preempt_disable();
> +		restore_c1_auto_demote(NULL);
> +		smp_call_function(restore_c1_auto_demote, NULL, 0);
> +		preempt_enable();
> +	}
> +
>  	pmc_core_send_ltr_ignore(pmcdev, 3, 0);
>  
>  	return pmc_core_resume_common(pmcdev);


      parent reply	other threads:[~2024-10-13  0:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11  0:36 [PATCH V2 1/2] platform/x86/intel/pmc: Refactor platform resume functions to use cnl_resume() David E. Box
2024-10-11  0:36 ` [PATCH V2 2/2] platform/x86/intel/pmc: Disable C1 auto-demotion during suspend David E. Box
2024-10-11  2:09   ` srinivas pandruvada
2024-10-11  3:50     ` David E. Box
2024-10-11 16:36       ` srinivas pandruvada
2024-10-11 11:05   ` Rafael J. Wysocki
2024-10-13  0:40   ` srinivas pandruvada [this message]

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=ab13c87c800fe03d5045ae3fb7442a7f050be9ba.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=david.e.box@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=ricardo.neri-calderon@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    /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