Blogs

GSoC Introduction: x86_64 port

Blog post by xyzzy on Sun, 2012-04-29 14:52

My name is Alex, I am a first year computer science student with a strong interest in operating systems and low-level software. My GSoC project this year is to begin a port of Haiku to the x86_64 architecture. Almost all modern x86 CPUs have 64-bit support, therefore a port of Haiku will allow it to take full advantage of these CPUs. The GSoC coding period is almost certainly too little time to finish a port of the whole OS, however my plan is to have ported at least the boot loader, kernel and some modules/drivers.

Universities in the UK finish later than most US universities, I do not finish my exams until a couple of weeks into the GSoC coding period. Therefore, there is a limited amount of work I will be able to do during the community bonding period. However, while researching my project proposal I’ve got myself familiar with the Haiku codebase and also submitted patches to fix the GCC4 x86_64 toolchain, which have been committed. I will use time that I do have to continue to familiarise myself with the Haiku code and start thinking about some of the implementation details of my project.

During the coding period, I will first work on the boot loader. I intend to modify the existing x86 boot loader so that it is capable of loading both a 32-bit Haiku kernel and a 64-bit one. Once this is done, I will work on implementing the x86_64 architecture functionality in the kernel. Finally, I will port modules and drivers to the 64-bit kernel.

Should I have time, I will also begin work on porting userland. As I said, there may not be enough time to get that far, but even if I don’t, there’s some future work for me to do after GSoC.

GSoC Introduction: OpenJDK port

Blog post by hamish on Fri, 2012-04-27 16:38
My Google Summer of Code project for this year is to provide a complete port of OpenJDK 7 to Haiku. Over the past few months I've been working on putting together a bootstrapping environment for building OpenJDK on Haiku, and porting the virtual machine and core libraries. Over the summer I hope to bring the port to a mostly-complete state by adding support for AWT, Java2d and jsound. This will allow Swing and AWT-based applications to run on Haiku. Here is an outline of my plans:

Community bonding period

  • Continue to work on getting the virtual machine and core libraries self-hosting.
  • Eradicate as many bugs as possible from the virtual machine and core libraries to give me a stable base to work from.
  • Familiarise myself with Bryan Varner and Andrew Bachmann's AWT/Java2d code from their Java 1.4.2 port, and see what needs to be done to update it to the OpenJDK 7 codebase.

Summer

  • Update the existing AWT/J2d port to the OpenJDK 7 codebase and implement the missing functionality.
  • Write a jsound port using the Media and MIDI kits.

Future

  • Get my work uploaded to the Haiku port project at OpenJDK to make it more official.
  • Create a Haiku look & feel for Swing.
  • Merge in the updates from the jdk7u project.
You can find my work and a quick attempt at build instructions on Bitbucket: https://bitbucket.org/hamishm/haiku-jdk. The entire source is split across multiple repositories; check my Bitbucket profile for the rest. In the coming weeks I also hope to release some binaries so interested parties can more easily test it out.

gsoc2012 cpuidle project introduction

Blog post by yongcong on Fri, 2012-04-27 16:04

My gsoc2012 project is adding cpuidle support to haiku. As we all know, transistor power consumption is composed of dynamic and static ones. The former is due to charge/discharge of capacitance and other switching activity; the later is due to leakage and bias current. In the following section, I'd like to simply abstract power saving technology in nowadays cpu; powering saving technology in nowadays OS; what's missing in haiku, IOW the reason why I want to work on it.

Power saving technology in CPU
Dynamic Frequency and Voltage Scaling
Change core frequency and the corresponding supply voltage on the fly. This technology can reduce both reduce the dynamic and static power consumption.

clock gating
stop clock distribution. This technology can reduce dynamic power consumption

power gating
With the improvement of manufacturing process, transistor feature size reduced significantly. Smaller transistors consumes less dynamic power due to lower voltage and gate capacitance. On the other hand, it consumes more static power due to leakage current rises s exponentially. One manufacturing technology -- the so called power gating can almost really cut off the transistors, so the leakage current and voltage is nearly zero. This technology can reduce static power consumption.

DFVS is used in the so called p-state. Clock gating and power gating is used in the so called C-states idle.

