From owner-svn-src-all@freebsd.org Fri Dec 13 01:17:20 2019 Return-Path: Delivered-To: svn-src-all@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 930F81DEB95; Fri, 13 Dec 2019 01:17:20 +0000 (UTC) (envelope-from jhb@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 47Yt7N3FTrz4L3Y; Fri, 13 Dec 2019 01:17:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 6AA2F4960; Fri, 13 Dec 2019 01:17:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBD1HKVJ011411; Fri, 13 Dec 2019 01:17:20 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBD1HKnP011410; Fri, 13 Dec 2019 01:17:20 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912130117.xBD1HKnP011410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 13 Dec 2019 01:17:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355683 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 355683 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2019 01:17:20 -0000 Author: jhb Date: Fri Dec 13 01:17:20 2019 New Revision: 355683 URL: https://svnweb.freebsd.org/changeset/base/355683 Log: Don't call into the debug server if it isn't configured. Reviewed by: markj (as part of a larger diff) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D20309 Modified: head/usr.sbin/bhyve/bhyverun.c Modified: head/usr.sbin/bhyve/bhyverun.c ============================================================================== --- head/usr.sbin/bhyve/bhyverun.c Fri Dec 13 00:45:14 2019 (r355682) +++ head/usr.sbin/bhyve/bhyverun.c Fri Dec 13 01:17:20 2019 (r355683) @@ -167,6 +167,7 @@ uint16_t cores, maxcpus, sockets, threads; char *guest_uuid_str; +static int gdb_port = 0; static int guest_vmexit_on_hlt, guest_vmexit_on_pause; static int virtio_msix = 1; static int x2apic_mode = 0; /* default is xAPIC */ @@ -416,7 +417,8 @@ fbsdrun_start_thread(void *param) snprintf(tname, sizeof(tname), "vcpu %d", vcpu); pthread_set_name_np(mtp->mt_thr, tname); - gdb_cpu_add(vcpu); + if (gdb_port != 0) + gdb_cpu_add(vcpu); vm_loop(mtp->mt_ctx, vcpu, vmexit[vcpu].rip); @@ -690,8 +692,11 @@ vmexit_mtrap(struct vmctx *ctx, struct vm_exit *vmexit stats.vmexit_mtrap++; + if (gdb_port == 0) { + fprintf(stderr, "vm_loop: unexpected VMEXIT_MTRAP\n"); + exit(4); + } gdb_cpu_mtrap(*pvcpu); - return (VMEXIT_CONTINUE); } @@ -770,6 +775,10 @@ static int vmexit_debug(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { + if (gdb_port == 0) { + fprintf(stderr, "vm_loop: unexpected VMEXIT_DEBUG\n"); + exit(4); + } gdb_cpu_suspend(*pvcpu); return (VMEXIT_CONTINUE); }