Skip to contentSkip to conversation

HIGHMEM

DISCUSSION Hdei Nunoe 5 participants 16 messages Dec 7, 2004 – Jan 11, 2005 MIPS

lore
Share & tools
lore

Hdei Nunoe

author
#0 lore raw

Hi there,

Has anyone succeeded the HIGHMEM with discontiguous physical memory?
I am using kernel 2.4.18 on TX4937 with two chunks of 256Mbyte memory.
There is 256Mbyte gap in between the physical memory blocks - lower memory is 0x00000000 to 0x10000000, upper memory is 0x20000000 to 0x30000000. System hungs when it create INIT process.

Cheers,
-hdei

#1 lore raw

On Tue, 2004-12-07 10:07:26 +0900, Hdei Nunoe <[email protected]> wrote in message <001101c4dbf9$1da02270$3ca06096@NUNOE>:

Quoted 2 lines

Has anyone succeeded the HIGHMEM with discontiguous physical memory? I am using kernel 2.4.18 on TX4937 with two chunks of 256Mbyte memory.

2.4.18 is obsolete...

MfG, JBG

Signature · 4 lines
Jan-Benedict Glaw       [email protected]    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
author
#2 lore raw

Hi Jan,

Will it work on the newer version?

Cheers,
-hdei

----- Original Message ----- From: "Jan-Benedict Glaw" <[email protected]>
To: "Hdei Nunoe" <[email protected]>
Cc: <[email protected]>
Sent: Tuesday, December 07, 2004 6:17 PM
Subject: Re: HIGHMEM

Quoted 2 lines

Has anyone succeeded the HIGHMEM with discontiguous physical memory? I am using kernel 2.4.18 on TX4937 with two chunks of 256Mbyte memory.

2.4.18 is obsolete...

MfG, JBG

#4 lore raw
In reply to Hdei Nunoe
Quoted 5 lines · Hdei Nunoe

Has anyone succeeded the HIGHMEM with discontiguous physical memory? I am using kernel 2.4.18 on TX4937 with two chunks of 256Mbyte memory. There is 256Mbyte gap in between the physical memory blocks - lower memory is 0x00000000 to 0x10000000, upper memory is 0x20000000 to 0x30000000. System hungs when it create INIT process.

In 2.4 the support for CONFIG_DISCONTIG and CONFIG_NUMA are a bit tangled with each other because IP27 is the only platform to uses these features and it needs both. Other than that you can also just setup your system as 0x0 - 0x10000000 being RAM, 0x10000000 - 0x20000000 being reserved memory and 0x20000000 - 0x30000000 being highmem. Which works but is a bit wasteful.

Issue #2 is that we don't support the combination of CONFIG_DISCONTIG and CONFIG_HIGHMEM. And highmem is a lobotomized solution for lobotomized silicon anyway. You have a 64-bit processor - use it's capabilities :-)

Issue #3 - As I recall the TX4937's H3 core is suffering from cache aliases. Handling those efficiently for highmem is not easily possible and so we don't even try. More recent kernels will refuse to enable highmem on such cache configurations but something like 2.4.18 which by now is an almost 3 year old antique doesn't know about that and will happily crash.

I recommend you should go for a 64-bit kernel instead. And 64-bit support is certainly better in 2.6 than in 2.4. Especially the area of 32-bit binary compatibility has been improved significantly.

Ralf

#3 lore raw
In reply to Hdei Nunoe

On Tue, 2004-12-07 18:56:33 +0900, Hdei Nunoe <[email protected]> wrote in message <002101c4dc43$08c4c7d0$3ca06096@NUNOE>:

Quoted 1 line

Will it work on the newer version?

Did you try recent 2.6.x versions?

MfG, JBG

Signature · 4 lines
Jan-Benedict Glaw       [email protected]    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
#5 lore raw
In reply to Ralf Baechle
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Ralf Baechle

ralf> Issue #3 - As I recall the TX4937's H3 core is suffering from ralf> cache aliases. Handling those efficiently for highmem is not ralf> easily possible and so we don't even try. More recent kernels ralf> will refuse to enable highmem on such cache configurations but ralf> something like 2.4.18 which by now is an almost 3 year old ralf> antique doesn't know about that and will happily crash.

ralf> I recommend you should go for a 64-bit kernel instead. And ralf> 64-bit support is certainly better in 2.6 than in 2.4. ralf> Especially the area of 32-bit binary compatibility has been ralf> improved significantly.

