>       int ret = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor,
>                                    sizeof(dev->descriptor));
> 
> I'm not convinced that such a call is safe in all circumstances.
> dev->descriptor is smaller than a cache line and is not cache line
> aligned.  When pci_map_single() finally gets called with address it
> will invalidate the whole cache line, which could cause problems if
> adjacent members of dev are accessed.

Assuming this cacheline sharing issue is real:

- if pci_map_single() doesn't flush dirty initial/terminal
   cache lines before invalidating them, that'd be a clear
   bug in that implementation:  one is supposed to flush
   dirty data before discarding cache entries.

- that specific call is made during enumeration, when
   no other concurrent modification of that device should be
   allowed

In short, such uses can be safe even given awkward cache models.


> Is this reasoning correct or do you think it's better to leave that
> code as-is?

Leave as-is, I think, unless there's a clear case where the
device is being modified during enumeration by something other
than khubd (which is likely a bug), causing a problem.

- Dave



_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - 
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to