Received: by 10.223.164.202 with SMTP id h10csp545647wrb; Tue, 7 Nov 2017 10:19:32 -0800 (PST) X-Google-Smtp-Source: ABhQp+SxbzHuNfQZNFYBNvv2l9z96Imx/Zn7Qy+vuTtM7kSx3vfLcorzt4EPaBwzYNhA6zan64re X-Received: by 10.101.100.148 with SMTP id e20mr19780648pgv.248.1510078772527; Tue, 07 Nov 2017 10:19:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510078772; cv=none; d=google.com; s=arc-20160816; b=BGxewqR4dfGvyxuFxVelBT6nKZQDRLH75Jk8I1k2LE8tJQtRUhCiFXaQIMg0od/C4L gmEgK//RVcCh5XvBc91i8O58oO6jaZMstLO4+ZZoAKZfY84CNFoXJPZPFJgPqjf3guio OA+K3QrDNbzSrVD2LgOMJos2yh22ndPAfR6sD7DCxTyaOunvfLoVT1BAoYDQ2SxyBr3y 4Uew6zFpqMToRHHt+P/AiArM5mbK+G9EPHT/GUNm9gznNLsWPxLHwOgpg9aUPAquoWgQ YKS14ePzkged4MRtF3qMVNlorLnhotPCrB1shuSS3/HfhqCHgkqrikoV4rOcGrBuTq/0 qzUg== 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:cc:references:to:subject:arc-authentication-results; bh=Nx/ju+QVxz5N0sCxo5HnFYuVRp3Zm6G1eVFuRbj7NBo=; b=hNk73ZWGaK7z4zAfjBZLT0gmLG58dv51ycI/qlzFpTw62KPfbfd7ihN/lZyLkwm/cH 2CBe/CvdbJC1yDbyb68TmLmr26Tgp7evn9mNCQAR7uPrXVm+EGhfCOPyJnyN/iOqpncX SDry3FVjy7Ejxh0K9m/chMfJPjpMEW/qFLTch2J5JCf8bgAe/tCLHJBAzF9xe1lT4uzd Ium+B7UPcIsRa6SzgYkHnzNiixUTGANUqFIlfOOF5JJFhZvCyJ2ruGS99/DDzyVS0Vlo 7dFHS/DBBT0rhvWEBaZVeSrz9iT9culZvzcoEOOGYTAVQjnWOhCRoDa8bi25M3snPgEQ 0G7w== 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 o15si1732655pgn.592.2017.11.07.10.19.19; Tue, 07 Nov 2017 10:19:32 -0800 (PST) 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 S1754975AbdKGI6f (ORCPT + 91 others); Tue, 7 Nov 2017 03:58:35 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43556 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753099AbdKGI6d (ORCPT ); Tue, 7 Nov 2017 03:58:33 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vA78sPfV104032 for ; Tue, 7 Nov 2017 03:58:32 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2e393qhvbj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 07 Nov 2017 03:58:30 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Nov 2017 08:58:27 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 7 Nov 2017 08:58:23 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vA78wOvV30212278; Tue, 7 Nov 2017 08:58:24 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4652C42052; Tue, 7 Nov 2017 08:53:29 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 433A04203F; Tue, 7 Nov 2017 08:53:28 +0000 (GMT) Received: from oc0383214508.ibm.com (unknown [9.124.35.229]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 7 Nov 2017 08:53:28 +0000 (GMT) Subject: Re: [PATCH v2] cpupower : Fix cpupower working when cpu0 is offline To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20171107072005.48034-1-huntbag@linux.vnet.ibm.com> Cc: Shuah Khan , Shuah Khan , Thomas Renninger From: Abhishek Date: Tue, 7 Nov 2017 14:28:22 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171107072005.48034-1-huntbag@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 17110708-0008-0000-0000-000004A86884 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17110708-0009-0000-0000-00001E3AFF1A Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-07_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711070127 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Can you have a look at it? Thanks and Regards, Abhishek Goel System Engineer IBM India Pvt. Ltd. On 11/07/2017 12:50 PM, Abhishek Goel wrote: > cpuidle_monitor used to assume that cpu0 is always online which is not > a valid assumption on POWER machines. This patch fixes this by searching > for the first online cpu and uses it, instead of always using cpu0 for > monitoring which may not be online. > > Signed-off-by: Abhishek Goel > --- > v2: Commit message updated. > --- > tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c > index 1b5da00..adacf99 100644 > --- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c > +++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c > @@ -130,15 +130,23 @@ static struct cpuidle_monitor *cpuidle_register(void) > { > int num; > char *tmp; > + int first_online_cpu; > + > + for (num = 0; num < cpu_count; num++) { > + if (cpupower_is_cpu_online(num)) > + break; > + }; > + first_online_cpu = num; > > /* Assume idle state count is the same for all CPUs */ > - cpuidle_sysfs_monitor.hw_states_num = cpuidle_state_count(0); > + cpuidle_sysfs_monitor.hw_states_num = > + cpuidle_state_count(first_online_cpu); > > if (cpuidle_sysfs_monitor.hw_states_num <= 0) > return NULL; > > for (num = 0; num < cpuidle_sysfs_monitor.hw_states_num; num++) { > - tmp = cpuidle_state_name(0, num); > + tmp = cpuidle_state_name(first_online_cpu, num); > if (tmp == NULL) > continue; > > @@ -146,7 +154,7 @@ static struct cpuidle_monitor *cpuidle_register(void) > strncpy(cpuidle_cstates[num].name, tmp, CSTATE_NAME_LEN - 1); > free(tmp); > > - tmp = cpuidle_state_desc(0, num); > + tmp = cpuidle_state_desc(first_online_cpu, num); > if (tmp == NULL) > continue; > strncpy(cpuidle_cstates[num].desc, tmp, CSTATE_DESC_LEN - 1); From 1583404291010222796@xxx Tue Nov 07 10:53:24 +0000 2017 X-GM-THRID: 1583404291010222796 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread