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?

Am sorry, it is the work of MS Outlook. Will take care...

>> 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.

It is not only the previous example where child_count would end up with a 
wrong value, if you look at __pm_runtime_suspend -

		if (dev->parent) {
			parent = dev->parent;
			atomic_add_unless(&parent->power.child_count, -1, 0);
		}

and in __pm_runtime_resume -

		if (parent)
			atomic_inc(&parent->power.child_count);


Also wanted to ask - do you think acquiring spinlock every time before 
even checking if parent supports runtime PM, optimal?


Regards,	
Nithish Mahalingam

_______________________________________________
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