Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp191140imm; Thu, 31 May 2018 22:04:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJb2LrHD7qr/JSXrkzUpiX36o+LA/tRv6vTAtydicct+Wex1+MZLNtqvDcLSFl7eDLCKjo6 X-Received: by 2002:a62:99d7:: with SMTP id t84-v6mr9533425pfk.252.1527829489414; Thu, 31 May 2018 22:04:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527829489; cv=none; d=google.com; s=arc-20160816; b=bbRG3uwfTLyzhnFz1EeSonplTxkEqtH6+rKUiSjjnwD7RZxqy/E4kEVlq+n0yqb7vd BpePIiqCZTtGoo2DlANU2EkmlQiin/qcqMy6zJMziK/Z+9h4XDDd+px9ITRXZLBnFqfh 0XCh7Y2AKVavyBJiGu6OhiOkqop0J26IcHbsJNKMjKYNveg6iPZdG8asE58c6UZd2YRR qsbtaEk/w2OgOonnXTTEdFwmIpBBekrBR87NEo89YopuJo7Ts8jdqJ4zM4IkcOU/6KxH g1ylCucQDnFAAAZUMy1eENQKszFTJBKVU7RHJwfPiVckVdPl8gv2ltoIEXO8+DV3dBGR QOjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date:arc-authentication-results; bh=rwsHppAM92LNKIuVyI8wTR7lCqJTXtSESKlvEJlf0LI=; b=ArXc7kj2va8S+K5nyGzrrLi6OFIqDprfRUQKozyix0XrSwbgosErD5vTfUaKrrpH5n IW4T+6h9IhcKT1tVwRRFBx9n4PueT4BDiQCIjVKw0MCMlN9TX80zUu3cL1mm8i25RulS xXkEj2O0WtLkFqvIpL+JsAXtvTaF10ltY9YWnhrsWpKOFlWpLVhkfOhKwsWoXi2Y7LlJ scWGQzK7IsY90gPnWlrrSwIM1m0xFtPZsyCHiJ6hxNnWt6wtl29UuMQyWqftoGmeMHJi 0Xf6chPLZq4JTelE+dvzHkSG1e4rgHQpwoYUnGABAyjNc7XgqQmHawp6oxB2lkJdahqt ENGg== 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 e8-v6si30561784pgq.173.2018.05.31.22.04.01; Thu, 31 May 2018 22:04:49 -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 S1750903AbeFAE7m (ORCPT + 99 others); Fri, 1 Jun 2018 00:59:42 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51600 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750760AbeFAE7l (ORCPT ); Fri, 1 Jun 2018 00:59:41 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w514xNXr070074 for ; Fri, 1 Jun 2018 00:59:40 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jayhwg3wc-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 01 Jun 2018 00:59:40 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 1 Jun 2018 00:54:39 -0400 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 1 Jun 2018 00:54:36 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w514sZ9c45220050 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 1 Jun 2018 04:54:35 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 05487B2066; Fri, 1 Jun 2018 01:56:14 -0400 (EDT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B50AFB205F; Fri, 1 Jun 2018 01:56:13 -0400 (EDT) Received: from sofia.ibm.com (unknown [9.124.35.22]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 1 Jun 2018 01:56:13 -0400 (EDT) Received: by sofia.ibm.com (Postfix, from userid 1000) id 386422E2DA1; Fri, 1 Jun 2018 10:24:33 +0530 (IST) Date: Fri, 1 Jun 2018 10:24:33 +0530 From: Gautham R Shenoy To: Balbir Singh Cc: "Gautham R. Shenoy" , "Rafael J. Wysocki" , Daniel Lezcano , Michael Ellerman , Stewart Smith , Michael Neuling , Vaidyanathan Srinivasan , Shilpasri G Bhat , Akshay Adiga , Nicholas Piggin , "open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)" , "linux-kernel@vger.kernel.org" , linux-pm@vger.kernel.org Subject: Re: [PATCH] cpuidle:powernv: Make the snooze timeout dynamic. Reply-To: ego@linux.vnet.ibm.com References: <1527768909-32637-1-git-send-email-ego@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-GCONF: 00 x-cbid: 18060104-0008-0000-0000-0000030FCFBF X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009106; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000264; SDB=6.01040623; UDB=6.00532705; IPR=6.00819753; MB=3.00021404; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-01 04:54:39 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060104-0009-0000-0000-0000396D9FF3 Message-Id: <20180601045433.GA17425@in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-01_03:,, 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-1805220000 definitions=main-1806010054 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Balbir, Thanks for reviewing the patch! On Fri, Jun 01, 2018 at 12:51:05AM +1000, Balbir Singh wrote: > On Thu, May 31, 2018 at 10:15 PM, Gautham R. Shenoy [..snip..] > > > > +static u64 get_snooze_timeout(struct cpuidle_device *dev, > > + struct cpuidle_driver *drv, > > + int index) > > +{ > > + int i; > > + > > + if (unlikely(!snooze_timeout_en)) > > + return default_snooze_timeout; > > + > > + for (i = index + 1; i < drv->state_count; i++) { > > + struct cpuidle_state *s = &drv->states[i]; > > + struct cpuidle_state_usage *su = &dev->states_usage[i]; > > + > > + if (s->disabled || su->disable) > > + continue; > > + > > + return s->target_residency * tb_ticks_per_usec; > > Can we ensure this is not prone to overflow? s->target_residency is an "unsigned int" so can take a maximum value of UINT_MAX. tb_ticks_per_usec is an "unsigned long" with a value in the range of 100-1000. The return value is a u64. The product of s->target_residency and tb_ticks_per_usec should be contained in u64. Is there a potential case of overflow that I am missing ? > > Otherwise looks good > > Reviewed-by: Balbir Singh -- Thanks and Regards gautham.