Re: [linux-pm] [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 5)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 24 Jun 2009, Alan Stern wrote:
> More comments to follow when I get time to review more of the code...

Here we go.  This isn't so detailed, because I wasn't able to do a 
detailed review.  Frankly, the code is kind of a mess.

The whole business about the runtime_notify and RPM_NOTIFY flags is 
impenetrable.  My suggestion: Rename runtime_notify to notify_pending 
and eliminate RPM_NOTIFY.  Then make sure that notify_pending is set 
whenever a notify work item is queued.

The pm_notify_or_cancel_work routine should just be pm_notify_work.  
It's silly to submit a workqueue item just to cancel a delayed
workqueue item!  Do all the cancellations in the __pm_runtime_resume
and __pm_runtime_suspend routines, where you're already in process
context.  If this means a work item occasionally runs at the wrong time
then let it -- it will quickly find out that it has nothing to do.  
And while you're at it, get rid of the runtime_break flag.

The logic in __pm_runtime_resume and __pm_runtime_suspend is too
complicated to check.  This is probably because of the interactions
with RPM_NOTIFY and runtime_break.  Once they are gone, the logic
should be much more straightforward: test the flags, then do whatever 
is needed based on the status.

I think once these cleanups are made, the code will be a lot more 
transparent.

In __pm_runtime_resume, don't assume that incrementing the parent's
child_count will prevent the parent from suspending; also increment the
resume_count.  And don't forget to decrement the parent's child_count
again if the resume fails.

In __pm_runtime_suspend, you should decrement the parent's child_count
before releasing the child's lock.  The pm_runtime_idle call should 
stay where it is, of course.

One more thing: Don't use flush_work or its relatives -- it tends to
cause deadlocks.  Use cancel_work_sync instead.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux