From nobody Mon Jun 12 13:50:23 2023 X-Original-To: dev-commits-src-branches@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 4QftNw1tx8z4cGd3; Mon, 12 Jun 2023 13:50:24 +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 4QftNv5FjTz47cS; Mon, 12 Jun 2023 13:50:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577823; 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=TFQtxsmmNVGc984kezxTct+c5IQKqvjJS+46fEJnVUU=; b=GUFn2kbD1h1cj5EsKm0NeX7cjFRnTpiHeRbx2XQp5bO6NdwCnhatYC2AuTb+pBcc3qAg2F FTTx9HwbgHKZI8wS/Jajmlytn90DxQ37O9fdj5z3C0DY0jIndL575QT8ZePKN0M8ZkP531 sLasXfNsexcna5b0og136bEWIZck72UrUExVu40Q6o7DvJEkRLzqAlPEc+FnfjtJaENMaK nQDvJJ/h5dVmyZdqEFJ7Ppvj1iYBkNapGUbKp1Qajw8+b7tpbE+RqJ4XZ/A/6DqVXDRscY eJ57J0FnCd2MHilrrci92jaya0wmNFF6akmmzEQjxSto0AtxtOQwOIpB7AzMBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686577823; 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=TFQtxsmmNVGc984kezxTct+c5IQKqvjJS+46fEJnVUU=; b=abwBGcNDO8eBWyGI1EC5znSfK6r3SUBLtKpFn9ONIAxsRS4nApkwmeB+zNfqEnBIIseEnk rH010XXPqcuaCMamvLG9tDA4TN/znhx4EDf563i8BE98knykHs/JZMj7RweXlesla5Wkks zOFlZGxtbob1ni/kEIYRdHZI+RGvP8giZjZO66G5UQpPGHebNVJsCLJFzgn+1UftSv6Uvd 9pKRusPyJ0rfF6f8IHoFQiDdTUqjMR+ojaM0+BKfAVez8VTEONNw+ODw+QhOUDtuEhL49A TNa2oLUJnDM63c1E/FQ7RRaMeqNN/kdocB6+EMEKBD7WMhUy72RNGfQdMqVFmg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686577823; a=rsa-sha256; cv=none; b=DthCeimXGzXrOf2Mr62If2N5bWv7Nt4hzJH4QkmsxhL8z+nQlvyjp+g8MZ4WLSyg0EFmrR JRgWl0Oy68h7yRvwmSDoF0QUA6U4o0eqPFCAR8n7rAf20f1lBMAIQmgTmQYqz3+pR56v7T vrU22WiSHoE9LPUMMy/DOUv5GGmRdrvdO2cyV+jP1UtZjz/VSxK22tNYfGBej4Genw4icG REJQrDCmqHK5gvH9k2XPc2KaDygUw45rszUzoZPBw7Ew9+dlJ67njXiW3mliic4DmRfeWZ ICDSn2nXsgiS/u5vtV9ec8aSStz0UD0ktIPTJQN7k5iYWe2xEIud+C+0GsScGA== 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 4QftNv3FPlzhjB; Mon, 12 Jun 2023 13:50:23 +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 35CDoNfX089410; Mon, 12 Jun 2023 13:50:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35CDoN1Y089409; Mon, 12 Jun 2023 13:50:23 GMT (envelope-from git) Date: Mon, 12 Jun 2023 13:50:23 GMT Message-Id: <202306121350.35CDoN1Y089409@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: ad1ed7742f0e - stable/13 - riscv: Print less CPU info List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: ad1ed7742f0e5a5059d5acac2901f74b3df7685e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=ad1ed7742f0e5a5059d5acac2901f74b3df7685e commit ad1ed7742f0e5a5059d5acac2901f74b3df7685e Author: Mitchell Horne AuthorDate: 2023-05-22 23:54:36 +0000 Commit: Mitchell Horne CommitDate: 2023-06-12 13:49:54 +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 (cherry picked from commit 940e6d36de1ef010f731e290c9b2b08535fff424) --- 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 e1a34983abf7..dafab6530024 100644 --- a/sys/riscv/riscv/identcpu.c +++ b/sys/riscv/riscv/identcpu.c @@ -449,18 +449,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" @@ -469,4 +481,6 @@ printcpuinfo(u_int cpu) "\06Float" "\15Mult/Div"); } + +#undef SHOULD_PRINT }