On Sunday, March 27, 2011 09:52:57 pm Matt Evans wrote: > On weakly-ordered systems, the reading of an event's content must occur > after reading the event's validity. > > Signed-off-by: Matt Evans <matt@xxxxxxxxxx> > --- > Segher, thanks for the comment; explanation added. > > drivers/usb/host/xhci-ring.c | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c > index 45f3b77..d6aa880 100644 > --- a/drivers/usb/host/xhci-ring.c > +++ b/drivers/usb/host/xhci-ring.c > @@ -2152,6 +2152,11 @@ static void xhci_handle_event(struct xhci_hcd > *xhci) } > xhci_dbg(xhci, "%s - OS owns TRB\n", __func__); > > + /* > + * Barrier between reading the TRB_CYCLE (valid) flag above and any > + * speculative reads of the event's flags/data below. > + */ > + rmb(); > /* FIXME: Handle more event types. */ > switch ((le32_to_cpu(event->event_cmd.flags) & TRB_TYPE_BITMASK)) { Isn't it the same memory that is being read the first time around? How reordering could happen here? Thanks. -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html