Bug 883913 - Boot win7 guest with virtio-net-pci and status=off, virtio NIC still works well inside guest.
Summary: Boot win7 guest with virtio-net-pci and status=off, virtio NIC still works we...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: virtio-win
Version: 6.4
Hardware: x86_64
OS: Windows
medium
medium
Target Milestone: rc
: ---
Assignee: Yvugenfi@redhat.com
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-05 14:54 UTC by FuXiangChun
Modified: 2012-12-19 14:26 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-12-19 14:26:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description FuXiangChun 2012-12-05 14:54:20 UTC
Description of problem:
Boot guest with -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:50:a4:a2:c9,status=off. virtio NIC still can use, this is "info qtree":

 dev: virtio-net-pci, id "net0"
        dev-prop: ioeventfd = off
        dev-prop: __com_redhat_macvtap_compat = off
        dev-prop: x-__com_redhat_rhel620_compat = off
        dev-prop: vectors = 3
        dev-prop: indirect_desc = on
        dev-prop: event_idx = on
        dev-prop: csum = on
        dev-prop: guest_csum = on
        dev-prop: gso = on
        dev-prop: guest_tso4 = on
        dev-prop: guest_tso6 = on
        dev-prop: guest_ecn = on
        dev-prop: guest_ufo = on
        dev-prop: host_tso4 = on
        dev-prop: host_tso6 = on
        dev-prop: host_ecn = on
        dev-prop: host_ufo = on
        dev-prop: mrg_rxbuf = on
        dev-prop: status = off

another issue:
   "set_link net0 on" cann't change NIC status, it is still off status in 'info qtree'

Version-Release number of selected component (if applicable):
# uname -r
2.6.32-345.el6.x86_64
qemu-kvm-0.12.1.2-2.337.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. /usr/libexec/qemu-kvm -m 2G -smp 2,cores=2,thread=1,socket=1 -M rhel6.4.0 -name rhel6 -uuid ddcbfb49-3411-1701-3c36-6bdbc00bedb9 -rtc base=utc,clock=host,driftfix=slew -boot c -device virtio-scsi-pci,bus=pci.0,addr=0x5,id=scsi0 -drive file=/mnt/win7-64.qcow2,if=none,id=drive-scsi0-0-0,if=none,media=disk,cache=none,format=qcow2,werror=stop,aio=native -device scsi-hd,ver=mike,bus=scsi0.0,drive=drive-scsi0-0-0,id=scsi1 -netdev tap,id=hostnet0,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown,vhost=on -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:50:a4:a2:c9,status=off -netdev tap,id=hostnet1,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown,vhost=on -device rtl8139,netdev=hostnet1,id=net1,mac=52:54:50:a4:c2:c9 -netdev tap,id=hostnet2,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown,vhost=on -device e1000,netdev=hostnet2,id=net2,mac=52:54:50:a4:d2:c9 -device virtio-balloon-pci,id=ballooning -monitor stdio  -qmp tcp:0:4466,server,nowait -monitor unix:/tmp/monitor2,server,nowait -spice disable-ticketing,port=5911 -vga qxl

2.use virtio NIC download file from ftp server

3.set_link net0 on
  
Actual results:
after step 2,Virtio NIC work well,
after step 3,status is off

Expected results:
after step 2,Virtio NIC cann't work
after step 3, status is on

Additional info:

Comment 2 Laszlo Ersek 2012-12-05 18:56:27 UTC
Yan,

I think this is about VIRTIO_NET_F_STATUS / VIRTIO_NET_S_LINK_UP getting lost somewhere. qemu seems to support those since ancient commit 554c97dd. (Bug 623735 appears vaguely related.)

In the RHEL-6 kvm-guest-drivers-windows tree, the function checking this bit is ParaNdis_ReportLinkStatus() in file "NetKVM/Common/ParaNdis-Common.c". The link status (connect state & link speed) is then reported in PostLinkState() [NetKVM/wlh/ParaNdis6-Driver.c]. Can we debug this somehow in the guest?

Thanks,
Laszlo

Comment 3 FuXiangChun 2012-12-06 03:12:20 UTC
guest is using virtio nic driver version: virtio-win-prewhql-0.1-49, I will test older driver version and update testing result to bz.

Comment 4 FuXiangChun 2012-12-06 07:57:08 UTC
network driver virtio-win-1.5.4-1.el6.noarch hit the same issue.

Comment 5 Yvugenfi@redhat.com 2012-12-06 09:53:25 UTC
Hi Laszlo,

