[Barrelfish-users] x86 cache patch
Kornilios Kourtis
kornilios.kourtis at inf.ethz.ch
Wed Jun 26 10:44:33 CEST 2013
Hi Mateusz,
On Sun, Jun 23, 2013 at 06:00:25PM +0200, Mateusz Olczak wrote:
> Hi,
>
> A while back I asked if caching was enabled for all cores and got the
> reply it was up to the hardware BIOS to do that for all cores. Since
> not all BIOSes do that, I had to make Barrelfish enable caches on all
> cores for purpose of benchmarking Barrelfish using Simics and g-cache.
>
> I've attached the tiny patch.
> What it does:
> For x86_32 in arch_init:
> Moves the enable_caches() out of #ifdef __scc__ and thus enables caches on all cores for x86_32, not only the Intel SCC.
>
> For x86_64:
> Adds the enable_caches() function and calls it in arch_init for x86_64,
> thus enabling caches on all cores for x86_64.
>
Thanks for the patch.
[snip]
> +#define CR0_CD (1 << 30)
> +#define CR0_NW (1 << 29)
> +
> +static inline void enable_caches(void)
> +{
> + uint64_t cr0;
> +
> + __asm volatile("mov %%cr0, %[cr0]" : [cr0] "=r" (cr0));
> + cr0 &= ~CR0_CD;
> + cr0 &= ~CR0_NW;
> + __asm volatile("mov %[cr0], %%cr0" :: [cr0] "r" (cr0));
> +}
As far as I can tell, this globally enables write-back caching which is
something we might not want on all x86 machines.
Also, I'm not sure about the whole patch, since if it's something that
can be configured from BIOS, having Barrelfish silently ignoring the BIOS
setting might be confusing.
cheers,
Kornilios.
--
Kornilios Kourtis
More information about the Barrelfish-users
mailing list