From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDA6CC35646 for ; Fri, 21 Feb 2020 16:49:19 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5C13E2067D for ; Fri, 21 Feb 2020 16:49:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C13E2067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48PHVN3BSqzDqn5 for ; Sat, 22 Feb 2020 03:49:16 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=nathanl@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48PHSh6bBRzDqfW for ; Sat, 22 Feb 2020 03:47:48 +1100 (AEDT) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01LGigIr011113; Fri, 21 Feb 2020 11:47:44 -0500 Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y8ubym7gq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Feb 2020 11:47:43 -0500 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 01LGj8b7004900; Fri, 21 Feb 2020 16:47:42 GMT Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by ppma04wdc.us.ibm.com with ESMTP id 2y68976dqq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Feb 2020 16:47:42 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01LGlgtk50856246 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Feb 2020 16:47:42 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 423F6124053; Fri, 21 Feb 2020 16:47:42 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1E774124054; Fri, 21 Feb 2020 16:47:42 +0000 (GMT) Received: from localhost (unknown [9.41.179.160]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 21 Feb 2020 16:47:42 +0000 (GMT) From: Nathan Lynch To: "Gautham R. Shenoy" Subject: Re: [PATCH v2 3/5] powerpc/pseries: Account for SPURR ticks on idle CPUs In-Reply-To: <1582262314-8319-4-git-send-email-ego@linux.vnet.ibm.com> References: <1582262314-8319-1-git-send-email-ego@linux.vnet.ibm.com> <1582262314-8319-4-git-send-email-ego@linux.vnet.ibm.com> Date: Fri, 21 Feb 2020 10:47:41 -0600 Message-ID: <87ftf3ubte.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-02-21_05:2020-02-21, 2020-02-21 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 suspectscore=1 malwarescore=0 mlxlogscore=879 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002210126 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tyrel Datwyler , linux-kernel@vger.kernel.org, Kamalesh Babulal , "Naveen N. Rao" , Vaidyanathan Srinivasan , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" "Gautham R. Shenoy" writes: > +static inline void snapshot_spurr_idle_entry(void) > +{ > + *this_cpu_ptr(&idle_entry_spurr_snap) = mfspr(SPRN_SPURR); > +} > + [...] > +static inline void update_idle_spurr_accounting(void) > +{ > + u64 *idle_spurr_cycles_ptr = this_cpu_ptr(&idle_spurr_cycles); > + u64 in_spurr = *this_cpu_ptr(&idle_entry_spurr_snap); > + > + *idle_spurr_cycles_ptr += mfspr(SPRN_SPURR) - in_spurr; > +} [...] > +static inline u64 read_this_idle_spurr(void) > +{ > + /* > + * If we are reading from an idle context, update the > + * idle-spurr cycles corresponding to the last idle period. > + * Since the idle context is not yet over, take a fresh > + * snapshot of the idle-spurr. > + */ > + if (get_lppaca()->idle == 1) { > + update_idle_spurr_accounting(); > + snapshot_spurr_idle_entry(); This samples spurr twice when it could do with just one. I don't know the performance implications, but will the results be coherent?