OS technology
Basically, two components are used: macro(suspend to ram or disk) and micro. The micro component consists of two components too:
cpufreq makes use of the DFVS technology in cpu
cpuidle makes use of the clock gating and power gating technology in cpu.

what's Haiku missing
Haiku can support pstate to some extent. However, since the DFVS is taken much less use than clock gating and power gating, and the leakage current is more obvious, the cpuidle is more and more important in nowadays OS.

What I will do
In my gsoc project, I'd like to implement the general cpuidle support and specific driver: intel idle driver for intel newer CPUs such as i3,i5,i7 etc. and acpi driver. Also one userspace tool is implemented to tell us the idle stages' statistics. I believe my project will benefit haiku in power efficiency and laptops' battery life.

During the bonding period, I'd like to dig into acpi spec and try to get the c-states information from ACPI _CST table and read documents about power saving from intel and AMD.

Last but not least, I'm glad work on this project under haiku's mentors guide.I can't wait to benchmark the power saving results after cpuidle is enabled on haiku;)

Playing Around With QEMU and VT-d

Blog post by pfoetchen on Sat, 2012-04-07 21:38

Yesterday I played a bit with qemu and the VT-d/IOMMU extension. The Vt-d extension present in many modern processors allows you to forward a PCI-device directly to your virtual machine so you can access it from the virtual machine as if it were a real device. This can be very helpful to develop drivers for PCI-devices without having to reboot the whole computer all the time.

For example in my PC I use my Intel-onboard graphic as my main graphics card but I also have a Radeon in the PCI-express slot so I tried to forward it to my Haiku VM and it was more or less successful ;). To do that under Linux you have to detach the card from its real driver (probably the radeon kernel module under linux) and give it to the pci-stub module (you might have to load it first). To get the PCI-IDs and all the other information use lspci.

# where 1002 is the vendor ID and 68f9 is the device ID of the Radeon card
echo "68f9 1002" > /sys/bus/pci/drivers/pci-stub/new_id
#unbind the device from the driver "0000:01:00.0" is the first device on the PCI-express-bus
echo 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
# unbinding might take some time so better be save than sorry ;)
sleep 5
#and finaly bind it to pci-stub
echo 0000:01:00.0 > /sys/bus/pci/drivers/pci-stub/bind

Now the Radeon card should be assigned to the pci-stub driver (you might have to rebind the audio part, too). This threw some errors for me but it still worked ;)

So we can come to the interesting part of it all: starting qemu with the new device I used the following comandline:

qemu-system-x86_64  -m 1024  -cdrom haiku-nightly-anyboot.image -device pci-assign,host=01:00.0  -serial file:log.txt

The thing that does all the work is the -device pci-assign,host=01:00.0 part that assigns the radeon card we just bound to the pci-stub driver to the virtual machine. Qemu should now start and boot on the normal qemu window but as soon as it loads the (Haiku) radeon driver with some luck your monitor attached to the Radeon card will go on and display something that should look like Haiku ;). It worked for me after some help from Alexander von Gluck.

This method will work with many devices but it has some caveats:

  • binding a graphics card is not yet officially supported by qemu
  • the graphics card was not yet started by the bios so the driver has to start it itself and that is probably the reason why I did get a rather distorted picture an my monitor sounded like it would explode soon ;)...
  • binding single devices does only work with PCI-express. If you want to bind a normal PCI-device you have to bind the whole PCI bus afaik
  • and the whole system is still quite experimental ;)

So have fun with this little trick and develop/test some cool drivers for haiku ;)

Ps: It works for Windows, too: I could play HL2 without any problems on my real Radeon (but I often get bluescreens if the card tries to save power...)
PPs: you should probably not annoy kallist5 with vt-d related bugs to much it is not supposed to work yet ;)

A Short BeGeistert 025 Report

Blog post by humdinger on Fri, 2012-04-06 05:05

As this was one of the smallest BeGeistert meetings, this report will be quite short as well...

I arrived at the airport on Saturday morning at about 9:15 and made it to the nice location at Düsseldorf's youth hostel at 10 o'clock. After weeks with temperatures up to 20 °C, the good weather took a day off and I made the 10 minute walk from the station "Luegplatz" to the hostel in a very fine drizzle and shivering 10 °C...

