From nobody Thu Jan 26 22:35:04 2023 X-Original-To: dev-commits-src-all@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 4P2wWX4xRYz3cCbC; Thu, 26 Jan 2023 22:35:04 +0000 (UTC) (envelope-from git@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 4P2wWX3Mwzz4Dgv; Thu, 26 Jan 2023 22:35:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674772504; 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; bh=c9xebMlLoQB1PfDQB4ibZpyi2qdWBIEIUgzT2o0XHvc=; b=M6bUL88MtEaZB//9biqiUo7PG/wvjOVsTUZblKRbIUTGLMlvohKaYl3QkY1gSACKF8y8Kd aDztMeNaP+RBKulRTQARMmp1ckYw5iBdGsljcNmCX98BJ1RdgF0MI6hx/jONgJOmZ3kUx5 +B1GiUf1MMF86CMgr2ZU0MpVUn8zXzk8lX+KMdle22AFqwdCyaeSKpHzXpFZeX0L4cfkc/ HnOCkirezXrJXh+keIhNVDvdKkHnQoU8tq3w79wYymIeON5V4qX+YiqfUKAtuz5wp6KhA+ 80+lkWh1dMPJhx0gl0Tse6C0aOLpyCla55piDxQAJDKQUn5ETx8psNNXtjfytw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674772504; 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; bh=c9xebMlLoQB1PfDQB4ibZpyi2qdWBIEIUgzT2o0XHvc=; b=WnESYPIUFbazfmoxQU1/duRROldDHvb8BU8cT0ZVO6olyZjnJPG0Ky6uz35qji3vvtRZd4 GVQBv5IyEDn1GBFmaCy2OJj/7JLBmM1jgMDrakMhB0Y8xSlTi1ejY+nRZ22P7+SY8phHDa P4eYUlZPlOSD3alNYoB7XTZqxC80+qbFhJnpfu37K+LZrpjwlU3eRdACkkL/WwkZQ6gAYX mB5gCvRiKVbrxdvy6V4q3bYeBwf6zcJ/6mgdtSb3LPxVQxZ4oujMNPyzJISipQ5e4ZqsrX saZRSRiGp8GLnDwV5TSfwucmYV+72sRAaBEEE3rDp/ELE4+K/G4dZ+C3n5RhRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674772504; a=rsa-sha256; cv=none; b=FdGEf6jSC3DTrpYhvRWHwvL/d/Fp82vlLTFnYHqMe05ts7RkvnAWr4Eb5QDlbM3oGKPpfy S4/gbEllhmz0jSmCyO02W5O8N+CaWFfv2VXHqGDM3XpKCAxXaBHYPxBN6iP6Ud+qvpZqt7 0uaKytUW4S12EvVOxPv6pEFm0UJC73CkbiDAfWUuJzTRUcW0CDpCnmXu0tqskewkFoGktx woVf4lHcBe+/0q6+Ey5Dm6dMKfPWTIU2IlB4JGEwcvE9AFVSvJByBwY8jLSWYqXBehCg22 6r+Bzfl0G6sziY2RwKRBq527Q2p1IuqZSZTiWWiszMoPUBlSxqm+5VGTjxysXQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4P2wWX27lszm7w; Thu, 26 Jan 2023 22:35:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30QMZ4SE051620; Thu, 26 Jan 2023 22:35:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30QMZ4gl051619; Thu, 26 Jan 2023 22:35:04 GMT (envelope-from git) Date: Thu, 26 Jan 2023 22:35:04 GMT Message-Id: <202301262235.30QMZ4gl051619@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 3dcdb83c85b5 - stable/13 - bhyve: Tidy vCPU pthread startup. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3dcdb83c85b5fb65ba9e826efcb7bb34091d80da Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3dcdb83c85b5fb65ba9e826efcb7bb34091d80da commit 3dcdb83c85b5fb65ba9e826efcb7bb34091d80da Author: John Baldwin AuthorDate: 2022-12-21 18:33:18 +0000 Commit: John Baldwin CommitDate: 2023-01-26 22:18:20 +0000 bhyve: Tidy vCPU pthread startup. Set the thread affinity in fbsdrun_start_thread next to where the thread name is set. This keeps all the pthread initialization operations at the start of a thread in one place. Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D37646 (cherry picked from commit 7224a96a55d512e00f390d4477e0fb0a163d7528) --- usr.sbin/bhyve/bhyverun.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index c110fecf31b0..aeafed1d0c69 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -525,7 +525,7 @@ fbsdrun_start_thread(void *param) { char tname[MAXCOMLEN + 1]; struct mt_vmm_info *mtp; - int vcpu; + int error, vcpu; mtp = param; vcpu = mtp->mt_vcpu; @@ -533,6 +533,12 @@ fbsdrun_start_thread(void *param) snprintf(tname, sizeof(tname), "vcpu %d", vcpu); pthread_set_name_np(mtp->mt_thr, tname); + if (vcpumap[vcpu] != NULL) { + error = pthread_setaffinity_np(mtp->mt_thr, sizeof(cpuset_t), + vcpumap[vcpu]); + assert(error == 0); + } + #ifdef BHYVE_SNAPSHOT checkpoint_cpu_add(vcpu); #endif @@ -971,12 +977,6 @@ vm_loop(struct vmctx *ctx, int vcpu) enum vm_exitcode exitcode; cpuset_t active_cpus; - if (vcpumap[vcpu] != NULL) { - error = pthread_setaffinity_np(pthread_self(), - sizeof(cpuset_t), vcpumap[vcpu]); - assert(error == 0); - } - error = vm_active_cpus(ctx, &active_cpus); assert(CPU_ISSET(vcpu, &active_cpus));