lkml.org 
[lkml]   [2016]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [Update][RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support
On Tue, Sep 27, 2016 at 10:54 AM, Lukas Wunner <lukas@wunner.de> wrote:
> On Fri, Sep 16, 2016 at 02:33:55PM +0200, Rafael J. Wysocki wrote:
>> +void device_links_unbind_consumers(struct device *dev)
>> +{
>> + struct device_link *link;
>> + int idx;
>> +
>> + start:
>> + idx = device_links_read_lock();
>> +
>> + list_for_each_entry_rcu(link, &dev->links_to_consumers, s_node) {
>> + enum device_link_status status;
>> +
>> + if (link->flags & DEVICE_LINK_STATELESS)
>> + continue;
>> +
>> + spin_lock(&link->lock);
>> + status = link->status;
>> + if (status == DEVICE_LINK_CONSUMER_PROBE) {
>> + spin_unlock(&link->lock);
>> +
>> + device_links_read_unlock(idx);
>> +
>> + wait_for_device_probe();
>> + goto start;
>> + }
>
> While revisiting this function it just occurred to me that there's
> a theoretical infinite loop here if the consumer probes, is unbound
> by the supplier, then reprobes again before the supplier had a chance
> to update the link to DEVICE_LINK_SUPPLIER_UNBIND. Perhaps this isn't
> a problem in practice, but noting anyway.

But the consumer is unbound only after setting the link status to
DEVICE_LINK_SUPPLIER_UNBIND and then it won't probe again.

Or am I overlooking something?

Thanks,
Rafael

\
 
 \ /
  Last update: 2016-09-27 13:53    [W:0.203 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site