RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 890288 - use set_link to change rtl8139 and e1000 network card's status but fail to make effectively after reboot guest
Summary: use set_link to change rtl8139 and e1000 network card's status but fail to m...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.4
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Amos Kong
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 907397 907716 913425
TreeView+ depends on / blocked
 
Reported: 2012-12-26 08:19 UTC by Sibiao Luo
Modified: 2015-05-25 00:06 UTC (History)
19 users (show)

Fixed In Version: qemu-kvm-0.12.1.2-2.349.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 907716 913425 (view as bug list)
Environment:
Last Closed: 2013-02-21 07:45:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0527 0 normal SHIPPED_LIVE qemu-kvm bug fix and enhancement update 2013-02-20 21:51:08 UTC

Description Sibiao Luo 2012-12-26 08:19:13 UTC
Description of problem:
boot guest with rtl8139/e1000 nic device, then set_link the rtl8139/e1000 network card's status to 'off' and check it status is 'down' in guest, but after reboot guest, it will return back to 'up' status. 
BTW, both the rtl8139 and e1000 nic device have this issue, but virtio_net has no such issue.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm
2.6.32-351.el6.x86_64
qemu-kvm-0.12.1.2-2.348.el6.x86_64
guest info:
rhel6.4 64bit
kernel-2.6.32-351.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.boot guest with rtl8139/e1000/virtio_net nic device.
eg:...-netdev tap,id=hostnet1,vhost=on,script=/etc/qemu-ifup -device e1000,netdev=hostnet1,id=e1000-net-pci1,mac=34:40:B5:9E:D3:91,bus=pci.0,addr=0x5
2.check nic status in guest(default: 'up').
# cat /sys/class/net/eth0/operstate 
up
3.change nic status in monitor.
(qemu) set_link $network_device off
4.re-check nic status in guest.
# cat /sys/class/net/eth0/operstate 
down
5.reboot guest and recheck nic status.
# cat /sys/class/net/eth0/operstate
  
Actual results:
after step 5, the rtl8139/e1000 network card's status return back to 'up', but the virtio_net nic is still 'down' status.
# cat /sys/class/net/eth0/operstate
up                   <---------for rtl8139/e1000

Expected results:
the rtl8139/e1000 network card's status is still 'down' status after reboot guest.
# cat /sys/class/net/eth0/operstate
down

Additional info:

Comment 2 Amos Kong 2012-12-27 11:05:33 UTC
This problem can also be reproduced by this steps:

1. boot a guest with e1000 / rtl8139 nic (pause guest by -S option)
2. set link down by monitor
  (qemu) set_link ... off
3. continue guest
  (qemu) c
4. check link status in guest

Comment 3 Amos Kong 2012-12-28 02:07:12 UTC
I tried with latest guest kernel (3.6.10-2.fc17.x86_64, driver updated) & latest upstream qemu

+ virtio-net:
  after reboot, link status is down in guest, network is unavailable.
+ rtl8139:
  after reboot, link status is unexpectedly up in guest, network is unavailable.
+e1000: (guest reboot will reset qemu setup)
  after reboot, link will be reset to be up, and network is (unexpectedly) available.

Comment 4 jason wang 2012-12-28 03:40:41 UTC
(In reply to comment #3)
> I tried with latest guest kernel (3.6.10-2.fc17.x86_64, driver updated) &
> latest upstream qemu
> 
> + virtio-net:
>   after reboot, link status is down in guest, network is unavailable.
> + rtl8139:
>   after reboot, link status is unexpectedly up in guest, network is
> unavailable.
> +e1000: (guest reboot will reset qemu setup)
>   after reboot, link will be reset to be up, and network is (unexpectedly)
> available.

Need to check whether the link status were preserved during reset for 8139. For e1000, I remember that there's a patch to preserved the link status, need to check whether the link status negotiation emulation patch has side effect of this.

Thanks

Comment 5 Amos Kong 2012-12-28 08:03:29 UTC
For e1000, link auto-negotiation emulation will always set link up in e1000_autoneg_timer, it's a regression bug, can be fixed by this patch:

diff --git a/hw/e1000.c b/hw/e1000.c
index 5537ad2..a3b602e 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -164,6 +164,10 @@ static void
 set_phy_ctrl(E1000State *s, int index, uint16_t val)
 {
     if ((val & MII_CR_AUTO_NEG_EN) && (val & MII_CR_RESTART_AUTO_NEG)) {
+        if (s->nic->nc.link_down) {
+            s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;
+            return;
+        }
         s->nic->nc.link_down = true;
         e1000_link_down(s);
         s->phy_reg[PHY_STATUS] &= ~MII_SR_AUTONEG_COMPLETE;

Comment 6 Amos Kong 2012-12-28 09:37:46 UTC
Posted two patches to upstream:
http://lists.gnu.org/archive/html/qemu-devel/2012-12/msg03555.html

  e1000: no need auto-negotiation if link was down
  rtl8139: preserve link state across device reset

(tested with wxp & rhel6 guests)

Comment 7 Amos Kong 2012-12-29 00:49:53 UTC
Hi Ademar,

> +e1000: (guest reboot will reset qemu setup)
>   after reboot, link will be reset to be up, and network is (unexpectedly)
> available.

^^^ rhel6 kernel & qemu-kvm-rhel6 also got this result

So if Admin limits VM user network by set_link, user can smartly re-got network by a reboot

For e1000, it is a regression introduced in RHEL6.4 by this commit:
so I agree to bug this bz in 6.4 by exception+

| commit ebfdba95f6fd2719dda11f4ebd9267af270e921b
| Author: Xiao Wang <jasowang>
| Date:   Fri Aug 10 09:03:49 2012 -0300
| 
|     e1000: link auto-negotiation emulation

Comment 8 Ademar Reis 2013-01-02 12:58:23 UTC
(In reply to comment #7)
> For e1000, it is a regression introduced in RHEL6.4 by this commit:
> so I agree to bug this bz in 6.4 by exception+
> 
> | commit ebfdba95f6fd2719dda11f4ebd9267af270e921b
> | Author: Xiao Wang <jasowang>
> | Date:   Fri Aug 10 09:03:49 2012 -0300
> | 
> |     e1000: link auto-negotiation emulation

Thanks for the details. Adding Regression keyword and requesting the blocker flag.

Comment 12 Sibiao Luo 2013-01-09 08:39:18 UTC
Verify this bug on qemu-kvm-0.12.1.2-2.349.el6.x86_64 with the comment #0 steps.

host info:
kernel-2.6.32-351.el6.x86_64
qemu-kvm-0.12.1.2-2.349.el6.x86_64
guest info:
kernel-2.6.32-351.el6.x86_64

steps:
the same to comment #0

Results:
after step 5, the rtl8139/e1000 network card's status is still 'down' status after reboot guest, and the network is unavailable.

Base on above, this issue has been fixed correctly.

Comment 14 Amos Kong 2013-02-01 07:59:20 UTC
http://marc.info/?t=135967653900002&r=1&w=3

Michael Roth (mdroth.ibm.com) raised a possible problem in upstream, I will track on it.

Comment 19 errata-xmlrpc 2013-02-21 07:45:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0527.html


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