Re: [PATCH tip/core/rcu 01/11] rcu: Expedite grace periods during suspend/resume

2013-08-19 Thread Borislav Petkov
On Sun, Aug 18, 2013 at 05:29:10PM -0700, Paul E. McKenney wrote:
> I would guess that once we have a few more subsystems that want
> RCU to temporarily expedite its grace periods, we will have enough
> information and experience to do something a bit more general. In the
> meantime, I am opting for something simple. ;-)

Aah, the empirical approach! Very wise, master Jedi :-)

-- 
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tip/core/rcu 01/11] rcu: Expedite grace periods during suspend/resume

2013-08-19 Thread Borislav Petkov
On Sun, Aug 18, 2013 at 05:29:10PM -0700, Paul E. McKenney wrote:
 I would guess that once we have a few more subsystems that want
 RCU to temporarily expedite its grace periods, we will have enough
 information and experience to do something a bit more general. In the
 meantime, I am opting for something simple. ;-)

Aah, the empirical approach! Very wise, master Jedi :-)

-- 
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tip/core/rcu 01/11] rcu: Expedite grace periods during suspend/resume

2013-08-18 Thread Paul E. McKenney
On Sun, Aug 18, 2013 at 11:34:44AM +0200, Borislav Petkov wrote:
> On Sat, Aug 17, 2013 at 08:17:17PM -0700, Josh Triplett wrote:
> > On Sat, Aug 17, 2013 at 06:37:46PM -0700, Paul E. McKenney wrote:
> > > From: Borislav Petkov 
> > > 
> > > CONFIG_RCU_FAST_NO_HZ can increase grace-period durations by up to
> > > a factor of four, which can result in long suspend and resume times.
> > > Thus, this commit temporarily switches to expedited grace periods when
> > > suspending the box and return to normal settings when resuming.
> > > 
> > > [ paulmck: This also papers over an audio/irq bug, but hopefully that will
> > >   be fixed soon. ]
> > > 
> > > Signed-off-by: Borislav Petkov 
> > > Signed-off-by: Paul E. McKenney 
> > 
> > This patch still seems like a hack, and there *ought* to be a better
> > general solution to avoid excessive grace-period latency.  Nonetheless,
> > in the absence of such a solution,
> > Reviewed-by: Josh Triplett 
> 
> Yeah, I'm not happy about it either but from quickly skimming over what
> context we're using rcu_expedited in, the basic requirement for a fix is
> for the pm core to be able to tell rcu not to stretch grace periods.
> 
> So simply setting a variable is much simpler than switching to calling
> all those *_expedited() rcu flavors from the pm notifier when going
> down.
> 
> Unless Paul has a better idea, of course.
> 
> The basic problem here is, however, that you need to temporarily
> reconfigure the inner workings of a subsystem because hardware is
> performing a power state transition. Unless someone teaches rcu about
> power state transitions... :-)

I would guess that once we have a few more subsystems that want RCU to
temporarily expedite its grace periods, we will have enough information
and experience to do something a bit more general.  In the meantime,
I am opting for something simple.  ;-)

Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tip/core/rcu 01/11] rcu: Expedite grace periods during suspend/resume

2013-08-18 Thread Borislav Petkov
On Sat, Aug 17, 2013 at 08:17:17PM -0700, Josh Triplett wrote:
> On Sat, Aug 17, 2013 at 06:37:46PM -0700, Paul E. McKenney wrote:
> > From: Borislav Petkov 
> > 
> > CONFIG_RCU_FAST_NO_HZ can increase grace-period durations by up to
> > a factor of four, which can result in long suspend and resume times.
> > Thus, this commit temporarily switches to expedited grace periods when
> > suspending the box and return to normal settings when resuming.
> > 
> > [ paulmck: This also papers over an audio/irq bug, but hopefully that will
> >   be fixed soon. ]
> > 
> > Signed-off-by: Borislav Petkov 
> > Signed-off-by: Paul E. McKenney 
> 
> This patch still seems like a hack, and there *ought* to be a better
> general solution to avoid excessive grace-period latency.  Nonetheless,
> in the absence of such a solution,
> Reviewed-by: Josh Triplett 

Yeah, I'm not happy about it either but from quickly skimming over what
context we're using rcu_expedited in, the basic requirement for a fix is
for the pm core to be able to tell rcu not to stretch grace periods.

So simply setting a variable is much simpler than switching to calling
all those *_expedited() rcu flavors from the pm notifier when going
down.

Unless Paul has a better idea, of course.

The basic problem here is, however, that you need to temporarily
reconfigure the inner workings of a subsystem because hardware is
performing a power state transition. Unless someone teaches rcu about
power state transitions... :-)

