Re: in_atomic() and DMA

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

 



On Fri, 2004-10-29 at 20:32 +0200, Michal Ludvig wrote:

> 1) What does it mean when the kernel is in state "atomic", i.e.
>    in_atomic()==1? How does it happen and what is allowed and what is
>    not there?

in_atomic() means that your code is atomic, that it does not except to
be rescheduled, will not be involuntarily preempted (nor should it
reschedule itself voluntarily), it should remain on the current
processor, etc.

Its a general way of saying "I am in a critical section" -- I say
general because it really includes more than that like, say, interrupt
handlers.  Anything that is truly atomic--presumes it will not be
interrupted and must run in entirety or not at all--hence the name.

Disabling preemption, get_cpu(), grabbing a spin lock, being in an
interrupt handler or softirq, etc all make you atomic.

> 2) Can I say about a given virtual address whether or not it is usable
>    for DMA? My function is called from different places and I want to
>    know if the pointer in its parameter can be used for DMA or if I
>    should copy the data to GFP_DMA-allocated space first.

Check out Documentation/DMA-API.txt

Particularly Part Ic.

	Robert Love



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux