DragonFly BSD
DragonFly kernel List (threaded) for 2011-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: about virtio driver porting from FreeBSD

From: Stéphanie Ouillon <stephanie@xxxxxxxxx>
Date: Sun, 20 Mar 2011 22:28:15 +0100


I come with some questions after I worked on virtio drivers during the week. The answers will help me to elaborate my timeline for the gsoc application :)

1. Virtio Network Driver

I solved the problem I discussed with Pratyush Kshirsagar about the loading of virtio.ko and I was able to check that the dmesg message was okay thanks to his help.
( I am still under Virtualbox, I set networks settings to virtio-net, bridge on the ethernet interface )
Here is the result of dmseg ( with some additional kprintf messages )  :

        We enter virtio_probe()
    virtio_probe 4096
    Device 4096 is okay
      virtiobus0 port 0xd020-0XD03f irq 10 at device 3.0 on pci0

    We enter virtio_attach()
    Virtio Network Device (rev 0x00) 0xc2aa52f8
    Virtio Type: 1
    Network dev child added
    We enter virtio_probe()
    virtio_probe 51966

    We enter virtio_probe()
    virtio_probe 9237

    We enter virtio_probe()
    virtio_probe 28947

So a virtio network device was found.

However, I face some problems with virtio-net when loading the module virtio-net.ko ( the child driver? ):
        - it tells me the module loads correctly but,
        - when I add some kprintf debug for dmseg, I can see that there are no calls to virtio_net_probe()
        - no network interface seems to be created, and I don't see which function in virtio-net.c creates it. I                 looked at the NetBSD code, if I understood it rightly, it uses ifnet to create the network interface with             the following functions : vioif-init(), vioif_stop(), etc ?
        - and to be sure I have no network, when I try to ping something, I get a "no route to host" message,                 and when I want to set a default route, I get a "network unreachable"

I saw in some messages in the mailing list that some tests have been done by Tim Bisson (http://leaf.dragonflybsd.org/mailarchive/kernel/2011-01/msg00053.html). Was it realized with the code you gave me ?

2. Ballooning and Block Device Drivers

At the moment, I run DragonFly BSD under VirtualBox... which is not nice :/
There are no memory ballooning available on 32-bits machines ( I've got an 32-bits machine, a mac, so I don't have kvm anymore ) :( ) and no virtio block drivers at all for VirtualBox.
So it seems that I'll have to run DragonFly BSD under Qemu to run code on my computer. However, as the project aims at implementing virtio drivers to run DragonFly BSD under kvm, I also plan to install some virtual machines under kvm on a server I have access to.

Block device driver has been ported from NetBSD, and it seems to have been tested ( http://gitorious.org/virtio-drivers/pages/Home )?
And ballooning driver still remains to be ported from NetBSD. I read that Minoura's NetBSD code was checked on NetBSD before porting. Was it done for each driver ( including ballooning ) ?

3. Changes to the kernel

According to these messages ( http://leaf.dragonflybsd.org/mailarchive/kernel/2011-01/msg00046.html ), the virtio net driver required some changes to the kernel ( adding kern/subr_sglist.c and making the probe interface public ). Why was it necessary ? Also, were some changes required for the block device driver ?

4. Performance tests ( not really a question :) )

As I understand it, tests will have to be done in order to compare performances with and without virtio, for each driver ( to be sure virtio is doing its job :) ).

Thank you !

Stéphanie Ouillon

From: "stephanie" <stephanie@minet.net>
Date: Tue, 15 Mar 2011 12:01:48 +0100


I finally solved my problem. It came from VirtualBox, I had to modify the
configuration XML file of the vm ( I had redirected some ports for ssh, and
I was changing the settings from a pcnet network card to virtio-net, the
configuration XML file wasn't following
http://forums.virtualbox.org/viewtopic.php?t=7175 ).

So now I am able to start the DragonFly vm and I have the same results than you
in the dmesg ( the last line is because I load virtio-net.ko too ).


On Mon, 14 Mar 2011 22:33:31 -0400 Pratyush Kshirsagar
<pratyush.kshirsagar@gmail.com> wrote

Hello, I have added the files you can use either NAT / Bridged network as
shown in first two images.
The other two show that the n/w device is attached but the dmesg did not show
the attache() and probe() function name printed with the MAC address. It use
to print it, I wonder what happened?
Still, I am sending this as a reference. 
I am using the 2-9 Development version and I updated it in
December.Hope this might help :)

- Pratyush Kshirsgar.

2011/3/14 Stéphanie Ouillon
  Well, I sum up all I did :

1) I compiled the code you sent me in your mail just as you told me to do,
no problem
2) The settings in VirtualBox where : NAT with PCI network card. I loaded
the two modules you indicated me. It gave me the following output :

#kldload -v ./virtio.ko
virtio_probe 51966virtio_probe 9237virtio_probe 28947Loaded ./virtio.ko,

