memory barrier to ensure copy_to_user() completes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

a)
Which memory barrier do I require if I need to ensure that a
copy_to_user(dest, src, len) completes before the next statement?

copy_to_user(dest, src, len) ;
//rmb(); OR wmb(); OR barrier(); OR mb(); ??????
//next statement;

I'm guessing:
Use rmb() to be sure that all of src is in registers, before continuing.
Use wmb() to be sure that all of src is actually written to dest
memory, before continuing.
?

b)

If I'm writing to hardware, and need to ensure the correct order, I'll
use wmb(), right?
e.g.:

#define HW_address1 20
#define HW_address2 40

*((int *)HW_address1) = 0x00000001;
wmb();  // is this good???
*((int *)HW_address2) = 0x00000010;


Thanks - Albert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux