Re: [PATCH] Runtime PM: Adding explicit check to make sure dev->parent supports runtime PM before accessing its PM fields.

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

 



Can you please tell your email client to wrap lines after 72 columns or 
so?

On Fri, 4 Dec 2009, Mahalingam, Nithish wrote:

> >> The below patch makes sure that dev->parent supports runtime PM before accessing its PM fields. Though the code does this check at a later point in time, doing it earlier > can optimize the code flow.
> 
> > This is not a good idea.  Those fields should be set correctly even if 
> > the parent's disable_depth is positive.  What would happen if the 
> > fields were wrong and then somebody called pm_runtime_enable(parent)?
> 
> Yes Alan, those fields do get set but if you look at __pm_runtime_set_status function -
> 
> 	if (status == RPM_SUSPENDED) {
> 		/* It always is possible to set the status to 'suspended'. */
> 		if (parent) {
> 			atomic_add_unless(&parent->power.child_count, -1, 0);
> 			notify_parent = !parent->power.ignore_children;
> 		}
> 		goto out_set;
> 	}
> 
> This code gets executed without doing any check to see if the parent supports runtime PM. Doing explicit check before can avoid executing these code at runtime.

And that would be a mistake.  If the code wasn't executed then
parent->power.child_count would contain an incorrect value.  However, I
agree that it might make sense to avoid setting notify_parent if the
parent is disabled.

Alan Stern

_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux