1 Aug 2011 04:11
1 Aug 2011 23:43
Re: Reducing CPU usage
On Mon, Aug 1, 2011 at 2:11 AM, Programmingkid <programmingkidx@...> wrote: > Is there a way to make OpenBIOS not use so much CPU time when running in QEMU? My laptop becomes very hot when I do anything in OpenBIOS. I've noticed that too. The input device (keyboard/serial) is scanned in a tight busy loop. With some effort, this could be changed to interrupt driven. But the same thing happens also when lots of Forth is executed, maybe the Forth interpreter and QEMU code fits in the CPU cache nicely and this then maximizes CPU throughput and power consumption.
2 Aug 2011 17:00
[PATCH] make select-dev and unselect-dev compatible with OBP
select-dev and unselect-dev are pre Open Firmware, and not the same as open-dev/device-end. Make them Sun OBP compatible by pulling the functionality for select-dev/unselect-dev out of (and simplifying) begin-package/end-package. Signed-off-by: Bob Breuer <breuerr@...> --- forth/admin/devices.fs | 4 ---- forth/debugging/fcode.fs | 22 +++++++++++++++++----- forth/device/pathres.fs | 4 ---- 3 files changed, 17 insertions(+), 13 deletions(-) Index: forth/device/pathres.fs =================================================================== --- forth/device/pathres.fs (revision 1045) +++ forth/device/pathres.fs (working copy) <at> <at> -471,10 +471,6 <at> <at> ( ihandle ) ; -: select-dev ( dev-str dev-len -- ihandle | 0 ) - open-dev -; - : execute-device-method ( ... dev-str dev-len met-str met-len -- ... false | ?? true ) 2swap Index: forth/admin/devices.fs =================================================================== --- forth/admin/devices.fs (revision 1045)(Continue reading)
2 Aug 2011 20:18
Re: Reducing CPU usage
On Mon, Aug 1, 2011 at 2:11 AM, Programmingkid
<programmingkidx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:Is there a way to make OpenBIOS not use so much CPU time when running in QEMU? My laptop becomes very hot when I do anything in OpenBIOS.
I've noticed that too. The input device (keyboard/serial) is scanned
in a tight busy loop. With some effort, this could be changed to
interrupt driven.
I was thinking the exact same thing.
But the same thing happens also when lots of Forth is executed, maybe
the Forth interpreter and QEMU code fits in the CPU cache nicely and
this then maximizes CPU throughput and power consumption.
Maybe we should give the user the option to reduce cpu usage. A compile-time or runtime option might do. My idea is set the interrupt controller to run code that makes the currently running code sleep for 10 milliseconds. That would take care of both problems. We would finally have computers that don't feel like space heaters after doing some Forth programming on them.
<div> <div><br></div> <div> <div> <blockquote type="cite"><span class="Apple-style-span"><br>On Mon, Aug 1, 2011 at 2:11 AM, Programmingkid<br><<a href="mailto:programmingkidx@...">programmingkidx@...</a>> wrote:<br><blockquote type="cite">Is there a way to make OpenBIOS not use so much CPU time when running in QEMU? My laptop becomes very hot when I do anything in OpenBIOS.<br> </blockquote> <br>I've noticed that too. The input device (keyboard/serial) is scanned<br>in a tight busy loop. With some effort, this could be changed to<br>interrupt driven.<br></span></blockquote> <div><br></div> <div>I was thinking the exact same thing.</div> <br><blockquote type="cite"><span class="Apple-style-span">But the same thing happens also when lots of Forth is executed, maybe<br>the Forth interpreter and QEMU code fits in the CPU cache nicely and<br>this then maximizes CPU throughput and power consumption.</span></blockquote> </div> <br><div>Maybe we should give the user the option to reduce cpu usage. A compile-time or runtime option might do. My idea is set the interrupt controller to run code that makes the currently running code sleep for 10 milliseconds. That would take care of both problems. We would finally have computers that don't feel like space heaters after doing some Forth programming on them.</div> </div> </div>
4 Aug 2011 16:39
Re: OpenBios Sparc64
I've written several lines of code in C in which I am trying to access the OpenBoot CIF to execute an instruction. But immediately after I do the call to the CIF interface address the PROM freezes. Does anyone have any ideas why is this so. I'm getting the CIF address from the %o4 register passed by SILO -- -- Razvan Ghitulete Universitatea Politehnica Bucuresti
4 Aug 2011 20:52
Re: OpenBios Sparc64
On Thu, Aug 4, 2011 at 2:39 PM, Ghitulete Razvan <razvan.ghitulete@...> wrote: > I've written several lines of code in C in which I am trying to access > the OpenBoot CIF to execute an instruction. But immediately after I do > the call to the CIF interface address the PROM freezes. Does anyone > have any ideas why is this so. I'm getting the CIF address from the > %o4 register passed by SILO Impossible to say without sources. Perhaps you should compare your CIF code to what SILO, Linux or *BSD are doing.
5 Aug 2011 13:24
Re: OpenBios Sparc64
On 04/08/11 15:39, Ghitulete Razvan wrote: > I've written several lines of code in C in which I am trying to access > the OpenBoot CIF to execute an instruction. But immediately after I do > the call to the CIF interface address the PROM freezes. Does anyone > have any ideas why is this so. I'm getting the CIF address from the > %o4 register passed by SILO Do you really mean OpenBoot or do you mean OpenBIOS? There was a bug in earlier versions of OpenBIOS where the CIF arguments were being read in the wrong order which is now fixed. Basically as you read the IEEE 1275 specification, left -> right maps to bottom -> top of stack so it may just be that you need to reverse the order of your arguments. Also if you are using OpenBIOS, you can enable DEBUG_CIF in libopenbios/client.c which will output all the CIF calls and their arguments on the console to help you. HTH, Mark. -- -- Mark Cave-Ayland - Senior Technical Architect PostgreSQL - PostGIS Sirius Corporation plc - control through freedom http://www.siriusit.co.uk t: +44 870 608 0063 Sirius Labs: http://www.siriusit.co.uk/labs
5 Aug 2011 14:52
Re: [PATCH] make select-dev and unselect-dev compatible with OBP
On 02/08/11 16:00, Bob Breuer wrote: > select-dev and unselect-dev are pre Open Firmware, and not the same > as open-dev/device-end. Make them Sun OBP compatible by pulling the > functionality for select-dev/unselect-dev out of (and simplifying) > begin-package/end-package. > > Signed-off-by: Bob Breuer<breuerr@...> > --- > forth/admin/devices.fs | 4 ---- > forth/debugging/fcode.fs | 22 +++++++++++++++++----- > forth/device/pathres.fs | 4 ---- > 3 files changed, 17 insertions(+), 13 deletions(-) > > Index: forth/device/pathres.fs > =================================================================== > --- forth/device/pathres.fs (revision 1045) > +++ forth/device/pathres.fs (working copy) > <at> <at> -471,10 +471,6 <at> <at> > ( ihandle ) > ; > > -: select-dev ( dev-str dev-len -- ihandle | 0 ) > - open-dev > -; > - > : execute-device-method > ( ... dev-str dev-len met-str met-len -- ... false | ?? true ) > 2swap > Index: forth/admin/devices.fs > =================================================================== > --- forth/admin/devices.fs (revision 1045) > +++ forth/admin/devices.fs (working copy) > <at> <at> -46,10 +46,6 <at> <at> > 0 active-package! > ; > > -: unselect-dev ( -- ) > - device-end > -; > - > : ?active-package ( -- phandle ) > active-package dup 0= abort" no active device" > ; > Index: forth/debugging/fcode.fs > =================================================================== > --- forth/debugging/fcode.fs (revision 1045) > +++ forth/debugging/fcode.fs (working copy) > <at> <at> -10,21 +10,33 <at> <at> > : headers ( -- ) > ; > > -: begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- ) > +\ Open specified device node and make it the current instance. > +\ pre Open Firmware, but Sun OBP compatible > +: select-dev ( dev-str dev-len -- ) > open-dev dup 0= abort" failed opening parent." > dup to my-self > ihandle>phandle active-package! > +; > + > +: begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- ) > + select-dev > new-device > set-args > ; > > -: end-package ( -- ) > - my-parent>r > - finish-device > +\ Close current node, deselect active package and current instance, > +\ leaving no instance selected > +\ pre Open Firmware, but Sun OBP compatible > +: unselect-dev ( -- ) > + my-self close-dev > 0 active-package! > 0 to my-self > - r> close-dev > ; > > +: end-package ( -- ) > + finish-device > + unselect-dev > +; > + > : apply ( ... "method-name< >device-specifier< >" -- ??? ) > ; I've applied this patch locally and tested it on my various SPARC32 images and everything seems to work fine. My only minor niggle is that logically I would expect all of the package words to be in forth/admin/devices.fs rather than forth/debugging/fcode.fs. However... reading the IEEE 1275 specification once again I found this on page 251 (Section H.8): "The following user interface command names have changed from their pre-Open Firmware versions, with no change in behavior" and select-dev/unselect-dev are listed below. Hmmm. This seems to disagree with the original intent of the patch. Anyone have any further thoughts on this? ATB, Mark. -- -- Mark Cave-Ayland - Senior Technical Architect PostgreSQL - PostGIS Sirius Corporation plc - control through freedom http://www.siriusit.co.uk t: +44 870 608 0063 Sirius Labs: http://www.siriusit.co.uk/labs
5 Aug 2011 14:56
Re: OpenBios Sparc64
I meant OpenBOOT, as I am trying to write something for a V9 and qemu doesn't have full suport for the V9 arch. But as far as i've noticed the openbios implementation resembles the openboot one. Anywho I managed to get passed this. It seems it was because I had the processor in a wrong state. But now I ran into some other problems, as it seems if I call the "finddevice" CIF command for any node, instead of getting a valid phandle, or an -1 in case i ask for gibberish(which i did). The CIF keeps returning the address to the string I passed as an argument (said device that i am searching). On Fri, Aug 5, 2011 at 2:24 PM, Mark Cave-Ayland <mark.cave-ayland@...> wrote: > On 04/08/11 15:39, Ghitulete Razvan wrote: > >> I've written several lines of code in C in which I am trying to access >> the OpenBoot CIF to execute an instruction. But immediately after I do >> the call to the CIF interface address the PROM freezes. Does anyone >> have any ideas why is this so. I'm getting the CIF address from the >> %o4 register passed by SILO > > Do you really mean OpenBoot or do you mean OpenBIOS? > > There was a bug in earlier versions of OpenBIOS where the CIF arguments were > being read in the wrong order which is now fixed. Basically as you read the > IEEE 1275 specification, left -> right maps to bottom -> top of stack so it > may just be that you need to reverse the order of your arguments. > > Also if you are using OpenBIOS, you can enable DEBUG_CIF in > libopenbios/client.c which will output all the CIF calls and their arguments > on the console to help you. > > > HTH, > > Mark. > > -- > Mark Cave-Ayland - Senior Technical Architect > PostgreSQL - PostGIS > Sirius Corporation plc - control through freedom > http://www.siriusit.co.uk > t: +44 870 608 0063 > > Sirius Labs: http://www.siriusit.co.uk/labs > > -- > OpenBIOS http://openbios.org/ > Mailinglist: http://lists.openbios.org/mailman/listinfo > Free your System - May the Forth be with you > -- Razvan Ghitulete Universitatea Politehnica Bucuresti -- -- OpenBIOS http://openbios.org/ Mailinglist: http://lists.openbios.org/mailman/listinfo Free your System - May the Forth be with you
5 Aug 2011 16:29
Re: [PATCH] make select-dev and unselect-dev compatible with OBP
Mark Cave-Ayland wrote: > On 02/08/11 16:00, Bob Breuer wrote: > >> select-dev and unselect-dev are pre Open Firmware, and not the same >> as open-dev/device-end. Make them Sun OBP compatible by pulling the >> functionality for select-dev/unselect-dev out of (and simplifying) >> begin-package/end-package. >> >> Signed-off-by: Bob Breuer<breuerr@...> >> --- >> forth/admin/devices.fs | 4 ---- >> forth/debugging/fcode.fs | 22 +++++++++++++++++----- >> forth/device/pathres.fs | 4 ---- >> 3 files changed, 17 insertions(+), 13 deletions(-) >> >> Index: forth/device/pathres.fs >> =================================================================== >> --- forth/device/pathres.fs (revision 1045) >> +++ forth/device/pathres.fs (working copy) >> <at> <at> -471,10 +471,6 <at> <at> >> ( ihandle ) >> ; >> >> -: select-dev ( dev-str dev-len -- ihandle | 0 ) >> - open-dev >> -; >> - >> : execute-device-method >> ( ... dev-str dev-len met-str met-len -- ... false | ?? true ) >> 2swap >> Index: forth/admin/devices.fs >> =================================================================== >> --- forth/admin/devices.fs (revision 1045) >> +++ forth/admin/devices.fs (working copy) >> <at> <at> -46,10 +46,6 <at> <at> >> 0 active-package! >> ; >> >> -: unselect-dev ( -- ) >> - device-end >> -; >> - >> : ?active-package ( -- phandle ) >> active-package dup 0= abort" no active device" >> ; >> Index: forth/debugging/fcode.fs >> =================================================================== >> --- forth/debugging/fcode.fs (revision 1045) >> +++ forth/debugging/fcode.fs (working copy) >> <at> <at> -10,21 +10,33 <at> <at> >> : headers ( -- ) >> ; >> >> -: begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- ) >> +\ Open specified device node and make it the current instance. >> +\ pre Open Firmware, but Sun OBP compatible >> +: select-dev ( dev-str dev-len -- ) >> open-dev dup 0= abort" failed opening parent." >> dup to my-self >> ihandle>phandle active-package! >> +; >> + >> +: begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- ) >> + select-dev >> new-device >> set-args >> ; >> >> -: end-package ( -- ) >> - my-parent>r >> - finish-device >> +\ Close current node, deselect active package and current instance, >> +\ leaving no instance selected >> +\ pre Open Firmware, but Sun OBP compatible >> +: unselect-dev ( -- ) >> + my-self close-dev >> 0 active-package! >> 0 to my-self >> - r> close-dev >> ; >> >> +: end-package ( -- ) >> + finish-device >> + unselect-dev >> +; >> + >> : apply ( ... "method-name< >device-specifier< >" -- ??? ) >> ; > > I've applied this patch locally and tested it on my various SPARC32 > images and everything seems to work fine. My only minor niggle is that > logically I would expect all of the package words to be in > forth/admin/devices.fs rather than forth/debugging/fcode.fs. Both begin-package and end-package were already in forth/debugging/fcode.fs. This is mostly just code movement/refactoring so I moved select-dev/unselect-dev to where most of the code already was. Let me know if you want it another way. None of the words that I changed are used anywhere within OpenBIOS itself. > > However... reading the IEEE 1275 specification once again I found this > on page 251 (Section H.8): "The following user interface command names > have changed from their pre-Open Firmware versions, with no change in > behavior" and select-dev/unselect-dev are listed below. Hmmm. This seems > to disagree with the original intent of the patch. Anyone have any > further thoughts on this? See the errata for section H.8. Also see the "Debugging and Testing Fcode Programs" section of "Writing FCode 3.x Programs" at http://download.oracle.com/docs/cd/E19253-01/806-1379-10/fctest.html#pgfId-330 which shows the simpler OBP definitions for begin-package/end-package along with descriptions of select-dev/unselect-dev. Maybe I should add this extra detail to the patch description and source comments. Bob > > ATB, > > Mark. >
RSS Feed