Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1520696ybh; Sun, 19 Jul 2020 23:38:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjlDehSuVfZHlRUMMsIot7ub4HqajIK+8FHMyJ+hzJNGEN8uA3z9zX5mcL83HU3FQyeyoQ X-Received: by 2002:a17:907:2633:: with SMTP id aq19mr19195911ejc.127.1595227082675; Sun, 19 Jul 2020 23:38:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595227082; cv=none; d=google.com; s=arc-20160816; b=fLvgCdnBw87slfas85qxhMUEL+/7ZKJYJN21gpygij/KmYCv4jDyBiYBk5W0bgzTES tyA8rYxJoLdU+GDRVoNMCq4mljFVlItjggucV9qbYL8WwB18c+KnR757PMfiQ8r/cSat wjP8rP8CJzAHwXoLD0qOBV1H2rWFSPQTJRjNpPnSwv4YsRXwT/TD2k96pA1zwwOA3kXT oZNxm5K3F41H0bqqnK/PTB27mtcfPhw8mh+eH0MdGOsDxVVpWokdhKVD9oU+kqSW7QUk 1uhJoaXnU0XXlRRZSr+bVMJg8Rh+IE9Ljp5p24dZqUngi+NlU1T2QDjW2wnq8hkjroep qZMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date; bh=qGf9FdTS21AbQghEfN3amsL0Ys9J05KFeR8xF3k8+OI=; b=Vnx/7Vb6lUjyf01eMXNY7nuN8L7j7mXdzcfEN42VAulnSgULB+6QfHe/2EKOQlYm+C 0LTPG7WDzooAbsqacC4wJDSBD/zw8REWo4ID47+w7lcIH6a9l8lvnsWpJFTvBIeEjBRW uZIVq01pUolzlDrRvRxSXpoNYtJTmCdLiQqguPA6YQ4Zb+TDxiph1nG3XBuh8keq9X1k Wfzqo6VImUIJSgFw92V7NvEFAq3vIVhcJLp2pDVaWAffdTM6dn/Cp9J0zLDo3bjj/rC3 ePRJzGVVPhP8hXixk68xd8AFTZrADFXY5/gwvqJ8BsY4g3AklAe+JjlCF0thATRQ0vHN 60xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id q20si11428510ejb.422.2020.07.19.23.37.39; Sun, 19 Jul 2020 23:38:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727784AbgGTGe5 (ORCPT + 99 others); Mon, 20 Jul 2020 02:34:57 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48382 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727115AbgGTGe4 (ORCPT ); Mon, 20 Jul 2020 02:34:56 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06K6X3s2016319; Mon, 20 Jul 2020 02:34:53 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32bwmkgvuv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Jul 2020 02:34:53 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06K6XrM3019897; Mon, 20 Jul 2020 02:34:53 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 32bwmkgvs7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Jul 2020 02:34:52 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06K6VdEX008154; Mon, 20 Jul 2020 06:34:48 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06ams.nl.ibm.com with ESMTP id 32brbh29eg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Jul 2020 06:34:48 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06K6Yj4432964866 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Jul 2020 06:34:45 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8B69511C069; Mon, 20 Jul 2020 06:34:45 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 090B211C05B; Mon, 20 Jul 2020 06:34:44 +0000 (GMT) Received: from drishya.in.ibm.com (unknown [9.85.113.150]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 20 Jul 2020 06:34:43 +0000 (GMT) Date: Mon, 20 Jul 2020 12:04:41 +0530 From: Vaidyanathan Srinivasan To: "Gautham R. Shenoy" Cc: Nicholas Piggin , Anton Blanchard , Nathan Lynch , Michael Ellerman , Michael Neuling , linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: Re: [PATCH 5/5] cpuidle-pseries: Block Extended CEDE(1) which adds no additional value. Message-ID: <20200720063441.GF4000@drishya.in.ibm.com> Reply-To: svaidy@linux.ibm.com References: <1594120299-31389-1-git-send-email-ego@linux.vnet.ibm.com> <1594120299-31389-6-git-send-email-ego@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1594120299-31389-6-git-send-email-ego@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-20_01:2020-07-17,2020-07-20 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=992 priorityscore=1501 phishscore=0 clxscore=1015 mlxscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=1 spamscore=0 impostorscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007200047 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Gautham R Shenoy [2020-07-07 16:41:39]: > From: "Gautham R. Shenoy" > > The Extended CEDE state with latency-hint = 1 is only different from > normal CEDE (with latency-hint = 0) in that a CPU in Extended CEDE(1) > does not wakeup on timer events. Both CEDE and Extended CEDE(1) map to > the same hardware idle state. Since we already get SMT folding from > the normal CEDE, the Extended CEDE(1) doesn't provide any additional > value. This patch blocks Extended CEDE(1). > > Signed-off-by: Gautham R. Shenoy Reviewed-by: Vaidyanathan Srinivasan > --- > drivers/cpuidle/cpuidle-pseries.c | 57 ++++++++++++++++++++++++++++++++++++--- > 1 file changed, 54 insertions(+), 3 deletions(-) > > diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c > index 6f893cd..be0b8b2 100644 > --- a/drivers/cpuidle/cpuidle-pseries.c > +++ b/drivers/cpuidle/cpuidle-pseries.c > @@ -350,6 +350,43 @@ static int pseries_cpuidle_driver_init(void) > return 0; > } > > +#define XCEDE1_HINT 1 > +#define ERR_NO_VALUE_ADD (-1) > +#define ERR_NO_EE_WAKEUP (-2) > + > +/* > + * Returns 0 if the Extende CEDE state with @hint is not blocked in > + * cpuidle framework. > + * > + * Returns ERR_NO_EE_WAKEUP if the Extended CEDE state is blocked due > + * to not being responsive to external interrupts. > + * > + * Returns ERR_NO_VALUE_ADD if the Extended CEDE state does not provide > + * added value addition over the normal CEDE. > + */ > +static int cpuidle_xcede_blocked(u8 hint, u64 latency_us, u8 responsive_to_irqs) > +{ > + > + /* > + * We will only allow extended CEDE states that are responsive > + * to irqs do not require an H_PROD to be woken up. > + */ > + if (!responsive_to_irqs) > + return ERR_NO_EE_WAKEUP; > + > + /* > + * We already obtain SMT folding benefits from CEDE (which is > + * CEDE with hint 0). Furthermore, CEDE is also responsive to > + * timer-events, while XCEDE1 requires an external > + * interrupt/H_PROD to be woken up. Hence, block XCEDE1 since > + * it adds no further value. > + */ > + if (hint == XCEDE1_HINT) > + return ERR_NO_VALUE_ADD; > + > + return 0; > +} > + > static int add_pseries_idle_states(void) > { > int nr_states = 2; /* By default we have snooze, CEDE */ > @@ -365,15 +402,29 @@ static int add_pseries_idle_states(void) > char name[CPUIDLE_NAME_LEN]; > unsigned int latency_hint = xcede_records[i].latency_hint; > u64 residency_us; > + int rc; > + > + if (latency_us < min_latency_us) > + min_latency_us = latency_us; > + > + rc = cpuidle_xcede_blocked(latency_hint, latency_us, > + xcede_records[i].responsive_to_irqs); > > - if (!xcede_records[i].responsive_to_irqs) { > + if (rc) { > + switch (rc) { > + case ERR_NO_VALUE_ADD: > + pr_info("cpuidle : Skipping XCEDE%d. No additional value-add\n", > + latency_hint); > + break; > + case ERR_NO_EE_WAKEUP: > pr_info("cpuidle : Skipping XCEDE%d. Not responsive to IRQs\n", > latency_hint); > + break; > + } > + > continue; > } > > - if (latency_us < min_latency_us) > - min_latency_us = latency_us; > snprintf(name, CPUIDLE_NAME_LEN, "XCEDE%d", latency_hint); > > /* We need these heuristics to select/reject idle states exposed by platform firmware to Linux primarily because not all states are really useful to Linux on a given setup. --Vaidy