Hello Jacky, On Tue, May 29, 2012 at 10:09 AM, h.t.jacky@gmail.com <h.t.jacky@gmail.com> wrote:
Hi Cunsuo,
Thanks for you prompt reply. But I'm just wondering why the other policies(such as writethrough) are abandoned, does anyone know the architecture difference?
They are not abandoned from architecture. If you do a git log -p on arch/arm/mm/mmu.c, this is what we get. commit 4b46d6416548fb6a0940dfd9911fd895eb6247b3 Author: Russell King <rmk+kernel@arm.linux.org.uk> Date: Sun Nov 1 17:44:24 2009 +0000 ARM: ensure initial page tables are setup for SMP systems Mapping the same memory using two different attributes (memory type, shareability, cacheability) is unpredictable. During boot, we encounter a situation when we're updating the kernel's page tables which can lead to dirty cache lines existing in the cache which are subsequently missed. This causes stack corruption, and therefore a crash. Therefore, ensure that the shared and cacheability settings matches the configuration that will be used later; this together with the restriction in early_cachepolicy() ensures that we won't create a mismatch during boot. Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 02243ee..ea67be0 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -117,6 +117,13 @@ static void __init early_cachepolicy(char **p) } if (i == ARRAY_SIZE(cache_policies)) printk(KERN_ERR "ERROR: unknown or unsupported cache policy\n"); + /* + * This restriction is partly to do with the way we boot; it is + * unpredictable to have memory mapped using two different sets of + * memory attributes (shared, type, and cache attribs). We can not + * change these attributes once the initial assembly has setup the + * page tables. + */ if (cpu_architecture() >= CPU_ARCH_ARMv6) { printk(KERN_WARNING "Only cachepolicy=writeback supported on ARMv6 and later\n"); cachepolicy = CPOLICY_WRITEBACK; Thanks, Arun
Cheers, Jacky Sent from my HTC
----- Reply message ----- From: "Cunsuo Guo" <cunsuo.guo@gmail.com> To: "Jacky lin" <h.t.jacky@gmail.com> Cc: <kernelnewbies@kernelnewbies.org> Subject: cache policy of arm mmu Date: Tue, May 29, 2012 09:10
Hi Jacky, I think the information of printk has already tell us the reason.
2012/5/29 Jacky lin <h.t.jacky@gmail.com>:
Hi all,
I found that the cache policy in after ARMv6 is always set as writeback mode in mmu.c.
static int __init early_cachepolicy(char *p) { ... if (cpu_architecture() >= CPU_ARCH_ARMv6) { printk(KERN_WARNING "Only cachepolicy=writeback supported on ARMv6 and later\n"); cachepolicy = CPOLICY_WRITEBACK; } ... }
Does anyone know why and provide some documents or links for that?
Thanks so much!
Cheers, Jacky
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies