From: Daniel Phillips <phillips@arcor.de>
To: <imran.badr@cavium.com>,
"'Manfred Spraul'" <manfred@colorfullife.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: Calculating kernel logical address ..
Date: Sat, 7 Sep 2002 03:57:20 +0200 [thread overview]
Message-ID: <E17nUqf-0006Lk-00@starship> (raw)
In-Reply-To: <00e901c255c8$bd144e80$9e10a8c0@IMRANPC>
On Friday 06 September 2002 19:13, Imran Badr wrote:
> > adr = user_address;
> > pgd_offset(current->mm, adr);
> >
> > if (!pgd_none(*pgd)) {
> > pmd = pmd_offset(pgd, adr);
> > if (!pmd_none(*pmd)) {
> > ptep = pte_offset(pmd, adr);
> > pte = *ptep;
> > if(pte_present(pte)) {
> > kaddr = (unsigned long) page_address(pte_page(pte));
> > kaddr |= (adr & (PAGE_SIZE - 1));
> > }
> > }
> > }
> >
> > Will this code always give me correct kernel logical address?
>
> I was wondering if the code which I am using, will always give me addresses
> no matter whether HIGHMEM is defined in kernel configuration or not.
On second thought, this code does have problems with highmem. The page in
question was never kmapped, so no kernel address was assigned if the page
was a high memory page. Besides that, there are other other changes to
page address that imply it can't be used with a high memory page. So the
above code isn't generic.
> I
> belive that it should not be problem because I am mmap'ing kmalloc'ed memory
> which always returns mapped memory. But whats happeing in my lab is
> different. If I define HIGHMEM in kernel configuration and install 2GB of
> memory in my server then I see a crash in the kernel where I try to access
> kaddr calculated bu above code. Any idea?
Because of what I just said.
> The problem with your suggestion is that at the point where user gives me an
> address for DMA, I do not know what kmalloc_buffer and vma->vm_start values
> are. Also, if there are more than one processes accessing the driver, then
> how am I going to keep track of all mmap'ed memory.
--
Daniel
next prev parent reply other threads:[~2002-09-07 7:05 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-06 15:44 Manfred Spraul
2002-09-06 17:13 ` Imran Badr
2002-09-07 1:57 ` Daniel Phillips [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-09-09 21:19 Manfred Spraul
2002-09-09 21:47 ` Andrew Morton
2002-09-10 17:01 ` Manfred Spraul
2002-09-09 21:02 Manfred Spraul
2002-09-09 21:07 ` Imran Badr
2002-09-09 17:06 Imran Badr
2002-09-09 17:29 ` Richard B. Johnson
2002-09-09 17:23 ` David S. Miller
2002-09-09 17:34 ` Martin J. Bligh
2002-09-09 17:40 ` Daniel Phillips
2002-09-09 17:31 ` Imran Badr
2002-09-09 18:00 ` Richard B. Johnson
2002-09-09 18:12 ` Imran Badr
2002-09-09 18:27 ` Daniel Phillips
2002-09-09 18:41 ` Imran Badr
2002-09-09 21:55 ` Alan Cox
2002-09-09 22:52 ` Imran Badr
2002-09-09 23:09 ` Alan Cox
2002-09-09 18:13 ` Jesse Barnes
2002-09-09 18:25 ` Daniel Phillips
2002-09-09 19:40 ` Andrew Morton
2002-09-09 20:41 ` Daniel Phillips
2002-09-10 6:43 ` Jens Axboe
2002-09-10 7:12 ` Andrew Morton
2002-09-09 18:42 ` Andrew Morton
2002-09-10 7:03 ` Gerd Knorr
2002-09-09 18:16 ` Kurt Ferreira
2002-09-09 18:17 ` David S. Miller
2002-09-09 18:17 ` Daniel Phillips
2002-09-09 18:43 ` Richard B. Johnson
2002-09-09 18:50 ` Daniel Phillips
2002-09-09 18:57 ` Richard B. Johnson
2002-09-09 18:08 ` Andrew Morton
2002-09-09 18:23 ` Daniel Phillips
2002-09-09 18:49 ` Imran Badr
2002-09-09 18:46 ` David S. Miller
2002-09-09 19:06 ` Daniel Phillips
2002-09-09 19:14 ` Andrew Morton
2002-09-09 19:23 ` Imran Badr
2002-09-06 3:23 side-by-side Re: BYTE Unix Benchmarks Version 3.6 Daniel Phillips
2002-09-06 3:34 ` Calculating kernel logical address Imran Badr
2002-09-07 1:44 ` Daniel Phillips
2002-09-08 0:01 ` David S. Miller
2002-09-08 18:44 ` Daniel Phillips
2002-09-09 5:00 ` David S. Miller
2002-09-09 5:17 ` Daniel Phillips
2002-09-09 5:28 ` David S. Miller
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=E17nUqf-0006Lk-00@starship \
--to=phillips@arcor.de \
--cc=imran.badr@cavium.com \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.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
all inboxes | Powered by JetHome®