[ofa-general] Re: [PATCH 24/28] IB/ipath - ipath_poll fixups and enhancements

Arthur Jones arthur.jones at qlogic.com
Thu Jun 21 08:23:12 PDT 2007


hi roland, ...

On Wed, Jun 20, 2007 at 02:00:27PM -0700, Roland Dreier wrote:
>  > +	tail = *(volatile u64 *)pd->port_rcvhdrtail_kvaddr;
> 
> Why is there a volatile here?  cf http://lwn.net/Articles/234017/
> ("volatile considered harmful")

from that article:

- Pointers to data structures in coherent memory which might be modified
  by I/O devices can, sometimes, legitimately be volatile.  A ring buffer
  used by a network adapter, where that adapter changes pointers to
  indicate which descriptors have been processed, is an example of this
  type of situation.

the port_rcvhdrttail_kvaddr is the kernel virtual address
allocated in coherent memory where the header queue is updated
by the chip.  we use volatile to make sure the compiler does
not use stale data...

arthur



More information about the general mailing list