linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* RE: temp. mem mappings
@ 2001-06-11 16:32 cohutta
  2001-06-25  6:52 ` Eric W. Biederman
  0 siblings, 1 reply; 17+ messages in thread
From: cohutta @ 2001-06-11 16:32 UTC (permalink / raw)
  To: Joseph A. Knapka, Stephen C. Tweedie; +Cc: linux-mm

>===== Original Message From "Joseph A. Knapka" <jknapka@earthlink.net> =====
>"Stephen C. Tweedie" wrote:
>>
>> Hi,
>>
>> On Thu, Jun 07, 2001 at 09:38:06PM -0400, cohutta wrote:
>>
>> > >Right --- you can use alloc_pages but we haven't done the
>> > >initialisation of the kmalloc slabsl by this point.
>> >
>> > My testing indicates that i can't use __get_free_page(GFP_KERNEL)
>> > any time during setup_arch() [still x86].  It causes a BUG
>> > in slab.c (line 920) [linux 2.4.5].
>>
>> After paging_init(), it should be OK --- as long as there is enough
>> memory that you don't end up calling the VM try_to_free_page routines.
>> Those will definitely choke this early in boot.
>
>But we don't actually give the zone allocator any free pages
>until mem_init().

Right, so what Stephen warned about is happening:
__get_free_page() causes a BUG in slab.c via __alloc_pages()
-> try_to_free_pages() -> do_try_to_free_pages()
-> shrink_dcache_memory() -> kmem_cache_shrink() -> BUG().

/c/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

^ permalink raw reply	[flat|nested] 17+ messages in thread
* RE: temp. mem mappings
@ 2001-06-08  1:38 cohutta
  2001-06-08 17:02 ` Joseph A. Knapka
  2001-06-08 18:07 ` Stephen C. Tweedie
  0 siblings, 2 replies; 17+ messages in thread
From: cohutta @ 2001-06-08  1:38 UTC (permalink / raw)
  To: Stephen C. Tweedie; +Cc: linux-mm

>===== Original Message From "Stephen C. Tweedie" <sct@redhat.com> =====
>Hi,
>
>On Wed, Jun 06, 2001 at 05:14:26PM -0400, cohutta wrote:
>
>> I think this is part of the problem: on my 1 GB system, the
>> ACPI tables are at physical 0x3fffxxxx == virtual 0xffffxxxx,
>> which could conflict with the APIC and IOAPIC mappings
>> (from fixmap.h).
>
>Shouldn't be --- the fixmaps should be part of the kernel's dynamic
>virtual area, which is not identity mapped.  You can still map those
>physical addresses via kmap() on a highmem system (and a 1GB machine
>should be running a highmem kernel).

Well i now have a 768 MB machine, but i don't think that
makes a big difference with the problem that i am seeing
in mapping this ACPI memory early in setup_arch() [x86].

>> Well, i'm talking about physical memory, but it's marked as ACPI
>> data.
>
>If it is marked PG_Reserved, then ioremap() will work on it despite it
>being inside the normal physical memory area.  If not, kmap() will
>still work.
>
>> Another part of the problem is that I need to do this early in
>> arch/i386/kernel/setup.c::setup_arch(), like between calls to
>> paging_init() and init_apic_mappings().  I can't use ioremap()
>> here can i?  ioremap() calls get_vm_area() which calls
>> kmalloc(), and i don't think i can use kmalloc() just yet.
>
>Right --- you can use alloc_pages but we haven't done the
>initialisation of the kmalloc slabsl by this point.

My testing indicates that i can't use __get_free_page(GFP_KERNEL)
any time during setup_arch() [still x86].  It causes a BUG
in slab.c (line 920) [linux 2.4.5].  Did I misunderstand you?
Do you have another suggestion?

[for others who need it, not Stephen:
  __get_free_page() -> __get_free_pages() -> alloc_pages()
  -> __alloc_pages() ]

>_Why_ do you need access to the ACPI tables so early, though?

ACPI tables have much to say about booting on newer x86 systems.
I'll try to be more specific later, when i can.

>Cheers,
> Stephen

Thanks Stephen.
/c/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

^ permalink raw reply	[flat|nested] 17+ messages in thread
* RE: temp. mem mappings
@ 2001-06-06 21:14 cohutta
  2001-06-07 10:00 ` Stephen C. Tweedie
  0 siblings, 1 reply; 17+ messages in thread
From: cohutta @ 2001-06-06 21:14 UTC (permalink / raw)
  To: Stephen C. Tweedie; +Cc: linux-mm

>===== Original Message From "Stephen C. Tweedie" <sct@redhat.com> =====
>Hi,
>
>On Tue, Jun 05, 2001 at 04:42:52PM -0400, cohutta wrote:
>
>> I don't really want to play with the page tables if i can help it.
>> I didn't use ioremap() because it's real system memory, not IO bus
>> memory.
>>
>> How much normal memory is identity-mapped at boot on x86?
>> Is it more than 8 MB?
>
>> I'm trying to read some ACPI tables, like the FACP.
>> On my system, this is at physical address 0x3fffd7d7 (e.g.).
>
>It depends at what time during boot.  Some ACPI memory is reusable
>once the system boots: the kernel parses the table then frees up the
>memory which the BIOS initialised.
>
>VERY early in boot, while the VM is still getting itself set up, there
>is only a minimal mapping set up by the boot loader code.  However,
>once the VM is initialised far enough to let you play with page
>tables, all memory will be identity-mapped up to just below the 1GB
>watermark.

