All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ocean HY1 He <hehy1@lenovo.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"lenb@kernel.org" <lenb@kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	David Tanaka <dtanaka@lenovo.com>,
	Nagananda Chumbalkar <nchumbalkar@lenovo.com>,
	"Zheng, Lv" <lv.zheng@intel.com>,
	Sumeet Kochar <skochar@lenovo.com>
Subject: RE: [PATCH] ACPI: Execute the _PTS method when system reboot
Date: Fri, 24 Jun 2016 02:59:24 +0000	[thread overview]
Message-ID: <BCBE834BAC19744BA2C3AC4D68DBF2198D8ACDFB@CNMAILEX03.lenovo.com> (raw)
In-Reply-To: <CAJZ5v0iR6KU+Oy3iP5Ungw2cpqpmRBPw6fy26OL+cjFUnMJCUg@mail.gmail.com>



Regards,
Ocean He
SW Development Dept. 
Beijing Design Center
Enterprise Product Group
Mobile: 18911778926
E-mail: hehy1@lenovo.com
No.6 Chuang Ye Road, Haidian District, Beijing, China 100085


> -----Original Message-----
> From: rjwysocki@gmail.com [mailto:rjwysocki@gmail.com] On Behalf Of
> Rafael J. Wysocki
> Sent: Thursday, June 23, 2016 9:13 PM
> To: Ocean HY1 He
> Cc: Rafael J. Wysocki; lenb@kernel.org; linux-acpi@vger.kernel.org;
> linux-kernel@vger.kernel.org; David Tanaka; Nagananda Chumbalkar
> Subject: Re: [PATCH] ACPI: Execute the _PTS method when system reboot
> 
> On Thu, Jun 23, 2016 at 2:55 PM, Ocean HY1 He <hehy1@lenovo.com>
> wrote:
> > Hi Rafael,
> > Please see my reply in below.
> >
> > Regards,
> > Ocean He
> > SW Development Dept.
> > Beijing Design Center
> > Enterprise Product Group
> > Mobile: 18911778926
> > E-mail: hehy1@lenovo.com
> > No.6 Chuang Ye Road, Haidian District, Beijing, China 100085
> >
> >> -----Original Message-----
> >> From: Rafael J. Wysocki [mailto:rjw@rjwysocki.net]
> >> Sent: Wednesday, June 22, 2016 7:56 AM
> >> To: Ocean HY1 He
> >> Cc: lenb@kernel.org; linux-acpi@vger.kernel.org;
> >> linux-kernel@vger.kernel.org; David Tanaka; Nagananda Chumbalkar
> >> Subject: Re: [PATCH] ACPI: Execute the _PTS method when system
> reboot
> >>
> >> On Monday, May 09, 2016 05:50:11 AM Ocean HY1 He wrote:
> >> > The _PTS control method is defined in the section 7.4.1 of acpi 6.0
> >> > spec. The _PTS control method is executed by the OS during the sleep
> >> > transition process for S1, S2, S3, S4, and for orderly S5 shutdown.
> >> > The sleeping state value (For example, 1, 2, 3, 4 or 5 for the S5
> >> > soft-off state) is passed to the _PTS control method. This method
> >> > is called after OSPM has notified native device drivers of the sleep
> >> > state transition and before the OSPM has had a chance to fully
> >> > prepare the system for a sleep state transition.
> >> >
> >> > The _PTS control method provides the BIOS a mechanism for
> performing
> >> > some housekeeping, such as writing the sleep type value to the
> >> embedded
> >> > controller, before entering the system sleeping state.
> >> >
> >> > According to section 7.5 of acpi 6.0 spec, _PTS should run after _TTS.
> >> >
> >> > Thus, a _PTS block notifier is added to the reboot notifier list so that
> >> > the _PTS object will also be evaluated when the system reboot.
> >>
> >> So I understand why it may be necessary to evaluate _PTS before
> entering
> >> S5,
> >> but I'm totally unsure about reboot.
> >>
> >> What does reboot have to do with S5?
> >>
> > In ACPI spec, there is no explicit words saying _PTS should be
> > executed when reboot. But reboot could be equal to the
> > process S0->S5->S0.
> 
> Not in general.
> 
> In particular, wakeup devices that would be set up for S5 need not be
> set up for that.  Also the mechanism by which transitions to S5 are
> entered is different from the reboot one, at least from the OS
> perspective.
> 
> > Thus _PTS should be executed when reboot.
> 
> No, it doesn't follow.
> 
> > I am thinking this is the same as _TTS. In ACPI spec, there is also
> > no explicit words saying _TTS should be executed when reboot.
> > But kernel executes _TTS when reboot indeed.
> 
> Yes, it does.  Maybe it shouldn't?
> 
> It may not hurt to call _PTS before reboot too, but is it guaranteed
> to work across the board on all systems everywhere?
> 
I try to clarify the key point of this case: does devices should go to S5(shutdown) when reboot?

