Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp367254ybh; Wed, 11 Mar 2020 02:39:01 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtK4sHUGkRW5Lsq7ZLTrK/wBBFzCW9olc4eQ+WJejsD8nHT3EgpcVVajjScNtal6Wotd51j X-Received: by 2002:a9d:3435:: with SMTP id v50mr338616otb.19.1583919541088; Wed, 11 Mar 2020 02:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583919541; cv=none; d=google.com; s=arc-20160816; b=QKuYSA1Q8yDGz7/vHnM/tBI+jlqUFWlW6EsbwiYrFeNlYa1FfyCyQG8dsV3E4B+6Hf Z43PQ/PP1Qgqq6JZVV+BB3dP7wIrgZwTjj23eW3dUstrEG0zIbvnugD4Pt1+5+LT54QR JQQBUiEo63idnz7HT+h9BDY5fkSGxtMl/KBxw5y3LVGgxS/stsT31orUtERhCWpfTq+J uz26av1E7/WAjImqNcL5ddyf4rQucMEWIVX1YOfEKFLas4YhYnZezswjCNJI9QkvYlyb 9XW2Rop6RzwDUZjRNwcmI6rTDMctgKt43rutWICqQ8ku89BoSTKkFp0eGa3+DR+Qbb8m jN9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=aIsGSVZ5hRe2Si9asZC+xXmdMU+0y36Czyr2Fb5Ifjs=; b=xVtucHBMvn1UypG3NWB2Uw8rMIXnFHEKdo2Qo1404b54sPNOCdfzf+rzyF2JrzZPlR ELO33JL13ZnaVs6faAgFz3Im3+KopOerua8Y2A+irZN50l0l3KcmRbrb6iJ1rHMaCux/ KRhUc4u/zUStkMcaFbwFV6rT0tjaPSAaRgvvrlxoJmoX34kyiuq5dnZl50NSqV93cRBu 0I8KnX8xvY7txdKRlYTCiaJyE6OX9yCB2HIJXyz11XfrOiMgt3uldid1By8BfsPTlEo/ ynirPIyTJsArGcWdb4yQOawQhNwOXTc7phjMb5iCaHJJh9wLZDwKzK69yCTilPpvz2CG JjOA== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l21si820131oic.126.2020.03.11.02.38.50; Wed, 11 Mar 2020 02:39:01 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728975AbgCKJiP (ORCPT + 99 others); Wed, 11 Mar 2020 05:38:15 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:65362 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728892AbgCKJiE (ORCPT ); Wed, 11 Mar 2020 05:38:04 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02B9UI6T041942; Wed, 11 Mar 2020 05:37:58 -0400 Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ypsgvrg4k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Mar 2020 05:37:58 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 02B9ZLcx003078; Wed, 11 Mar 2020 09:37:57 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma05wdc.us.ibm.com with ESMTP id 2ypjxr3te3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Mar 2020 09:37:57 +0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02B9btrK29163852 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Mar 2020 09:37:55 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BC0766E053; Wed, 11 Mar 2020 09:37:55 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12D4C6E054; Wed, 11 Mar 2020 09:37:55 +0000 (GMT) Received: from sofia.ibm.com (unknown [9.85.122.202]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 11 Mar 2020 09:37:54 +0000 (GMT) Received: by sofia.ibm.com (Postfix, from userid 1000) id 0D1312E3219; Wed, 11 Mar 2020 15:07:47 +0530 (IST) From: "Gautham R. Shenoy" To: Nathan Lynch , Michael Ellerman , Vaidyanathan Srinivasan , Kamalesh Babulal , "Naveen N. Rao" , Tyrel Datwyler Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, "Gautham R. Shenoy" Subject: [PATCH v3 0/6] Track and expose idle PURR and SPURR ticks Date: Wed, 11 Mar 2020 15:07:35 +0530 Message-Id: <1583919461-27405-1-git-send-email-ego@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.3.1 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-03-11_02:2020-03-10,2020-03-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 suspectscore=0 priorityscore=1501 bulkscore=0 spamscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 mlxscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003110061 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Gautham R. Shenoy" Hi, This is the third version of the patches to track and expose idle PURR and SPURR ticks. These patches are required by tools such as lparstat to compute system utilization for capacity planning purposes. The previous versions can be found here: v2: https://lkml.org/lkml/2020/2/21/21 v1: https://lore.kernel.org/patchwork/cover/1159341/ They key changes from v2 are: - The prolog and epilog functions have been named pseries_idle_prolog() and pseries_idle_epilog() respectively to indicate their pseries specific nature. - Fixed the Documentation for /sys/devices/system/cpu/cpuX/idle_spurr as pointed out by Nathan Lynch. - Introduces a patch (Patch 6/6) to send an IPI in order to read and cache the values of purr, spurr, idle_purr and idle_spurr of the target CPU when any one of them is read via sysfs. These cached values will be presented if any of these sysfs are read within the next 10ms. If these sysfs files are read after 10ms from the earlier IPI, a fresh IPI is issued to read and cache the values again. This minimizes the number of IPIs required to be sent when these values are read back-to-back via the sysfs interface. Test-results: While reading the four sysfs files back-to-back for a given CPU every second for 100 seconds. Without patch 6/6 (Without caching): 16 [XICS 2 Edge IPI] = 422 times DBL [Doorbell interrupts] = 13 times Total : 435 IPIs. With patch 6/6 (With caching): 16 [XICS 2 Edge IPI] = 111 times DBL [Doorbell interrupts] = 17 times Total : 128 IPIs. Motivation: =========== On PSeries LPARs, the data centers planners desire a more accurate view of system utilization per resource such as CPU to plan the system capacity requirements better. Such accuracy can be obtained by reading PURR/SPURR registers for CPU resource utilization. Tools such as lparstat which are used to compute the utilization need to know [S]PURR ticks when the cpu was busy or idle. The [S]PURR counters are already exposed through sysfs. We already account for PURR ticks when we go to idle so that we can update the VPA area. This patchset extends support to account for SPURR ticks when idle, and expose both via per-cpu sysfs files. These patches are required for enhancement to the lparstat utility that compute the CPU utilization based on PURR and SPURR which can be found here : https://groups.google.com/forum/#!topic/powerpc-utils-devel/fYRo69xO9r4 With the patches, when lparstat is run on a LPAR running CPU-Hogs, ========================================================================= sudo ./src/lparstat -E 1 3 System Configuration type=Dedicated mode=Capped smt=8 lcpu=2 mem=4834176 kB cpus=0 ent=2.00 ---Actual--- -Normalized- %busy %idle Frequency %busy %idle ------ ------ ------------- ------ ------ 1 99.99 0.00 3.35GHz[111%] 110.99 0.00 2 100.00 0.00 3.35GHz[111%] 111.00 0.00 3 100.00 0.00 3.35GHz[111%] 111.00 0.00 ========================================================================= When lparstat is run on an LPAR that is idle, ========================================================================= $ sudo ./src/lparstat -E 1 3 System Configuration type=Dedicated mode=Capped smt=8 lcpu=2 mem=4834176 kB cpus=0 ent=2.00 ---Actual--- -Normalized- %busy %idle Frequency %busy %idle ------ ------ ------------- ------ ------ 1 0.71 99.30 2.18GHz[ 72%] 0.53 71.48 2 0.56 99.44 2.11GHz[ 70%] 0.43 69.57 3 0.54 99.46 2.11GHz[ 70%] 0.43 69.57 ========================================================================= Gautham R. Shenoy (6): powerpc: Move idle_loop_prolog()/epilog() functions to header file powerpc/idle: Add accessor function to always read latest idle PURR powerpc/pseries: Account for SPURR ticks on idle CPUs powerpc/sysfs: Show idle_purr and idle_spurr for every CPU Documentation: Document sysfs interfaces purr, spurr, idle_purr, idle_spurr pseries/sysfs: Minimise IPI noise while reading [idle_][s]purr Documentation/ABI/testing/sysfs-devices-system-cpu | 39 ++++++ arch/powerpc/include/asm/idle.h | 89 ++++++++++++++ arch/powerpc/kernel/sysfs.c | 133 +++++++++++++++++++-- arch/powerpc/platforms/pseries/setup.c | 8 +- drivers/cpuidle/cpuidle-pseries.c | 39 ++---- 5 files changed, 267 insertions(+), 41 deletions(-) create mode 100644 arch/powerpc/include/asm/idle.h -- 1.9.4