Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2767114ybp; Thu, 10 Oct 2019 12:16:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZxH3Um4qN7/2R4jpXbfhj/VgpKSbX1dAn1cJyY5g2zlNHOrvFeKFllxc2/yGcnt8hCFdX X-Received: by 2002:a17:906:1911:: with SMTP id a17mr9654352eje.14.1570734981466; Thu, 10 Oct 2019 12:16:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570734981; cv=none; d=google.com; s=arc-20160816; b=LrxskCBUN9rvYPMirdKcns91Mew79o9IwmTiFeGuR3WZhL0aDM1IrZcAsucbQ3bqmq 9dVyFYSqYjIeXpe2x+DIK6237KaXW44cdb8zD2FO0CsdYVxbg4C5mBcGOvrPfgL4T8Rk XfZ+UWu6S8CieJn2u7YBgkQES8lxB5k4GwFmVMRhtKqRP6HOQ9F2YvmtvFAhagItBakd DL2u1CD8hxbxyDC+HJ+og4aT1Jp5IZzoqs2rD5FFUFxbzGhL614FXLMaGcJhOVtN//fu sqYmJBrH5Iy3WGLvRYwBPw1UDdJPetgvR4IYjqAbbrD5pos5e7fTkRKMMLwJ9jRy6iiX lRDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject; bh=3wLGzStStavXTbF0Dwk+VO0kfRx09jIXs/0scUwgRIg=; b=aQ8ogz6bzzHBmQ78/93+Xz2PW/w2Tvuc+MqSZXFiEGIKEbIgHLhNKNX3kMu9hCQnSu KcDQcC9ZPv/QvN5Y6BFApSf6mvlq1++zaiKtnvzKailJdRMChur5kFVHnrpxYfXjJscM OoxaDktCDZEMBWDsXA6QCjp/jpRNPVxDNTkim+FH39sSqClUg5bV2UACRSK/ilxRVPYk IebB9rQrDvdQ8fVom5QP8ACAM3m7u8ebUMvQy7vWn/Ho03FrKzuSoQ1NA/7ykpwsNAkc Qxa4Y7kGkNc9auRXzQjkqBeQ6QG/UDjG4f9UBf2bcFZtY3Tx7tYcV5EfFHXRFo2EFR8+ YkEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=csail.mit.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g13si3705311ejf.133.2019.10.10.12.15.56; Thu, 10 Oct 2019 12:16:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=csail.mit.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727122AbfJJTMs (ORCPT + 99 others); Thu, 10 Oct 2019 15:12:48 -0400 Received: from outgoing-stata.csail.mit.edu ([128.30.2.210]:37943 "EHLO outgoing-stata.csail.mit.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726007AbfJJTMr (ORCPT ); Thu, 10 Oct 2019 15:12:47 -0400 X-Greylist: delayed 1315 seconds by postgrey-1.27 at vger.kernel.org; Thu, 10 Oct 2019 15:12:46 EDT Received: from [4.30.142.84] (helo=[127.0.1.1]) by outgoing-stata.csail.mit.edu with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1iIdWT-000Zwa-C8; Thu, 10 Oct 2019 14:50:49 -0400 Subject: [PATCH 1/3] tracing/hwlat: Report total time spent in all NMIs during the sample From: "Srivatsa S. Bhat" To: linux-kernel@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com Cc: amakhalov@vmware.com, akaher@vmware.com, anishs@vmware.com, bordoloih@vmware.com, srivatsab@vmware.com, srivatsa@csail.mit.edu Date: Thu, 10 Oct 2019 11:50:46 -0700 Message-ID: <157073343544.17189.13911783866738671133.stgit@srivatsa-ubuntu> User-Agent: StGit/0.18 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srivatsa S. Bhat (VMware) nmi_total_ts is supposed to record the total time spent in *all* NMIs that occur on the given CPU during the (active portion of the) sampling window. However, the code seems to be overwriting this variable for each NMI, thereby only recording the time spent in the most recent NMI. Fix it by accumulating the duration instead. Fixes: 7b2c86250122 ("tracing: Add NMI tracing in hwlat detector") Cc: stable@vger.kernel.org Signed-off-by: Srivatsa S. Bhat (VMware) --- kernel/trace/trace_hwlat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c index fa95139..a0251a7 100644 --- a/kernel/trace/trace_hwlat.c +++ b/kernel/trace/trace_hwlat.c @@ -150,7 +150,7 @@ void trace_hwlat_callback(bool enter) if (enter) nmi_ts_start = time_get(); else - nmi_total_ts = time_get() - nmi_ts_start; + nmi_total_ts += time_get() - nmi_ts_start; } if (enter)