From nobody Mon Feb 28 18:12:00 2022 X-Original-To: virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0EF1219F4A38 for ; Mon, 28 Feb 2022 18:12:01 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K6pPD5zbWz3sDl for ; Mon, 28 Feb 2022 18:12:00 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE25F2016F for ; Mon, 28 Feb 2022 18:12:00 +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 21SIC08A043524 for ; Mon, 28 Feb 2022 18:12:00 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 21SIC0FF043523 for virtualization@FreeBSD.org; Mon, 28 Feb 2022 18:12:00 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 262113] bhyveclt: Every second attempt to destroy->run fails with: invalid argument error Date: Mon, 28 Feb 2022 18:12:00 +0000 X-Bugzilla-Reason: AssignedTo CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bhyve X-Bugzilla-Version: 13.0-STABLE X-Bugzilla-Keywords: needs-qa X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: risner@stdio.com X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: virtualization@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? maintainer-feedback? maintainer-feedback? X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646071920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VN/XVIkSR4jqij2Mjm0PputMkHQqhpm/UVrhRWRkoow=; b=Dj3jlDM1bKp8d8bNNx2tlTOGSeVBCE/99hLIcZF8d7mWbRjI2J3GZzNu+DfbYZEe0mI3/N ZRpGcdFUX3G6iqWFFWXfJezH6wJY7lDq9UFSVuIrpOgsGGElUS7YNUwjgeDiHh6VH4vg3j NU3vu8nOzPP9jwVJ32L+0l/MjKj9ejfeVQmoCPwR7Cqo5rKtCcTB2wEOTS7M7kWyNr96az AxEdJUgPyVxQzYUKOjZXbu2DT05TbYr86mmOJyyzTkNBSIXe84ndtRTu1RVhaxA3XUAMhq QUpHT6qJv9mChTZ7FqrpCRKhPkip8Yt9zk8/IlRIFII2ti7x7ymM/ZWfRHWXkQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646071920; a=rsa-sha256; cv=none; b=wu6RB8avW1Q85w35uj+QVnPU3jVGHWWGXw+uB5xWuP2F779w6OV9cKu7/ew5FsK40mhEJQ zU+oPw+VlbbRxxLzNyQEk1xWYdcjQPSYRmKxivMf3f4UhaRl11z5hgjYG3tgf8PIfIJDEb 2YqiIydflKzOcyr2EaSYxuOe1oAlmGO9dWSQ+GwrDVNapzm+bdR8koqOd/cRGZxF9Yu3MH pKHA2VFC+6hXduZLTa0kpXOEXeuBeN8APG6F92LLnuSb593r2QNT0Mz7bUAGI9Xaju9fwA hoDtTfsNOuyLsebAkoU6PF9xJrf+MvJyDuWf3heVhWkWpyC2q1H7qMhfiuOnSQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D262113 --- Comment #4 from risner --- As advised, I found it worked if I give it several second between the destr= oy and the creation of a new session. The destroy_dev_sched_cb() call is the scheduled task in the kernel. It appears to remove the /dev/vmm entry, but = not yet all the kernel entries are removed by the time the create call tries to= add them back. While looking at the code it felt to me this line: https://github.com/freebsd/freebsd-src/blob/22054f88914b51113f77f6eccc11353= a891f9f3e/usr.sbin/bhyve/bhyverun.c#L1081 Only covered the situation of "the VM still exists" and doesn't cover "the = VM is being destroy but not yet completely destroyed." In the case of it being destroyed, the code falls through to: https://github.com/freebsd/freebsd-src/blob/22054f88914b51113f77f6eccc11353= a891f9f3e/usr.sbin/bhyve/bhyverun.c#L1105 with an invalid argument return value vm_open() as it's been destroy by the time this happens. Is there no way to catch the scheduled destroy and return something other t= han EEXIST in the create to catch this state? Addressing the points brought up (lines beginning with >> are my responses): - the docs issue that would seem to imply destroy is necessary in certain cases. >> My confusion would have been alleviated by adding a note that destroy is= only needed if you have no plans to resume the vm and wish to free the wir= ed memory. - presumably we'd like a destroy/run cycle/procedure to either a) work, or,= at least b) have an improved user experience that an error every second attemp= t. >> Adding another state response distinct from EEXIST say perhaps ESHUTDOWN= if there is scheduled destroy, the error could be less confusing by respon= ding with "destroy in progress" or similar. --=20 You are receiving this mail because: You are the assignee for the bug. You are on the CC list for the bug.=