[openib-general] [PATCH] use mmiowb after doorbell ring

Michael S. Tsirkin mst at mellanox.co.il
Tue Oct 17 11:16:38 PDT 2006


Quoting r. Roland Dreier <rdreier at cisco.com>:
> Subject: Re: [PATCH] use mmiowb after doorbell ring
> 
>  > > I don't think an mmiowb() equivalent is available from userspace.
>  > 
>  > Isn't this just an asm() command?
> 
> Nope, look at the kernel source, specifically arch/ia64/sn/kernel/iomv.c
> 
>  > BTW, I think we really should implement proper rmb/wmb in arch.h.
>  > Last time I looked we only had compiler barriers here, and
>  > this means, I think, that a read from e.g. CQE contents could bypass
>  > the read of the CQE valid bit.
> 
> I'm not absolutely sure everything there is correct but I did my best,
> for example
> 
> #elif defined(__ia64__)
> 
> #define mb()    asm volatile("mf" ::: "memory")
> 
> Do you know of any specific archs that are broken?

Look e.g. on mthca/cq.c


        cqe = next_cqe_sw(cq);
        if (!cqe)
                return CQ_EMPTY;

        /*
           * Make sure we read CQ entry contents after we've checked the
           * ownership bit.
           */
        mb();

        qpn = ntohl(cqe->my_qpn);


kernel code does rmb rather than mb there.



-- 
MST




More information about the general mailing list