Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp946919ybt; Tue, 7 Jul 2020 04:15:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDX2R9kG/Qxlm2YlVyjNf/xREv2USx5mFDS+t/xm+pc1199uYc34uPQXbqq/C3obVfAzR5 X-Received: by 2002:a50:afa2:: with SMTP id h31mr8096473edd.303.1594120546178; Tue, 07 Jul 2020 04:15:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594120546; cv=none; d=google.com; s=arc-20160816; b=LBbvUCK6NQgREZ+1hwUi6zURgNmeZv3gGeC9bg5u4a/h2SvqbU3XuidtSiHcKYBGLv umw9q8aCcK9zOE02NIgj7PBYXzFL76HwSe/3LVkpX8yne2H2KPuVxPUHcf4uaBk25L2r yrk+2rusII/5dMVrDRahe1XDqtHSQDFc8vUpbTtLhS2F5v2pIAongDclWNOr4Y9iywWf Dh5Dwht/TvPeB6CFDPE+eP5nY3rRC3JJdQ378Co1gbaUTv/E/6SFuFDmg1hCQDRYJde1 evhlQkCz8fRvplzQAGvdMppsUq4EVtDZYehyv6iYJpJa4SVTHltpihEuPdaD0rOBKva2 2aAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=zHiriCoQKp3D6+dwEkKVcL3LUwiik5AsA1CbLXCv5Us=; b=OEseilF54hCujf/y7japIDB43U3fiQMUzJGjwITgnYPbZ0SUEtjp7yYFHlzysIJPDN 1TCBJyI/JhrBx4wzQh86KsEiJP7it2FYxysqVxpcV5m+yUg22k4uoffjRcjrYLmEPv8x NAYxT5e8voXAwUmEbdEYMN/te5WTKsC0heDmFiw2ZdIgc59wcXsDauDonaF7gKT/AmaN fHxLfGVRuZnw/XQDu78VjWfqJKGqpM5quBz2YlLcCYuPbHSHIQs6lIfuuNuz8jJ5hxQb R0BLUKuMp4v5aZg8bdHQWrSyqRNYS1s1Fy21fm+VWSXUusHbPTvU9su3r/ZoyzpL7ACS N4bg== 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 d13si14619089edh.256.2020.07.07.04.15.21; Tue, 07 Jul 2020 04:15:46 -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 S1728259AbgGGLMU (ORCPT + 99 others); Tue, 7 Jul 2020 07:12:20 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:46348 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727962AbgGGLMH (ORCPT ); Tue, 7 Jul 2020 07:12:07 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 067B1aN6159350; Tue, 7 Jul 2020 07:12:02 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 324ffdweur-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Jul 2020 07:12:02 -0400 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 067B1iFC160156; Tue, 7 Jul 2020 07:12:01 -0400 Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0b-001b2d01.pphosted.com with ESMTP id 324ffdweuc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Jul 2020 07:12:01 -0400 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 067B0HGh032108; Tue, 7 Jul 2020 11:12:00 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 324qfur48q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Jul 2020 11:12:00 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 067BC0Jv50659838 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 Jul 2020 11:12:00 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2BAF0B2065; Tue, 7 Jul 2020 11:12:00 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D007EB205F; Tue, 7 Jul 2020 11:11:59 +0000 (GMT) Received: from sofia.ibm.com (unknown [9.85.70.202]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 7 Jul 2020 11:11:59 +0000 (GMT) Received: by sofia.ibm.com (Postfix, from userid 1000) id 509982E48B9; Tue, 7 Jul 2020 16:41:54 +0530 (IST) From: "Gautham R. Shenoy" To: Nicholas Piggin , Anton Blanchard , Nathan Lynch , Michael Ellerman , Michael Neuling , Vaidyanathan Srinivasan Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, "Gautham R. Shenoy" Subject: [PATCH 1/5] cpuidle-pseries: Set the latency-hint before entering CEDE Date: Tue, 7 Jul 2020 16:41:35 +0530 Message-Id: <1594120299-31389-2-git-send-email-ego@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1594120299-31389-1-git-send-email-ego@linux.vnet.ibm.com> References: <1594120299-31389-1-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-07_06:2020-07-07,2020-07-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 impostorscore=0 cotscore=-2147483648 malwarescore=0 mlxscore=0 adultscore=0 mlxlogscore=776 spamscore=0 priorityscore=1501 bulkscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2007070081 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Gautham R. Shenoy" As per the PAPR, each H_CEDE call is associated with a latency-hint to be passed in the VPA field "cede_latency_hint". The CEDE states that we were implicitly entering so far is CEDE with latency-hint = 0. This patch explicitly sets the latency hint corresponding to the CEDE state that we are currently entering. While at it, we save the previous hint, to be restored once we wakeup from CEDE. This will be required in the future when we expose extended-cede states through the cpuidle framework, where each of them will have a different cede-latency hint. Signed-off-by: Gautham R. Shenoy --- drivers/cpuidle/cpuidle-pseries.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c index 4a37252..39d4bb6 100644 --- a/drivers/cpuidle/cpuidle-pseries.c +++ b/drivers/cpuidle/cpuidle-pseries.c @@ -105,19 +105,27 @@ static void check_and_cede_processor(void) } } +#define NR_CEDE_STATES 1 /* CEDE with latency-hint 0 */ +#define NR_DEDICATED_STATES (NR_CEDE_STATES + 1) /* Includes snooze */ + +u8 cede_latency_hint[NR_DEDICATED_STATES]; static int dedicated_cede_loop(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { + u8 old_latency_hint; pseries_idle_prolog(); get_lppaca()->donate_dedicated_cpu = 1; + old_latency_hint = get_lppaca()->cede_latency_hint; + get_lppaca()->cede_latency_hint = cede_latency_hint[index]; HMT_medium(); check_and_cede_processor(); local_irq_disable(); get_lppaca()->donate_dedicated_cpu = 0; + get_lppaca()->cede_latency_hint = old_latency_hint; pseries_idle_epilog(); @@ -149,7 +157,7 @@ static int shared_cede_loop(struct cpuidle_device *dev, /* * States for dedicated partition case. */ -static struct cpuidle_state dedicated_states[] = { +static struct cpuidle_state dedicated_states[NR_DEDICATED_STATES] = { { /* Snooze */ .name = "snooze", .desc = "snooze", -- 1.9.4