Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp542567pxj; Fri, 11 Jun 2021 05:43:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVe4ZOM+95LarnZfy6cBGi1ZFIXky4pfqyTY4c5oVmft4FVivYfffOn46u/MvCrAz/1Mz9 X-Received: by 2002:a17:906:8a55:: with SMTP id gx21mr3563644ejc.179.1623415417430; Fri, 11 Jun 2021 05:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623415417; cv=none; d=google.com; s=arc-20160816; b=bb0wlkQrTQOmyhR9KuNsNcL2mtV4y1epU+3czusulXRqr3oRl2fvRM73XUcqgjuKMW iaYgZmVlU2/jfozGjCRQYeQ0Pf71aC4UCayRrWPwwrC7fx3No/xQilmtbGUmZDaA9O0s L3qaPCb6iGsclinULZIrxCI7kLPn+azjfObWeC3T1VHKKtjcpYknJKKbhPPfR4LV/kdV uqgDHHbuTY7NWY0A4SP29NBGUY80FdQN5a7u/khhK94Iu4svEZjLm0UrVVb8TTRVwYKm wJM4sGC8b4Yl/mERYhJcDKak/AH/oUgOZXyO3G2FjLr8V/YYGUK5VegHQyXq0EmjIPHb I0bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=a5WRh0MAjG2DP5aTknLcy+PSuacHavo64fKGsZkzwF0=; b=DJhFoeqqMAsbUns0HoczmFMjtD8JQ7qDHTxcHhIjL4cqF9SdD1zCaIiFyuJqwv5O8m 0Sb7Eu/r/fC9+4MdWiqy+XplrKqKogxyLaMPlnX7uYe7aNJR4oED8lR1NKjJL4X5K0v4 HflO6lQablbBfS6V6OxBVWTcWgHepocP6RaDfkw8aXTcdIxCyQRzbnXdBVNa+Xr/HwKJ iEgkpWwGv/J4R4/SqBlhr7h9OSXc/+VZRhIK7g4Nf/AIg+rNIUnuL5j2hiAYdiT8AJnh bdNZ26WBsrwl79XM9VLVqwh9tECmKf7DOV8nrwZulgV8XqeaUaONxMabMq1cg0CFo3y9 02dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=nGac9Bjy; 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=pass (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 13si4789763ejh.524.2021.06.11.05.43.14; Fri, 11 Jun 2021 05:43:37 -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; dkim=pass header.i=@ibm.com header.s=pp1 header.b=nGac9Bjy; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230291AbhFKMoO (ORCPT + 99 others); Fri, 11 Jun 2021 08:44:14 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:24234 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230382AbhFKMoJ (ORCPT ); Fri, 11 Jun 2021 08:44:09 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15BCY9uL009855; Fri, 11 Jun 2021 08:42:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=a5WRh0MAjG2DP5aTknLcy+PSuacHavo64fKGsZkzwF0=; b=nGac9Bjy5ASQhxp1Z+a18JnPsEAPz57D8F2IddrEyRghCNNItZYMWh4dEc4lOOd1JdzU xu8HLb27IibM0T5WE4h95HPLsqj2/mgBf5m1zkESqRlluxh8gF80hC8FV4AZKKzZcYEK 8NAA060EEY/RbpjapjXPQk0z0/f1vfJCQE1qpdm0LQwQ64hj//9Y70fl5rM7DSZveYYj +Jv5jX07KIENM7C/sXvM5nd3q95Dw+797uOA2iukDWsBWoNq20kzp08sTWYDOMK53Zrv lNWZTl+NS+qnsrCgubWDp4b2Wv1kabGTHlDruOeQghBsNwMWfk4cbszBgHnvAe1583D6 8Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3947x987s2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Jun 2021 08:42:01 -0400 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15BCZJLC013549; Fri, 11 Jun 2021 08:42:01 -0400 Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0b-001b2d01.pphosted.com with ESMTP id 3947x987r5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Jun 2021 08:42:01 -0400 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15BCVvt5004892; Fri, 11 Jun 2021 12:41:59 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma01fra.de.ibm.com with ESMTP id 3936ns0j0w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Jun 2021 12:41:59 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15BCfv0q28049792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 11 Jun 2021 12:41:57 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3D5B752050; Fri, 11 Jun 2021 12:41:57 +0000 (GMT) Received: from pratiks-thinkpad.in.ibm.com (unknown [9.85.83.107]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 613A55206D; Fri, 11 Jun 2021 12:41:55 +0000 (GMT) From: "Pratik R. Sampat" To: mpe@ellerman.id.au, shuah@kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kselftest@vger.kernel.org, psampat@linux.ibm.com, pratik.r.sampat@gmail.com Subject: [RFC 0/2] CPU-Idle latency selftest framework Date: Fri, 11 Jun 2021 18:11:52 +0530 Message-Id: <20210611124154.56427-1-psampat@linux.ibm.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: NdzjWYErMp3zz-_gDPdC9Vim00ndpAAZ X-Proofpoint-ORIG-GUID: li3M71lYsUdbBpi0D5AZavIakVCRF0PR X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-06-11_05:2021-06-11,2021-06-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 clxscore=1011 adultscore=0 suspectscore=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106110080 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A kernel module + userspace driver to estimate the wakeup latency caused by going into stop states. The motivation behind this program is to find significant deviations behind advertised latency and residency values. The patchset measures latencies for two kinds of events. IPIs and Timers As this is a software-only mechanism, there will additional latencies of the kernel-firmware-hardware interactions. To account for that, the program also measures a baseline latency on a 100 percent loaded CPU and the latencies achieved must be in view relative to that. To achieve this, we introduce a kernel module and expose its control knobs through the debugfs interface that the selftests can engage with. The kernel module provides the following interfaces within /sys/kernel/debug/latency_test/ for, IPI test: ipi_cpu_dest = Destination CPU for the IPI ipi_cpu_src = Origin of the IPI ipi_latency_ns = Measured latency time in ns Timeout test: timeout_cpu_src = CPU on which the timer to be queued timeout_expected_ns = Timer duration timeout_diff_ns = Difference of actual duration vs expected timer Sample output on a POWER9 system is as follows: # --IPI Latency Test--- # Baseline Average IPI latency(ns): 3114 # Observed Average IPI latency(ns) - Snooze: 3265 # Observed Average IPI latency(ns) - Stop0_lite: 3507 # Observed Average IPI latency(ns) - Stop0: 3739 # Observed Average IPI latency(ns) - Stop2: 3807 # Observed Average IPI latency(ns) - Stop4: 17070 # Observed Average IPI latency(ns) - Stop5: 1038174 # # --Timeout Latency Test-- # Baseline Average timeout diff(ns): 1420 # Observed Average timeout diff(ns) - Snooze: 1640 # Observed Average timeout diff(ns) - Stop0_lite: 1764 # Observed Average timeout diff(ns) - Stop0: 1715 # Observed Average timeout diff(ns) - Stop2: 1845 # Observed Average timeout diff(ns) - Stop4: 16581 # Observed Average timeout diff(ns) - Stop5: 939977 Pratik R. Sampat (2): powerpc/cpuidle: Extract IPI based and timer based wakeup latency from idle states powerpc/selftest: Add support for cpuidle latency measurement arch/powerpc/kernel/Makefile | 1 + arch/powerpc/kernel/test-cpuidle_latency.c | 157 +++++++ lib/Kconfig.debug | 10 + tools/testing/selftests/powerpc/Makefile | 1 + .../powerpc/cpuidle_latency/.gitignore | 2 + .../powerpc/cpuidle_latency/Makefile | 6 + .../cpuidle_latency/cpuidle_latency.sh | 419 ++++++++++++++++++ .../powerpc/cpuidle_latency/settings | 1 + 8 files changed, 597 insertions(+) create mode 100644 arch/powerpc/kernel/test-cpuidle_latency.c create mode 100644 tools/testing/selftests/powerpc/cpuidle_latency/.gitignore create mode 100644 tools/testing/selftests/powerpc/cpuidle_latency/Makefile create mode 100755 tools/testing/selftests/powerpc/cpuidle_latency/cpuidle_latency.sh create mode 100644 tools/testing/selftests/powerpc/cpuidle_latency/settings -- 2.17.1