Re: [Gems-users] How can linux OS acquire statistical values in Ruby


Date: Tue, 21 Dec 2010 12:24:43 -0500
From: Philip Garcia <pcgarcia@xxxxxxxx>
Subject: Re: [Gems-users] How can linux OS acquire statistical values in Ruby
There are a few ways to do this, but beware, all of these have some downsides.  The first, is as you said, to have the OS issue magic instructions.  Modify the magic macro so that it specifies it's clobbering registers you're reading from, and then have a HAP handler for the magic instruction that will write into the register.  Also make sure the asm for the magic macro copies the values from the register into the appropriate memory location.

Method number 2 involves setting up a memory mapped I/O space, but will cause major problems if whatever module does this isn't loaded (so setting up checkpoints would be annoying, as you'd need a third module that just does this memory I/O that can always be loaded.   This is the cleanest way to handle things, but the most work to do right.

The final way involves having the simulator periodically update a value in memory with the stats you want.  This would likely have to be done every cycle.  It could potentially be the easiest, as all you'd have to do is create a new structure in the kernel (statically allocated, or it won't show up in the symbol table), and grep the symbol table for it's location.  The virtual and physical addresses of the kernel space are the same, so you can just use the write physical memory routine (can't remember it's exact name offhand) to write to the structure.  

With any of these methods, you'd have to do something to ensure that your modifications to the OS don't require ruby/opal to be loaded while booting up the OS and setting up workloads.  This can be tricky, and if you modify the scheduler based on these values, you'd want some sort of sentinel value that when it becomes non-zero means ruby/opal are loaded, and to do whatever your modifications are trying to do.  Modifying the kernel can be very difficult to do, although using simic's built-in debug tools helps quite a bit.

Hope this helps,
Phil
On Dec 20, 2010, at 12:23 PM, Woomin Hwang wrote:

Hi all,
 
I am trying to get statistical values from Ruby module and use it inside the linux kernel.
Is it possible to get date located inside the ruby module and use it in the linux?
I found some thread related to MAGIC instruction to issue command via constant values.
But what I want is to make linux OS get values from ruby module at runtime.
 
I tried to search threads in the mailing list archive. But I can’t found yet.
Currently I’m using GEMS 2.1.1 / Simics 3.0.31 and Walnut with SPARC/linux 2.6.36.
 
Please help.
 
Sincerely,
 
Woomin Hwang
_______________________________________________
Gems-users mailing list
Gems-users@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/gems-users
Use Google to search the GEMS Users mailing list by adding "site:https://lists.cs.wisc.edu/archive/gems-users/" to your search.


[← Prev in Thread] Current Thread [Next in Thread→]