Subject: Re: CVS commit: src/sys/arch/mips
To: None <port-mips@netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-mips
Date: 03/05/2005 17:53:40
In article <000d01c52149$0c4c8dc0$0e00a8c0@paq6>
locore64@alkyltechnology.com wrote:

> The last night I was
> finally succesful to make Tsutsui-san enlightened about it.
> (He had wrong idea about VIPT.  Not a personal offence,
> you know).  Curt's cache/SMP book is the authority.

Hehe, The Curt's book always helps me. ;-) (for bus_dma, for mips etc. etc.)

I thought that the data corruption problem on R5000 machines
are caused by 2-way set associative cache because both
2-way set of lines could contain data which have the same physical
address mapped to the different virtual address and it caused
virtual alias, but as nisimura-san said I was wrong because
VIPT cache uses physcall address tag so such data which have
the same physical address should hit existing data in the cache line
if it is mapped to virtual addresses which have the same index.
Then, the problem on R5K machines shouldn't be on set-associative cache
but just lack of VCE.
(i.e. R4000 with no L2 or Vr41xx machines may have the same problem.)

Today I've checked how much VCED happens on my R4400
news5000 by disabling VCED/VCEI handlers in mipsX_subr.S.
Well, it causes awful result. VCED happens right after
init is started, so I'm suprised how R4600/R5000 machines
(which don't have VCE hardware) are wokring on current kernels.

Some VCEDs happen on mips_pagecopy() and mips_pagezero()
as pmap_copy_page and pmap_zero_page() use KSEG0,
but VCED still happens with wbinv cache ops
(i.e my patch doesn't help the problem so much).
Other VCEDs occur mostly on pool, because current mips pmap
use KSEG0 address for pool pages (which is defined in pmap.h):
---
/*
 * Alternate mapping hooks for pool pages.  Avoids thrashing the TLB.
 */
#define	PMAP_MAP_POOLPAGE(pa)	MIPS_PHYS_TO_KSEG0((pa))
#define	PMAP_UNMAP_POOLPAGE(va)	MIPS_KSEG0_TO_PHYS((va))
---

Maybe pmap_copy_page() and pmap_zero_page() could be rewritten
to use some specific KSEG2 pages (which can cover whole virtual indexes)
on copying/zeroing pages (suggestted by nisimura-san, but I guess
rafal also had a similar idea or implementation), but I wonder
how we could change this pool page mappings.
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp