Date: Fri, 08 Nov 2019 17:20:09 +0000 From: bugzilla-noreply@freebsd.org To: virtualization@FreeBSD.org Subject: [Bug 241808] bhyve e1000 broken after r354288 Message-ID: <bug-241808-27103@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D241808 Bug ID: 241808 Summary: bhyve e1000 broken after r354288 Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: bhyve Assignee: virtualization@FreeBSD.org Reporter: aleksandr.fedorov@itglobal.com I found a problem trying to run the following command: sh /usr/share/examples/bhyve/vmrun.sh -c 2 -m 4096M -n e1000 -t tap1000 -d freebsd-12-0.img freebsd-0 Autoboot in 9 seconds, hit [Enter] to boot or any other key to stop=20= =20=20=20=20=20=20=20=20=20 Loading kernel...=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 /boot/kernel/kernel text=3D0x1678a68 data=3D0x1cd288+0x768b40 syms=3D[0x8+0x174cd8+0x8+0x19224a]=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 Loading configured modules...=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 /boot/entropy size=3D0x1000=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 Error return from kevent change: No such file or directory=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 ---<<BOOT>>---=20= =20=20=20=20=20=20=20 Copyright (c) 1992-2018 The FreeBSD Project.=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20 Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994=20= =20=20=20=20=20=20=20 The Regents of the University of California. All rights reserved.= =20=20=20=20=20=20=20 FreeBSD is a registered trademark of The FreeBSD Foundation.=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 FreeBSD 12.0-RELEASE r341666 GENERIC amd64=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1)=20 .... driver bug: Unable to set devclass (class: atkbdc devname: (unknown)) Unhandled ps2 mouse command 0xe1 psm0: <PS/2 Mouse> irq 12 on atkbdc0 psm0: [GIANT-LOCKED] psm0: model Generic PS/2 mouse, device ID 0 Error return from kevent change: No such file or directory Error return from kevent change: No such file or directory =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 Error return from kevent change: No such file or directory =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 Error return from ke vent change: No such file or directory Error return from kevent change: No s= uch file or directory =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0= x10 on acpi0 uart0: console (9600,n,8,1) uart1: <16550 or compatible> port 0x2f8-0x2ff irq 3 on acpi0 vga0: <Generic ISA VGA> at port 0x3b0-0x3bb iomem 0xb0000-0xb7fff pnpid PNP= 0900 on isa0 As you can see, kevent () returns with an error when trying to update the l= ist of events: https://svnweb.freebsd.org/base/head/usr.sbin/bhyve/mevent.c?view=3Dmarkup#= l487 The guest virtual machine does not respond to the keyboard, etc. So, I added some debugging output to find out the cause of the error. Index: usr.sbin/bhyve/mevent.c=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20=20=20=20=20=20=20=20= =20=20=20=20=20 --- usr.sbin/bhyve/mevent.c (revision 354546)=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 +++ usr.sbin/bhyve/mevent.c (working copy)=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 @@ -200,6 +200,7 @@=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 mevent_qlock();=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 LIST_FOREACH_SAFE(mevp, &change_head, me_list, tmpp) { + if (mevp->me_closefd) { /* * A close of the file descriptor will remove the @@ -218,6 +219,8 @@ kev[i].flags =3D mevent_kq_flags(mevp); kev[i].fflags =3D mevent_kq_fflags(mevp); kev[i].udata =3D mevp; + printf("%s: fd %d, flags: %04X\r\n", __func__,=20 + mevp->me_fd, kev[i].flags); i++; } @@ -264,6 +267,8 @@ return (NULL); } + printf("%s fd: %d\r\n", __func__, tfd); + mevp =3D NULL; mevent_qlock(); @@ -338,12 +343,15 @@ if (evp->me_state =3D=3D MEV_DEL_PENDING) return (EINVAL); + printf("%s: old state: %d new state: %d fd: %d\r\n",=20 + __func__, evp->me_state, newstate, evp->me_fd); + /* * No update needed if state isn't changing */ if (evp->me_state =3D=3D newstate) return (0); - + mevent_qlock(); evp->me_state =3D newstate; @@ -484,6 +492,9 @@ if (numev) { ret =3D kevent(mfd, changelist, numev, NULL, 0, NUL= L); if (ret =3D=3D -1) { + for (int i =3D 0; i < numev; i++) + printf("%s: %d: descr: %lu flags: %04X\r\n",=20 + __func__, i, changelist[i].ident, changelist[i].flags); perror("Error return from kevent change"); } } Guest kernel output: Autoboot in 9 seconds, hit [Enter] to boot or any other key to stop=20= =20=20=20=20=20=20=20=20=20 Loading kernel...=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 /boot/kernel/kernel text=3D0x1678a68 data=3D0x1cd288+0x768b40 syms=3D[0x8+0x174cd8+0x8+0x19224a]=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 Loading configured modules...=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 /boot/entropy size=3D0x1000=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 mevent_add_state fd: 0 <-- Add stdin to kqueue=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 mevent_add_state fd: 4 <-- Add tapX descriptor to kqueue (https://svnweb.freebsd.org/base/head/usr.sbin/bhyve/net_backends.c?view=3D= markup#l223)=20 mevent_update: old state: 5 new state: 2 fd: 4 <-- Update tapX descriptor s= tate from MEV_ADD_DISABLED to MEV_ENABLE=20=20 mevent_add_state fd: 19=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 mevent_add_state fd: 7=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 mevent_build: fd 7, flags: 0001=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 mevent_build: fd 19, flags: 0001=20=20=20=20=20=20=20 mevent_build: fd 4, flags: 0004 <--- !!!!! Build eventlist for kevent() (ta= pX descriptor) - struct kevent::flags =3D=3D EV_ENABLE, But before that, there= was no call to kevent () with the EV_ADD flag for this descriptor!!!!=20=20 mevent_build: fd 0, flags: 0001=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 mevent_dispatch: 0: descr: 7 flags: 0001=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 mevent_dispatch: 1: descr: 19 flags: 0001=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20 mevent_dispatch: 2: descr: 4 flags: 0004=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 mevent_dispatch: 3: descr: 0 flags: 0001=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 Error return from kevent change: No such file or directory <-- We got an error!!! ---<<BOOT>>---=20= =20=20=20=20=20=20=20 Copyright (c) 1992-2018 The FreeBSD Project.=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20 Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994=20 As I understand, the problem is that the e1000 backend activates the recept= ion of packets too soon - before the kevent () system call is called to add descriptor to kqueue from mevent_dispatch(). If I move the netbe_rx_enable() call to e82545_rx_enable(), the guest machi= ne is working fine: Index: usr.sbin/bhyve/pci_e82545.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- usr.sbin/bhyve/pci_e82545.c (revision 354546) +++ usr.sbin/bhyve/pci_e82545.c (working copy) @@ -1526,6 +1526,7 @@ { sc->esc_rx_enabled =3D 1; + netbe_rx_enable(sc->esc_be); } static void @@ -2351,8 +2352,6 @@ net_genmac(pi, sc->esc_mac.octet); } - netbe_rx_enable(sc->esc_be); - /* H/w initiated reset */ e82545_reset(sc, 0); --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-241808-27103>