Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp7034235ybf; Fri, 6 Mar 2020 09:06:36 -0800 (PST) X-Google-Smtp-Source: ADFU+vuV5ORnVy0ULPw56qwC6c8GnBTqdIqom9rC2gYVgLmEPWT3OKOzPMX+UbootdXAXYme91f+ X-Received: by 2002:a9d:70c5:: with SMTP id w5mr3445101otj.58.1583514396215; Fri, 06 Mar 2020 09:06:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583514396; cv=none; d=google.com; s=arc-20160816; b=acNBiIa4xJTwBD3Xc1NpDTHEvSCGq2DnyZXQSu2wSANcmJTCjtIce2zqf1C+y+ZU2s Y+j1wTn7BS98B8FBM5/L2s6uPmFK/+ftIaIxIziGLydjp80+zfBHMmBr+nALVl4HfNrs 2jGn+KOtIJUSdWpvTHjM+tPubif8ClZXzcUiKelnBWudRXIrRmWrYwWtAZNqsDIa53xq +RiXu9nGCAZW4t99nAFsgJkj0vH2WWaUWIcuelpRhnHSqAHnxKIaRxzsbF9+/uw92Eh4 50ueyli+BY+f4morNfe4DOJ2w11aQ/63/wqxSpiu8ORwiw9DdSN+DfyHcrj2L1jXz+3S fQjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=NxFQLc2E/ZHMBgOL4R7rMbMVGzzHpzwARo2OCMqySVQ=; b=1GTOhKEiI9DAIIvSRoapsjxe48bCbs385B7a0PEJwSADHqnd154tOgjFPJ+irlxHoD EZx1H6x4ZRKvuX19eoAlABAH5N+/fC0Cl9nFLb1/qNGPbrHsVEUMKgQFbc7FONpdrUdG QD8x/zOpxwWeHjaHN2QPxVV1+bF8ogfyO1it8u4wR74sSN5dC41eETx2cuZvvDkj4tzO FrgzXovFyoyKkB4JI+l5eGPioXDseNA3WlwB/VhGFkBvqm4IUpnf7VIuMSW1Bl4/744J uhGRg4JkSzz0Yem9MRS/jPsrNGXUE/VqwOsgtoHEFbY9p2CcdmX/iLSoIY18s6WW2Idi GuTA== 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 e17si1614300otq.272.2020.03.06.09.06.14; Fri, 06 Mar 2020 09:06:36 -0800 (PST) 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 S1726781AbgCFRDV (ORCPT + 99 others); Fri, 6 Mar 2020 12:03:21 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48240 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725873AbgCFRDU (ORCPT ); Fri, 6 Mar 2020 12:03:20 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 026Gse2H106590; Fri, 6 Mar 2020 12:03:10 -0500 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ykgnfxub8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 Mar 2020 12:03:10 -0500 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 026GwYPx031882; Fri, 6 Mar 2020 17:03:09 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma03dal.us.ibm.com with ESMTP id 2yffk8a81x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 Mar 2020 17:03:09 +0000 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 026H37Wg53412158 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 6 Mar 2020 17:03:08 GMT Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DA6DC6A047; Fri, 6 Mar 2020 17:03:07 +0000 (GMT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BF6D06A04F; Fri, 6 Mar 2020 17:03:07 +0000 (GMT) Received: from localhost (unknown [9.41.179.160]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 6 Mar 2020 17:03:07 +0000 (GMT) From: Nathan Lynch To: "Naveen N. Rao" Cc: Kamalesh Babulal , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Vaidyanathan Srinivasan , Tyrel Datwyler , ego@linux.vnet.ibm.com Subject: Re: [PATCH v2 4/5] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU In-Reply-To: <1582625516.nbsanohdks.naveen@linux.ibm.com> References: <1582262314-8319-1-git-send-email-ego@linux.vnet.ibm.com> <1582262314-8319-5-git-send-email-ego@linux.vnet.ibm.com> <87eeunubp7.fsf@linux.ibm.com> <20200224051447.GC12846@in.ibm.com> <1582625516.nbsanohdks.naveen@linux.ibm.com> Date: Fri, 06 Mar 2020 11:03:07 -0600 Message-ID: <87wo7xju0k.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-03-06_05:2020-03-06,2020-03-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 phishscore=0 spamscore=0 suspectscore=1 mlxlogscore=973 lowpriorityscore=0 adultscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003060111 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "Naveen N. Rao" writes: > Gautham R Shenoy wrote: >> On Fri, Feb 21, 2020 at 10:50:12AM -0600, Nathan Lynch wrote: >>> It's regrettable that we have to wake up potentially idle CPUs in order >>> to derive correct idle statistics for them, but I suppose the main user >>> (lparstat) of these interfaces already is causing this to happen by >>> polling the existing per-cpu purr and spurr attributes. >>> >>> So now lparstat will incur at minimum four syscalls and four IPIs per >>> CPU per polling interval -- one for each of purr, spurr, idle_purr and >>> idle_spurr. Correct? >> >> Yes, it is unforunate that we will end up making four syscalls and >> generating IPI noise, and this is something that I discussed with >> Naveen and Kamalesh. We have the following two constraints: >> >> 1) These values of PURR and SPURR required are per-cpu. Hence putting >> them in lparcfg is not an option. >> >> 2) sysfs semantics encourages a single value per key, the key being >> the sysfs-file. Something like the following would have made far more >> sense. >> >> cat /sys/devices/system/cpu/cpuX/purr_spurr_accounting >> purr:A >> idle_purr:B >> spurr:C >> idle_spurr:D >> >> There are some sysfs files which allow something like this. Eg: >> /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state >> >> Thoughts on any other alternatives? > > Umm... procfs? > /me ducks I had wondered about perf events but I'm not sure that's any more suitable. >>> At some point it's going to make sense to batch sampling of remote CPUs' >>> SPRs. > > How did you mean this? It looks like we first need to provide a separate > user interface, since with the existing sysfs interface providing > separate files, I am not sure if we can batch such reads. I mean in order to minimize IPI traffic something like: sample/calculate all of a CPU's purr, idle_purr, spurr, idle_spurr in a single IPI upon a read of any of the attributes, and cache the result for some time, so that the anticipated subsequent reads of the other attributes use the cached results instead of generating more IPIs. That would keep the current sysfs interface at the cost of imposing a certain coarseness in the results. Anyway, that's a mitigation that could be considered if the implementation in this patch is found to be too expensive in practice.