Should we use "dsb" or "dmb" between write to buffer and write to register

Mark Zhang markzhang at nvidia.com
Mon Aug 22 00:53:42 PDT 2022


Hi ARM experts,

May I consult when to use dsb or dmb in our device driver, thanks:

For example when send a command a FW/HW, usually we do it with 3 steps:
   1. memcpy(buff, src, size);
   2. wmb();
   3. write64(ctrl, reg_addr);

IIUC in kernel wmb() is implemented with "dsb st". When we change this 
to "dmb st" then we get better performance, but we are not sure if it's 
safe. I have read Will's post[1] but still not sure.

So our questions are:
1. can we use "dmb" here?
2. If we can then should we use "dmb st", or "dmb oshst"?

Thank you very much.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/commit/?id=22ec71615d824f4f11d38d0e55a88d8956b7e45f



More information about the linux-arm-kernel mailing list