All of lore.kernel.org
 help / color / mirror / Atom feed
* Some questions about virtio-net on Xen x86
@ 2021-08-19 10:38 Jiamei Xie
  2021-08-19 14:16 ` Anthony PERARD
  0 siblings, 1 reply; 3+ messages in thread
From: Jiamei Xie @ 2021-08-19 10:38 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Chen, nd

Hi all,
I tried to run virtio-net on X86 machine according to the Wiki page https://wiki.xenproject.org/wiki/Virtio_On_Xen. 
And I Encountered some confusing problems.

The Qemu version I used is QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.17)

The content of guest.cfg is as below:
type = "hvm"
name = "g1"
memory = 512
vcpus = 2
vif = [ 'model=virtio-net' ]
disk = [ 'file:xxx/rootfs.image,xvda1,rw,backendtype=qdisk' ] kernel = "/boot/vmlinuz-5.4.0-80-generic"
ramdisk = "/boot/initrd.img-5.4.0-80-generic"
root = "/dev/xvda1 ro"
extra = 'console=hvc0 xencons=tty'

I enter the guest shell. Use ps command to get the running qemu command as below:

/usr/local/lib/xen/bin/qemu-system-i386
-xen-domid 31
-no-shutdown
-chardev socket,id=libxl-cmd,path=/var/run/xen/qmp-libxl-31,server=on,wait=off
-mon chardev=libxl-cmd,mode=control
-chardev socket,id=libxenstat-cmd,path=/var/run/xen/qmp-libxenstat-31,server=on,wait=off
-mon chardev=libxenstat-cmd,mode=control
-nodefaults -no-user-config
-name g1
-vnc 127.0.0.1:0,to=99
-display none
-kernel /boot/vmlinuz-5.4.0-80-generic
-initrd /boot/initrd.img-5.4.0-80-generic -append root=/dev/xvda1 ro console=hvc0 xencons=tty -device cirrus-vga,vgamem_mb=8 -boot order=cda -smp 2,maxcpus=2 -device virtio-net,id=nic0,netdev=net0,mac=00:16:3e:30:1a:6e
-netdev type=tap,id=net0,ifname=vif31.0-emu,br=xenbr0,script=no,downscript=no
-machine xenfv,suppress-vmdesc=on -m 504 -drive file=xxx/rootfs.image,if=ide,index=0,media=disk,format=raw,cache=writeback

The network-related parameters are
" 
-device virtio-net,id=nic0,netdev=net0,mac=00:16:3e:30:1a:6e
-netdev type=tap,id=net0,ifname=vif31.0-emu,br=xenbr0,script=no,downscript=no
"

Get the interface info as below using command 'ip a'. The mac address of eth0 is
00:16:3e:30:1a:6e, the same as in the qemu command, which made me think
 virto-net has run successfully.
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:16:3e:30:1a:6e brd ff:ff:ff:ff:ff:ff
    inet 192.168.200.3/24 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::216:3eff:fe30:1a6e/64 scope link
       valid_lft forever preferred_lft forever

I made further check. 
1. I run command 'lspci' and got below message. But there is no virtio devices.
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
00:03.0 VGA compatible controller: Cirrus Logic GD 5446

2. Run "ls /sys/class/net/ -l", what I got is as below:
lrwxrwxrwx  1 root root 0 Aug 19 08:15 eth0 -> ../../devices/vif-0/net/eth0 lrwxrwxrwx  1 root root 0 Aug 19 08:15 lo -> ../../devices/virtual/net/lo

Run "ls /sys/bus/xen/devices/vif-0/net/ -l", what I got is as below:
total 0 drwxr-xr-x 5
root root 0 Aug 19 08:15 eth0

It seems eth0 is not virtio-net, properly a pv-net. I am really confused.

 I have the following questions:
1. Does Xen x86 still support virtio-net based on QEMU backend?
2. If yes, is there anything wrong in my guest config file?
3. Is my way to check virtio-net in guest is right?

It is highly appreciated if you kindly tell me about these.

Best wishes
Jiamei Xie



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Some questions about virtio-net on Xen x86
  2021-08-19 10:38 Some questions about virtio-net on Xen x86 Jiamei Xie
@ 2021-08-19 14:16 ` Anthony PERARD
  2021-08-20  2:37   ` Jiamei Xie
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony PERARD @ 2021-08-19 14:16 UTC (permalink / raw)
  To: Jiamei Xie; +Cc: xen-devel, Wei Chen, nd

On Thu, Aug 19, 2021 at 10:38:49AM +0000, Jiamei Xie wrote:
> Hi all,
> I tried to run virtio-net on X86 machine according to the Wiki page https://wiki.xenproject.org/wiki/Virtio_On_Xen. 
> And I Encountered some confusing problems.
> 
> It seems eth0 is not virtio-net, properly a pv-net. I am really confused.
> 
>  I have the following questions:
> 1. Does Xen x86 still support virtio-net based on QEMU backend?

Well, we don't test it, and the libxl toolstack doesn't really help
getting virtio devices.

> 2. If yes, is there anything wrong in my guest config file?

The wiki state that you should add 'xen_emul_unplug=never' to the
guest kernel's command line. (That would be "extra" in your guest.cfg.)
I think that will prevent the virtio-net device from been unplug, and so
you will see the virtio-net device in the guest.

But since libxl create Xen PV device anyway, you'll still have the Xen
PV NIC, so two NICs with the same MAC.

I hope that help,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Some questions about virtio-net on Xen x86
  2021-08-19 14:16 ` Anthony PERARD