Haiku on Java

Blog post by yourpalal on Thu, 2012-03-01 22:36

As part of my work at the University of Auckland (which is drawing to a close soon) I have been looking at Java on Haiku. There is already some support for Java on Haiku. By running installoptionalpackage DevelopmentJava you can get the JamVM java virtual machine, GNU Classpath (including gjar, gjavah and maybe some other utilities), and ecj (the Eclipse Java compiler, which is written in Java). This is enough to run and compile basic Java apps. For instance, the popular Java buildtool Ant can run on Haiku.

Anyway, the reason I was investigating this is because the University of Auckland has a big Java library (a database, actually) that has been developed here, and Christof and Gerald (my supervisors) want to bring it to Haiku. To do this, we require the ability to write code that integrates with both Java libraries, and the Haiku API. I looked at various solutions:

  • gcj compiles Java to C++, but seemed like too big of a port
  • Java Native Interface (JNI) allows for writing C++ code that hosts a JavaVM and calls Java code, but is tedious to write.
  • SWIG can generate Java bindings to C++ libraries, even allowing Java classes to inherit from, and override virtual methods in, C++ classes.

SWIG is a mature solution that handles writing lots of JNI code, and the input files are pretty much just C++ headers, so it doesn't require too much tedious work. Given these points, I decided to go with SWIG, and I have put the results (so far) on Github.

Currently, I have two tests, one that runs a custom handler on the BApplication thread (also works running it on an extra BLooper) and listens for messages. The other test makes a very simple GUI using the Haiku API. Check out the result of this test in the image on the right. That's a BWindow with a BButton and a BGroupLayout and a BStringView, all created with Java code!!!

There are still some issues, but I'm really excited about the progress that I've made already, and I'm very impressed with SWIG! As I said in the README on Github, having Java bindings also opens up the door for any JVM language to use the Haiku API, for instance Jython, JRuby, and Scala to name a few. If you're interested in contributing, head over to github and fork the project. If you just want to try it out, it's really easy to do that, there are instructions on github in the README.

Tales From the Land of Auck and Zea

Blog post by yourpalal on Thu, 2012-02-16 21:42

As was announced a little while ago, I recently got the opportunity to travel to Auckland, New Zealand to do some Computer Science research at the University of Auckland (UoA) with Christof Lutteroth and Gerald Weber (two professors here). Actually, it's not so much 'recently' as it is 'currently', since I'm still here! Christof has been interested in Haiku for a while, and has already done some research using Haiku. Stack and Tile, for instance, started as a research project here, as did the BALMLayout layout class. Furthermore, I'm not the only Haiku-er here, as Clemens Zeidler is currently working on his PhD in CS under the supervision of Christof and Gerald.

My supervisors have been very flexible with what I can work on, and we decided the first thing I should do is work on the BALMLayout. BALMLayout (ALM = Auckland Layout Model) is based on the idea of a constraint-based layout, where the programmer doesn't explicitly position elements, but rather describes how they must be positioned relative to each other or the layout area, and ALM figures it out. Since the code for BALMLayout was written before I started working on Haiku's layout API, BALMLayout had fallen behind a bit. So one thing I worked on was getting it up to date with the API. There were also a few things that BALMLayout was doing a bit differently from the other layout classes, which I've now normalized. I've also implemented a layout builder class for ALM, like the ones that exist for other layouts. The end goal is to have BALMLayout promoted to be a first-class layout, included in libbe.so, like the Grid, Group, and Card layouts. Although I've already written a bunch of code, I haven't yet pushed it to the main Haiku repo, but that's something I hope to do soon.

The next project I'm working on is pretty interesting in a few ways, as it includes running and compiling Java code on Haiku (using JamVM, GNUClasspath, and Eclipse's ecj compiler), and calling Java code from C++ as well (using JNI). Although this work is more experimental, it should pave the way for using PDStore, a triplestore database developed at the UoA on Haiku, basically making it available to C++ programs as a library.

Now that you guys know what I'm up to, I want to thank everyone who helped make this trip possible: Haiku folks, UoA folks, my family and also Google (especially Carol Smith at the Open Source Programs Office), who provided me with a grant to keep things running smoothly.

Syndicate content