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=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable 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 84927C35641 for ; Mon, 24 Feb 2020 04:57:10 +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 0387A20656 for ; Mon, 24 Feb 2020 04:57:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0387A20656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.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 48QqYH5BjJzDqSM for ; Mon, 24 Feb 2020 15:57:07 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=ego@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 48QqW91XLRzDqFS for ; Mon, 24 Feb 2020 15:55:16 +1100 (AEDT) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01O4oL2W050797; Sun, 23 Feb 2020 23:55:10 -0500 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 2yb008tudv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Feb 2020 23:55:10 -0500 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 01O4pL9W005423; Mon, 24 Feb 2020 04:55:09 GMT Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by ppma02dal.us.ibm.com with ESMTP id 2yaux6cqjr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Feb 2020 04:55:09 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01O4t9rY45023654 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Feb 2020 04:55:09 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1847FB2064; Mon, 24 Feb 2020 04:55:09 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CDCB5B205F; Mon, 24 Feb 2020 04:55:08 +0000 (GMT) Received: from sofia.ibm.com (unknown [9.124.35.26]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 24 Feb 2020 04:55:08 +0000 (GMT) Received: by sofia.ibm.com (Postfix, from userid 1000) id 39DCC2E3231; Mon, 24 Feb 2020 10:25:06 +0530 (IST) Date: Mon, 24 Feb 2020 10:25:06 +0530 From: Gautham R Shenoy To: Nathan Lynch Subject: Re: [PATCH v2 1/5] powerpc: Move idle_loop_prolog()/epilog() functions to header file Message-ID: <20200224045506.GA12846@in.ibm.com> References: <1582262314-8319-1-git-send-email-ego@linux.vnet.ibm.com> <1582262314-8319-2-git-send-email-ego@linux.vnet.ibm.com> <87lfowt22z.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87lfowt22z.fsf@linux.ibm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-23_07:2020-02-21, 2020-02-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 impostorscore=0 suspectscore=0 adultscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002240040 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: , Reply-To: ego@linux.vnet.ibm.com Cc: "Gautham R. Shenoy" , 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" Hello Nathan, On Fri, Feb 21, 2020 at 09:03:16AM -0600, Nathan Lynch wrote: > "Gautham R. Shenoy" writes: > > > From: "Gautham R. Shenoy" > > > > Currently prior to entering an idle state on a Linux Guest, the > > pseries cpuidle driver implement an idle_loop_prolog() and > > idle_loop_epilog() functions which ensure that idle_purr is correctly > > computed, and the hypervisor is informed that the CPU cycles have been > > donated. > > > > These prolog and epilog functions are also required in the default > > idle call, i.e pseries_lpar_idle(). Hence move these accessor > > functions to a common header file and call them from > > pseries_lpar_idle(). Since the existing header files such as > > asm/processor.h have enough clutter, create a new header file > > asm/idle.h. > > > > Signed-off-by: Gautham R. Shenoy > > --- > > arch/powerpc/include/asm/idle.h | 27 +++++++++++++++++++++++++++ > > arch/powerpc/platforms/pseries/setup.c | 7 +++++-- > > drivers/cpuidle/cpuidle-pseries.c | 24 +----------------------- > > 3 files changed, 33 insertions(+), 25 deletions(-) > > create mode 100644 arch/powerpc/include/asm/idle.h > > > > diff --git a/arch/powerpc/include/asm/idle.h b/arch/powerpc/include/asm/idle.h > > new file mode 100644 > > index 0000000..f32a7d8 > > --- /dev/null > > +++ b/arch/powerpc/include/asm/idle.h > > @@ -0,0 +1,27 @@ > > +#ifndef _ASM_POWERPC_IDLE_H > > +#define _ASM_POWERPC_IDLE_H > > +#include > > + > > +static inline void idle_loop_prolog(unsigned long *in_purr) > > +{ > > + ppc64_runlatch_off(); > > + *in_purr = mfspr(SPRN_PURR); > > + /* > > + * Indicate to the HV that we are idle. Now would be > > + * a good time to find other work to dispatch. > > + */ > > + get_lppaca()->idle = 1; > > +} > > + > > +static inline void idle_loop_epilog(unsigned long in_purr) > > +{ > > + u64 wait_cycles; > > + > > + wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles); > > + wait_cycles += mfspr(SPRN_PURR) - in_purr; > > + get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles); > > + get_lppaca()->idle = 0; > > + > > + ppc64_runlatch_on(); > > +} > > +#endif > > Looks fine and correct as a cleanup, but asm/include/idle.h and > idle_loop_prolog, idle_loop_epilog, strike me as too generic for > pseries-specific code. Should it be prefixed with pseries , i.e pseries_idle_prolog() and pseries_idle_epilog() ? Also, I am planning another round of cleanup to move all the idle-related declaration from asm/include/processor.h to asm/include/idle.h