From nobody Tue May 23 13:23:24 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 4QQZl11LXcz4CTn6; Tue, 23 May 2023 13:23:25 +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 4QQZl10SBnz3swV; Tue, 23 May 2023 13:23:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684848205; 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=s0YNOROvuUXqGaUxg+I+yHjz2G3lkeKInvJDvnwJS60=; b=JgfhMxGqjG8KQhgiInnAyj88MwMGZELDafWXZNVom7U2IyLQUV6p9l/ZhFLdXkjqvEUATs etJoXJXamurLchSmZTaTxPLXQpyFxhBS0WzraY6JNUdIQqCNxXFIPsSNcNp4wx+1z3keJh gp0qNbb5D5LIBP/81idDjfe+DN0934qQmtXLX1WicnXW9D4ZJKr1DzmQZFdfOIv/XYCwfo u2nfwC5/NZK8WwzZJl4MxxaOEEMDhZcfnILipF+OWXlBepFfsnUjZaUJDQih+FKBI4SdIb WRrL6Mw7+8dXyYHQ+/yYKSectvx3m1XeylbqhACOvbrAkEFDaxWX8HpkFNVlrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684848205; 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=s0YNOROvuUXqGaUxg+I+yHjz2G3lkeKInvJDvnwJS60=; b=OuZzYwzmoesqp+uk07Ss4V+5m7pr3oINysTUGVS302xmPCFKATImnWxCv1gdMJ8RlrBNYR TFrVb5nGqxfeXGjAKxn91G0/HZ29JQvwNU0nio2fDrjpYP7PhpF1B3KCfupDoACZ0x3WqQ nUVBwkfcOrcvFrcfX0jJCrF/jOQCBDMkEyTzpQFPoDA816c+iwcMlHInn/4zWTUT6IIuwU ysrPr1VGdeSjw4oZ5l3+xvqMhDtmpAxZ+GvL9p/9AWkBFOJ1isqo+gfXU0ONkGb5N060o2 3xL6kr/ttBvxs2e2/55bvEfqN8FekqVj1HR8i8El2PF7F3y/Agt+hdEA7aRKBg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684848205; a=rsa-sha256; cv=none; b=gzUuTpfJrJ0zqSexInWvegy3ZW2QcDNLHoMFQbRDO3VfaaKQ7LoEGKR+0X91TnolKfEvye hglPfNXus4/H0wDkNLcSQ/pPTJ0f6UoCoQrPz7udwicfpqKlxvusFCpewfViBK9yt/7AVB hreyOFMrtkrE7J+vM4SZFtMj21X+MDKswI41lDn3p4Qxugq6tCLPy1NQpyftKEpujGBy7W IMUO2K5S5gX7tfUuaQg+QQkcDkzrjKBZciJcgcpR8P3nL62U7NFaPJ3NxdwsDVtP4GUpY5 le7jZVMSnCFHRe7AearKJ9i93sNI/W75cb/XbYq4j1jKVL7X+ZYJWkL3WrvQCQ== 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 4QQZl06g9cz11vR; Tue, 23 May 2023 13:23:24 +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 34NDNOTa016588; Tue, 23 May 2023 13:23:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34NDNO5n016587; Tue, 23 May 2023 13:23:24 GMT (envelope-from git) Date: Tue, 23 May 2023 13:23:24 GMT Message-Id: <202305231323.34NDNO5n016587@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 940e6d36de1e - main - riscv: Print less CPU 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 940e6d36de1ef010f731e290c9b2b08535fff424 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=940e6d36de1ef010f731e290c9b2b08535fff424 commit 940e6d36de1ef010f731e290c9b2b08535fff424 Author: Mitchell Horne AuthorDate: 2023-05-22 23:54:36 +0000 Commit: Mitchell Horne CommitDate: 2023-05-23 13:19:46 +0000 riscv: Print less CPU info Change the reporting strategy to more closely follow what arm64 implements: - Always print the one-line CPU summary when a core comes online - Only print the additional fields (e.g. ISA) when they differ from the CPU before it In the common case of identical CPUs this results in informative but non-repetitive output. For example, in QEMU: CPU 0 : Vendor=Unspecified Core=Unknown (Hart 0) marchid=0x80032, mimpid=0x80032 MMU: 0x7 ISA: 0x112d real memory = 8589934592 (8192 MB) avail memory = 8332300288 (7946 MB) FreeBSD/SMP: Multiprocessor System Detected: 6 CPUs CPU 1 : Vendor=Unspecified Core=Unknown (Hart 1) CPU 2 : Vendor=Unspecified Core=Unknown (Hart 2) CPU 3 : Vendor=Unspecified Core=Unknown (Hart 3) Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40024 --- sys/riscv/riscv/identcpu.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/sys/riscv/riscv/identcpu.c b/sys/riscv/riscv/identcpu.c index 01e9fe9b4669..b68cc5c78352 100644 --- a/sys/riscv/riscv/identcpu.c +++ b/sys/riscv/riscv/identcpu.c @@ -447,18 +447,30 @@ printcpuinfo(u_int cpu) KASSERT(desc->isa_extensions != 0, ("Empty extension set for CPU %u, did parsing fail?", cpu)); - /* Print details for boot CPU or if we want verbose output */ - if (cpu == 0 || bootverbose) { - /* Summary line. */ - printf("CPU %-3u: Vendor=%s Core=%s (Hart %u)\n", cpu, - desc->cpu_mvendor_name, desc->cpu_march_name, hart); + /* + * Suppress the output of some fields in the common case of identical + * CPU features. + */ +#define SHOULD_PRINT(_field) \ + (cpu == 0 || desc[0]._field != desc[-1]._field) + /* Always print summary line. */ + printf("CPU %-3u: Vendor=%s Core=%s (Hart %u)\n", cpu, + desc->cpu_mvendor_name, desc->cpu_march_name, hart); + + /* These values are global. */ + if (cpu == 0) printf(" marchid=%#lx, mimpid=%#lx\n", marchid, mimpid); + + if (SHOULD_PRINT(mmu_caps)) { printf(" MMU: %#b\n", desc->mmu_caps, "\020" "\01Sv39" "\02Sv48" "\03Sv57"); + } + + if (SHOULD_PRINT(isa_extensions)) { printf(" ISA: %#b\n", desc->isa_extensions, "\020" "\01Atomic" @@ -467,4 +479,6 @@ printcpuinfo(u_int cpu) "\06Float" "\15Mult/Div"); } + +#undef SHOULD_PRINT }