Skip to contentSkip to conversation

v3.16-rc1 & default cachepolicy

PATCH New Aaro Koskinen 3 participants 6 messages Jun 19, 2014 – Jun 20, 2014 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

Hi,

When booting v3.16-rc1 on OMAP1, I noticed strange slowness. E.g. initramfs unpack takes several minutes. This was caused by default cachepolicy getting changed from writethrough -> uncached for some reason:

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 3.16.0-rc1-e3-los_880e+ (aaro at cooljazz) (gcc version 4.9.0 (GCC) ) #1 PREEMPT Thu Jun 19 22:51:42 EEST 2014
[    0.000000] CPU: ARM925T [54029252] revision 2 (ARMv4T), cr=0000317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: Amstrad E3 (Delta)
[    0.000000] Ignoring memory below PHYS_OFFSET: 0x02000000-0x10000000
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] Memory policy: Data cache uncached
[...]
[    4.602732] Unpacking initramfs...
[  425.125093] Freeing initrd memory: 3532K (c1c00000 - c1f73000)

It seems this is caused by commit:

commit ca8f0b0a545f55b3dc6877cda24d609a8979c951

Author: Russell King <[email protected]>
Date:   Tue May 27 20:34:28 2014 +0100

ARM: ensure C page table setup code follows assembly code

I can workaround this with "cachepolicy=writethrough" parameter.

A.

#1 lore raw
Quoted 21 lines · Aaro Koskinen

Hi,

When booting v3.16-rc1 on OMAP1, I noticed strange slowness. E.g. initramfs unpack takes several minutes. This was caused by default cachepolicy getting changed from writethrough -> uncached for some reason:

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 3.16.0-rc1-e3-los_880e+ (aaro at cooljazz) (gcc version 4.9.0 (GCC) ) #1 PREEMPT Thu Jun 19 22:51:42 EEST 2014
[    0.000000] CPU: ARM925T [54029252] revision 2 (ARMv4T), cr=0000317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: Amstrad E3 (Delta)
[    0.000000] Ignoring memory below PHYS_OFFSET: 0x02000000-0x10000000
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] Memory policy: Data cache uncached
[...]
[    4.602732] Unpacking initramfs...
[  425.125093] Freeing initrd memory: 3532K (c1c00000 - c1f73000)

It seems this is caused by commit:

Quoted 7 lines

commit ca8f0b0a545f55b3dc6877cda24d609a8979c951

Author: Russell King <[email protected]>
Date:   Tue May 27 20:34:28 2014 +0100

ARM: ensure C page table setup code follows assembly code

I can workaround this with "cachepolicy=writethrough" parameter.

It brings up the question - proc-arm925.S contains:

        .long   PMD_TYPE_SECT | \
                PMD_BIT4 | \
                PMD_SECT_AP_WRITE | \
                PMD_SECT_AP_READ
        .long   PMD_TYPE_SECT | \
                PMD_BIT4 | \
                PMD_SECT_AP_WRITE | \
                PMD_SECT_AP_READ

In other words, it's telling the assembly code to setup uncached mappings for everything, even memory. Most people want to set memory up (even at the assembly code time) in cacheable mode... so I'd suggest adding:

                PMD_SECT_BUFFERABLE | \
                PMD_SECT_CACHEABLE | \

from the first. You'll find it in the .macro at the end of proc-arm925.S. Please let me know if that works for you.

Thanks.

Signature · 2 lines
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
#2 lore raw

Hi,

Quoted 43 lines · Russell King - ARM Linux
Quoted 19 lines · Aaro Koskinen

When booting v3.16-rc1 on OMAP1, I noticed strange slowness. E.g. initramfs unpack takes several minutes. This was caused by default cachepolicy getting changed from writethrough -> uncached for some reason:

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 3.16.0-rc1-e3-los_880e+ (aaro at cooljazz) (gcc version 4.9.0 (GCC) ) #1 PREEMPT Thu Jun 19 22:51:42 EEST 2014
[    0.000000] CPU: ARM925T [54029252] revision 2 (ARMv4T), cr=0000317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: Amstrad E3 (Delta)
[    0.000000] Ignoring memory below PHYS_OFFSET: 0x02000000-0x10000000
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] Memory policy: Data cache uncached
[...]
[    4.602732] Unpacking initramfs...
[  425.125093] Freeing initrd memory: 3532K (c1c00000 - c1f73000)

It seems this is caused by commit:

Quoted 7 lines

commit ca8f0b0a545f55b3dc6877cda24d609a8979c951

Author: Russell King <[email protected]>
Date:   Tue May 27 20:34:28 2014 +0100

ARM: ensure C page table setup code follows assembly code

I can workaround this with "cachepolicy=writethrough" parameter.

It brings up the question - proc-arm925.S contains:

        .long   PMD_TYPE_SECT | \
                PMD_BIT4 | \
                PMD_SECT_AP_WRITE | \
                PMD_SECT_AP_READ
        .long   PMD_TYPE_SECT | \
                PMD_BIT4 | \
                PMD_SECT_AP_WRITE | \
                PMD_SECT_AP_READ

In other words, it's telling the assembly code to setup uncached mappings for everything, even memory. Most people want to set memory up (even at the assembly code time) in cacheable mode... so I'd suggest adding:

Quoted 5 lines
                PMD_SECT_BUFFERABLE | \
                PMD_SECT_CACHEABLE | \

from the first. You'll find it in the .macro at the end of proc-arm925.S. Please let me know if that works for you.

So I tried the below change. But now it hangs early, even before the earlyprintk is working. :-/

A.

arch/arm/mm/proc-arm925.S +2 -0
index 97448c3..cb7c0e7 100644
@@ -502,6 +502,8 @@ __\name\()_proc_info:
 	.long	\cpu_val
 	.long	\cpu_mask
 	.long   PMD_TYPE_SECT | \
+		PMD_SECT_BUFFERABLE | \
+		PMD_SECT_CACHEABLE | \
 		PMD_BIT4 | \
 		PMD_SECT_AP_WRITE | \
 		PMD_SECT_AP_READ
#3 lore raw
Quoted 2 lines · Aaro Koskinen

So I tried the below change. But now it hangs early, even before the earlyprintk is working. :-/

Thanks for trying. I notice you said "write-through", so can you drop the PMD_SECT_BUFFERABLE flag and try again please?

Signature · 2 lines
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
#4 lore raw

Hi,

Quoted 6 lines · Russell King - ARM Linux
Quoted 2 lines · Aaro Koskinen

So I tried the below change. But now it hangs early, even before the earlyprintk is working. :-/

Thanks for trying. I notice you said "write-through", so can you drop the PMD_SECT_BUFFERABLE flag and try again please?

Yes, that works.

A.

#5 lore raw

PATCH 1/1 ARM: arm925: ensure assembly sets up writethrough mapping

Commit ca8f0b0a545f ("ARM: ensure C page table setup code follows assembly code") did what it said on the tin, but some of the older CPU code omitted the default cache policy from their files. This results in the kernel running with the caches disabled. Fix this for ARM925.

---
 arch/arm/mm/proc-arm925.S | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mm/proc-arm925.S +1 -0
index 97448c3acf38..ba0d58e1a2a2 100644
@@ -502,6 +502,7 @@ __\name\()_proc_info:
 	.long	\cpu_val
 	.long	\cpu_mask
 	.long   PMD_TYPE_SECT | \
+		PMD_SECT_CACHEABLE | \
 		PMD_BIT4 | \
 		PMD_SECT_AP_WRITE | \
 		PMD_SECT_AP_READ
Signature · 1 line
1.8.3.1