[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <379fb4870708310825o70509368l490ac9063ce09866@mail.gmail.com>
Date: Fri, 31 Aug 2007 17:25:55 +0200
From: "anon... anon.al" <anon.asdf@...il.com>
To: linux-kernel@...r.kernel.org
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists