[Simh] Throttling and this release

Mark Pizzolato - Info Comm Mark at infocomm.com
Sat Jul 7 18:00:38 EDT 2012


On Saturday, July 07, 2012 at 1:31 PM David Brownlee wrote:
> On 7 July 2012 20:36, Mark Pizzolato - Info Comm <Mark at infocomm.com>
> wrote:
> > On Saturday, July 07, 2012 at 9:33 AM, Gregg Levine wrote:
> >> On 7 July 2012 07:00, Gregg Levine <gregg.drwho8 at gmail.com> wrote:
> >> > Hello!
> >> > Was the throttle function included as part of this release of
> SIMH? I
> >> > finally managed to get NetBSD/VAX installed, but it managed to
> corral
> >> > the entire workload of the host at 100% of the CPU.
> >> >
> >> > I want to throttle it back to about 75%.
> >>
> >> Alternatively if there is a specific pattern which would be best for
> >> simh to detect idle it should be easy enough to adjust NetBSD's idle
> >> loop to match...
> >
> > Hi there,
> >
> > I'm maintaining the SIMH vax simulator which, for many, has become
> the replacement for physical vax hardware as more aging hardware just
> stops working, or folks are merely interested in virtualizing the
> activities which they've been using vax systems for.
> >
> > I have recently revisited the simh vax simulator's support for
> detecting guest OS being in an idle state, and completely reimplemented
> what had been done in the past.  The prior implementation may have
> caught the transition into the idle state, but any simulator device's
> polling could easily take it out of the idle state.  The current
> implementation reliably detects that a guest OS is IN an idle state not
> merely the transition to it.
> >
> > We've got this concept working for all of the "Legacy" operating
> systems (Legacy meaning old and unchanging).  Meanwhile, the BSD
> derived operating systems (NetBSD and OpenBSD) still provide vax
> architecture support and hence are moving targets.  Over time, NetBSD
> and OpenBSD have internally adjusted what the concept of what/how to
> idle things as support for multi-core systems and systems with low
> power states have been implemented.  For the vax architecture, what had
> been done while the OS was idle in the early BSD days has changed.
> >
> > Idle support in the simulator is achieved by detecting some condition
> which is unique to when a system is actually idling.  For some OSes
> (i.e. older versions of NetBSD) this involves things like a particular
> instruction (TSTL), executing in low core system space (8000000-
> 80003FFF), on the interrupt stack, with a 6 byte TSTL instruction with
> a zero status (this was previously visible in subr.S).  That pattern is
> no longer correct for probably many versions of NetBSD.  When I trace
> instructions executed I can't find a unique pattern which is only done
> while idling.  So, I dug through the source to try and found how things
> are done now and currently there is no platform specific code in the
> vax idle path (in kern_idle.c\idle_loop()) .  There is a platform
> specific "cpu_idle()" macro defined in
> usr/src/sys/arch/vax/include/cpu.h which expands to nothing in the
> current code ("#define cpu_idle() do {} while (/*CONSCOND*/0)" ).  To
> provide a unique pattern which simh can detect, this macro could be
> changed to:
> >
> >       #define cpu_idle() do { _splset(splx(1)); } while
> (/*CONSCOND*/0)
> >
> > This would give me a unique pattern to detect NetBSD guest OS idling
> (i.e. setting IPL to 1 (which is otherwise unused in current versions
> of NetBSD)).  Meanwhile, this code wouldn't hurt anything when run on
> real vax hardware, and it wouldn't affect any platform independent code
> (i.e. kern_idle.c).
> >
> > I've added detection of this pattern when the simulator is configured
> for NetBSD Idle detection to the codebase of the simh vax simulator.
> >
> > What would it take for this change, or something like it, be added to
> the NetBSD source forward?
> 
> I really should have checked the -current source tree before my
> initial response...
> 
> It appears that the latest commit to sys/arch/vax/include/cpu.h on
> NetBSD-current was:
> 
> revision 1.94
> date: 2012/02/27 15:50:48;  author: matt;  state: Exp;  lines: +13 -2
> Change cpu_idle to be an inline which sets IPL to 1 and then back to 0
> so simh can recognize the kernel is idle.
> 
> which set cpu_idle to
> 
> static inline void
> cpu_idle(void)
> {
>         int ipl = mfpr(PR_IPL);
>         mtpr(1, PR_IPL);
>         mtpr(ipl, PR_IPL);
> }
> 
> I'm assuming the switching of IPL to 1 and then immediately back is OK
> for simh in this situation - could you confirm?

This is exactly the goal.  
IPL 1 is not used anywhere in the NetBSD kernel so this the transition to IPL 1 can be used as the idle trigger for that OS.

This is equivalent to the suggested macro change.

> Assuming so I can submit a pullup of this change into the netbsd-6
> branch so it will make the NetBSD-6 release, and potentially submit it
> into the netbsd-5 and even netbsd-4 branches so anyone building from
> the head of those branches can also benefit.

Please do.

Thanks.

- Mark Pizzolato


More information about the Simh mailing list