Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp890536ybg; Tue, 28 Jul 2020 23:48:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIkM6BV/lWy/YR66TOv+MubYk/avi+KWjzKyh96DZCYMODhVFZdhmU6klbp8FHJX2yOm4/ X-Received: by 2002:aa7:d8d7:: with SMTP id k23mr13509331eds.54.1596005315887; Tue, 28 Jul 2020 23:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596005315; cv=none; d=google.com; s=arc-20160816; b=x4dikHPaAs1u8R866TexScRFC2LNA6wYjqIvb5s9tuQ91elJnQFn5pPWKr/2p+JeS1 gilpWJss0NsU9JAeUhFUSG4OgIb4t/6ZLVvna3wP0XofykJhw7m9cPID2KhHnnCn44dW OU+HUElibDFhf2YEb7WeZFCfjQmg8I/WKKtaf0fvN5NEmneyCp/KnFLoszTUPitOmMsW 5B9oiEBQgQDRRc88DJqDcGhVm7DyLYmuA6fTxU1NJE6uAGV2JwFB/AHzc7nMAPifPuer GPpP+9FsUk/v4A+vJw6nUoZnmBE+HJfq+ycInqzhA5w3OkbQIl7wprOCMVm4sMvCMPAl zIgg== 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=9nzvuikC2P348w6LBDEo7DrqpUFuSZvgNYvDVE4aNEk=; b=TQVZxJIQbEbvr/sS6dfTVKYoukJo7eS9QyxEKG5wKm2rjt3Z2cmXG6lZhT8n/xOGSg HgnlFu+XuZf6PAW4q/IBXjTr523RkkQEk+DKMHH4PEc4SX9LTJ0F91ItHKzWgYDti3Kv Hh0PfEVIKhLGr+biTnG6aaqXDMLOxxBz0iAeu3vhzPCvhXmdykXX1cFaT15a2giK+knM QnqyccTBwQwAaO2daefWxSTkqZ2WNdRdesAZb0OYe5HvHUwoahLG8P1Jo1JR4gn4lSUp 4XO/aCqH54vbQay1qLsico2laMcWY6iCJWbFwHn381Di140E0li5MyyOJyz82zkCFpL+ XuSw== 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 gz9si372635ejb.81.2020.07.28.23.48.13; Tue, 28 Jul 2020 23:48:35 -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 S1727088AbgG2Grx (ORCPT + 99 others); Wed, 29 Jul 2020 02:47:53 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:1980 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727069AbgG2Grw (ORCPT ); Wed, 29 Jul 2020 02:47:52 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06T6UqJx081895; Wed, 29 Jul 2020 02:47:47 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32jqrsk7jb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Jul 2020 02:47:47 -0400 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06T6VHE2083671; Wed, 29 Jul 2020 02:47:46 -0400 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 32jqrsk7hp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Jul 2020 02:47:46 -0400 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06T6UdlF004560; Wed, 29 Jul 2020 06:47:46 GMT Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by ppma02dal.us.ibm.com with ESMTP id 32gcy4fhd7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Jul 2020 06:47:46 +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 06T6ljld56492374 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Jul 2020 06:47:45 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 53BC2B2065; Wed, 29 Jul 2020 06:47:45 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F2E07B205F; Wed, 29 Jul 2020 06:47:44 +0000 (GMT) Received: from sofia.ibm.com (unknown [9.85.85.173]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 29 Jul 2020 06:47:44 +0000 (GMT) Received: by sofia.ibm.com (Postfix, from userid 1000) id 9CEF82E2FB8; Wed, 29 Jul 2020 12:17:39 +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 v2 1/3] cpuidle-pseries: Set the latency-hint before entering CEDE Date: Wed, 29 Jul 2020 12:17:32 +0530 Message-Id: <1596005254-25753-2-git-send-email-ego@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1596005254-25753-1-git-send-email-ego@linux.vnet.ibm.com> References: <1596005254-25753-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-29_02:2020-07-28,2020-07-29 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=821 bulkscore=0 spamscore=0 adultscore=0 impostorscore=0 suspectscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007290041 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. Reviewed-by: Vaidyanathan Srinivasan 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 3e058ad2..88e71c3 100644 --- a/drivers/cpuidle/cpuidle-pseries.c +++ b/drivers/cpuidle/cpuidle-pseries.c @@ -86,19 +86,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(); @@ -130,7 +138,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