public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: mdaljeet@in.ibm.com
Cc: linux-kernel@vger.kernel.org, kraxel@bytesex.org
Subject: Re: query regarding 'map_user_kiobuf'
Date: Tue, 29 May 2001 20:28:17 +0100	[thread overview]
Message-ID: <2332.991164497@redhat.com> (raw)
In-Reply-To: <CA256A5B.00548719.00@d73mta01.au.ibm.com>
In-Reply-To: <CA256A5B.00548719.00@d73mta01.au.ibm.com>


mdaljeet@in.ibm.com said:
> After using the 'map_user_kiobuf', I observed the followiing:
> 
> 1. 'kiobuf->maplist[0]->virtual' contains a different virtual address than
> the user space buffer address
> 2. But these two addresses are mapped as when i write something using the
> address 'kiobuf->maplist[0]->virtual' inside the kernel, I see the same
> data in the user space buffer in my application.
> 3. I use the 'virt_to_phys' operation to the virtual address
> 'kiobuf->maplist[0]->virtual' to get the physical address.
> 4. I use this physical address for DMA operations.
> 
> Now, using this information I do a DMA from card to system memory. What I
> have noticed is that DMA happens somewhere else in the system memory. I am
> not able to execute most of the commands (ls, chmod, cat, clear etc) after
> my user program exits.
> 
> Am I doing the steps 3 and 4 above right?

After calling map_user_kiobuf(), I believe you should be locking the pages
in memory by calling lock_kiovec(). Otherwise, nothing prevents them from 
being paged out again.

Also, the pages may be in high memory and not directly accessible. You should
use kmap() before touching them from the kernel rather than just using 
page->virtual, and obviously kunmap() afterwards.

The PCI DMA interface is more complex than simply using virt_to_phys() too, 
if you want to deal correctly with the highmem case. I'm sure others will 
give you the details or pointers to the documentation.

--
dwmw2



  reply	other threads:[~2001-05-29 19:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa.f4liqpv.6lq2r7@ifi.uio.no>
2001-05-29 14:04 ` query regarding 'map_user_kiobuf' mdaljeet
2001-05-29 19:28   ` David Woodhouse [this message]
     [not found]   ` <fa.e3ea6bv.t0ceia@ifi.uio.no>
2001-05-30 15:12     ` William Waddington
2001-05-30 15:37     ` David Woodhouse

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=2332.991164497@redhat.com \
    --to=dwmw2@infradead.org \
    --cc=kraxel@bytesex.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdaljeet@in.ibm.com \
    /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