From nobody Thu Jun 30 17:27:57 2022 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 C950987025A; Thu, 30 Jun 2022 17:27:58 +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 4LYlf601TQz4Rlv; Thu, 30 Jun 2022 17:27:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656610078; 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=SmyN1V8rT1Zg+MuNHyS0UYwuzhB0ILMph+jvJwD7qSw=; b=PpvZX5Jma4mmAM9WNaoeGfKMOobBtUIZ+6qxICMkTIc+nOZum5qnFwFB68vi+i0sHhMoIu GqvO2L134FvWzoZWFUooiywUPKtwjSxtQtOKNtGvNSQw3+eMgTR1QLzOhP8o3daXfJP86X L7oatVuk5pHXyc3QxSCQT9EABeCdHXQnD6SBm3NQIXQ9GpK+MmbFVvHXs412h0oWL5oirI kGx7VIa6Xg4f0MnqS/TFT2f0e+vDbHEIF2zchepoQXb+W5g1z4eNagrky6KidEX04klk5c w1xkv7e1L5Cs5Q1BniOBUqdClh5VgqTM3MuW/18P0m94fIHyHY+0H6jk7Vfipw== 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 D1C792A1E; Thu, 30 Jun 2022 17:27:57 +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 25UHRvjb010081; Thu, 30 Jun 2022 17:27:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25UHRvdM010080; Thu, 30 Jun 2022 17:27:57 GMT (envelope-from git) Date: Thu, 30 Jun 2022 17:27:57 GMT Message-Id: <202206301727.25UHRvdM010080@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 5afcca138f6b - main - vmm: Cherry pick illumos commit '13361 bhyve should mask RDT cpuid info' 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/main X-Git-Reftype: branch X-Git-Commit: 5afcca138f6b1f9d6413de586a0cf2baf16da764 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656610078; 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=SmyN1V8rT1Zg+MuNHyS0UYwuzhB0ILMph+jvJwD7qSw=; b=xyPdh35RWJPSpSHlmCJ3qxefa369l1khMt8s9NatT1mTGOu2Th8qz5CPFwm3OD10arL24B 6RcUjnB6ahaw2tR9CBQdjkh5QMV9GxdwIg9Ix5XxkjFtP4QrZN/Md0mKPeDiNYH6DLUOGc 67jttCiFhv+8fvVL4xLhYr5bXepReIXRrX4REo1rnsDRBrp7rmuP9RZXsgqHsPE4Wr7LKb KLGaBg92kPlep/XVWmPXt0DSkMRMR+JTI5mlx+3iB0fk7EXIFXwVld9suHAxIgf/Qr91a5 dZZlxRqbljlDrn26qUXAOCgjLc2rB9mZoFIou40wW16o/0vgQQibzgWeC2U8ug== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656610078; a=rsa-sha256; cv=none; b=H2El9+Iw0HmBIieWEf1qME5qa+YqyWwFawbOD24kpQrm58CtLTyc7pJesNg7W7hpuLViZC e0VTJ9omlL2xLM4gwhUXlJlRHsmkps1RqgU4UmBbh+Os2yZDlAPMD63FEQ4jz4QkS8X7Bw B1NKNAJLxDHDmhmbWVYkq6pulTtlVj1hxpjq54vh+Q1LnzdFjL1sBIQQFSgXIfpRDJY2bh /nVSNuw2VjYoOobghMP9UUEGRAvb8ZuxeiFzvD/JNZUiIRt9yf8UrCuwJkDYnrW6Fd4pG8 gMlIjL5FdBu0of47Ki8kpeUA/kwamO5cQ5VovQlHj0xQCmpeSm8QCvVY5JxpGA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5afcca138f6b1f9d6413de586a0cf2baf16da764 commit 5afcca138f6b1f9d6413de586a0cf2baf16da764 Author: Vitaliy Gusev AuthorDate: 2022-06-30 17:27:27 +0000 Commit: John Baldwin CommitDate: 2022-06-30 17:27:27 +0000 vmm: Cherry pick illumos commit '13361 bhyve should mask RDT cpuid info' Summary: commit 1a5f1879be09d3de900b2510692dd12003784d84 Author: Patrick Mooney Date: 2020-12-16T20:02:23.000Z 13361 bhyve should mask RDT cpuid info Reviewed by: Andy Fiddaman Reviewed by: Toomas Soome Approved by: Robert Mustacchi https://github.com/illumos/illumos-gate/commit/1a5f1879be09d3de900b2510692dd12003784d8 ---- We saw similar warning of GP (on Intel Xeon CPU E5-2630 v4 and VM with Ubuntu 20.04 5.4.0-113-generic) until this commit is applied: ``` [ 1.658880] kernel: unchecked MSR access error: WRMSR to 0xc8f (tried to write 0x0000000000000000) at rIP: 0xffffffffacc735b4 (native_write_msr+0x4/0x30) [ 1.662734] kernel: Call Trace: [ 1.663885] kernel: ? clear_closid_rmid.isra.0+0x36/0x40 [ 1.665501] kernel: resctrl_online_cpu+0xdc/0x3f0 [ 1.666952] kernel: ? __switch_to_asm+0x40/0x70 [ 1.668358] kernel: ? __switch_to+0x7f/0x480 [ 1.669693] kernel: ? cat_wrmsr+0x70/0x70 [ 1.670970] kernel: cpuhp_invoke_callback+0x9b/0x580 [ 1.672541] kernel: ? __schedule+0x2eb/0x740 [ 1.673893] kernel: cpuhp_thread_fun+0xb8/0x120 [ 1.675304] kernel: smpboot_thread_fn+0xd0/0x170 [ 1.676685] kernel: kthread+0x104/0x140 [ 1.677948] kernel: ? sort_range+0x30/0x30 [ 1.679299] kernel: ? kthread_park+0x90/0x90 [ 1.680570] kernel: ret_from_fork+0x35/0x40 [ 1.682000] kernel: *** VALIDATE rdt *** [ 1.683454] kernel: resctrl: L3 monitoring detected ``` Reviewed by: markj, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D35442 --- sys/amd64/vmm/x86.c | 18 ++++++++++++++++++ sys/amd64/vmm/x86.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c index c97cb91af4f6..67542fe3b661 100644 --- a/sys/amd64/vmm/x86.c +++ b/sys/amd64/vmm/x86.c @@ -576,6 +576,24 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, uint64_t *rax, uint64_t *rbx, } break; + case CPUID_0000_000F: + case CPUID_0000_0010: + /* + * Do not report any Resource Director Technology + * capabilities. Exposing control of cache or memory + * controller resource partitioning to the guest is not + * at all sensible. + * + * This is already hidden at a high level by masking of + * leaf 0x7. Even still, a guest may look here for + * detailed capability information. + */ + regs[0] = 0; + regs[1] = 0; + regs[2] = 0; + regs[3] = 0; + break; + case CPUID_0000_0015: /* * Don't report CPU TSC/Crystal ratio and clock diff --git a/sys/amd64/vmm/x86.h b/sys/amd64/vmm/x86.h index 318f0b5cf871..4785bb8f46d4 100644 --- a/sys/amd64/vmm/x86.h +++ b/sys/amd64/vmm/x86.h @@ -41,6 +41,8 @@ #define CPUID_0000_000A (0xA) #define CPUID_0000_000B (0xB) #define CPUID_0000_000D (0xD) +#define CPUID_0000_000F (0xF) +#define CPUID_0000_0010 (0x10) #define CPUID_0000_0015 (0x15) #define CPUID_8000_0000 (0x80000000) #define CPUID_8000_0001 (0x80000001)