memory barrier to ensure copy_to_user() completes
- From: "anon... anon.al" <anon.asdf@xxxxxxxxx>
- Date: Fri, 31 Aug 2007 17:25:55 +0200
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: memory barrier to ensure copy_to_user() completes
- From: Alan Cox
- Re: memory barrier to ensure copy_to_user() completes
- Prev by Date: Re: [11/36] Use page_cache_xxx in fs/buffer.c
- Next by Date: Re: [PATCH] input: Silence 'unused variable' warning in iforce joystick driver
- Previous by thread: [PATCH 0/3] debloat aic7xxx and aic79xx drivers
- Next by thread: Re: memory barrier to ensure copy_to_user() completes
- Index(es):
Relevant Pages
|
|