#kldload -v ./virtio_net.ko
Loaded ./virtio-net.ko, id=6

virtio_probe 51966virtio_probe 9237virtio_probe 28947

3) I changed the settings to bridge with virtio-net. But there is no way to
launch the vm with them.
Message error : 

Configuration error: Failed to get the "MAC" value
Unknown error creating VM (VERR_CFGM_VALUE_NOT_FOUND).

I tried with all the available options ( NAT, private network with host,
etc), nothing works.

I checked it again, and Im pretty sure I used the right code since it is the
only piece of code I have ^^


Le 14/03/11 23:06, Pratyush Kshirsagar a écrit :
Yes it was 2.9 and I do not think it would be the problem. Did you did as I
said and just check the attach() and probe() calls. Are you using the same
files that I mailed with the instructions.
  - Pratyush

2011/3/14 Stéphanie Ouillon
   Do you use the latest stable version of DragonFlyBSD or the version in
development ?

Le 14/03/11 13:51, Pratyush Kshirsagar a écrit :   The previous mail
contains the intel N/W adapters and I did not find the paravirtualized
and the MAC address.
So, I thought this may be the problem.

2011/3/14 Stéphanie Ouillon
   Well, I had already checked the settings.
Ill try the latest version of VirtualBox 4.0.4, hoping that the bug for
VirtualBox 4.0.2 has been fixed and that the vm will boot.

Le 14/03/11 02:58, Pratyush Kshirsagar a écrit : I think this are the N/W
adapters that your VMM / Hypervisor has or attached to. But if you are using
Virtual Box  you need to Click the Advanced tab in N/W settings and select
adapter type to 
Paravirtualized Network (virtio-net)
I am using bridge networking with this N/W adapter.
Please check the settings and try to run it.
Hope it solves the problem.

  - Pratyush.

  2011/3/13 Stéphanie Ouillon

I run 10 days ago the code you sent to me in your mail, but I had to read
more about virtio driver to be able to understand a bit more the architecture
of the code.

Well, I used a DragonFly 2.9-development on Virtualbox (not the latest
version of VBox because there is a reported bug for DragonFly BSD machines,
I use the 3.12) and I used a PCnet-PCI II emulated network card (NAT mode).

I build the code to load the modules and I did what you mentionned :

#kldload -v ./virtio.ko
virtio_probe 51966virtio_probe 9237virtio_probe 28947Loaded ./virtio.ko,

#kldload -v ./virtio_net.ko
Loaded ./virtio-net.ko, id=6

virtio_probe 51966virtio_probe 9237virtio_probe 28947

I checked the numbers, they match the following devices :
51966 : Virtual Guest Service
9237 : "0x8086","0x2415","Intel Corporation","Intel 82801DBM SM/BUS
Controller 24C3","Aureal (AD1881 SOUNDMAX) Placa Mãe Asaki P3-141"
28947: "0x8086","0x7113","Intel Corporation","82371AB/EB/MB","PIIX4/4E/4M
Power Management Controller"

However, I see no message from the virtio_attach() fonction nor
virtio_net_probe() or virtio_net_attach() and I dont understand why ( if it
normal, or not ? ).
I tried to launch Virtualbox with virtio-net for the network configuration
to see what would happen, if I could go further and have more information but
I had an error message at the very beginning :

Configuration error: Failed to get the "MAC" value
Unknown error creating VM (VERR_CFGM_VALUE_NOT_FOUND).

So the vm couldnt be launched, even when configured with no network

Stéphanie Ouillon

Le 28/02/11 02:34, Pratyush Kshirsagar a écrit :   Yes, you are right but I
did some work porting virtio network driver from NetBSD before we moved
forward to port it from FreeBSD. Attached is the partly done code.
  The other basic calls needed for block and network drivers are kept same by
Tim and me so that we dont do lot of cleaning and book keeping stuff.

  The working code is in "net" directory and not the nbsd_code.
you need to make the outer dir and then the do make in net.
use kldload -v ./virtio.ko followed by kldload -v ./virtio_net.ko 
Thus when you use dmesg it will show the messages during the netword device
probe and attach() with the network device number/id.

  You can mail me for further information.

  - Pratyush Kshirsagar.

2011/2/27 Stéphanie Ouillon

Ive read the posts on the DragonFly BSD Digest site about virtio, but I have
some questions about it.

A virtual network driver was ported from NetBSD, using some FreeBSD code
that wasnt supposed to be public under a BSD license. So for the moment, the
code that is published on gitorious
(http://gitorious.org/virtio-drivers/virtio-drivers/trees/master [6]) cant be
used at all ? Can somebody tell me more about that ?
Thanks !



[1] mailto:stephanie@minet.net
[2] mailto:stephanie@minet.net
[3] mailto:stephanie@minet.net
[4] mailto:stephanie@minet.net
[5] mailto:stephanie@minet.net
[6] http://gitorious.org/virtio-drivers/virtio-drivers/trees/master

[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]