I think the answer is yes. 
And It has no hurt to let devices go to S5 before reboot is invoked, here is the reasons:
#1 The new _PTS codes block nothing thus reboot can be guaranteed to be invoked eventually.
#2. Devices are mandatory to support S5 state, this means go to S5 could be a safe trip.
#3 Reboot would cause devices re-initialization from the scratch.

What's your decision then? ;-)

Regards,
Ocean.

> >> > Signed-off-by: Ocean He <hehy1@lenovo.com>
> >> > Signed-off-by: Nagananda Chumbalkar <nchumbalkar@lenovo.com>
> >> > ---
> >> >  drivers/acpi/sleep.c | 27 +++++++++++++++++++++++++++
> >> >  1 file changed, 27 insertions(+)
> >> >
> >> > diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> >> > index 2a8b596..8b290fb 100644
> >> > --- a/drivers/acpi/sleep.c
> >> > +++ b/drivers/acpi/sleep.c
> >> > @@ -55,6 +55,26 @@ static struct notifier_block tts_notifier = {
> >> >     .priority       = 0,
> >> >  };
> >> >
> >> > +static int pts_notify_reboot(struct notifier_block *this,
> >> > +                   unsigned long code, void *x)
> >> > +{
> >> > +   acpi_status status;
> >> > +
> >> > +   status = acpi_execute_simple_method(NULL, "\\_PTS",
> >> ACPI_STATE_S5);
> >> > +   if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
> >> > +           /* It won't break anything. */
> >> > +           printk(KERN_NOTICE "Failure in evaluating _PTS
> object\n");
> >> > +   }
> >> > +
> >> > +   return NOTIFY_DONE;
> >> > +}
> >> > +
> >> > +static struct notifier_block pts_notifier = {
> >> > +   .notifier_call  = pts_notify_reboot,
> >> > +   .next           = NULL,
> >> > +   .priority       = 0,
> >> > +};
> >> > +
> >> >  static int acpi_sleep_prepare(u32 acpi_state)
> >> >  {
> >> >  #ifdef CONFIG_ACPI_SLEEP
> >> > @@ -896,5 +916,12 @@ int __init acpi_sleep_init(void)
> >> >      * object can also be evaluated when the system enters S5.
> >> >      */
> >> >     register_reboot_notifier(&tts_notifier);
> >> > +
> >> > +   /*
> >> > +    * According to section 7.5 of acpi 6.0 spec, _PTS should run
> after
> >> > +    * _TTS when the system enters S5.
> >> > +    */
> >> > +   register_reboot_notifier(&pts_notifier);
> >>
> >> Why do you have to add a second notifier?
> >>
> >> Why can't _TTS and _PTS be evaluated from one notifier?
> >>
> > If execute _PTS method in tts_notify_reboot(), then it would break
> > definition of tts_notify_reboot().
> 
> What exactly would it break?
> 
> > My intention is to keep new codes
> > has limited impact on existed codes.
> 
> Even if that makes a little sense?
> 
> > Of course, it's possible to merge _TTS and _PTS into one unified notifier.
> > The advantage is more actions could be added into the unified notifier
> in future.
> > Which way you prefer?
> 
> I would just use one notifier.
I follow you.
> 
> Thanks,
> Rafael

  reply	other threads:[~2016-06-24  3:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-09  5:50 [PATCH] ACPI: Execute the _PTS method when system reboot Ocean HY1 He
2016-05-16  3:04 ` Ocean HY1 He
2016-05-24  6:41 ` Ocean HY1 He
2016-05-24 10:15   ` Prarit Bhargava
2016-05-24 10:15     ` Prarit Bhargava
2016-05-30  3:28     ` Ocean HY1 He
2016-05-31  9:59       ` Prarit Bhargava
2016-05-31  9:59         ` Prarit Bhargava
2016-06-21 23:56 ` Rafael J. Wysocki
2016-06-23 12:55   ` Ocean HY1 He
2016-06-23 13:12     ` Rafael J. Wysocki
2016-06-24  2:59       ` Ocean HY1 He [this message]
2016-06-24 12:36         ` Rafael J. Wysocki
2016-06-24  0:30     ` Zheng, Lv
2016-06-24  2:06       ` Ocean HY1 He

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=BCBE834BAC19744BA2C3AC4D68DBF2198D8ACDFB@CNMAILEX03.lenovo.com \
    --to=hehy1@lenovo.com \
    --cc=dtanaka@lenovo.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=nchumbalkar@lenovo.com \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=skochar@lenovo.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.