Re: memory barrier to ensure copy_to_user() completes
- From: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>
- Date: Fri, 31 Aug 2007 17:08:07 +0100
Which memory barrier do I require if I need to ensure that a
copy_to_user(dest, src, len) completes before the next statement?
Define "completes"
copy_to_user(dest, src, len) ;
//rmb(); OR wmb(); OR barrier(); OR mb(); ??????
Usually none of them
If I'm writing to hardware, and need to ensure the correct order, I'll
use wmb(), right?
No
e.g.:
#define HW_address1 20
#define HW_address2 40
*((int *)HW_address1) = 0x00000001;
wmb(); // is this good???
*((int *)HW_address2) = 0x00000010;
Linux doesn't define directly poking kernel addresses to hit hardware as
valid (and on many platforms it doesn't work). Use readl/writel and their
ordering is defined.
Read Documentation/io_ordering.txt and Docuemntation/pci.txt
-
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/
- References:
- memory barrier to ensure copy_to_user() completes
- From: anon... anon.al
- memory barrier to ensure copy_to_user() completes
- Prev by Date: [PATCH][RFC] Starting point for deprecating "ether=" boot time option.
- Next by Date: Distributed storage. Security attributes and ducumentation update.
- Previous by thread: memory barrier to ensure copy_to_user() completes
- Next by thread: [ANNOUNCE] DeskOpt - on fly task, i/o scheduler optimization
- Index(es):
Relevant Pages
|
|