Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp7065032ybf; Fri, 6 Mar 2020 09:40:12 -0800 (PST) X-Google-Smtp-Source: ADFU+vuAh5QmFusrgMe6IFEK3Aj1IX8ydffo+1jYBpLOOk44H1RZHUAjQSp/EGW5pJDByiGawXaU X-Received: by 2002:a9d:10d:: with SMTP id 13mr3612615otu.334.1583516412623; Fri, 06 Mar 2020 09:40:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583516412; cv=none; d=google.com; s=arc-20160816; b=M5BhbDF/G9XfOBnxHlXZB0Nx5qoPdslrKvT77TNxmOGGQLWyW64z9jbjMSV5qniJxO z0CA1ZLDt0EOuoAGThkbRVTpP78LJoFnEoOEKYArspm4IfAqMSCCt7eCU/CbawKBdHgu jhOcvw0ir76wiVcFCOHaNuXx1K9hesU1XF9Tx3vZCzECSValxDqfHE+apQ5sbX1oaHOJ XzvgPFxZcaF+igzJN1tAvVwqC3Y40N1dz8f6kRzZPg8ekJMPN8DdTpXXznbNZqWegK+D xCftZTeB2+vK7hOKEk+dEc513F3LxBzApJ5r8hQbSlpzftl7IGFK9PHQVzVTOAUDY4NQ Q4ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :user-agent:mime-version:in-reply-to:references:cc:to:subject:from :date; bh=1eewsaLSm5qAlXoNZ15MDgiCNSQtVm2S3Ki/q/G1TtY=; b=Kcans8JbUTMOnIsSvzmpV5pBEQxkjFeiHaGBi2UFq75SJr5P9csqfrv/2ZewgCpZed QlwCTg7oS0evONkehUcJTjfzG1HZ49k6F8SD6Nq1pMTL5x1BRlJ8DuId6/53xJvR4twu 01qurAqjYAYY3eCHjIm1RauazuyjuvjzaA3PiwyAQeXAuyGIPrcts3OyJJW/TS24U0vX ZW8wWCtLATguNGLq3eicxziqyKO9l04SpCGHQTKdUej0Wll8OpuKbQVLQcLg1iLkdPIR KKxp6MmlZkRvbNnZ6b16WvBurV5TdFCxLoit6w6Qj1wBXOcF9RMMNV78HDykI1WH5ZiR A9kA== 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 m17si1903381otk.113.2020.03.06.09.39.59; Fri, 06 Mar 2020 09:40:12 -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 S1726231AbgCFRje convert rfc822-to-8bit (ORCPT + 99 others); Fri, 6 Mar 2020 12:39:34 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:53190 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725922AbgCFRje (ORCPT ); Fri, 6 Mar 2020 12:39:34 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 026HdTQm001441 for ; Fri, 6 Mar 2020 12:39:33 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2yjx06gevh-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 06 Mar 2020 12:39:31 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 6 Mar 2020 17:35:35 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 6 Mar 2020 17:35:32 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 026HZUWi30802058 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 6 Mar 2020 17:35:30 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9BA48AE04D; Fri, 6 Mar 2020 17:35:30 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3B650AE045; Fri, 6 Mar 2020 17:35:30 +0000 (GMT) Received: from localhost (unknown [9.199.51.218]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 6 Mar 2020 17:35:30 +0000 (GMT) Date: Fri, 06 Mar 2020 23:05:28 +0530 From: "Naveen N. Rao" Subject: Re: [PATCH v2 4/5] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU To: Nathan Lynch Cc: ego@linux.vnet.ibm.com, Kamalesh Babulal , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Vaidyanathan Srinivasan , Tyrel Datwyler 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> <87wo7xju0k.fsf@linux.ibm.com> In-Reply-To: <87wo7xju0k.fsf@linux.ibm.com> MIME-Version: 1.0 User-Agent: astroid/v0.15-13-gb675b421 (https://github.com/astroidmail/astroid) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT X-TM-AS-GCONF: 00 x-cbid: 20030617-4275-0000-0000-000003A90C04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20030617-4276-0000-0000-000038BE1F55 Message-Id: <1583515770.c7z1yvxj3h.naveen@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-03-06_06:2020-03-06,2020-03-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 bulkscore=0 clxscore=1015 suspectscore=0 mlxlogscore=999 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003060112 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nathan Lynch wrote: > "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. Yes, we considered that, but it looks like the event reads are not "batched" in any manner. So, the IPI overhead will be similar. > >>>> 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. Thanks for clarifying, that makes sense. Though we need to be careful in ensuring the sysfs semantics work as expected. > > Anyway, that's a mitigation that could be considered if the > implementation in this patch is found to be too expensive in practice. That's a good point. We can optimize later if this turns out to be a problem in practice, if we end up using this approach. - Naveen