From patchwork Mon Feb 17 11:17:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11386131 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 91B46109A for ; Mon, 17 Feb 2020 11:18:47 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6D3FF2070B for ; Mon, 17 Feb 2020 11:18:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="G1d0ZHd5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D3FF2070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j3ePK-0006bf-89; Mon, 17 Feb 2020 11:17:46 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j3ePJ-0006ba-6d for xen-devel@lists.xenproject.org; Mon, 17 Feb 2020 11:17:45 +0000 X-Inumbo-ID: 1e455010-5177-11ea-bfcd-12813bfff9fa Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1e455010-5177-11ea-bfcd-12813bfff9fa; Mon, 17 Feb 2020 11:17:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1581938264; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FV/TMnSmgfHBpkUWVZPWz/LX4LCctWW2dzYLExVsyoA=; b=G1d0ZHd5Xb3gtAfnAS64u2eQvu2IYG/Mdb4CKlSHseXMWpTyWSMaVkWq tZJpgpUrfLbJ4lZ84knhPnZ+UYaUCMmqmJZwFhBQnRU2ovJxOgxTotm7p jfKEgkRWP/mOoMG2vQrrTR8LrTvKSKT59bhMJn6loz044mN1pimGfO9lx E=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: tk+nmZ7os2LlsQjuzO89MDdHmiIW7ZQlBjdEcm+Bw0mE8gQlOCOqepx0bEINP/NGjEjB4zgfky /6Ijz71ypmzgTWztm6r6ecC/shWpt7dC5g0VPMyyhuvDD1Neo9QLIGnkR7A0/c86FZXnzjJu5E 9gNrGFVr32EdrQbpZqTSMrjwbjkClC+QCRLPQGAlI5IHK25fiyefsDzOqVufyQndpbQpNf2YA6 WHFYtcQZ5zL9vrufJr2DJ5xXcicsoqQtsGbuALQQ+l7+0+kAa1LbegTT//JMrpeQvW7OJLo7o7 1e0= X-SBRS: 2.7 X-MesageID: 12922760 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,452,1574139600"; d="scan'208";a="12922760" From: Andrew Cooper To: Xen-devel Date: Mon, 17 Feb 2020 11:17:38 +0000 Message-ID: <20200217111740.7298-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200217111740.7298-1-andrew.cooper3@citrix.com> References: <20200217111740.7298-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/3] x86/nmi: Corrections and improvements to do_nmi_stats() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The hardware domain doesn't necessarily have the domid 0. Render v instead, adjusting the strings to avoid printing trailing whitespace. Rename i to cpu, and use separate booleans for pending/masked. Drop the unnecessary domain local variable. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monné --- xen/arch/x86/nmi.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c index a5c6bdd0ce..638677a5fe 100644 --- a/xen/arch/x86/nmi.c +++ b/xen/arch/x86/nmi.c @@ -587,25 +587,25 @@ static void do_nmi_trigger(unsigned char key) static void do_nmi_stats(unsigned char key) { - int i; - struct domain *d; - struct vcpu *v; + const struct vcpu *v; + unsigned int cpu; + bool pend, mask; printk("CPU\tNMI\n"); - for_each_online_cpu ( i ) - printk("%3d\t%3d\n", i, nmi_count(i)); + for_each_online_cpu ( cpu ) + printk("%3d\t%3d\n", cpu, nmi_count(cpu)); - if ( ((d = hardware_domain) == NULL) || (d->vcpu == NULL) || - ((v = d->vcpu[0]) == NULL) ) + if ( !hardware_domain || !hardware_domain->vcpu || + !(v = hardware_domain->vcpu[0]) ) return; - i = v->async_exception_mask & (1 << VCPU_TRAP_NMI); - if ( v->nmi_pending || i ) - printk("dom0 vpu0: NMI %s%s\n", - v->nmi_pending ? "pending " : "", - i ? "masked " : ""); + pend = v->nmi_pending; + mask = v->async_exception_mask & (1 << VCPU_TRAP_NMI); + if ( pend || mask ) + printk("%pv: NMI%s%s\n", + v, pend ? " pending" : "", mask ? " masked" : ""); else - printk("dom0 vcpu0: NMI neither pending nor masked\n"); + printk("%pv: NMI neither pending nor masked\n", v); } static __init int register_nmi_trigger(void)