Prev: [ANN] Linux Security Summit 2010 - Announcement and CFP
Next: [PATCH 4/8] PM: suspend_block: Add debugfs file
From: Florian Mickler on 1 Jun 2010 01:40 On Tue, 1 Jun 2010 12:20:12 +1000 Neil Brown <neilb(a)suse.de> wrote: > On Tue, 1 Jun 2010 03:49:37 +0200 (CEST) > Thomas Gleixner <tglx(a)linutronix.de> wrote: > > If "suspend" is another deep idle state and the hardware is sane, > > there is no race at all - assumed that the driver/platform developer > > got it right. It's not rocket science to transition from "normal" irq > > delivery to wakeup based delivery raceless (except for PC style x86 > > hardware of today) > > If "suspend" is the thing we are used to via /sys/power/state then the > > race will persist forever except for the suspend blocker workaround, > > which we can express in QoS terms as well w/o adding another suspend > > related user space API. Can you explain the difference between the /sys/power/state thing? Is it the reprogramming of wake-sources as mentioned by Raffael? In an idle based suspend I assume there would be no new wake-sources on suspending. > I'm not interested in adding another user-space API if it can possibly be > avoided, and I think it can. But that is a later step in the process. > > I think you have acknowledged that there is a race with suspend - thanks. > Next step was "can it be closed". > You seem to suggest that it can, but you describe it as a "work around" > rather than a "bug fix"... Well as far as I get it, the workaround is to not suspend in sitations where a race is likely to occur. (I.e. block suspend) > > Do you agree that the race is a "bug", and therefore it is appropriate to > "fix" it assuming an acceptable fix can be found (which I think it can)? > > If you agree that it is appropriate for try to fix this bug, then the next > step would be to get the Android devs to agree that a fix could - in > principle - address the need for which they created suspend-blockers. > Arve: can you confirm that? > > Then, with a clear and agreed goal, we can look at possible fixes. > > Thanks, > NeilBrown > > > > > Thanks, > > > > tglx cheers, Flo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Igor Stoppa on 1 Jun 2010 02:40 Hi, ext Arve Hj�nnev�g wrote: > It sounded like you were suggesting that initiating suspend from idle > would somehow avoid the race condition with wakeup events. All I'm > saying is that you would need to block suspend in all the same places. > If you don't care about ignoring wakeup events, then sure you can > initiate suspend from idle. > Sorry if i'm asking something that was already said, but the thread is quite complex and i am not sure i have been able to grasp all of it. So, regardless of the SW implementation: -1) are you focusing on "good" HW or do you want to address all at the same time? -2) would you be ok with addressing "bad" HW as a special case, which requires workarounds and shouldn't dictate the overall design? -3) do you agree with the assumption that new HW is expected to get reasonably better and therefore workarounds at point 2) will progressively be confined to devices less and less common? -4) going to the definition of "good" and "bad" (maybe this should have come earlier in the list), can we define "good" HW as HW where: * suspend state and lowest achievable runtime idle state are basically equivalent from both power consumption and latency pov * the HW itself is properly able to track wakeup sources while it is in its deepest power state (as example OMAP3 has few independent wake-capable pads and a "wake ring" where one only gets the information that at least one of the pads belonging to such ring has received a wakeup) * wakeup sources can be dynamically masked at HW level, so that if a peripheral is not interesting, it doesn't wakeup the system (for example the camera button when the camera cover is closed) -5) HW that is not capable of properly generating asynchronous signal is most likely the cause for extra timers in kernel and it should be considered "bad" - in any other case having recurring in-kernel timers should be treated as bugs, if their existence is not tied to some meaningful work thanks, igor -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Florian Mickler on 1 Jun 2010 03:10 On Mon, 31 May 2010 16:26:17 -0700 mark gross <640e9920(a)gmail.com> wrote: > On Mon, May 31, 2010 at 11:38:55PM +0200, Rafael J. Wysocki wrote: > > On Monday 31 May 2010, Arve Hj�nnev�g wrote: > > > 2010/5/29 Alan Stern <stern(a)rowland.harvard.edu>: > > > > On Sat, 29 May 2010, Arve Hj�nnev�g wrote: > > > > > > > >> > In place of in-kernel suspend blockers, there will be a new type of QoS > > > >> > constraint -- call it QOS_EVENTUALLY. It's a very weak constraint, > > > >> > compatible with all cpuidle modes in which runnable threads are allowed > > > >> > to run (which is all of them), but not compatible with suspend. > > > >> > > > > >> This sound just like another API rename. It will work, but given that > > > >> suspend blockers was the name least objectionable last time around, > > > >> I'm not sure what this would solve. > > > > > > > > It's not just a rename. By changing this into a QoS constraint, we > > > > make it more generally useful. Instead of standing on its own, it > > > > becomes part of the PM-QOS framework. > > > > > > > > > > We cannot use the existing pm-qos framework. It is not safe to call > > > from atomic context. > > > > We've just merged a patch that fixed that if I'm not mistaken. Mark, did your > > PM QoS update fix that? > > > > I'm pretty sure it can be called in atomic context, and if its not I'm > sure we can fix that. It can be called in atomic context. I don't > think it was ever a problem to call it in atomic context. The problem it > had was that crappy list of string compares. Thats been fixed. > > --mgross > Well, the register call uses kzalloc. Apart from that I think we're good. The outstanding list traversals can be fixed also. (see below) Cheers, Flo From 66fdd76f8cc4be722dba3859ddadfe07e7a4b755 Mon Sep 17 00:00:00 2001 From: Florian Mickler <florian(a)mickler.org> Date: Tue, 1 Jun 2010 09:04:26 +0200 Subject: [PATCH] pm_qos: remove unnecessary list-traversal The new extreme_value is only depending on the old extreme_value and the changing value. Signed-off-by: Florian Mickler <florian(a)mickler.org> --- kernel/pm_qos_params.c | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c index f42d3f7..6618e2c 100644 --- a/kernel/pm_qos_params.c +++ b/kernel/pm_qos_params.c @@ -136,6 +136,16 @@ static s32 min_compare(s32 v1, s32 v2) } +static void update_target_val(int pm_qos_class, s32 val) +{ + s32 extreme_value; + s32 new_value; + extreme_value = atomic_read(&pm_qos_array[pm_qos_class]->target_value); + new_value = pm_qos_array[pm_qos_class]->comparitor(val,extreme_value); + if (extreme_value != new_value) + atomic_set(&pm_qos_array[pm_qos_class]->target_value,new_value); +} + static void update_target(int pm_qos_class) { s32 extreme_value; @@ -227,8 +237,8 @@ struct pm_qos_request_list *pm_qos_add_request(int pm_qos_class, s32 value) spin_lock_irqsave(&pm_qos_lock, flags); list_add(&dep->list, &pm_qos_array[pm_qos_class]->requests.list); + update_target_val(pm_qos_class,dep->value); spin_unlock_irqrestore(&pm_qos_lock, flags); - update_target(pm_qos_class); } return dep; @@ -249,23 +259,21 @@ void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req, s32 new_value) { unsigned long flags; - int pending_update = 0; s32 temp; if (pm_qos_req) { /*guard against callers passing in null */ + int target = pm_qos_req->pm_qos_class; spin_lock_irqsave(&pm_qos_lock, flags); if (new_value == PM_QOS_DEFAULT_VALUE) - temp = pm_qos_array[pm_qos_req->pm_qos_class]->default_value; + temp = pm_qos_array[target]->default_value; else temp = new_value; if (temp != pm_qos_req->value) { - pending_update = 1; pm_qos_req->value = temp; + update_target_val(target,temp); } spin_unlock_irqrestore(&pm_qos_lock, flags); - if (pending_update) - update_target(pm_qos_req->pm_qos_class); } } EXPORT_SYMBOL_GPL(pm_qos_update_request); -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Thomas Gleixner on 1 Jun 2010 07:00 On Tue, 1 Jun 2010, Neil Brown wrote: > > I think you have acknowledged that there is a race with suspend - thanks. > Next step was "can it be closed". > You seem to suggest that it can, but you describe it as a "work around" > rather than a "bug fix"... > > Do you agree that the race is a "bug", and therefore it is appropriate to > "fix" it assuming an acceptable fix can be found (which I think it can)? If we can fix it, yes we definitely should do and not work around it. Thanks, tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Thomas Gleixner on 1 Jun 2010 07:20
On Mon, 31 May 2010, Arve Hj�nnev�g wrote: > On Mon, May 31, 2010 at 2:46 PM, Thomas Gleixner <tglx(a)linutronix.de> wrote: > > On Mon, 31 May 2010, James Bottomley wrote: > >> > >> For MSM hardware, it looks possible to unify the S and C states by doing > >> suspend to ram from idle but I'm not sure how much work that is. > > > > On ARM, it's not rocket science and we have in tree support for this > > already (OMAP). I have done the same thing on a Samsung part as a > > prove of concept two years ago and it's really easy as the hardware is > > sane. Hint: It's designed for mobile devices :) > > > > We already enter the same power state from idle and suspend on msm. In > the absence of misbehaving apps, the difference in power consumption > is entirely caused by periodic timers in the user-space framework > _and_ kernel. It only takes a few timers triggering per second (I > think 3 if they do no work) to double the average power consumption on > the G1 if the radio is off. We originally added wakelocks because the > hardware we had at the time had much lower power consumption in > suspend then idle, but we still use suspend because it saves power. So how do you differentiate between timers which _should_ fire and those you do not care about ? We have mechanisms in place to defer timers so the wakeups are minimized. If that's not enough we need to revisit. Thanks, tglx |