Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1431283

RE: [PATCH 3/4][RFC v2] PM / hibernate: introduce a flag to indicate resuming from hibernation

From "Chen, Yu C" <yu.c.chen@intel.com>
Newsgroups linux.kernel
Subject RE: [PATCH 3/4][RFC v2] PM / hibernate: introduce a flag to indicate resuming from hibernation
Date 2016-06-26 03:40 +0200
Message-ID <rO7df-4HO-1@gated-at.bofh.it> (permalink)
References <rNYtj-7Eq-3@gated-at.bofh.it> <rNYtj-7Eq-7@gated-at.bofh.it> <rNZ61-7RB-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

> -----Original Message-----
> From: Pavel Machek [mailto:pavel@ucw.cz]
> Sent: Sunday, June 26, 2016 12:53 AM
> To: Chen, Yu C
> Cc: linux-pm@vger.kernel.org; x86@kernel.org; Rafael J. Wysocki; Len Brown;
> Peter Zijlstra; H. Peter Anvin; Borislav Petkov; Brian Gerst; Thomas Gleixner;
> Ingo Molnar; Varun Koyyalagunta; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 3/4][RFC v2] PM / hibernate: introduce a flag to indicate
> resuming from hibernation
> 
> On Sun 2016-06-26 00:18:52, Chen Yu wrote:
> > Sometime we need to do some operations before resuming from
> > hibernation, so introduce a flag to indicate this stage.
> >
> > Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> > ---
> >  include/linux/suspend.h  | 7 +++++++
> >  kernel/power/hibernate.c | 3 +++
> >  2 files changed, 10 insertions(+)
> >
> > diff --git a/include/linux/suspend.h b/include/linux/suspend.h index
> > 8b6ec7e..422e87a 100644
> > --- a/include/linux/suspend.h
> > +++ b/include/linux/suspend.h
> > @@ -384,6 +384,12 @@ extern bool system_entering_hibernation(void);
> >  extern bool hibernation_available(void);  asmlinkage int
> > swsusp_save(void);  extern struct pbe *restore_pblist;
> > +extern bool in_resume_hibernate;
> 
> in_resume_hibernation? But it is pretty sad if we need another such
> state function...
At first I tried not to add any new flags, and just let all the CPUs fall into hlt if it is
triggered by disable_nonboot_cpus, but as depicted in [PATCH 4/4], 
there is a scenario that,   what about the CPUs already  offline before
the hibernation? They might be in deep cstate by mwait, and mwait is not
safe during resume.
We have to kick all the offline CPUs online again, and then
put them offline to hlt state, thus to avoid the unsafe memory access during resume.
(The memory mapping for text code is not safe during resume, so it's hard to fix it
in mwait_play_dead, and the kick mechanism seems to be a suitable choice).
In order to restrict the impact of the kick mechanism to a minimal scope, I used this
flag to make this  mechanism only work for hibernation resume phase.

thanks,
Yu

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4][RFC v2] x86, hotplug: Use hlt instead of mwait when resuming from hibernation Chen Yu <yu.c.chen@intel.com> - 2016-06-25 18:20 +0200
  [PATCH 3/4][RFC v2] PM / hibernate: introduce a flag to indicate resuming from hibernation Chen Yu <yu.c.chen@intel.com> - 2016-06-25 18:20 +0200
    Re: [PATCH 3/4][RFC v2] PM / hibernate: introduce a flag to indicate  resuming from hibernation Pavel Machek <pavel@ucw.cz> - 2016-06-25 19:00 +0200
      RE: [PATCH 3/4][RFC v2] PM / hibernate: introduce a flag to  indicate resuming from hibernation "Chen, Yu C" <yu.c.chen@intel.com> - 2016-06-26 03:40 +0200
  [PATCH 1/4][RFC v2] PM / sleep: Avoid accessing frozen_cpus if it is NULL Chen Yu <yu.c.chen@intel.com> - 2016-06-25 18:20 +0200
    Re: [PATCH 1/4][RFC v2] PM / sleep: Avoid accessing frozen_cpus if  it is NULL Pavel Machek <pavel@ucw.cz> - 2016-06-25 19:00 +0200
      RE: [PATCH 1/4][RFC v2] PM / sleep: Avoid accessing frozen_cpus if  it is NULL "Chen, Yu C" <yu.c.chen@intel.com> - 2016-06-26 03:20 +0200
      RE: [PATCH 1/4][RFC v2] PM / sleep: Avoid accessing frozen_cpus if  it is NULL "Chen, Yu C" <yu.c.chen@intel.com> - 2016-06-26 06:30 +0200
  [PATCH 2/4][RFC v2] PM / sleep: Introduce arch-specific hook for disable/enable nonboot cpus Chen Yu <yu.c.chen@intel.com> - 2016-06-25 18:20 +0200
    Re: [PATCH 2/4][RFC v2] PM / sleep: Introduce arch-specific hook for  disable/enable nonboot cpus Pavel Machek <pavel@ucw.cz> - 2016-06-25 19:00 +0200
      RE: [PATCH 2/4][RFC v2] PM / sleep: Introduce arch-specific hook  for disable/enable nonboot cpus "Chen, Yu C" <yu.c.chen@intel.com> - 2016-06-26 03:20 +0200

csiph-web