linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: preeti <preeti@linux.vnet.ibm.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	Linux PM mailing list <linux-pm@vger.kernel.org>,
	linux-acpi@vger.kernel.org,
	Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
Subject: Re: Cpuidle drivers,Suspend : Fix suspend/resume hang with intel_idle driver
Date: Mon, 02 Jul 2012 11:03:14 +0530	[thread overview]
Message-ID: <4FF1329A.7000502@linux.vnet.ibm.com> (raw)
In-Reply-To: <4FF1336D.10808@linux.vnet.ibm.com>

On 07/02/2012 11:06 AM, preeti wrote:
> On 06/30/2012 03:37 AM, Rafael J. Wysocki wrote:
>> On Friday, June 29, 2012, preeti wrote:
>>> On 06/29/2012 12:41 AM, Rafael J. Wysocki wrote:
>>>> On Thursday, June 28, 2012, preeti wrote:
>>>>> On 06/28/2012 03:23 PM, Rafael J. Wysocki wrote:
>>>>>> On Thursday, June 28, 2012, preeti wrote:
>>>>>>>
>>>>>>> From: Preeti U Murthy <preeti@linux.vnet.ibm.com>
>>>> [...]
>>>>> cpuidle is an architecture independent part of the kernel  code.Since 
>>>>> this patch aims at x86 architecture in specific,I considered it
>>>>> inappropriate.
>>>>>
>>>>> In addition to this,suspend happens on x86 only if ACPI is configured.
>>>>
>>>> But that is not required for intel_idle, so if it hangs with intel_idle,
>>>> then it is not dependent on ACPI after all.
>>> True intel_idle does not need ACPI to be configured,but that also means
>>> that the kernel will not provide you the means to suspend.
>>
>> Yes, it will.  You can hibernate without ACPI in theory.
> 
> True.You can suspend to disk without ACPI,but can suspend to RAM only
> with ACPI.
> This also highlights the fact that my patch has not taken care of
> hibernate notifiers,which I should have done.This goes to say that the
> callbacks during suspend better not be in ACPI specific code.I will look
> into correcting the placement of the callbacks.
> 
>>
>>> There is no question of resume hang here at all as you cannot suspend in
>>> the first place.
>>>
>>> The issue is when ACPI is configured,and intel_idle is chosen to be the
>>> cpuidle driver.In this situation when the user suspends,cpus can enter
>>> deep sleep states as intel_idle driver does not prevent then from doing so.
>>> This is when resume hangs.
>>
>> I know that.
>>
>>>>> Therefore it seemed right to put the callback in ACPI specific code
>>>>> which deals with ACPI sleep support.
>>>>
>>>> I wonder if we can address this issue correctly.  That is, in a non-racy
>>>> way and in a better place.
>>>>
>>>> First, I really don't think it is necessary to "suspend" cpuidle (be it
>>>> ACPI or any other) when device drivers' suspend routines are being
>>>> executed (which also is racy, because the cpuidle "suspend" may be running
>>>> concurrently with cpuidle on another CPU) or earlier.  We really may want
>>>> to disable the deeper C-states when we're about to execute
>>>> suspend_ops->prepare_late(), or hibernation_ops->prepare(), i.e. after
>>>> we've run dpm_suspend_end() successfully.
>>>
>>> The commit "ACPI:disable lower idle C-states across suspend/resume"
>>> states that device_suspend() calls ACPI suspend functions which cause
>>> side effects on the lower idle C-states.
>>
>> I'd like to know the details, then.  Which ACPI suspend functions those are,
>> in particular, because I'm not aware of any in device_suspend().
>>
>> Also, please note that this commit is 5 years old and some things have changed
>> in the suspend code paths since that time.
> 
> I agree.My view on this,as I have mentioned in one of my previous mails
> is, in the patch with the acpi_idle_suspend workaround,we have not taken
> precautions to check if there are cpus that have already entered deep
> C-states before the suspend routine has begun.
> 
> We take care of disabling entry into deep C-states only during suspend.
> so if deep C-states are posing problems during suspend,then why dont
> these cpus that have entered idle states before suspend cause a resume hang?
>

Because cpu hotplug kicks the cpu out of any idle state it was in, in order
to execute the CPU_DYING_FROZEN callbacks. (See my other mail about this).
 
