Subject: Re: Patches for EST and SMP
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Juan RP <juan@xtrarom.org>
List: tech-kern
Date: 03/17/2007 10:52:45
On Saturday 17 March 2007, YAMAMOTO Takashi wrote:
> > Moving to tech-kern only.
> >
> > On Saturday 17 March 2007, YAMAMOTO Takashi wrote:
> > > if something behaves in unexpected ways, please investigate why it
> > > does. please don't commit the code which you don't understand.
> > > to me, the iteration seems completely bogus.
> >
> > x86_broadcast_ipi() doesn't seem to get the primary cpu, that's why I
> > added the second iter.
> >
> > Why don't you explain the things are there wrong? I'm not a MASTER of
> > UNIVERSE like you.
>
> because it isn't the first time and i already know how it's hard to
> explain you what's wrong...
> and, actually, i explained what's wrong here.  ie. the iteration is
> completely bogus.

I fixed it, apb@ told me a way that works without the second iter.

Calling msr_ipi_{read,write} from msr_cpu_broadcast and curcpu() on it.

> you want to use ipi in the first place because you want to run these
> operations on each cpus.  it doesn't make sense unless the callback
> only operates the cpu on which it's running.

You are right, and I have it understood.

I removed the code for CPU_IS_PRIMARY and friends, and I set
ci_msr_rvalue from curcpu().

I verified that the new code works setting a new level,  now it
reports just the same than before but with all things (hopefully) you said 
fixed.

msr_cpu_broadcast_read: msr=28 ci->ci_msr_value=28

msr_cpu_broadcast: ---- START ----
msr_cpu_broadcast: before read
msr_read_ipi: (cpu1) before read
msr_read_ipi: (cpu1) after read
msr_cpu_broadcast: after read
msr_read_ipi: (cpu0) before read
msr_cpu_broadcast: before pause
msr_read_ipi: (cpu0) after read
msr_cpu_broadcast: x86_msr_runcount=3 ncpu=2
msr_cpu_broadcast: after pause
cpu0: ci_msr_rvalue=0x28
cpu1: ci_msr_rvalue=0x28
msr_cpu_broadcast: ----- END -----

msr_cpu_broadcast_write: msr=30

msr_cpu_broadcast: ---- START ----
msr_cpu_broadcast: before write
msr_write_ipi: (cpu1) before write
msr_write_ipi: (cpu1) after write
msr_cpu_broadcast: after write
msr_cpu_broadcast: before pause
msr_write_ipi: (cpu0) before write
msr_cpu_broadcast: x86_msr_runcount=2 ncpu=2
msr_write_ipi: (cpu0) after write
msr_cpu_broadcast: after pause
cpu0: ci_msr_rvalue=0x28
cpu1: ci_msr_rvalue=0x28
msr_cpu_broadcast: ----- END -----

http://www.netbsd.org/~xtraeme/msr_ipi_handlers.diff

(refresh again)

-- 

http://plog.xtrarom.org/
Juan RP's blog - NetBSD/pkgsrc news in Spanish