I looked at the code of the guest driver - we have a bug on driver startup.
We are not checking the status on start up. We will during the change of the link, during adapter restart by NDIS, upon return from S3\S4 and on timer if a specific parameter is set - and yes it is done by the ParaNdis_ReportLinkStatus.

So this bug can be fixed. Also there is a workaround  - using  "TestOnly.DelayConnect(ms)" parameter - in this case the driver will indicate the connection status after set number of milliseconds and it will check the actual device status.

Regarding
>>> "set_link net0 on" cann't change NIC status, it is still off status in 'info qtree'

I think this is something that should be checked in QEMU.


Best regards,
Yan.

Comment 6 Laszlo Ersek 2012-12-06 10:53:54 UTC
Thanks for checking, Yan; I'm changing the component to virtio-win then.

Xiang Chun, regarding "set_link net0 on":
- can you please open a separate BZ for that?
- does it always fail, or only when you pass "status=off" to virtio-net-pci at qemu startup? In other words, does it work when you start qemu normally, and then do "set_link net0 off", "set_link net0 on"?

Thanks!

Comment 7 FuXiangChun 2012-12-07 03:15:03 UTC
(In reply to comment #6)
> Thanks for checking, Yan; I'm changing the component to virtio-win then.
> 
> Xiang Chun, regarding "set_link net0 on":
> - can you please open a separate BZ for that?
I opened a new bug 884923.
> - does it always fail, or only when you pass "status=off" to virtio-net-pci
> at qemu startup? In other words, does it work when you start qemu normally,
> and then do "set_link net0 off", "set_link net0 on"?
Mainly issue:Normally boot guest with "status=off", virtio-net-pci works well inside guest after guest boots successfully.  My understanding is that virtio-net-pci shouldn't work(because it's status is off)
> 
> Thanks!

Comment 8 Laszlo Ersek 2012-12-07 10:37:28 UTC
Yan,

please see bug 884923 comment 3.

(In reply to comment #5)

> I looked at the code of the guest driver - we have a bug on driver startup.
> We are not checking the status on start up.

This may still be worth fixing (I can't tell), but I'd like to let you know that the "status=off" qdev property spec on the qemu command line is *not* about link status. It is about a host feature -- whether the host makes the link status available to the guest *at all* (ie. the "status" field in the virtio-net device specific config struct). If the feature is absent, then the guest must assume the link is always active. If the feature is on, the guest must check for link status.

In practice RHEL-6 qemu-kvm always makes the status word available, apparently.

Comment 9 Yvugenfi@redhat.com 2012-12-09 08:23:18 UTC
(In reply to comment #8)
> Yan,
> 
> please see bug 884923 comment 3.
> 
> (In reply to comment #5)
> 
> > I looked at the code of the guest driver - we have a bug on driver startup.
> > We are not checking the status on start up.
> 
> This may still be worth fixing (I can't tell), but I'd like to let you know
> that the "status=off" qdev property spec on the qemu command line is *not*
> about link status. It is about a host feature -- whether the host makes the
> link status available to the guest *at all* (ie. the "status" field in the
> virtio-net device specific config struct). If the feature is absent, then
> the guest must assume the link is always active. If the feature is on, the
> guest must check for link status.
> 
> In practice RHEL-6 qemu-kvm always makes the status word available,
> apparently.

Already understood it when tried to run a debugging :)

So in this case I don't understand what's the issue... status=0ff -> NIC link is always on. 
Although the property name is very confusing.

Comment 10 RHEL Program Management 2012-12-14 06:56:01 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 11 Yvugenfi@redhat.com 2012-12-19 14:25:54 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Thanks for checking, Yan; I'm changing the component to virtio-win then.
> > 
> > Xiang Chun, regarding "set_link net0 on":
> > - can you please open a separate BZ for that?
> I opened a new bug 884923.
> > - does it always fail, or only when you pass "status=off" to virtio-net-pci
> > at qemu startup? In other words, does it work when you start qemu normally,
> > and then do "set_link net0 off", "set_link net0 on"?
> Mainly issue:Normally boot guest with "status=off", virtio-net-pci works
> well inside guest after guest boots successfully.  My understanding is that
> virtio-net-pci shouldn't work(because it's status is off)
> > 
> > Thanks!

Hi,

According to Laszlo clarification and actual behavior of "status=off", status=off means that we do not support link notifications, closing this bug.

Reading link status on driver start up fixed by the following commit:
http://git.engineering.redhat.com/?p=users/yvugenfi/internal-kvm-guest-drivers-windows/.git;a=commit;h=9ca8b6fe68573e6fff707b66b302ae2fd4d4949d

Best regards,
Yan.


Note You need to log in before you can comment on or make changes to this bug.