@ 2021-08-20  2:37   ` Jiamei Xie
  0 siblings, 0 replies; 3+ messages in thread
From: Jiamei Xie @ 2021-08-20  2:37 UTC (permalink / raw)
  To: Anthony PERARD; +Cc: xen-devel, Wei Chen, nd

Hi Anthony,

-----Original Message-----
From: Anthony PERARD <anthony.perard@citrix.com> 
Sent: 2021年8月19日 22:16
To: Jiamei Xie <Jiamei.Xie@arm.com>
Cc: xen-devel@lists.xenproject.org; Wei Chen <Wei.Chen@arm.com>; nd <nd@arm.com>
Subject: Re: Some questions about virtio-net on Xen x86

On Thu, Aug 19, 2021 at 10:38:49AM +0000, Jiamei Xie wrote:
> Hi all,
> I tried to run virtio-net on X86 machine according to the Wiki page https://wiki.xenproject.org/wiki/Virtio_On_Xen. 
> And I Encountered some confusing problems.
> 
> It seems eth0 is not virtio-net, properly a pv-net. I am really confused.
> 
>  I have the following questions:
> 1. Does Xen x86 still support virtio-net based on QEMU backend?

Well, we don't test it, and the libxl toolstack doesn't really help getting virtio devices.

> 2. If yes, is there anything wrong in my guest config file?

The wiki state that you should add 'xen_emul_unplug=never' to the guest kernel's command line. (That would be "extra" in your guest.cfg.) I think that will prevent the virtio-net device from been unplug, and so you will see the virtio-net device in the guest.

But since libxl create Xen PV device anyway, you'll still have the Xen PV NIC, so two NICs with the same MAC.

I hope that help,

--
Anthony PERARD

Your answer helped me a lot, thank you very much. After adding 'xen_emul_unplug=never', virtio-net can work normally.
I can see the virtio net device with lspci command.
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
00:03.0 SCSI storage controller: Broadcom / LSI 53c895a
00:04.0 VGA compatible controller: Cirrus Logic GD 5446
00:05.0 Ethernet controller: Red Hat, Inc. Virtio network device

Best wishes
Jiamei Xie




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-20  2:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 10:38 Some questions about virtio-net on Xen x86 Jiamei Xie
2021-08-19 14:16 ` Anthony PERARD
2021-08-20  2:37   ` Jiamei Xie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.