On Saturday, July 07, 2012 at 9:33 AM, Gregg Levine wrote:
> On 7 July 2012 07:00, Gregg Levine <[email protected]> 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, th
 is 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?  

Thanks.

-       Mark Pizzolato


_______________________________________________
Simh mailing list
[email protected]
http://mailman.trailing-edge.com/mailman/listinfo/simh

Reply via email to