Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1541042yba; Sun, 14 Apr 2019 13:05:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqySaHZIIipmv2YIFymB1gThVVmktSzysEEc+lC4p7BbyDldOYR/xvcsJzVr2JfQQzJG2kXM X-Received: by 2002:aa7:8518:: with SMTP id v24mr71196560pfn.219.1555272335558; Sun, 14 Apr 2019 13:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555272335; cv=none; d=google.com; s=arc-20160816; b=wwku/iZreGsfdyBs2YrS6ESndqZLIkiEQg31jAp7WjKGErnIbKE1MBQV/KqK1EDCWZ m5J/+4hMAwysnEYfjaNgzq62CVVSF8ybUqUMqm6MkxWkzoglydRmNhBYlokhjXODxd7o 4ayZaxy8ZWhM7eOjbaarMmhQ5Xon8PvyySzhEd9GK1CSk25GZgMZHcepSdzGc13Qkf0b GB6cL+kVvrNcsawOwufYCVquazf7FGo3/faTPz6Z6hXYJP1fUCIptsVav6bLqqm8LL2o YoN9pSFrOBxad3OyJuzYaul0WetzOxHaVR4pAWvMmffEqRvexPkSTgGv9LilBlyP0IDL hvFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:cc:to:subject; bh=rT1mzi962kchiJDfhEl6ynYwiA3K6/XVPWCFcL/pSkM=; b=yZa4HUxA9Z9MlS7p9IgOL3/ZktrZDFkhRGL6gp0PzqdtZc4RBATZeQpVo6SXsd8asW c/QJma3N0msEEIVpFUTBxDGZsZleGje1v9GuLC5u1vp4vd5+OoShpTZQpHxyK1/fvklh //FTlyJ8uciltDoYsjt1fZe3Ho9/VnnSdluW33SqZ/eXwY4q+oiJjzlUpRt7VBipNmVK SmCtEEiF7wHY6Lf++0bXMkLiDCMzZ0dpm48TgXxQOjNg0ufF0kQ6Bv1+1tP0jjIW01nE Qxxl9Hq3RvUYcWuDhHuq3+maNicwF+DfoI38OQARpkKkQ5sfKwQsqJJ1H4Ciw+k+EVKR qojg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id l191si30686415pfc.213.2019.04.14.13.05.15; Sun, 14 Apr 2019 13:05:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726724AbfDNUEl (ORCPT + 99 others); Sun, 14 Apr 2019 16:04:41 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:47392 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725797AbfDNUEk (ORCPT ); Sun, 14 Apr 2019 16:04:40 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3EJwusK066727 for ; Sun, 14 Apr 2019 16:04:39 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rvbcardk7-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 14 Apr 2019 16:04:38 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 14 Apr 2019 21:04:37 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 14 Apr 2019 21:04:35 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3EK4YR647513638 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 14 Apr 2019 20:04:34 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 510EBAE053; Sun, 14 Apr 2019 20:04:34 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EE4B8AE045; Sun, 14 Apr 2019 20:04:30 +0000 (GMT) Received: from oc0383214508.ibm.com (unknown [9.85.73.3]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 14 Apr 2019 20:04:30 +0000 (GMT) Subject: Re: [PATCH v2 1/2] cpuidle : auto-promotion for cpuidle states To: "Rafael J. Wysocki" Cc: Linux Kernel Mailing List , linuxppc-dev , Linux PM , "Rafael J. Wysocki" , Daniel Lezcano , Michael Ellerman , "Gautham R. Shenoy" References: <20190405091647.4169-1-huntbag@linux.vnet.ibm.com> <20190405091647.4169-2-huntbag@linux.vnet.ibm.com> From: Abhishek Date: Mon, 15 Apr 2019 01:34:29 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 19041420-0012-0000-0000-0000030EB42E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19041420-0013-0000-0000-00002146E62F Message-Id: <32cdf163-32b7-1011-16aa-8b40332832db@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-04-14_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904140152 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rafael, Thanks for the Review. Few inline replies below. On 04/09/2019 03:31 PM, Rafael J. Wysocki wrote: > On Fri, Apr 5, 2019 at 11:17 AM Abhishek Goel > wrote: >> Currently, the cpuidle governors (menu /ladder) determine what idle state > There are three governors in 5.1-rc. > >> an idling CPU should enter into based on heuristics that depend on the >> idle history on that CPU. Given that no predictive heuristic is perfect, >> there are cases where the governor predicts a shallow idle state, hoping >> that the CPU will be busy soon. However, if no new workload is scheduled >> on that CPU in the near future, the CPU will end up in the shallow state. >> >> In case of POWER, this is problematic, when the predicted state in the >> aforementioned scenario is a lite stop state, as such lite states will >> inhibit SMT folding, thereby depriving the other threads in the core from >> using the core resources. >> >> To address this, such lite states need to be autopromoted. > I don't quite agree with this statement and it doesn't even match what > the patch does AFAICS. "Autopromotion" would be going from the given > state to a deeper one without running state selection in between, but > that's not what's going on here. Thinking to call it "timed-exit". Is that good? >> The cpuidle-core can queue timer to correspond with the residency value of the next >> available state. Thus leading to auto-promotion to a deeper idle state as >> soon as possible. > No, it doesn't automatically cause a deeper state to be used next > time. It simply kicks the CPU out of the idle state and one more > iteration of the idle loop runs on it. Whether or not a deeper state > will be selected in that iteration depends on the governor > computations carried out in it. I did not mean that next state is chosen automatically. I should have been more descriptive here instead of just using "as soon as possible" > Now, this appears to be almost analogous to the "polling" state used > on x86 which uses the next idle state's target residency as a timeout. > > While generally I'm not a big fan of setting up timers in the idle > loop (it sort of feels like pulling your own hair in order to get > yourself out of a swamp), if idle states like these are there in your > platform, setting up a timer to get out of them in the driver's > ->enter() routine might not be particularly objectionable. Doing that > in the core is a whole different story, though. > > Generally, this adds quite a bit of complexity (on the "ugly" side of > things IMO) to the core to cover a corner case present in one > platform, while IMO it can be covered in the driver for that platform > directly. As of now, since this code doesn't add any benefit to the other platform, I will post a patch with this implementation covered in platform-specific driver code. You are right that all the information needed for this implementation are also available there in platform driver code, so we should be good to go.