And this is a small step to a 64-bit kernel for TX49XX. Could you apply?

arch/mips/mm/Makefile +1 -0
@@ -49,6 +49,7 @@
 endif
 ifdef CONFIG_MIPS64
 obj-$(CONFIG_CPU_R4300)		+= tlbex64.o
+obj-$(CONFIG_CPU_TX49XX)	+= tlbex64.o
 obj-$(CONFIG_CPU_R4X00)		+= tlbex64.o
 obj-$(CONFIG_CPU_R5000)		+= tlbex64.o
 obj-$(CONFIG_CPU_NEVADA)	+= tlbex64.o
author
#10 lore raw
In reply to Ralf Baechle

Ralf,

Thanks for the info! I still have a ocuple of question, hope you do not mind.

Quoted 3 lines

In 2.4 the support for CONFIG_DISCONTIG and CONFIG_NUMA are a bit tangled with each other because IP27 is the only platform to uses these features and it needs both.

Is it named "sgi-ip27"?

Quoted 4 lines

Other than that you can also just setup your system
as 0x0 - 0x10000000 being RAM, 0x10000000 - 0x20000000 being reserved memory and 0x20000000 - 0x30000000 being highmem. Which works but is a bit wasteful.

The gap in physical memory is 0x10000000 - 0x20000000, but it is 0x90000000 - 0xC0000000 in virtual memory because there is K1 segment. So the macros such as __pa() or __va() does not work, I think. Started to wonder it might not be easy as just changing the PAGE_OFFSET value. Do you see?

cheers,
-hdei

#11 lore raw
Quoted 5 lines · Hdei Nunoe
Quoted 3 lines

In 2.4 the support for CONFIG_DISCONTIG and CONFIG_NUMA are a bit tangled with each other because IP27 is the only platform to uses these features and it needs both.

Is it named "sgi-ip27"?

Yes, obviously :-)

Quoted 5 lines
Quoted 4 lines

Other than that you can also just setup your system
as 0x0 - 0x10000000 being RAM, 0x10000000 - 0x20000000 being reserved memory and 0x20000000 - 0x30000000 being highmem. Which works but is a bit wasteful.

Quoted 7 lines

The gap in physical memory is 0x10000000 - 0x20000000, but it is 0x90000000 -
0xC0000000 in virtual memory because there is K1 segment. So the macros such
as __pa() or __va() does not work, I think. Started to wonder it might not be easy
as just changing the PAGE_OFFSET value. Do you see?

PAGE_OFFSET is the difference of a ZONE_NORMAL's virtual address and it's physical address. Once there is no more 1:1 mapping between physical and virtual addresses such as in your suggestion PAGE_OFFSET can no longer be used, that is you need to rewrite all users of this function.

Ralf

#7 lore raw
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line · Ralf Baechle

And this is a small step to a 64-bit kernel for TX49XX. Could you apply?

ralf> Sure, done.

Thanks. And this is next step. Could you apply too?

include/asm-mips/addrspace.h +1 -0
diff -u linux-mips/include/asm-mips/addrspace.h linux/include/asm-mips/addrspace.h 
@@ -126,6 +126,7 @@
     || defined (CONFIG_CPU_R4X00)					\
     || defined (CONFIG_CPU_R5000)					\
     || defined (CONFIG_CPU_NEVADA)					\
+    || defined (CONFIG_CPU_TX49XX)					\
     || defined (CONFIG_CPU_MIPS64)
 #define	KUSIZE			0x0000010000000000	/* 2^^40 */
 #define	KUSIZE_64		0x0000010000000000	/* 2^^40 */
author
#8 lore raw

MIPS32 -> MIPS64

Hello,

Could anyone tell how significant the migration from MIPS32 to MIPS64 is?
Is it just re-building with the MIPS64 toolchain? Or is it like another architecture porting?

Regards,
-hdei

#9 lore raw

Re: MIPS32 -> MIPS64

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Hdei Nunoe

nunoe> Could anyone tell how significant the migration from MIPS32 to nunoe> MIPS64 is? Is it just re-building with the MIPS64 toolchain? nunoe> Or is it like another architecture porting?

Just rebuilding will not be enough, but the migration will not be so hard.

Most of you have to do is using correct integer data types ('long' is 64bit and 'int' is 32bit in mips64 kernel).

---
Atsushi Nemoto