I think this is part of the problem: on my 1 GB system, the
ACPI tables are at physical 0x3fffxxxx == virtual 0xffffxxxx,
which could conflict with the APIC and IOAPIC mappings
(from fixmap.h).
I removed 256 MB, but i still have a few problems.

>> kmap() ends up calling set_pte(), which is close to what i am
>> already doing.  i'm having a problem on the unmap side when i
>> am done with the temporary mapping.
>
>kunmap().  :-)  But kmap only works on CONFIG_HIGHMEM kernel builds.
>On kernels built without high memory support, kmap will not allow you
>to access memory beyond the normal physical memory boundary.

Well, i'm talking about physical memory, but it's marked as ACPI
data.

Another part of the problem is that I need to do this early in
arch/i386/kernel/setup.c::setup_arch(), like between calls to
paging_init() and init_apic_mappings().  I can't use ioremap()
here can i?  ioremap() calls get_vm_area() which calls
kmalloc(), and i don't think i can use kmalloc() just yet.

methinks that i'm back to a modification of Timur's suggestion--
a bunch of manual page dir/table changes.

Any other suggestions or corrections to my comments?

thanks.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: temp. mem mappings
@ 2001-06-05 20:42 cohutta
  2001-06-05 20:59 ` Timur Tabi
  2001-06-06  8:23 ` Stephen C. Tweedie
  0 siblings, 2 replies; 17+ messages in thread
From: cohutta @ 2001-06-05 20:42 UTC (permalink / raw)
  To: linux-mm

> > > Allocate a virtual memory area using vmalloc and then save and
modify the
> > > pmd/pgd/pte to point to the physical memory you want.  To unmap,
just undo the
> > > previous steps.
> >
> > ioremap() is there for exactly that purpose.
>
> True, except that you can't use ioremap on normal memory, which is
what I
> assumed he was trying to do.

  Normal memory is identity-mapped very early in boot anyway (except for
  highmem on large Intel boxes, that is, and kmap() works for that.)
---

I don't really want to play with the page tables if i can help it.
I didn't use ioremap() because it's real system memory, not IO bus
memory.

How much normal memory is identity-mapped at boot on x86?
Is it more than 8 MB?

I'm trying to read some ACPI tables, like the FACP.
On my system, this is at physical address 0x3fffd7d7 (e.g.).

kmap() ends up calling set_pte(), which is close to what i am
already doing.  i'm having a problem on the unmap side when i
am done with the temporary mapping.

thanks.
/cohutta/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

^ permalink raw reply	[flat|nested] 17+ messages in thread
* temp. mem mappings
@ 2001-06-05 17:54 cohutta
  2001-06-05 18:25 ` Timur Tabi
  0 siblings, 1 reply; 17+ messages in thread
From: cohutta @ 2001-06-05 17:54 UTC (permalink / raw)
  To: linux-mm

hi-

i'm trying to map some memory during kernel init.
(this is x86-specific.)
this should be temporary, unmapped after use.
this memory is not in the low identity-mapped 8 MB.

currently i have this sorta working by using a new fixed
mapping (linux/include/asm-i386/fixmap.h) and calling
set_fixmap() which calls set_pte_phys().
after i use (access, read-only) this memory, i try to
unmap it so that i can use the same virtual address
again by calling set_fixmap() again.
i use pte_clear() to unmap it.
however the next time that i call set_fixmap(),
set_pte_phys() gives me a pte_ERROR()...because the
pte hasn't been cleared (?).
but the new mapping seems to work.

i tried to make this similar to linux/include/asm-i386/highmem.h.

what is the a preferred/correct method to map and unmap memory
temporarily?

thanks.
/cohutta/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2001-06-25  6:52 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-11 16:32 temp. mem mappings cohutta
2001-06-25  6:52 ` Eric W. Biederman
  -- strict thread matches above, loose matches on Subject: below --
2001-06-08  1:38 cohutta
2001-06-08 17:02 ` Joseph A. Knapka
2001-06-08 18:07 ` Stephen C. Tweedie
2001-06-08 21:22   ` Joseph A. Knapka
2001-06-06 21:14 cohutta
2001-06-07 10:00 ` Stephen C. Tweedie
2001-06-05 20:42 cohutta
2001-06-05 20:59 ` Timur Tabi
2001-06-05 22:27   ` Joseph A. Knapka
2001-06-06  8:23 ` Stephen C. Tweedie
2001-06-05 17:54 cohutta
2001-06-05 18:25 ` Timur Tabi
2001-06-05 18:41   ` Stephen C. Tweedie
2001-06-05 18:51     ` Timur Tabi
2001-06-05 18:59       ` Stephen C. Tweedie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox