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

Roland Dreier rdreier at cisco.com
Mon Oct 16 10:24:21 PDT 2006


Actually, one further question:

 > @@ -314,6 +316,9 @@ void mthca_cq_clean(struct mthca_dev *de
 >   		wmb();
 >   		cq->cons_index += nfreed;
 >   		update_cons_index(dev, cq, nfreed);
 > +		/* use mmiowb to ensure update is ordered properly 
 > +		 * prior to releasing the spinlock */
 > +		mmiowb();
 >   	}
 > 
 >   	spin_unlock_irq(&cq->lock);
 > @@ -711,6 +716,11 @@ repoll:
 >   		}
 >   	}
 > 
 > +	if (freed) {
 > +		/* we rang the MTHCA_CQ_DOORBELL so use mmiowb 
 > +		 * to make sure it is ordered properly */
 > +		mmiowb();
 > +	}
 >   	spin_unlock_irqrestore(&cq->lock, flags);
 > 
 >   	return err == 0 || err == -EAGAIN ? npolled : err;

Would it be cleaner just to put an mmiowb() inside update_cons_index()
in the case where the doorbell gets rung?  That way there's no
unnecessary mmiowb() in the memfree case (which doesn't use a doorbell
or do any writing to PCI at all).

 - R.




More information about the general mailing list