Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1619545ybv; Fri, 14 Feb 2020 03:04:33 -0800 (PST) X-Google-Smtp-Source: APXvYqwtxf8mIT+Egyjx5e4QFGQJsVKj5EnTPGWAK60ck2CWrgK+4g4AVkC+NNJYMhqZ/+V+chPa X-Received: by 2002:aca:5fc6:: with SMTP id t189mr1520619oib.166.1581678272864; Fri, 14 Feb 2020 03:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581678272; cv=none; d=google.com; s=arc-20160816; b=XUJ11DjohpZH0+3ArBCBD9fTN5OV3VtjZAf2Q7FN9f43WD4mixYe0LUmp1TZ9FsMrc ijzlKZyfQXRjoVZLsC3g86oF/r7kwawDVitWGrHgINwnxnfbJmFLzfXkZc/A9xshEjv9 mfS9HJEl2E/weRSbhCjNQtYahnA+hG9SQwuIWkzGJXRlSw8LxE8CjVo618811Mzww5tv GJdzK55jNebmE98gG+zeqnwSrxWAelb4qlJ5zoUR4fxJtCCV125HN/OwNXr+GmyBn5ur W3FXfR8lUOw5hqImPgG7qF6Nhd+aXgg8fb/hVjCT84Xgivr4idA0MU8PBArGVwQmMlD0 5cxw== 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-transfer-encoding :mime-version:references:in-reply-to:date:subject:cc:to:from; bh=raIdvx/ttfD7WqnQilPtSJ1GywzB4lMvePNOPlxxyos=; b=P5YAhVv6i3I7uUPLvDQmevnYzlvuSiSvKGcr0GieQxAoRLufVFAK6QzJmrVIv+s7eR BqhHKLZJpm8SISsvpjjjKmruneeP/utmJkW9/vFUyO9xWAdDKCxOXG+Gjb5DLNGHPEfX EOxH32ygIL8N16mNUsplN23BxBnxImGCGzmWC9sqQueT1lV5tAxwcTSq/qSij7CDc9jk pp3FvqtCsESqB3AHWTysU2a9+d1BAhHP60LPRjWRB/6Mt/i3S/efRh/KFCZWg8k+AYU3 CAhDAFIdNtxfViV2kj23DkJrWYZ7Ny9KuBRdIpSHVYJZ5id4bhCHJEkWQ7NzTyfqO2yP cDdg== 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 g10si2685183otn.12.2020.02.14.03.04.16; Fri, 14 Feb 2020 03:04: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 S2387401AbgBNLEE (ORCPT + 99 others); Fri, 14 Feb 2020 06:04:04 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:26418 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728807AbgBNLED (ORCPT ); Fri, 14 Feb 2020 06:04:03 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01EB3up3088769 for ; Fri, 14 Feb 2020 06:04:02 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y4j8gc1d5-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 14 Feb 2020 06:04:01 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 14 Feb 2020 11:03:56 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 14 Feb 2020 11:03:52 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01EB3oUe57671754 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Feb 2020 11:03:50 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AEF9AA4064; Fri, 14 Feb 2020 11:03:50 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 08B06A4054; Fri, 14 Feb 2020 11:03:46 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.199.37.109]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 14 Feb 2020 11:03:45 +0000 (GMT) From: Kajol Jain To: acme@kernel.org, linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, anju@linux.vnet.ibm.com, maddy@linux.vnet.ibm.com, ravi.bangoria@linux.ibm.com, peterz@infradead.org, yao.jin@linux.intel.com, ak@linux.intel.com, jolsa@kernel.org, kan.liang@linux.intel.com, jmario@redhat.com, alexander.shishkin@linux.intel.com, mingo@kernel.org, paulus@ozlabs.org, namhyung@kernel.org, mpetlan@redhat.com, gregkh@linuxfoundation.org, benh@kernel.crashing.org, kjain@linux.ibm.com Subject: [PATCH 1/8] powerpc/perf/hv-24x7: Fix inconsistent output values incase multiple hv-24x7 events run Date: Fri, 14 Feb 2020 16:33:28 +0530 X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200214110335.31483-1-kjain@linux.ibm.com> References: <20200214110335.31483-1-kjain@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 20021411-4275-0000-0000-000003A16988 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20021411-4276-0000-0000-000038B56D79 Message-Id: <20200214110335.31483-2-kjain@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-14_03:2020-02-12,2020-02-14 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 phishscore=0 impostorscore=0 bulkscore=0 malwarescore=0 mlxscore=0 adultscore=0 spamscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002140091 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 2b206ee6b0df ("powerpc/perf/hv-24x7: Display change in counter values")' added to print _change_ in the counter value rather then raw value for 24x7 counters. Incase of transactions, the event count is set to 0 at the beginning of the transaction. It also sets the event's prev_count to the raw value at the time of initialization. Because of setting event count to 0, we are seeing some weird behaviour, whenever we run multiple 24x7 events at a time. For example: command#: ./perf stat -e "{hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/, hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/}" -C 0 -I 1000 sleep 100 1.000121704 120 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/ 1.000121704 5 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/ 2.000357733 8 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/ 2.000357733 10 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/ 3.000495215 18,446,744,073,709,551,616 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/ 3.000495215 18,446,744,073,709,551,616 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/ 4.000641884 56 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/ 4.000641884 18,446,744,073,709,551,616 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/ 5.000791887 18,446,744,073,709,551,616 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/ Getting these large values in case we do -I. As we are setting event_count to 0, for interval case, overall event_count is not coming in incremental order. As we may can get new delta lesser then previous count. Because of which when we print intervals, we are getting negative value which create these large values. This patch rather then setting event_count to 0, it change local64_set to local64_add in function 'h_24x7_event_read'. With this patch In power9 platform command#: ./perf stat -e "{hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/, hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/}" -C 0 -I 1000 sleep 100 1.000117685 93 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/ 1.000117685 1 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/ 2.000349331 98 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/ 2.000349331 2 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/ 3.000495900 131 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/ 3.000495900 4 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/ 4.000645920 204 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/ 4.000645920 61 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/ 4.284169997 22 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/ Signed-off-by: Kajol Jain --- arch/powerpc/perf/hv-24x7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 573e0b309c0c..6dbbf70232aa 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -1409,7 +1409,7 @@ static void h_24x7_event_read(struct perf_event *event) * that would require issuing a hcall, which would then * defeat the purpose of using the txn interface. */ - local64_set(&event->count, 0); + local64_add(0, &event->count); } put_cpu_var(hv_24x7_reqb); -- 2.18.1