From: malte.vesper@postgrad.manchester.ac.uk (Malte Vesper)
To: kernelnewbies@lists.kernelnewbies.org
Subject: mapping driver allocated memory to process
Date: Thu, 26 Mar 2015 02:28:07 +0000 [thread overview]
Message-ID: <55136EB7.4080107@postgrad.manchester.ac.uk> (raw)
Hello,
I am working on a DMA driver and noticed that consistent dma performs
rapidly better than streaming dma. Since I want to employ zero copy dma
I want to map the memory the driver allocates with dmam_alloc_coherent
into the user process. I would like to implement this using IOCTL rather
than mmap.
I had a look at dma_mmap_attrs, which expects a vm_area struct. Is it ok
to simply allocate one and fill it with apropriate data like in
mmap_region(lxr.free-electrons.com/source/mm/mmap.c#L1594), if so I
noticed that the kernel uses a memory pool (vm_area_cachep), which I
apparently can't access (dmesg: Unknown symbol vm_area_cachep (err 0)),
can I just wildly allocate or is there some black magic connected that
relies on vma structs beeing in the area of the pool?
I also looked at install_special_mapping which seems even closer to what
I want to do (I do not need to provide a vma), however it is not
exported as well. Is there a way to use it in a dynamic module anyway? I
saw it used mainly in arch specific code.
do_mmap, seems to have disappeared (at least it is not in any sane place
in the 3.19 lxr),
do_mmap_pgoff seems to be wrong for the job since I do not see how to
tell that function that I have struct** page, rather than a file to back
the mapping.
I would greatly appreciate pointers on up to date summaries on the
memory system, http://linux-mm.org/ seems slightly stale,
https://www.kernel.org/doc/gorman/pdf/understand.pdf was helpful,
although I could not entirly read it (yet).
Any pointers to helpful functions, or gotchas are much appreciated. (I
hope I managed to make it clear, that I tried to do my research + trial
and lots of error...).
Thanks,
Malte
reply other threads:[~2015-03-26 2:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55136EB7.4080107@postgrad.manchester.ac.uk \
--to=malte.vesper@postgrad.manchester.ac.uk \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).