Subject: Re: ARM1136 panic on arm32_sync_icache()
To: Todd Poynor <tpoynor@danger.com>
From: Matt Thomas <matt@3am-software.com>
List: port-arm
Date: 11/07/2007 19:49:09
On Nov 7, 2007, at 4:58 PM, Todd Poynor wrote:
> A program containing the following fragment can crash an ARM1136
> system with a Data Abort in the kernel:
>
> struct arm_sync_icache_args a;
>
> a.addr = malloc(PAGE_SIZE * 3);
> a.len = PAGE_SIZE * 3;
> sysarch(ARM_SYNC_ICACHE, &a);
>
> The ARMv6 Virtually Indexed Physically Tagged cache maintenance
> system control coprocessor instructions that invalidate lines based
> on Modified Virtual Addresses throw Data Abort exceptions for
> virtual addresses not mapped in the PTE. On previous VIVT cache
> revisions of the architecture, a PTE lookup was not necessary, and
> so callers that synced cache lines in pages not actually written
> did not incur this problem.
>
> One workaround is to have the syscall version invalidate the entire
> cache (another popular UNIX variant does this a lot due to ARM1136
> errata). Or invalidate based on set/way (which at 4KB ways means
> invalidating a whole lotta cache). Or figure out the cause of the
> kernel Data Abort and either send the process a SIGSEGV or skip
> faulting instructions (or fix up address range and restart for MCRR
> range instructions).
>
> I'll send a patch for one of those options if nobody raises any
> objections or alternate suggestions. Thanks,
I prefer the of onfault since this error shouldn't normally happen.