-- 
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tip/core/rcu 01/11] rcu: Expedite grace periods during suspend/resume

2013-08-18 Thread Paul E. McKenney
On Sun, Aug 18, 2013 at 11:34:44AM +0200, Borislav Petkov wrote:
 On Sat, Aug 17, 2013 at 08:17:17PM -0700, Josh Triplett wrote:
  On Sat, Aug 17, 2013 at 06:37:46PM -0700, Paul E. McKenney wrote:
   From: Borislav Petkov b...@alien8.de
   
   CONFIG_RCU_FAST_NO_HZ can increase grace-period durations by up to
   a factor of four, which can result in long suspend and resume times.
   Thus, this commit temporarily switches to expedited grace periods when
   suspending the box and return to normal settings when resuming.
   
   [ paulmck: This also papers over an audio/irq bug, but hopefully that will
 be fixed soon. ]
   
   Signed-off-by: Borislav Petkov b...@suse.de
   Signed-off-by: Paul E. McKenney paul...@linux.vnet.ibm.com
  
  This patch still seems like a hack, and there *ought* to be a better
  general solution to avoid excessive grace-period latency.  Nonetheless,
  in the absence of such a solution,
  Reviewed-by: Josh Triplett j...@joshtriplett.org
 
 Yeah, I'm not happy about it either but from quickly skimming over what
 context we're using rcu_expedited in, the basic requirement for a fix is
 for the pm core to be able to tell rcu not to stretch grace periods.
 
 So simply setting a variable is much simpler than switching to calling
 all those *_expedited() rcu flavors from the pm notifier when going
 down.
 
 Unless Paul has a better idea, of course.
 
 The basic problem here is, however, that you need to temporarily
 reconfigure the inner workings of a subsystem because hardware is
 performing a power state transition. Unless someone teaches rcu about
 power state transitions... :-)

I would guess that once we have a few more subsystems that want RCU to
temporarily expedite its grace periods, we will have enough information
and experience to do something a bit more general.  In the meantime,
I am opting for something simple.  ;-)

Thanx, Paul

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tip/core/rcu 01/11] rcu: Expedite grace periods during suspend/resume

2013-08-18 Thread Borislav Petkov
On Sat, Aug 17, 2013 at 08:17:17PM -0700, Josh Triplett wrote:
 On Sat, Aug 17, 2013 at 06:37:46PM -0700, Paul E. McKenney wrote:
  From: Borislav Petkov b...@alien8.de
  
  CONFIG_RCU_FAST_NO_HZ can increase grace-period durations by up to
  a factor of four, which can result in long suspend and resume times.
  Thus, this commit temporarily switches to expedited grace periods when
  suspending the box and return to normal settings when resuming.
  
  [ paulmck: This also papers over an audio/irq bug, but hopefully that will
be fixed soon. ]
  
  Signed-off-by: Borislav Petkov b...@suse.de
  Signed-off-by: Paul E. McKenney paul...@linux.vnet.ibm.com
 
 This patch still seems like a hack, and there *ought* to be a better
 general solution to avoid excessive grace-period latency.  Nonetheless,
 in the absence of such a solution,
 Reviewed-by: Josh Triplett j...@joshtriplett.org

Yeah, I'm not happy about it either but from quickly skimming over what
context we're using rcu_expedited in, the basic requirement for a fix is
for the pm core to be able to tell rcu not to stretch grace periods.

So simply setting a variable is much simpler than switching to calling
all those *_expedited() rcu flavors from the pm notifier when going
down.

Unless Paul has a better idea, of course.

The basic problem here is, however, that you need to temporarily
reconfigure the inner workings of a subsystem because hardware is
performing a power state transition. Unless someone teaches rcu about
power state transitions... :-)

-- 
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tip/core/rcu 01/11] rcu: Expedite grace periods during suspend/resume

2013-08-17 Thread Josh Triplett
On Sat, Aug 17, 2013 at 06:37:46PM -0700, Paul E. McKenney wrote:
> From: Borislav Petkov 
> 
> CONFIG_RCU_FAST_NO_HZ can increase grace-period durations by up to
> a factor of four, which can result in long suspend and resume times.
> Thus, this commit temporarily switches to expedited grace periods when
> suspending the box and return to normal settings when resuming.
> 
> [ paulmck: This also papers over an audio/irq bug, but hopefully that will
>   be fixed soon. ]
> 
> Signed-off-by: Borislav Petkov 
> Signed-off-by: Paul E. McKenney 

This patch still seems like a hack, and there *ought* to be a better
general solution to avoid excessive grace-period latency.  Nonetheless,
in the absence of such a solution,
Reviewed-by: Josh Triplett 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH tip/core/rcu 01/11] rcu: Expedite grace periods during suspend/resume

