From: mulyadi.santosa@gmail.com (Mulyadi Santosa)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Build scatterlist covering a process' text segment?
Date: Sat, 28 May 2011 16:42:56 +0700 [thread overview]
Message-ID: <BANLkTim3bwXaGXaeXo7D8ZprNUgCw7CK2g@mail.gmail.com> (raw)
In-Reply-To: <4DE01E94.8000505@enea.com>
Hi...
On Sat, May 28, 2011 at 04:58, Arvid Brodin <arvid.brodin@enea.com> wrote:
> Ok. And looking at e.g. sg_set_buf(), the scatterlist expects a kernel virtual
> address (it uses virt_to_page() on its "buf" parameter internally, which
> requires a kernel virtual adress, if I understand correctly).
>
> There seems to be no way to map process adresses to kernel addresses. (Well I
> guess one could follow the page tables to get the physical page, and then map
> back to kernel space, but this only works as long as the memory is paged in.)
> Please correct me if I'm wrong.
I am not good at it, but I think at the first place, you might use
get_user_pages() (take a look here
:http://lxr.linux.no/#linux+v2.6.39/mm/memory.c#L1703)
then once you get the pointer to the pages (and making sure they're
pinned by get_user_pages), I think you just need to use kmap().
I suggest to really observe that scatter gather function and see if
address in kernel address space is really needed.... if not, you can
avoid using kmap() completely.
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
next prev parent reply other threads:[~2011-05-28 9:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-23 23:06 Build scatterlist covering a process' text segment? Arvid Brodin
2011-05-25 20:27 ` Arvid Brodin
2011-05-26 4:02 ` Mulyadi Santosa
2011-05-27 21:58 ` Arvid Brodin
2011-05-28 9:42 ` Mulyadi Santosa [this message]
2011-06-17 0:47 ` Arvid Brodin
2011-06-17 15:10 ` Jonathan Neuschäfer
2011-06-17 15:18 ` Metin KAYA
2011-06-17 17:59 ` Dave Hylands
2011-06-17 18:46 ` Jonathan Neuschäfer
2011-06-17 18:53 ` Dave Hylands
2011-06-17 19:00 ` Jonathan Neuschäfer
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=BANLkTim3bwXaGXaeXo7D8ZprNUgCw7CK2g@mail.gmail.com \
--to=mulyadi.santosa@gmail.com \
--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).