On Sun, 20 Jun 2004, Oliver Neukum wrote: > > I don't see the problem. If the other processor synchronizes properly > > then the write barrier in the unlock function will guarantee that both the > > pointer and the memory it points to are initialized. Unless the first > > processor doesn't initialize the memory area until _after_ it has released > > the lock -- but in that case you shouldn't expect the area to be > > initialized. > > But only if you drop the lock _before_ you call usb_set_intfdata() > which in probe() methods is not the case, because the up() is in the caller.
Why? If you call usb_set_intfdata() and then drop the lock (which is the case in probe() methods), all values will be properly initialized after the lock has been dropped. > Or you have to take the same lock when you use usb_get_intfdata() > which is not always the case. > I am on x86 which has ordered store. Sorry, you need ppc or something like > that to trigger it. Theoretically you might see it in hub_configure() racing > hub_port_status(). (I'll assume the second paragraph is an example of what you meant in the first paragraph.) hub_port_status() is called from within the khubd thread in response to an interrupt URB completion. The URB is submitted within hub_configure() after hub_probe() has called usb_set_intfdata(). The process of submitting an URB involves acquiring and releasing several locks, so both the interface data pointer and the memory it points to are guaranteed to be fully flushed to RAM when hub_port_status() runs. So the problem can't arise in your example. In general this sort of problem can arise whenever two processors try to share data. There's nothing special about usb_set_intfdata(); I don't see why you have singled it out. Alan Stern ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