2013-08-17 Thread Paul E. McKenney
From: Borislav Petkov 

CONFIG_RCU_FAST_NO_HZ can increase grace-period durations by up to
a factor of four, which can result in long suspend and resume times.
Thus, this commit temporarily switches to expedited grace periods when
suspending the box and return to normal settings when resuming.

[ paulmck: This also papers over an audio/irq bug, but hopefully that will
  be fixed soon. ]

Signed-off-by: Borislav Petkov 
Signed-off-by: Paul E. McKenney 
---
 kernel/rcutree.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 338f1d1..69e4792 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -54,6 +54,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "rcutree.h"
 #include 
@@ -3032,6 +3033,22 @@ static int rcu_cpu_notify(struct notifier_block *self,
return NOTIFY_OK;
 }
 
+static int rcu_pm_notify(struct notifier_block *self,
+unsigned long action, void *hcpu)
+{
+   switch (action) {
+   case PM_HIBERNATION_PREPARE:
+   rcu_expedited = 1;
+   break;
+   case PM_POST_RESTORE:
+   rcu_expedited = 0;
+   break;
+   default:
+   break;
+   }
+   return NOTIFY_OK;
+}
+
 /*
  * Spawn the kthread that handles this RCU flavor's grace periods.
  */
@@ -3273,6 +3290,7 @@ void __init rcu_init(void)
 * or the scheduler are operational.
 */
cpu_notifier(rcu_cpu_notify, 0);
+   pm_notifier(rcu_pm_notify, 0);
for_each_online_cpu(cpu)
rcu_cpu_notify(NULL, CPU_UP_PREPARE, (void *)(long)cpu);
 }
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH tip/core/rcu 01/11] rcu: Expedite grace periods during suspend/resume

2013-08-17 Thread Paul E. McKenney
From: Borislav Petkov b...@alien8.de

CONFIG_RCU_FAST_NO_HZ can increase grace-period durations by up to
a factor of four, which can result in long suspend and resume times.
Thus, this commit temporarily switches to expedited grace periods when
suspending the box and return to normal settings when resuming.

[ paulmck: This also papers over an audio/irq bug, but hopefully that will
  be fixed soon. ]

Signed-off-by: Borislav Petkov b...@suse.de
Signed-off-by: Paul E. McKenney paul...@linux.vnet.ibm.com
---
 kernel/rcutree.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 338f1d1..69e4792 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -54,6 +54,7 @@
 #include linux/stop_machine.h
 #include linux/random.h
 #include linux/ftrace_event.h
+#include linux/suspend.h
 
 #include rcutree.h
 #include trace/events/rcu.h
@@ -3032,6 +3033,22 @@ static int rcu_cpu_notify(struct notifier_block *self,
return NOTIFY_OK;
 }
 
+static int rcu_pm_notify(struct notifier_block *self,
+unsigned long action, void *hcpu)
+{
+   switch (action) {
+   case PM_HIBERNATION_PREPARE:
+   rcu_expedited = 1;
+   break;
+   case PM_POST_RESTORE:
+   rcu_expedited = 0;
+   break;
+   default:
+   break;
+   }
+   return NOTIFY_OK;
+}
+
 /*
  * Spawn the kthread that handles this RCU flavor's grace periods.
  */
@@ -3273,6 +3290,7 @@ void __init rcu_init(void)
 * or the scheduler are operational.
 */
cpu_notifier(rcu_cpu_notify, 0);
+   pm_notifier(rcu_pm_notify, 0);
for_each_online_cpu(cpu)
rcu_cpu_notify(NULL, CPU_UP_PREPARE, (void *)(long)cpu);
 }
-- 
1.8.1.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH tip/core/rcu 01/11] rcu: Expedite grace periods during suspend/resume

2013-08-17 Thread Josh Triplett
On Sat, Aug 17, 2013 at 06:37:46PM -0700, Paul E. McKenney wrote:
 From: Borislav Petkov b...@alien8.de
 
 CONFIG_RCU_FAST_NO_HZ can increase grace-period durations by up to
 a factor of four, which can result in long suspend and resume times.
 Thus, this commit temporarily switches to expedited grace periods when
 suspending the box and return to normal settings when resuming.
 
 [ paulmck: This also papers over an audio/irq bug, but hopefully that will
   be fixed soon. ]
 
 Signed-off-by: Borislav Petkov b...@suse.de
 Signed-off-by: Paul E. McKenney paul...@linux.vnet.ibm.com

This patch still seems like a hack, and there *ought* to be a better
general solution to avoid excessive grace-period latency.  Nonetheless,
in the absence of such a solution,
Reviewed-by: Josh Triplett j...@joshtriplett.org
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/