>>
>>> This means we need to disable entry into deeper C-states even before
>>> dpm_suspend_start(),
>>
>> This most likely is wrong.
>>
>> We may need to "suspend" cpuidle before calling suspend_device_irqs(),
>> but then again that shouldn't be made via a notifier I think.  Why don't
>> we simply make suspend_device_irqs() disable lower C-states to start with?
>>
>>> but how much before?
>>>
>>> The commit answers this too.It says removing the functionality of
>>> entering deep C-states before suspend removed the side effects.Besides,
>>> the commit title says'across suspend/resume'.So I think to address the
>>> resume hang effectively,it is desirable to disable entry into deeper
>>> C-states during suspend_prepare operations.
>>>>
>>>> So, it seems, it might be a good idea to place a cpuidle driver suspend
>>>> (and/or hibernation) hook at the end of dpm_suspend_end() and make ACPI
>>>> and intel_idle drivers implement that hook.
>>>>
>>> Dont you think this patch is meant to fix a very ACPI specific problem?
>>
>> No, I don't.
>>
>>> Which is why I think the call backs or any hook meant to fix this should
>>> go into ACPI specific code.
>>> Else it will seem irrelevant to all other architectures that implement
>>> suspend.
>>
>> I don't honestly think it is irrelevant.  The fact is that similar problems
>> have not been reported on other architectures _yet_, which by no means can
>> be taken as a proof that those architectures are not affected.
>>
>> Anyway, I think that the right way to address this is through a cpuidle driver
>> callback executed from suspend_device_irqs() (and analogously for the resume
>> code path) and not through some hacky-ugly ACPI changes.
> 
> I agree with having a cpuidle driver callback as even hibernate
> callbacks need to be taken care of which have nothing to do with ACPI.
> 
> But on what basis is the placement of the call back suggested at
> suspend_device_irqs()? What is the assurance that this placement  will
> not cause a resume hang considering we dont know what precisely is
> causing this problem?
> 

Any place before CPU hotplug should do, I think.

Regards,
Srivatsa S. Bhat


  reply	other threads:[~2012-07-02  5:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-28  9:16 Cpuidle drivers,Suspend : Fix suspend/resume hang with intel_idle driver preeti
2012-06-28  9:53 ` Rafael J. Wysocki
2012-06-28 16:21   ` preeti
2012-06-28 19:11     ` Cpuidle drivers, Suspend " Rafael J. Wysocki
2012-06-29  4:11       ` Cpuidle drivers,Suspend " preeti
2012-06-29  5:26         ` preeti
2012-06-29  8:53           ` [PATCH] " preeti
2012-06-29 22:13             ` [PATCH] Cpuidle drivers, Suspend " Rafael J. Wysocki
2012-06-29 22:11           ` Cpuidle drivers,Suspend " Rafael J. Wysocki
2012-07-02  4:37             ` preeti
2012-07-02  5:04               ` Cpuidle drivers, Suspend " Srivatsa S. Bhat
2012-07-02  5:27                 ` Cpuidle drivers,Suspend " preeti
2012-07-02  5:28                   ` Srivatsa S. Bhat
2012-06-29 22:07         ` Rafael J. Wysocki
2012-06-30 13:11           ` Rafael J. Wysocki
2012-07-02 10:21             ` preeti
2012-07-02  5:36           ` preeti
2012-07-02  5:33             ` Srivatsa S. Bhat [this message]
2012-07-02 19:43               ` Rafael J. Wysocki
2012-07-06  3:11                 ` [PATCH V2] Suspend,cpuidle:resume_hang fix with cpuidle preeti
2012-07-06  3:07                   ` Dave Hansen
2012-07-06  7:36                     ` preeti
2012-07-06  7:42                     ` preeti
2012-07-06 17:20                       ` Srivatsa S. Bhat
2012-07-06 17:23                       ` Rafael J. Wysocki
2012-07-06 17:21                         ` Dave Hansen
2012-07-06 17:30                           ` Rafael J. Wysocki

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=4FF1329A.7000502@linux.vnet.ibm.com \
    --to=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=dave@linux.vnet.ibm.com \
    --cc=deepthi@linux.vnet.ibm.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=preeti@linux.vnet.ibm.com \
    --cc=rjw@sisk.pl \
    /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;
as well as URLs for NNTP newsgroup(s).