Re: memory barrier to ensure copy_to_user() completes

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

 



> 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 [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