author
#12 lore raw
In reply to Ralf Baechle

Ralf,

It worked fine with small changes!! Comment and Criticism are welcome.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Other than that you can also just setup your system
as 0x0 - 0x10000000 being RAM, 0x10000000 - 0x20000000 being reserved memory and 0x20000000 - 0x30000000 being highmem. Which works but is a bit wasteful.

I have set up my system as following :
- 0x00000000 - 0x10000000 RAM
- 0x10000000 - 0x40000000 RESERVED
- 0x40000000 - 0x50000000 RAM
So that the gap in physical address space and one in virtual address space becomes equal. It is 0x40000000 in this case (0x10000000 - 0x40000000 vs 0x90000000 - 0xc0000000). That means no physical <-> virtual macro change are needed. hehe...
And the MMU mapping to the upper 256MB is fixed with the CP0 wired register.

Changes are pretty small as follows :
--- tlb-r4k.c ---
381c381
< write_32bit_cp0_register(CP0_WIRED, 0);
---

Quoted 1 line
      write_32bit_cp0_register(CP0_WIRED, 8 /* XXX 0 */);

--- pgtable.h ---
123c123
< #define VMALLOC_START KSEG2
---

Quoted 1 line

#define VMALLOC_START KSEG3 /* XXX KSEG2 */

--- page.h ---
148c148
< #define HIGHMEM_START 0x20000000UL
---

Quoted 1 line

#define HIGHMEM_START 0x50000000UL /* XXX 0x20000000UL */

--- prom.c ---

Quoted 29 lines
      add_memory_region(0, (256*1024*1024), BOOT_MEM_RAM);
      add_memory_region(0x10000000, (256*1024*1024), BOOT_MEM_RESERVED);
      add_memory_region(0x20000000, (512*1024*1024), BOOT_MEM_RESERVED);
      add_memory_region(0x40000000, (256*1024*1024), BOOT_MEM_RAM);

      {
          TLB_TBL32 tlb;
          unsigned int nTlb = 48;             /* max TLB entry */
          unsigned int size = 0x02000000;     /* 32MB boundary */
          unsigned int vadr = 0xc0000000;     /* virtual address */
          unsigned int padr = 0x40000000;     /* physical address */

          printk ("memory map started.\n");
            for (i=0; i<8; i++)
              {
              tlb.mask = 0x01ffe000;          /* 16M bit[24-13] */
              tlb.hi  = vadr + (i*size);
              tlb.lo1 = (padr >> 6) | ((i*size + (size/2)) >> 6) | 0x1f;
              tlb.lo0 = (padr >> 6) | ((i*size) >> 6) | 0x1f;
              setTLB32 (i, &tlb);
              }
            for (i=8; i<nTlb; i++)
              {
              tlb.mask = 0x0;
              tlb.hi  = 0x80000000;
              tlb.lo1 = 0;
              tlb.lo0 = 0;
              setTLB32 (i, &tlb);
              }
Quoted 8 lines
            for (i=0; i<nTlb; i++)
              {
              getTLB32 (i, &tlb);
              printk ("get: mask=0x%08x hi=0x%08x lo0=0x%08x 
lo1=0x%08x.\n",
                      tlb.mask, tlb.hi, tlb.lo0, tlb.lo1);
              }
      }

Cheers,
-hdei

#13 lore raw
Quoted 4 lines · Hdei Nunoe

I have set up my system as following :
- 0x00000000 - 0x10000000 RAM
- 0x10000000 - 0x40000000 RESERVED
- 0x40000000 - 0x50000000 RAM

Your setup may work it's pretty wasteful; you're burning 12MB memory for unused kernel data structures.

Ralf

#14 lore raw
Quoted 8 lines · Ralf Baechle
Quoted 4 lines · Hdei Nunoe

I have set up my system as following :
- 0x00000000 - 0x10000000 RAM
- 0x10000000 - 0x40000000 RESERVED
- 0x40000000 - 0x50000000 RAM

Your setup may work it's pretty wasteful; you're burning 12MB memory for unused kernel data structures.

Time to start using virtually contiguous memory, like m68k does? ;-) (no, it's not in mainline)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#15 lore raw
Quoted 2 lines · Geert Uytterhoeven

Time to start using virtually contiguous memory, like m68k does? ;-) (no, it's not in mainline)

Won't work for MIPS; there's the KSEG1 address gap.

Ralf