From owner-freebsd-virtualization@freebsd.org Fri Nov 8 17:20:09 2019 Return-Path: Delivered-To: freebsd-virtualization@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 504A7158500 for ; Fri, 8 Nov 2019 17:20:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 478n8T2CyRz4dYf for ; Fri, 8 Nov 2019 17:20:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 4A38C1584FF; Fri, 8 Nov 2019 17:20:09 +0000 (UTC) Delivered-To: virtualization@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49F261584FE for ; Fri, 8 Nov 2019 17:20:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478n8T18FZz4dYd for ; Fri, 8 Nov 2019 17:20:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AC991557 for ; Fri, 8 Nov 2019 17:20:09 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id xA8HK8A0083845 for ; Fri, 8 Nov 2019 17:20:08 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id xA8HK8dq083844 for virtualization@FreeBSD.org; Fri, 8 Nov 2019 17:20:08 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: virtualization@FreeBSD.org Subject: [Bug 241808] bhyve e1000 broken after r354288 Date: Fri, 08 Nov 2019 17:20:09 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bhyve X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: aleksandr.fedorov@itglobal.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: virtualization@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Nov 2019 17:20:09 -0000 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 ---<>---=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: 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: 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!!! ---<>---=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.=