public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Hartmann <jhartmann@valinux.com>
To: Timur Tabi <ttabi@interactivesi.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: ioremap_nocache problem?
Date: Thu, 25 Jan 2001 10:47:13 -0700	[thread overview]
Message-ID: <3A7066A1.5030608@valinux.com> (raw)
In-Reply-To: <3A6D5D28.C132D416@sangate.com> <20010123165117Z131182-221+34@kanga.kvack.org>  <20010123165117Z131182-221+34@kanga.kvack.org> ; from ttabi@interactivesi.com on Tue, Jan 23, 2001 at 10:53:51AM -0600 <20010125155345Z131181-221+38@kanga.kvack.org>  <20010125165001Z132264-460+11@vger.kernel.org> <E14LpvQ-0008Pw-00@mail.valinux.com>

Timur Tabi wrote:

> ** Reply to message from Jeff Hartmann <jhartmann@valinux.com> on Thu, 25 Jan
> 2001 10:04:47 -0700
> 
> 
> 
>>> The problem with this is that between the ioremap and iounmap, the page is
>>> reserved.  What happens if that page belongs to some disk buffer or user
>>> process, and some other process tries to free it.  Won't that cause a problem?
>> 
>> 	The page can't belong to some other process/kernel component.  You own 
>> the page if you allocated it.  
> 
> 
> Ok, my mistake.  I wasn't paying attention to the "get_free_pages" call.  My
> problem is that I'm ioremap'ing someone else's page, but my hardware sits on the
> memory bus disguised as real memory, and so I need to poke around the 4GB space
> trying to find it.

As in an MMIO aperture?  If its MMIO on the bus you should be able to 
just call ioremap with the bus address.  By nature of it being outside 
of real ram, it should automatically be uncached (unless you've set an 
MTRR over that region saying otherwise).

> 
> 
> 
>> (I was the one who added support to 
>> the kernel to ioremap real ram, trust me.)
> 
> 
> I really appreciate that feature, because it helps me a lot.  Any
> recommendations on how I can do what I do without causing any problems?  Right
> now, my driver never calls iounmap on memory that's in real RAM, even when it
> exits.  Fortunately, the driver isn't supposed to exit, so all it does is waste
> a few KB of virtual memory.

Look at the functions agp_generic_free_gatt_table and 
agp_generic_create_gatt_table in agpgart_be.c (drivers/char/agp).  They 
do the ioremap_nocache on real ram for the GATT/GART table.  Heres some 
quick pseudo code as well.

I_want_a_no_cached_page() {
alloc a page
reserve the page
flush every cpu's cache
ioremap_nocache the page
}

I_want_to_free_a_no_cached_page() {
iounmap the page
unreserve the page
free the page
}

-Jeff

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  parent reply	other threads:[~2001-01-25 17:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-23 10:30 ioremap_nocache problem? Mark Mokryn
2001-01-23 16:53 ` Timur Tabi
2001-01-23 18:12 ` Roman Zippel
2001-01-24  0:50   ` David Wragg
2001-01-24 15:14   ` Timur Tabi
     [not found]   ` <E14LRce-0008FU-00@diver.doc.ic.ac.uk>
2001-01-24 15:39     ` David Wragg
2001-01-23 18:38 ` Timur Tabi
2001-01-24  1:01   ` David Wragg
     [not found] ` <20010123165117Z131182-221+34@kanga.kvack.org>
2001-01-25 15:16   ` Stephen C. Tweedie
     [not found]     ` <200101251556.f0PFuPd01743@mail.redhat.com>
2001-01-26 10:37       ` Stephen C. Tweedie
2001-01-25 15:56   ` Timur Tabi
     [not found]   ` <20010125155345Z131181-221+38@kanga.kvack.org>
2001-01-25 16:44     ` Roman Zippel
     [not found]       ` <20010125164707Z131181-222+39@kanga.kvack.org>
2001-01-26 10:39         ` Stephen C. Tweedie
2001-01-25 16:49     ` Timur Tabi
2001-01-25 17:04       ` Jeff Hartmann
2001-01-25 17:11       ` Timur Tabi
     [not found]       ` <E14LpvQ-0008Pw-00@mail.valinux.com>
2001-01-25 17:47         ` Jeff Hartmann [this message]
     [not found]           ` <20010125175027Z131219-222+40@kanga.kvack.org>
2001-01-26 10:43             ` Stephen C. Tweedie
2001-01-25 17:53         ` Timur Tabi
2001-01-25 18:13           ` Jeff Hartmann
2001-01-25 18:18           ` Timur Tabi
     [not found]           ` <E14Lqyt-0003z6-00@mail.valinux.com>
2001-01-25 18:46             ` Jeff Hartmann

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=3A7066A1.5030608@valinux.com \
    --to=jhartmann@valinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ttabi@interactivesi.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