driver core: fix possible missing of device probe
PATCH 1/1 driver core: fix possible missing of device probe
Inside bus_add_driver(), one device might be added into the bus or probed which is triggered by deferred probe just after completing of driver_attach() and before 'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)', so the device won't be probed by this driver.
This patch moves the below line
'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)'
before driver_attach() inside bus_add_driver().
So fixes the problem since the below way can guarantee that no probe(dev) may be lost.
CPU0 CPU1driver_register
... write(bus->driver_list) smp_mb() read(bus->device_list) ... device_add /* bus_add_device */ write(bus->device_list) smp_mb() /* bus_probe_device*/ read(bus->driver_list)
And the smp_mb() has been implicit by UNLOCK+LOCK of 'klist' according to 'VARIETIES OF MEMORY BARRIER' part of Documentation/memory-barriers.txt.
--- drivers/base/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/bus.c +1 -1
@@ -714,12 +714,12 @@ int bus_add_driver(struct device_driver *drv)if (error) goto out_unregister; +klist_add_tail (&priv->knode_bus, &bus->p->klist_drivers);if (drv->bus->p->drivers_autoprobe) { error =driver_attach (drv);if (error) goto out_unregister; } -klist_add_tail (&priv->knode_bus, &bus->p->klist_drivers);module_add_driver (drv->owner, drv); error =driver_create_file (drv, &driver_attr_uevent);
Signature · 1 line
1.7.9.5
Hello Ming,
Though I am not an expert in this driver core area but I have been following this fix.So have some queries below:
Quoted 1 line · Ming Lei
Inside
bus_add_driver(), one device might be added into
should it not be "driver might be added into"?
Quoted 4 lines
the bus or probed which is triggered by deferred probe just after completing of
driver_attach()and before 'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)', so the device won't be probed by this driver.
So the corresponding device will not be probed.
Quoted 10 lines
This patch moves the below line
'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)'before
driver_attach()insidebus_add_driver().So fixes the problem since the below way can guarantee that no probe(dev) may be lost.
As I understand CPU0 is just calling bus_add_driver and driver_attach is called and after that it was pre-empted and cpu1 came into picture. Deferred probe started running on cpu1 and it didn't find the driver present int the knode_bus and unloaded the driver(why it unloaded is already explained by russell in his first post).
Hope my understanding is correct.
Quoted 51 lines
CPU0 CPU1
driver_register... write(bus->driver_list) smp_mb() read(bus->device_list) ... device_add /* bus_add_device */ write(bus->device_list) smp_mb() /* bus_probe_device*/ read(bus->driver_list)And the
smp_mb()has been implicit by UNLOCK+LOCK of 'klist' according to 'VARIETIES OF MEMORY BARRIER' part ofDocumentation/memory-barriers.txt.Reported-and-Tested-by Russell King <[email protected]>Cc <[email protected]>Signed-off-by Ming Lei <[email protected]>--- drivers/base/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/base/bus.c +1
-2@@ -714,12 +714,12 @@ int bus_add_driver(struct device_driver *drv)if (error) goto out_unregister; +klist_add_tail (&priv->knode_bus, &bus->p->klist_drivers);if (drv->bus->p->drivers_autoprobe) { error =driver_attach (drv);if (error) goto out_unregister; } -klist_add_tail (&priv->knode_bus, &bus->p->klist_drivers);module_add_driver (drv->owner, drv); error =driver_create_file (drv, &driver_attr_uevent); --1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 22 lines · anish singh
Hello Ming,
Though I am not an expert in this driver core area but I have been following this fix.So have some queries below:Quoted 1 line · Ming Lei
Inside
bus_add_driver(), one device might be added intoshould it not be "driver might be added into"?
Quoted 4 lines
the bus or probed which is triggered by deferred probe just after completing of
driver_attach()and before 'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)', so the device won't be probed by this driver.So the corresponding device will not be probed.
Quoted 10 lines
This patch moves the below line
'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)'before
driver_attach()insidebus_add_driver().So fixes the problem since the below way can guarantee that no probe(dev) may be lost.
Quoted 19 lines
As I understand CPU0 is just calling
bus_add_driveranddriver_attachis called and after that it was pre-empted and cpu1 came into picture. Deferred probe started running on cpu1 and it didn't find the driver present int theknode_busand unloaded the driver(why it unloaded is already explained by russell in his first post).
Hope my understanding is correct.Quoted 13 lines
CPU0 CPU1
driver_register... write(bus->driver_list) smp_mb() read(bus->device_list) ... device_add /* bus_add_device */ write(bus->device_list) smp_mb() /* bus_probe_device*/ read(bus->driver_list)
Actually, this description is rubbish. It's not about the SMP barriers, or read/write device/driver lists, or about two CPUs (my test setup only has one CPU.)
It's about threads, and the relative timing of those threads through the driver model code. All in all, what with the error path issue, and now the blatently wrong description, I'm not gaining much confidence in Ming Lei.
The below is actually what's happening, according to my analysis - and you'll notice that the device list has absolutely nothing to do with it:
Thread 0 Thread 1 Thread 2driver_attach()
bus_for_each_dev()
__driver_attach(, devA)
driver_probe_device(, devA)
really_probe(devA, )
driver_deferred_probe_add(devA)
driver_attach()
bus_for_each_dev()
__driver_attach(, devA)
driver_probe_device(, devB)
really_probe(devB, )
driver_bound(devB)
driver_deferred_probe_trigger()
deferred_probe_work_func()
bus_probe_device(devA)
device_attach(devA)
bus_for_each_drv()
__device_attach(, devA)
*fails to find driver*
*devA dropped from
deferred probe list*klist_add_tail(klist_drivers)
The reason this fix works is because the order in thread 0 means that when thread 2 comes to re-probe the device, it does find the driver, and if the resources that the driver needs are still not found (and it again returns -EPROBE_DEFER) the device will be placed back on the deferred probe list.
Quoted 77 lines · Russell King - ARM Linux
Quoted 22 lines · anish singh
Hello Ming,
Though I am not an expert in this driver core area but I have been following this fix.So have some queries below:Quoted 1 line · Ming Lei
Inside
bus_add_driver(), one device might be added intoshould it not be "driver might be added into"?
Quoted 4 lines
the bus or probed which is triggered by deferred probe just after completing of
driver_attach()and before 'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)', so the device won't be probed by this driver.So the corresponding device will not be probed.
Quoted 10 lines
This patch moves the below line
'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)'before
driver_attach()insidebus_add_driver().So fixes the problem since the below way can guarantee that no probe(dev) may be lost.
Quoted 19 lines
As I understand CPU0 is just calling
bus_add_driveranddriver_attachis called and after that it was pre-empted and cpu1 came into picture. Deferred probe started running on cpu1 and it didn't find the driver present int theknode_busand unloaded the driver(why it unloaded is already explained by russell in his first post).
Hope my understanding is correct.Quoted 13 lines
CPU0 CPU1
driver_register... write(bus->driver_list) smp_mb() read(bus->device_list) ... device_add /* bus_add_device */ write(bus->device_list) smp_mb() /* bus_probe_device*/ read(bus->driver_list)Actually, this description is rubbish. It's not about the SMP barriers, or read/write device/driver lists, or about two CPUs (my test setup only has one CPU.)
It's about threads, and the relative timing of those threads through the driver model code. All in all, what with the error path issue, and now the blatently wrong description, I'm not gaining much confidence in Ming Lei.
The below is actually what's happening, according to my analysis - and you'll notice that the device list has absolutely nothing to do with it:
Thread 0 Thread 1 Thread 2
driver_attach()
bus_for_each_dev()
__driver_attach(, devA)
driver_probe_device(, devA)really_probe(devA, ) driver_deferred_probe_add(devA) driver_attach() bus_for_each_dev() __driver_attach(, devA) driver_probe_device(, devB) really_probe(devB, ) driver_bound(devB) driver_deferred_probe_trigger() deferred_probe_work_func() bus_probe_device(devA) device_attach(devA) bus_for_each_drv() __device_attach(, devA) *fails to find driver* *devA dropped from deferred probe list*
Quoted 7 lines
klist_add_tail(klist_drivers)The reason this fix works is because the order in thread 0 means that when thread 2 comes to re-probe the device, it does find the driver, and if the resources that the driver needs are still not found (and it again returns -EPROBE_DEFER) the device will be placed back on the deferred probe list.
Explanation of this problem can't be better than this.Thanks Russell. I was totally confused by the explanation put forward by Ming.
Quoted 4 lines · Russell King - ARM Linux
Actually, this description is rubbish. It's not about the SMP barriers, or read/write device/driver lists, or about two CPUs (my test setup only has one CPU.)
Could you point out in detail what is wrong with my description?
Looks the description has been posted for about 12 days...
Quoted 2 lines
It's about threads, and the relative timing of those threads through
I do not mention threads case in one CPU because the context in which device_add runs will always see the driver added into bus's driver list after applying the patch in this situation. And it is obvious under UP case.
But in SMP case, it is not so obvious like UP, driver_register and device_add will be run in two individual CPU, so memory barrier plays a role in making device_add see the new added driver in the situation described in the commit log, and avoid the problem.
Quoted 6 lines
the driver model code. All in all, what with the error path issue, and now the blatently wrong description, I'm not gaining much confidence in Ming Lei.
The below is actually what's happening, according to my analysis - and you'll notice that the device list has absolutely nothing to do with it:
I don't think your analysis is complete for the two reasons:
- the problem isn't only triggered by deferred probe, and can be triggered by device_add too
- your analysis doesn't cover SMP case
In fact, it is just a race between driver_register and device_add or bus_probe_device, and should be nothing to do with deferred probe.
See my posted description again:
Inside bus_add_driver(), one device might be added into the bus or probed which is triggered by deferred probe just after completing of driver_attach() and before 'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)', so the device won't be probed by this driver.
Quoted 23 lines
Thread 0 Thread 1 Thread 2
driver_attach()
bus_for_each_dev()
__driver_attach(, devA)
driver_probe_device(, devA)really_probe(devA, ) driver_deferred_probe_add(devA) driver_attach() bus_for_each_dev() __driver_attach(, devA) driver_probe_device(, devB) really_probe(devB, ) driver_bound(devB) driver_deferred_probe_trigger() deferred_probe_work_func() bus_probe_device(devA) device_attach(devA) bus_for_each_drv() __device_attach(, devA) *fails to find driver* *devA dropped from deferred probe list*
Quoted 1 line
klist_add_tail(klist_drivers)
Didn't my description cover the description above? ( bus_probe_device is called between driver_attach and klist_add_tail)
Also it is only one of the two situations addressed by the patch.
Quoted 3 lines
The reason this fix works is because the order in thread 0 means that when thread 2 comes to re-probe the device, it does find the driver,
You mean the driver_attach on same driver can happen at the same time? If so, it is simply wrong.
Quoted 3 lines
and if the resources that the driver needs are still not found (and it again returns -EPROBE_DEFER) the device will be placed back on the deferred probe list.
Thanks,
--
Ming Lei
Quoted 9 lines · Ming Lei
Quoted 4 lines · Russell King - ARM Linux
Actually, this description is rubbish. It's not about the SMP barriers, or read/write device/driver lists, or about two CPUs (my test setup only has one CPU.)
Could you point out in detail what is wrong with my description?
Quoted 7 lines
Looks the description has been posted for about 12 days...
Quoted 2 lines
It's about threads, and the relative timing of those threads through
I do not mention threads case in one CPU because the context in which
device_addruns will always see the driver added into
There you go again. Look at my _much_ better description of the problem and you'll notice that device_add has nothing to do with this.
Quoted 5 lines
bus's driver list after applying the patch in this situation. And it is obvious under UP case.
But in SMP case, it is not so obvious like UP,
driver_registeranddevice_addwill be run in two individual CPU, so memory barrier
Again, device_add() has nothing to do with this. Do you actually understand the problem? Plainly as you're bringing device_add() into this, you do not.
Quoted 7 lines
plays a role in making
device_addsee the new added driver in the situation described in the commit log, and avoid the problem.Quoted 4 lines
the driver model code. All in all, what with the error path issue, and now the blatently wrong description, I'm not gaining much confidence in Ming Lei.
Quoted 8 lines
Quoted 2 lines
The below is actually what's happening, according to my analysis - and you'll notice that the device list has absolutely nothing to do with it:
I don't think your analysis is complete for the two reasons:
- the problem isn't only triggered by deferred probe, and can be triggered by
device_addtoo
- your analysis doesn't cover SMP case
Total rubbish. It does cover the SMP case, because those threads can run on different CPUs. The key issue is that there's a race between different parts of the kernel, and IT IS NOT between the major device list and driver list as you keep on bringing up.
Quoted 10 lines
In fact, it is just a race between
driver_registeranddevice_addorbus_probe_device, and should be nothing to do with deferred probe.See my posted description again:
Inside
bus_add_driver(), one device might be added into the bus or probed which is triggered by deferred probe just after completing ofdriver_attach()and before 'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)', so the device won't be probed by this driver.
This paragraph makes no sense to me as a native English speaker.
Quoted 24 lines
Quoted 22 lines
Thread 0 Thread 1 Thread 2
driver_attach()
bus_for_each_dev()
__driver_attach(, devA)
driver_probe_device(, devA)really_probe(devA, ) driver_deferred_probe_add(devA) driver_attach() bus_for_each_dev() __driver_attach(, devA) driver_probe_device(, devB) really_probe(devB, ) driver_bound(devB) driver_deferred_probe_trigger() deferred_probe_work_func() bus_probe_device(devA) device_attach(devA) bus_for_each_drv() __device_attach(, devA) *fails to find driver* *devA dropped from deferred probe list*Quoted 1 line
klist_add_tail(klist_drivers)
Quoted 2 lines
Didn't my description cover the description above? (
bus_probe_deviceis called betweendriver_attachandklist_add_tail)
Given that your description makes no sense (either to me or, as we've also found out, to Anish Singh), it means your description is not able to be understood. So no, your description does not cover the situation I reported by the mere fact that it was uninteligable.
Quoted 8 lines
Also it is only one of the two situations addressed by the patch.
Quoted 3 lines
The reason this fix works is because the order in thread 0 means that when thread 2 comes to re-probe the device, it does find the driver,
You mean the
driver_attachon same driver can happen at the same time? If so, it is simply wrong.
Sigh... your lack of understanding is impressive. I do not mean that driver_attach() can happen on the same struct device_driver simultaneously. Go back and look at my description of the three threads. Do you see two driver_attach() statements in that? No. So clearly I don't mean that.
Quoted 5 lines
Quoted 3 lines
and if the resources that the driver needs are still not found (and it again returns -EPROBE_DEFER) the device will be placed back on the deferred probe list.
Thanks,
Sorry, I don't think you know what you're talking about, and as such please remove my reported and tested by from this patch. I do not wish to endorse a patch created by someone who seemingly has a total lack of understanding of the problem I reported.
Thanks.
Quoted 5 lines · Russell King - ARM Linux
Quoted 2 lines
I do not mention threads case in one CPU because the context in which
device_addruns will always see the driver added intoThere you go again. Look at my _much_ better description of the problem and you'll notice that
device_addhas nothing to do with this.
OK, I explain it again:
CPU0 CPU1
driver_register
... bus_add_driver driver_attach device_add(devb) klist_add_tail(klist_drivers)
When device_add(devb) is run just after completion of driver_attach and before klist_add_tail(klist_drivers), the 'devb' can't be probed in device_add because the driver hasn't been added into bus, and it wasn't be probed in driver_attach because driver_attach didn't see the device in the bus.
So the 'devb' will be missed to be probed in the bus, won't it?
Thanks,
--
Ming Lei
Quoted 20 lines · Ming Lei
Quoted 5 lines · Russell King - ARM Linux
Quoted 2 lines
I do not mention threads case in one CPU because the context in which
device_addruns will always see the driver added intoThere you go again. Look at my _much_ better description of the problem and you'll notice that
device_addhas nothing to do with this.OK, I explain it again:
CPU0 CPU1
driver_register... bus_add_driver driver_attach device_add(devb) klist_add_tail(klist_drivers)
Quoted 7 lines
When
device_add(devb)is run just after completion ofdriver_attachand beforeklist_add_tail(klist_drivers), the 'devb' can't be probed indevice_addbecause the driver hasn't been added into bus, and it wasn't be probed indriver_attachbecausedriver_attachdidn't see the device in the bus.So the 'devb' will be missed to be probed in the bus, won't it?
Wait a moment. You're describing a *totally* *different* problem to the problem I reported. I say - for the third time - that in the problem I reported, device_add() has NOTHING TO DO WITH IT.
In your previous mail, you complained that my description did not cover another case. I throw that back at you and say to you that _your_ description does _not_ cover my case, but refers to a _different_ problem which happens to be fixed by the _same_ fix.
To attach my "reported-by" to a problem description which is not the problem that I reported is bad practice, and actually creates a lie. If you wish to keep your problem description, then you must remove my Reported-by, because the problem you refer to in your description is not _my_ problem.
Quoted 27 lines · Russell King - ARM Linux
Quoted 26 lines · Ming Lei
Quoted 5 lines · Russell King - ARM Linux
Quoted 2 lines
I do not mention threads case in one CPU because the context in which
device_addruns will always see the driver added intoThere you go again. Look at my _much_ better description of the problem and you'll notice that
device_addhas nothing to do with this.OK, I explain it again:
CPU0 CPU1
driver_register... bus_add_driver driver_attach device_add(devb) klist_add_tail(klist_drivers)When
device_add(devb)is run just after completion ofdriver_attachand beforeklist_add_tail(klist_drivers), the 'devb' can't be probed indevice_addbecause the driver hasn't been added into bus, and it wasn't be probed indriver_attachbecausedriver_attachdidn't see the device in the bus.
Quoted 4 lines
Quoted 1 line
So the 'devb' will be missed to be probed in the bus, won't it?
Wait a moment. You're describing a *totally* *different* problem to the problem I reported. I say - for the third time - that in the
I don't see there is any difference between them. In my above description, it will become same if the 'device_add' is changed to 'bus_probe_device'.
I have mentioned it in my commit log already.
Quoted 6 lines
problem I reported,
device_add()has NOTHING TO DO WITH IT.In your previous mail, you complained that my description did not cover another case. I throw that back at you and say to you that _your_ description does _not_ cover my case, but refers to a _different_ problem which happens to be fixed by the _same_ fix.
As said above, if 'device_add()' is replaced with 'bus_probe_device()', that becomes your problem, right?
Quoted 6 lines
To attach my "reported-by" to a problem description which is not the problem that I reported is bad practice, and actually creates a lie. If you wish to keep your problem description, then you must remove my Reported-by, because the problem you refer to in your description is not _my_ problem.
I mentioned 'bus_probe_device' case in my commit log.
If you still think that is not your problem, I can remove the reported-by.
Thanks,
--
Ming Lei
Quoted 19 lines · anish singh
Hello Ming,
Though I am not an expert in this driver core area but I have been following this fix.So have some queries below:Quoted 1 line · Ming Lei
Inside
bus_add_driver(), one device might be added intoshould it not be "driver might be added into"?
Quoted 4 lines
the bus or probed which is triggered by deferred probe just after completing of
driver_attach()and before 'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)', so the device won't be probed by this driver.So the corresponding device will not be probed.
Quoted 7 lines
This patch moves the below line
'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)'before
driver_attach()insidebus_add_driver().
Quoted 8 lines
Quoted 3 lines
So fixes the problem since the below way can guarantee that no probe(dev) may be lost.
As I understand CPU0 is just calling
bus_add_driveranddriver_attachis called and after that it was pre-empted and cpu1 came into picture. Deferred probe started running on cpu1 and it didn't find the driver present int theknode_busand unloaded the driver(why it unloaded is already explained by russell in his first post).
If the driver is unloaded, it is not a problem because the device will be probed after the driver is loaded again, so it is nothing to do with driver unloading. I don't know it was mentioned before.
The problem is that the bus_probe_device or device_add context may not see the driver added in driver_register context, in which the device is not being seen by driver_attach too. Only when the device is not probed in both the two contexts, the problem is triggered.
If the device can be guaranteed to be probed always in one of the two contexts, the problem will be solved. That is the idea in the patch.
Quoted 1 line
Hope my understanding is correct.
Hope I clarify the problem.
Thanks,
--
Ming Lei
Quoted 40 lines · Ming Lei
Quoted 19 lines · anish singh
Hello Ming,
Though I am not an expert in this driver core area but I have been following this fix.So have some queries below:Quoted 1 line · Ming Lei
Inside
bus_add_driver(), one device might be added intoshould it not be "driver might be added into"?
Quoted 4 lines
the bus or probed which is triggered by deferred probe just after completing of
driver_attach()and before 'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)', so the device won't be probed by this driver.So the corresponding device will not be probed.
Quoted 7 lines
This patch moves the below line
'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)'before
driver_attach()insidebus_add_driver().Quoted 8 lines
Quoted 3 lines
So fixes the problem since the below way can guarantee that no probe(dev) may be lost.
As I understand CPU0 is just calling
bus_add_driveranddriver_attachis called and after that it was pre-empted and cpu1 came into picture. Deferred probe started running on cpu1 and it didn't find the driver present int theknode_busand unloaded the driver(why it unloaded is already explained by russell in his first post).If the driver is unloaded, it is not a problem because the device will be probed after the driver is loaded again, so it is nothing to do with driver unloading. I don't know it was mentioned before.
The problem is that the
bus_probe_deviceordevice_addcontext may not see the driver added indriver_registercontext, in which the device is not being seen bydriver_attachtoo. Only when the device is not probed in both the two contexts, the problem is triggered.
Quoted 6 lines
If the device can be guaranteed to be probed always in one of the two contexts, the problem will be solved. That is the idea in the patch.
Quoted 1 line
Hope my understanding is correct.
Hope I clarify the problem.
Ming,
Somehow I feel here that the problem reported by Russell is totally different from your understanding of problem.I humbly urge you to have a look at Russell's nice explanation.
I was easily able to understand the problem faced by him and the reasoning put forward by him and moreover if the issue had been related to SMP russell would have definitely mentioned it given his knowledge of the same.
Thanks for your time.
Quoted 5 lines
Thanks,
--
Ming Lei
Quoted 3 lines · anish kumar
Ming,
Somehow I feel here that the problem reported by Russell is totally different from your understanding of problem.I humbly urge you to have
I let Russell answer if it is same problem, see my last email.
Quoted 1 line
a look at Russell's nice explanation.
Sorry, how do you know I didn't look at Russell's explanation?
Thanks,
--
Ming Lei
Quoted 7 lines · Ming Lei
Quoted 3 lines · anish kumar
Ming,
Somehow I feel here that the problem reported by Russell is totally different from your understanding of problem.I humbly urge you to have
Quoted 5 lines
I let Russell answer if it is same problem, see my last email.
Quoted 1 line
a look at Russell's nice explanation.
Sorry, how do you know I didn't look at Russell's explanation?
Sorry but I just had a cursory glance at your explanation and looks like there was some argument between you and russell so thought about that(shamelessly not even going through the explanation put forward by you as I understood the problem and solution). Anyway as mentioned earlier I am no expert on driver core but just wanted to learn the wonderful driver core design.
Hope I didn't offend you.
Quoted 5 lines
Thanks,
--
Ming Lei
Quoted 8 lines · Ming Lei
Quoted 3 lines · anish kumar
Ming,
Somehow I feel here that the problem reported by Russell is totally different from your understanding of problem.I humbly urge you to haveI let Russell answer if it is same problem, see my last email.
I'm tired of this thread. It's really not worth spending any more time on this crap. You can't see the problem, and it seems you're unwilling to listen to the feedback that's being given to you.
Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Ming Lei
Quoted 3 lines · anish kumar
Ming,
Somehow I feel here that the problem reported by Russell is totally different from your understanding of problem.I humbly urge you to have
Quoted 5 lines
Quoted 1 line
I let Russell answer if it is same problem, see my last email.
I'm tired of this thread. It's really not worth spending any more time on this crap. You can't see the problem, and it seems you're unwilling to listen to the feedback that's being given to you.
Looks you did not reply my previous question, right? And you just said it is wrong, and not mention what is wrong about my description.
> Could you point out in detail what is wrong with my description?
OK, I understand that you think what my patch addressed is not same with the problem you reported, so I will remove the reported-by.
Thanks,
--
Ming Lei
Quoted 29 lines · Ming Lei
Inside
bus_add_driver(), one device might be added into the bus or probed which is triggered by deferred probe just after completing ofdriver_attach()and before 'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)', so the device won't be probed by this driver.This patch moves the below line
'klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers)'before
driver_attach()insidebus_add_driver().So fixes the problem since the below way can guarantee that no probe(dev) may be lost.
CPU0 CPU1
driver_register... write(bus->driver_list) smp_mb() read(bus->device_list) ... device_add /* bus_add_device */ write(bus->device_list) smp_mb() /* bus_probe_device*/ read(bus->driver_list)
Quoted 5 lines
And the
smp_mb()has been implicit by UNLOCK+LOCK of 'klist' according to 'VARIETIES OF MEMORY BARRIER' part ofDocumentation/memory-barriers.txt.Reported-and-Tested-by Russell King <[email protected]>
Please use [email protected] here, thanks.