Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp299169imm; Thu, 14 Jun 2018 20:42:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIyYg/vBI07OXNGDVimIe4d6+AHAuGBuvHYVJSbO1huPciSELJyOwUS9ywAENDnLMPTbLXb X-Received: by 2002:a63:6186:: with SMTP id v128-v6mr4706524pgb.35.1529034137017; Thu, 14 Jun 2018 20:42:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529034136; cv=none; d=google.com; s=arc-20160816; b=fAfVSnR4XKmKy8erH5EM4vAIxv9plqleLJJXwwAkI8/pQ1/TytGdoLeARMeie+4FaC dnASO/dqGXDftwdHuSY/thQu1Jr8tPLFGpaVh9VdSffTTHaEgm3t8Bi2wbK4fDGY3Q1L 8ZoRNlM9Z95fdSm/CaO3cooaNEy1qzmb6rETxeJLrK92oVpheEWEgn5QPNmrQccm1JXX 3PKyzOQSaqvNay9YVnIloFawNXhDTH6i85cqloOT5LS9RwpKWl/JeppW5t5tXJgGU8tH rG/ANEijRHMtpQGbGxDnJWeCfUZWPbbEVJ/S5zCNryQCndZHw8m1ZodiFD/TdlvGD+GL /wVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=tIlhi0ZR2CRJYTtBx5J8wPs1PdAk9Iyp8tqn6GyHRBs=; b=Vsunl6gHH6CFoCpSIUm1nlz+EQEfoQEAsk5GoRdAJ9O28RatT/1M3WwN6i+8G/wt97 I3pEZnP9vaUbEiKUtJGlp2r0gn2GYN2+egpkDp5H52/y+RWkVZrSEmdXRQPVuv54WN8E xY2yNpthxXQLnC88DuzckTEKMbU4cnK6onRze8p86kYZDyJHkL00CBjqyBfbiCWOJxuA 2lkzvMMXcpLk6+QOexsoTLNUcdp68wJjncP0hHOQDZzhl5Rnu7s8aComhdjw04E+B+qd +JO+SHwNsIkmbvT6E5nmiEpyF8Kd3+vwncAhR2L6MwIhZ24QMfBfDKoF/sr2oCSZ92Zt RneQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q72-v6si6784607pfi.183.2018.06.14.20.42.02; Thu, 14 Jun 2018 20:42:16 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965504AbeFODlg (ORCPT + 99 others); Thu, 14 Jun 2018 23:41:36 -0400 Received: from mga09.intel.com ([134.134.136.24]:36518 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964995AbeFODlf (ORCPT ); Thu, 14 Jun 2018 23:41:35 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jun 2018 20:41:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,225,1526367600"; d="scan'208";a="237618899" Received: from nelizabe-mobl.amr.corp.intel.com (HELO ssarabia-MOBL7.amr.corp.intel.com) ([10.254.79.241]) by fmsmga006.fm.intel.com with ESMTP; 14 Jun 2018 20:41:34 -0700 Date: Thu, 14 Jun 2018 20:41:33 -0700 From: Solio Sarabia To: linux-kernel@vger.kernel.org Cc: linux-perf-users@vger.kernel.org, kys@microsoft.com, stephen@networkplumber.org, shiny.sebastian@intel.com, amy.l.leeland@intel.com, solio.sarabia@intel.com Subject: Differences in cpu utilization reported by sar, emon Message-ID: <20180615034133.GA5932@ssarabia-MOBL7.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello -- I'm running into an issue where sar, mpstat, top, and other tools show less cpu utilization compared to emon [1]. Sar uses /proc/stat as its source, and was configured to collect in 1s intervals. Emon reads hardware counter MSRs in the PMU in timer intervals, 0.1s for this scenario. The platform is based on Xeon E5-2699 v3 (Haswell) 2.3GHz, 2_sockets, 18_cores/socket, 36_cores in total, running Ubuntu 16.04, Linux 4.4.0-128-generic. A network micro workload, ntttcp-for-linux [2], sends packets from client to server, through a 40GbE direct link. Numbers below are from server side. total %util CPU11 CPU21 CPU22 CPU25 emon 99.99 15.90 36.22 36.82 sar 99.99 0.06 0.36 0.35 interrupts/sec CPU11 CPU21 CPU22 CPU25 intrs/sec 846 28923 12844 6304 Contributors to /proc/interrupts: CPU11: Local timer interrupts and Rescheduling interrupts CPU21-CPU25: PCI MSI vector from network driver softirqs/sec CPU11 CPU21 CPU22 CPU25 TIMER 198 1 2 1 NET_RX 1 28889 23553 18546 TASKLET 0 28889 11676 6249 Somehow hardware irqs and softirqs do not have an effect on the core's utilization. Another observation is that as more cores are used to process packets, the emon/sar gap increases. Kernels used default HZ=250. I also tried HZ=1000, which helped improve throughput, but difference in util is still there. Same for newer kernels 4.13, 4.15. I would appreciate pointers to debug this, or insights as what could cause this behavior. [1] https://software.intel.com/en-us/download/emon-users-guide [2] https://github.com/simonxiaoss/ntttcp-for-linux Thanks, -Solio