Messages in this thread | | | Date | Fri, 31 Aug 2007 17:25:55 +0200 | From | "anon... anon.al" <> | Subject | memory barrier to ensure copy_to_user() completes |
| |
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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |