From nobody Sat Apr 11 22:46:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A121C00144 for ; Thu, 4 Aug 2022 05:47:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239070AbiHDFrt (ORCPT ); Thu, 4 Aug 2022 01:47:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238960AbiHDFr0 (ORCPT ); Thu, 4 Aug 2022 01:47:26 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2071.outbound.protection.outlook.com [40.107.92.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37F6C6111A; Wed, 3 Aug 2022 22:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f8dSDIXtpwO/weBAfRchYicY6BXYO8eEZCJYX31Cse0V7Vi7mYhSQdAYTP3oWhGEpkzzhJ7SoseCXOvbRkm9dKm4eqM2DEhnE3BGfpjFsMWaffRUhVub4Sn2ngcmXXAFhWbs0N1yqrB+wLXujsDNQ1dA/ymdCAEAixaG9T9jAL6WL1KahIzdSqoSMAVmNLRJV94H8T3ADrb0ywnfudntZD04Nx/RGAy1s8sDvBV2xoHt7+gmfc9jjh/ZmmYyEs6rl5s7CVtzHvbLJZtpDylzglH4oC0SD2b5eNLGWFK2O1CS9VfJwceaZwr6HaRRGe+kVKsvXyDd5m8BXyfAkT7upg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=G/TX9smQeuJV1bYric3acWx63EsDvg5HzzRSxVEznG0=; b=QyghJhKpH6hz7EWrfx96PieM3UNc1FXeAgApJWXk4PqICqemgU7+sVomLlgBqZETE5O0fOAEAbOrT5WkrMHgMU6vseEggGDqBgsredlROZ1yQ//gFRupccYcE/aGaHwBQLCR4USEMsoQsdPJI6v1kzyRsvWILUeREJmNGet4ib3gMoCEoiwRCo/5yokQaZOmNZP/SNeCg4HYFjm7H92vFIM878pt0Myf+f5Qj1ROvu3Gw8L57C3v2/ftiLmrCQNXqgGHknq+TDg86lwk2Sf5LXpNk5SzGjpwZhXUwe0+ciz5fMt+dOSpByPE3fV4pZ24qmi3AHgAUFDU1S4FzP1MLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G/TX9smQeuJV1bYric3acWx63EsDvg5HzzRSxVEznG0=; b=jEvqvGayZJmEP3b2QMT1EBxWVIHJDlHvIFWyjsANc0KdbYtzUhDvrazlBoCTCTew4n0nTcvDEaDSQMEi0ILi1P2fCYcI4oIxh6Y3ulKaW+wx3rkNA33u+Hn8l3eACgLSmJoYSnlMawG4anJJL/KjPquRQXGbbWI63yhZhF3YxfE= Received: from DS7PR03CA0063.namprd03.prod.outlook.com (2603:10b6:5:3bb::8) by BN6PR12MB1665.namprd12.prod.outlook.com (2603:10b6:405:7::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Thu, 4 Aug 2022 05:47:10 +0000 Received: from DM6NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3bb:cafe::b8) by DS7PR03CA0063.outlook.office365.com (2603:10b6:5:3bb::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.16 via Frontend Transport; Thu, 4 Aug 2022 05:47:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT060.mail.protection.outlook.com (10.13.173.63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5504.14 via Frontend Transport; Thu, 4 Aug 2022 05:47:09 +0000 Received: from jasmine-meng.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 4 Aug 2022 00:47:04 -0500 From: Meng Li To: Shuah Khan , Huang Rui , CC: "Rafael J . Wysocki" , Nathan Fontenot , Deepak Sharma , "Alex Deucher" , Mario Limonciello , Jinzhou Su , Perry Yuan , Xiaojian Du , Viresh Kumar , Borislav Petkov , , Meng Li Subject: [PATCH V2 1/4] selftests: amd-pstate: Modify amd-pstate-ut.sh to basic.sh. Date: Thu, 4 Aug 2022 13:44:11 +0800 Message-ID: <20220804054414.1510764-2-li.meng@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804054414.1510764-1-li.meng@amd.com> References: <20220804054414.1510764-1-li.meng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 414af6bd-55b5-4ac9-5e28-08da75dcc5ad X-MS-TrafficTypeDiagnostic: BN6PR12MB1665:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 92zxHYm7HuoWLx4x6ZyWt1aFAk0w1hX7Kot1DfNZaD6GJyNG4ITXN5ahFLR+V7t9J86w5C4JKmKu1Qm1PBDiwZ7TKwPJfUwA/K6digTn7GivHh/g2ijsH6OA+Y7HihrzEryIPVs4wY5GYmjmhHi+z3yVM8qSUQJQpvbXNvs5uQWViqFPO+FpLR7RaWu/F3I3VRVY8B3d8FS+MpGsjNjLNspO/izaWSJeCMRsoQv2wtIzWXBauL+je6YS0jNDv1TtUTWxw63yN+aPg89vGxypuo0X8a8d87lqK/tIGz49JCjS90JvBHESNN9BqEQQYRgNTCUyy1dba6Zzq2giYQRRXh/iC4m4t8mTa3vqvbh2UO4IpetGbyvVVf9ZumbE0bEDGNmbrLC+WLaK+hdSuqk2mqPIS0Gtdpm1smgpVEBxpOdqNdEuJ9kOCKw+iYMcLCbEIGfcXGQ+ohnxBcdjwfkEpbTfpV+ySF1GMQXcq0wFGcop70+MgoaRqU1VslTXC7fwEM6BEoOp6C2hc6S4WM/yI8G8kQIsEt7BTvW6dvWkYKTW85WRyl93YVPCbBgqaARlmwNJ9Z/40QGcKjzdY+PVzDdbrQOqB4W7f8Rbs9azKBD2FEsWsqOUqTIo1nNi9w/XOKDZScqZkremAZ2ULEAMOc6scSJWKZSqj9iI1HnqFU9fI1jFhA8ClSrCWhFBK17fHiSOreCaCJvKdisBbmU3uHF4Dnnc03a9I2071trjviedlfq9U+BwqEICXdk/kQcKMRnWIrklgvTgZQS8AGaviH/U/pzH4fm76qT0LN6obuW2IYcxifpbxnMJecNAbI3RQhL9UTu0z8l4AoL68TfWSA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(376002)(136003)(396003)(346002)(46966006)(36840700001)(40470700004)(16526019)(186003)(426003)(47076005)(336012)(40460700003)(2906002)(26005)(41300700001)(7696005)(6666004)(1076003)(82740400003)(2616005)(86362001)(81166007)(356005)(40480700001)(83380400001)(82310400005)(36860700001)(5660300002)(36756003)(70586007)(4326008)(70206006)(8676002)(8936002)(316002)(478600001)(54906003)(110136005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 05:47:09.5137 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 414af6bd-55b5-4ac9-5e28-08da75dcc5ad X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1665 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Modify amd-pstate-ut.sh to basic.sh. The purpose of this modification is to facilitate the subsequent addition of gitsource, tbench and other tests. Then you can specify test case in kselftest/amd-pstate, for example: sudo ./run.sh -c basic, this command only test basic kernel funcitions. The detail please run the below script. ./run.sh --help Signed-off-by: Meng Li --- tools/testing/selftests/amd-pstate/Makefile | 3 +- .../selftests/amd-pstate/amd-pstate-ut.sh | 55 ------- tools/testing/selftests/amd-pstate/basic.sh | 38 +++++ tools/testing/selftests/amd-pstate/run.sh | 141 ++++++++++++++++++ 4 files changed, 181 insertions(+), 56 deletions(-) delete mode 100755 tools/testing/selftests/amd-pstate/amd-pstate-ut.sh create mode 100755 tools/testing/selftests/amd-pstate/basic.sh create mode 100755 tools/testing/selftests/amd-pstate/run.sh diff --git a/tools/testing/selftests/amd-pstate/Makefile b/tools/testing/se= lftests/amd-pstate/Makefile index 199867f44b32..6f4c7b01e3bb 100644 --- a/tools/testing/selftests/amd-pstate/Makefile +++ b/tools/testing/selftests/amd-pstate/Makefile @@ -4,6 +4,7 @@ # No binaries, but make sure arg-less "make" doesn't trigger "run_tests" all: =20 -TEST_PROGS :=3D amd-pstate-ut.sh +TEST_PROGS :=3D run.sh +TEST_FILES :=3D basic.sh =20 include ../lib.mk diff --git a/tools/testing/selftests/amd-pstate/amd-pstate-ut.sh b/tools/te= sting/selftests/amd-pstate/amd-pstate-ut.sh deleted file mode 100755 index 273364650285..000000000000 --- a/tools/testing/selftests/amd-pstate/amd-pstate-ut.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0 - -# amd-pstate-ut is a test module for testing the amd-pstate driver. -# It can only run on x86 architectures and current cpufreq driver -# must be amd-pstate. -# (1) It can help all users to verify their processor support -# (SBIOS/Firmware or Hardware). -# (2) Kernel can have a basic function test to avoid the kernel -# regression during the update. -# (3) We can introduce more functional or performance tests to align -# the result together, it will benefit power and performance scale optimiz= ation. - -# Kselftest framework requirement - SKIP code is 4. -ksft_skip=3D4 - -# amd-pstate-ut only run on x86/x86_64 AMD systems. -ARCH=3D$(uname -m 2>/dev/null | sed -e 's/i.86/x86/' -e 's/x86_64/x86/') -VENDOR=3D$(cat /proc/cpuinfo | grep -m 1 'vendor_id' | awk '{print $NF}') - -if ! echo "$ARCH" | grep -q x86; then - echo "$0 # Skipped: Test can only run on x86 architectures." - exit $ksft_skip -fi - -if ! echo "$VENDOR" | grep -iq amd; then - echo "$0 # Skipped: Test can only run on AMD CPU." - echo "$0 # Current cpu vendor is $VENDOR." - exit $ksft_skip -fi - -scaling_driver=3D$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_dri= ver) -if [ "$scaling_driver" !=3D "amd-pstate" ]; then - echo "$0 # Skipped: Test can only run on amd-pstate driver." - echo "$0 # Current cpufreq scaling drvier is $scaling_driver." - exit $ksft_skip -fi - -msg=3D"Skip all tests:" -if [ ! -w /dev ]; then - echo $msg please run this as root >&2 - exit $ksft_skip -fi - -if ! /sbin/modprobe -q -n amd-pstate-ut; then - echo "amd-pstate-ut: module amd-pstate-ut is not found [SKIP]" - exit $ksft_skip -fi -if /sbin/modprobe -q amd-pstate-ut; then - /sbin/modprobe -q -r amd-pstate-ut - echo "amd-pstate-ut: ok" -else - echo "amd-pstate-ut: [FAIL]" - exit 1 -fi diff --git a/tools/testing/selftests/amd-pstate/basic.sh b/tools/testing/se= lftests/amd-pstate/basic.sh new file mode 100755 index 000000000000..e4c43193e4a3 --- /dev/null +++ b/tools/testing/selftests/amd-pstate/basic.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +# amd-pstate-ut is a test module for testing the amd-pstate driver. +# It can only run on x86 architectures and current cpufreq driver +# must be amd-pstate. +# (1) It can help all users to verify their processor support +# (SBIOS/Firmware or Hardware). +# (2) Kernel can have a basic function test to avoid the kernel +# regression during the update. +# (3) We can introduce more functional or performance tests to align +# the result together, it will benefit power and performance scale optimiz= ation. + +# protect against multiple inclusion +if [ $FILE_BASIC ]; then + return 0 +else + FILE_BASIC=3DDONE +fi + +amd_pstate_basic() +{ + printf "\n---------------------------------------------\n" + printf "*** Running AMD P-state ut ***" + printf "\n---------------------------------------------\n" + + if ! /sbin/modprobe -q -n amd-pstate-ut; then + echo "amd-pstate-ut: module amd-pstate-ut is not found [SKIP]" + exit $ksft_skip + fi + if /sbin/modprobe -q amd-pstate-ut; then + /sbin/modprobe -q -r amd-pstate-ut + echo "amd-pstate-basic: ok" + else + echo "amd-pstate-basic: [FAIL]" + exit 1 + fi +} diff --git a/tools/testing/selftests/amd-pstate/run.sh b/tools/testing/self= tests/amd-pstate/run.sh new file mode 100755 index 000000000000..dfacbec063c0 --- /dev/null +++ b/tools/testing/selftests/amd-pstate/run.sh @@ -0,0 +1,141 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# protect against multiple inclusion +if [ $FILE_MAIN ]; then + return 0 +else + FILE_MAIN=3DDONE +fi + +source basic.sh + +# amd-pstate-ut only run on x86/x86_64 AMD systems. +ARCH=3D$(uname -m 2>/dev/null | sed -e 's/i.86/x86/' -e 's/x86_64/x86/') +VENDOR=3D$(cat /proc/cpuinfo | grep -m 1 'vendor_id' | awk '{print $NF}') + +FUNC=3Dall +OUTFILE=3Dselftest + +# Kselftest framework requirement - SKIP code is 4. +ksft_skip=3D4 + +# All amd-pstate tests +amd_pstate_all() +{ + printf "\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n" + printf "***** Running AMD P-state Sanity Tests *****\n" + printf "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n\= n" + + # unit test for amd-pstate kernel driver + amd_pstate_basic +} + +helpme() +{ + printf "Usage: $0 [OPTION...] + [-h ] + [-o ] + [-c ] + \n" + exit 2 +} + +parse_arguments() +{ + while getopts ho:c: arg + do + case $arg in + h) # --help + helpme + ;; + + c) # --func_type (Function to perform: basic (default: all)) + FUNC=3D$OPTARG + ;; + + o) # --output-file (Output file to store dumps) + OUTFILE=3D$OPTARG + ;; + + *) + helpme + ;; + esac + done +} + +prerequisite() +{ + if ! echo "$ARCH" | grep -q x86; then + echo "$0 # Skipped: Test can only run on x86 architectures." + exit $ksft_skip + fi + + if ! echo "$VENDOR" | grep -iq amd; then + echo "$0 # Skipped: Test can only run on AMD CPU." + echo "$0 # Current cpu vendor is $VENDOR." + exit $ksft_skip + fi + + scaling_driver=3D$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_dr= iver) + if [ "$scaling_driver" !=3D "amd-pstate" ]; then + echo "$0 # Skipped: Test can only run on amd-pstate driver." + echo "$0 # Current cpufreq scaling drvier is $scaling_driver." + exit $ksft_skip + fi + + msg=3D"Skip all tests:" + if [ ! -w /dev ]; then + echo $msg please run this as root >&2 + exit $ksft_skip + fi +} + +do_test() +{ + case "$FUNC" in + "all") + amd_pstate_all + ;; + + "basic") + amd_pstate_basic + ;; + + *) + echo "Invalid [-f] function type" + helpme + ;; + esac +} + +# clear dumps +pre_clear_dumps() +{ + case "$FUNC" in + "all") + rm -rf $OUTFILE* + ;; + + *) + ;; + esac +} + +post_clear_dumps() +{ + rm -rf $OUTFILE.log +} + +# Parse arguments +parse_arguments $@ + +# Make sure all requirements are met +prerequisite + +# Run requested functions +pre_clear_dumps +do_test | tee -a $OUTFILE.log +post_clear_dumps --=20 2.25.1 From nobody Sat Apr 11 22:46:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EEC8C00144 for ; Thu, 4 Aug 2022 05:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239049AbiHDFsN (ORCPT ); Thu, 4 Aug 2022 01:48:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239042AbiHDFrh (ORCPT ); Thu, 4 Aug 2022 01:47:37 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2085.outbound.protection.outlook.com [40.107.243.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7AF760690; Wed, 3 Aug 2022 22:47:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g2SSuGUjfASsJ6b/RUBF/7LRQxxg/ntWEiROJNHs5s8Kt2bB05+JB05H9ir35eY2EXCGcLUHxxbhhlZfUnuMbwxNBj3C7fv+YWf3pjazng3rY+CJ/HwQkIZdM1TudJ+tm0az5XdEtG6Jnj0Hbp+V+M8DXJpAncPVXUU/Hk1jerQZMz879BG/f+HrEgKqX+DnpRsaTUkTjsnifgIRAPJOd6ZAatwAkYMj6dg2Z08W6rYVuYC8xwhKaIbrOrmY+zwn36I0ro/7DTcAbWHv/Is6Ong6Atbmp/UdPHXVPl+lemQqnQgaP6ut043kjfslZsGLkggkZVzfVQlzVeZNTEhgEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Wwl9nR00gFZ16B5JRcGrfEc448b1AvpaOyB0Qp2MbDQ=; b=APDn3isFyX5R3iZH9yWp6kfkpqR7eHNe3HVIzvxwf0MO1nfx9to/n01g4uCgEY+m/jwodix0rcU94eyqDX4xv71XMkIcsbErcUQkzwMbzZAPGVmpolq85mYUcStz5eErIJyKIDHy9UTAEW90fTx9KPgextG6Tta7ThsTRWRQDYU1LkTGMnFsrOHJMu+i21VtmH8PsQ4A+QVjKsjrtCnUJnEyeYPPA5/rm2mVy8Jx+hyoxlIER2E9f829RT85BwWJPgyEEVYN0gZpAkTCp7691geoFPUrTMtXtWbc2ixr0PNQg8cjH3ReNwmUIG553zoRrSLx6vL+GibAE4EErGBsDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wwl9nR00gFZ16B5JRcGrfEc448b1AvpaOyB0Qp2MbDQ=; b=NZi4yDq5EFjeiEZJeOxxaGEp6dSU/mLZr86zz9aex9JDia8l4cB8vQhpneiBduDN7m/J6FtFThiEepuza/LionY96XcNyWZCA3MUC6kJy7ODJfmeJH811EaMfxXjRGCrAU5mNZMtfdAHOIgzaTyxG6bImnI99+MWfPPsJPIUoE8= Received: from DS7PR03CA0083.namprd03.prod.outlook.com (2603:10b6:5:3bb::28) by SA0PR12MB4591.namprd12.prod.outlook.com (2603:10b6:806:9d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.12; Thu, 4 Aug 2022 05:47:19 +0000 Received: from DM6NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3bb:cafe::d2) by DS7PR03CA0083.outlook.office365.com (2603:10b6:5:3bb::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.16 via Frontend Transport; Thu, 4 Aug 2022 05:47:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT060.mail.protection.outlook.com (10.13.173.63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5504.14 via Frontend Transport; Thu, 4 Aug 2022 05:47:19 +0000 Received: from jasmine-meng.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 4 Aug 2022 00:47:09 -0500 From: Meng Li To: Shuah Khan , Huang Rui , CC: "Rafael J . Wysocki" , Nathan Fontenot , Deepak Sharma , "Alex Deucher" , Mario Limonciello , Jinzhou Su , Perry Yuan , Xiaojian Du , Viresh Kumar , Borislav Petkov , , Meng Li Subject: [PATCH V2 2/4] selftests: amd-pstate: Trigger tbench benchmark and test cpus Date: Thu, 4 Aug 2022 13:44:12 +0800 Message-ID: <20220804054414.1510764-3-li.meng@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804054414.1510764-1-li.meng@amd.com> References: <20220804054414.1510764-1-li.meng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05b2d3ed-7150-4165-04df-08da75dccbc7 X-MS-TrafficTypeDiagnostic: SA0PR12MB4591:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UYXQJGqYCGL+FqqzCHUtIkosr4FUXF3hw01ApZW5vSFUAe+LGCI9/rC9OMgo/VVOBVPSUwzsc4H5aAoYKGr5GI30U73XrPBPyHBT5R1d4VxSXZiH/72PpkdBWub6xQfGaZsDT6MdkrFybBmIcDiZNZr1/DfLG7zCbaSGlgVDAVjrfsBML7Ock+qCdGU0wCHA2OoIw53rnD7HfHvzl1vG8jLYVk4r8ziByEe19FAapvByuLgc63z8c0BpdzEzirz73NFxdZU0/16K/0IkLCRwKC3Q+YYNNvOuQ0ogUG7NYjmvUwxcfB1JQwrkoAFfb5BC4TEEeS0bVp2w76UYsLmukwInfWNtzDQqw03I9QNiHv0FoSUamBPgEHgpixpvixciI0Gb/Sl5dwZ4fdCuYUx4VozE25cm47G057Xe0rpOr7yZQUEsSG4a9t8T3PHYr/eX19uSsBFHrnIfKf/NFPU/plnaoq/arbmhmy9XnTpSIQizjfdSJWmyo5GH7dMzSRRsx4jyJBDkzUd0R4csj3wWVu5gR6jI2IJNWtEiPNck3v96HBtB4CRkei0ngD745gK7CMM9MzTunGKf0Moss7iAMlgDUx7nGXV3ywTGhMoOl9TVQvcgmycHLb55b2EVIEHcHdt2GHWuBE3aTOtAFKE14r1kR68jUnGOSFK/Pr3H33EdDmAR+SxRIN1TMA44v8t41voTKfDobQ71dS0qJOubwBscJFTt4g+7w3OTW3ZuiSOVXVzeB9uAgCN5y5toZR3N3ooDzi4aooXzBN2pfNtQdSmitkhnqQdVR8+rG3o9RW4gShGjb9HyejPmKmA6jTwNvK+x6OPi8wPiS/QMwUBBjjFekrL3RDmx1C8j48PnBRaQtRv0Y9rCNGNZ9kGcekIw X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230016)(4636009)(396003)(136003)(376002)(346002)(39860400002)(36840700001)(46966006)(40470700004)(316002)(336012)(426003)(47076005)(8676002)(36756003)(1076003)(2616005)(26005)(41300700001)(36860700001)(16526019)(186003)(7696005)(82310400005)(83380400001)(478600001)(2906002)(86362001)(5660300002)(40460700003)(6666004)(82740400003)(30864003)(54906003)(81166007)(40480700001)(8936002)(110136005)(70206006)(356005)(70586007)(4326008)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 05:47:19.7325 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05b2d3ed-7150-4165-04df-08da75dccbc7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4591 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add tbench.sh trigger the tbench testing and monitor the cpu desire performance, frequency, load, power consumption and throughput etc. Signed-off-by: Meng Li --- tools/testing/selftests/amd-pstate/Makefile | 10 +- tools/testing/selftests/amd-pstate/run.sh | 217 ++++++++++- tools/testing/selftests/amd-pstate/tbench.sh | 358 +++++++++++++++++++ 3 files changed, 576 insertions(+), 9 deletions(-) create mode 100755 tools/testing/selftests/amd-pstate/tbench.sh diff --git a/tools/testing/selftests/amd-pstate/Makefile b/tools/testing/se= lftests/amd-pstate/Makefile index 6f4c7b01e3bb..cac8dedb7226 100644 --- a/tools/testing/selftests/amd-pstate/Makefile +++ b/tools/testing/selftests/amd-pstate/Makefile @@ -4,7 +4,15 @@ # No binaries, but make sure arg-less "make" doesn't trigger "run_tests" all: =20 +uname_M :=3D $(shell uname -m 2>/dev/null || echo not) +ARCH ?=3D $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/) + +ifeq (x86,$(ARCH)) +TEST_GEN_FILES +=3D ../../../power/x86/amd_pstate_tracer/amd_pstate_trace.= py +TEST_GEN_FILES +=3D ../../../power/x86/intel_pstate_tracer/intel_pstate_tr= acer.py +endif + TEST_PROGS :=3D run.sh -TEST_FILES :=3D basic.sh +TEST_FILES :=3D basic.sh tbench.sh =20 include ../lib.mk diff --git a/tools/testing/selftests/amd-pstate/run.sh b/tools/testing/self= tests/amd-pstate/run.sh index dfacbec063c0..aa264e96a6e6 100755 --- a/tools/testing/selftests/amd-pstate/run.sh +++ b/tools/testing/selftests/amd-pstate/run.sh @@ -9,6 +9,7 @@ else fi =20 source basic.sh +source tbench.sh =20 # amd-pstate-ut only run on x86/x86_64 AMD systems. ARCH=3D$(uname -m 2>/dev/null | sed -e 's/i.86/x86/' -e 's/x86_64/x86/') @@ -16,9 +17,107 @@ VENDOR=3D$(cat /proc/cpuinfo | grep -m 1 'vendor_id' | = awk '{print $NF}') =20 FUNC=3Dall OUTFILE=3Dselftest +OUTFILE_TBENCH=3D"$OUTFILE.tbench" + +SYSFS=3D +CPUROOT=3D +CPUFREQROOT=3D +MAKE_CPUS=3D + +TIME_LIMIT=3D100 +PROCESS_NUM=3D128 +LOOP_TIMES=3D3 +TRACER_INTERVAL=3D10 +CURRENT_TEST=3Damd-pstate +COMPARATIVE_TEST=3D =20 # Kselftest framework requirement - SKIP code is 4. ksft_skip=3D4 +all_scaling_names=3D("acpi-cpufreq" "amd-pstate") + +# Get current cpufreq scaling driver name +scaling_name() +{ + if [ "$COMPARATIVE_TEST" =3D "" ]; then + echo "$CURRENT_TEST" + else + echo "$COMPARATIVE_TEST" + fi +} + +# Counts CPUs with cpufreq directories +count_cpus() +{ + count=3D0; + + for cpu in `ls $CPUROOT | grep "cpu[0-9].*"`; do + if [ -d $CPUROOT/$cpu/cpufreq ]; then + let count=3Dcount+1; + fi + done + + echo $count; +} + +# $1: policy +find_current_governor() +{ + cat $CPUFREQROOT/$1/scaling_governor +} + +# $1: policy +backup_governor() +{ + local cur_gov=3D$(find_current_governor $1) + + printf "Governor backup done for $1: $cur_gov\n" + echo "$1 $cur_gov" >> $OUTFILE.backup_governor.log +} + +restore_governor() +{ + i=3D0; + + policies=3D$(awk '{print $1}' $OUTFILE.backup_governor.log) + for policy in $policies; do + let i++; + governor=3D$(sed -n ''$i'p' $OUTFILE.backup_governor.log | awk '{print $= 2}') + + # switch governor + _switch_governor $policy $governor + printf "Governor restored for $policy to $governor\n" + done +} + +# $1: policy, $2: governor +_switch_governor() +{ + echo $2 > $CPUFREQROOT/$1/scaling_governor +} + +for_each_policy() +{ + policies=3D$(ls $CPUFREQROOT| grep "policy[0-9].*") + for policy in $policies; do + $@ $policy + done +} + +# $1: governor, $2: policy +switch_governor() +{ + local filepath=3D$CPUFREQROOT/$2/scaling_available_governors + + # Exit if cpu isn't managed by cpufreq core + if [ ! -f $filepath ]; then + return; + fi + + # switch governor + _switch_governor $2 $1 + + printf "Switched governor for $2 to $1\n" +} =20 # All amd-pstate tests amd_pstate_all() @@ -27,8 +126,19 @@ amd_pstate_all() printf "***** Running AMD P-state Sanity Tests *****\n" printf "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n\= n" =20 + count=3D$(count_cpus) + if [ $count =3D 0 ]; then + printf "No cpu is managed by cpufreq core, exiting\n" + exit; + else + printf "AMD P-state manages: $count CPUs\n" + fi + # unit test for amd-pstate kernel driver amd_pstate_basic + + # tbench + amd_pstate_tbench } =20 helpme() @@ -37,21 +147,27 @@ helpme() [-h ] [-o ] [-c ] + basic: Basic testing, + tbench: Tbench testing.>] + [-t ] + [-p ] + [-l ] + [-i ] + [-m ] \n" exit 2 } =20 parse_arguments() { - while getopts ho:c: arg + while getopts ho:c:t:p:l:i:m: arg do case $arg in h) # --help helpme ;; =20 - c) # --func_type (Function to perform: basic (default: all)) + c) # --func_type (Function to perform: basic, tbench (default: all)) FUNC=3D$OPTARG ;; =20 @@ -59,6 +175,26 @@ parse_arguments() OUTFILE=3D$OPTARG ;; =20 + t) # --tbench-time-limit + TIME_LIMIT=3D$OPTARG + ;; + + p) # --tbench-process-number + PROCESS_NUM=3D$OPTARG + ;; + + l) # --tbench-loop-times + LOOP_TIMES=3D$OPTARG + ;; + + i) # --amd-tracer-interval + TRACER_INTERVAL=3D$OPTARG + ;; + + m) # --comparative-test + COMPARATIVE_TEST=3D$OPTARG + ;; + *) helpme ;; @@ -80,10 +216,28 @@ prerequisite() fi =20 scaling_driver=3D$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_dr= iver) - if [ "$scaling_driver" !=3D "amd-pstate" ]; then - echo "$0 # Skipped: Test can only run on amd-pstate driver." - echo "$0 # Current cpufreq scaling drvier is $scaling_driver." - exit $ksft_skip + if [ "$COMPARATIVE_TEST" =3D "" ]; then + if [ "$scaling_driver" !=3D "$CURRENT_TEST" ]; then + echo "$0 # Skipped: Test can only run on $CURRENT_TEST driver or run co= mparative test." + echo "$0 # Current cpufreq scaling drvier is $scaling_driver." + exit $ksft_skip + fi + else + case "$FUNC" in + "tbench") + if [ "$scaling_driver" !=3D "$COMPARATIVE_TEST" ]; then + echo "$0 # Skipped: Comparison test can only run on $COMPARATIVE_TEST= driver." + echo "$0 # Current cpufreq scaling drvier is $scaling_driver." + exit $ksft_skip + fi + ;; + + *) + echo "$0 # Skipped: Comparison test are only for tbench or gitsource." + echo "$0 # Current comparative test is for $FUNC." + exit $ksft_skip + ;; + esac fi =20 msg=3D"Skip all tests:" @@ -91,10 +245,44 @@ prerequisite() echo $msg please run this as root >&2 exit $ksft_skip fi + + if [ ! -f perf ] ; then + echo $msg please build perf under directory tools/perf and copy it to di= rectory amd-pstate. >&2 + exit $ksft_skip + fi + + SYSFS=3D`mount -t sysfs | head -1 | awk '{ print $3 }'` + + if [ ! -d "$SYSFS" ]; then + echo $msg sysfs is not mounted >&2 + exit 2 + fi + + CPUROOT=3D$SYSFS/devices/system/cpu + CPUFREQROOT=3D"$CPUROOT/cpufreq" + + if ! ls $CPUROOT/cpu* > /dev/null 2>&1; then + echo $msg cpus not available in sysfs >&2 + exit 2 + fi + + if ! ls $CPUROOT/cpufreq > /dev/null 2>&1; then + echo $msg cpufreq directory not available in sysfs >&2 + exit 2 + fi } =20 do_test() { + # Check if CPUs are managed by cpufreq or not + count=3D$(count_cpus) + MAKE_CPUS=3D$((count*2)) + + if [ $count =3D 0 ]; then + echo "No cpu is managed by cpufreq core, exiting" + exit 2; + fi + case "$FUNC" in "all") amd_pstate_all @@ -104,6 +292,10 @@ do_test() amd_pstate_basic ;; =20 + "tbench") + amd_pstate_tbench + ;; + *) echo "Invalid [-f] function type" helpme @@ -116,7 +308,15 @@ pre_clear_dumps() { case "$FUNC" in "all") - rm -rf $OUTFILE* + rm -rf $OUTFILE.log + rm -rf $OUTFILE.backup_governor.log + rm -rf *.png + ;; + + "tbench") + rm -rf $OUTFILE.log + rm -rf $OUTFILE.backup_governor.log + rm -rf tbench_*.png ;; =20 *) @@ -127,6 +327,7 @@ pre_clear_dumps() post_clear_dumps() { rm -rf $OUTFILE.log + rm -rf $OUTFILE.backup_governor.log } =20 # Parse arguments diff --git a/tools/testing/selftests/amd-pstate/tbench.sh b/tools/testing/s= elftests/amd-pstate/tbench.sh new file mode 100755 index 000000000000..161b78fc12d7 --- /dev/null +++ b/tools/testing/selftests/amd-pstate/tbench.sh @@ -0,0 +1,358 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +# Testing and monitor the cpu frequency and performance when +# this script trigger tbench test. + +# protect against multiple inclusion +if [ $FILE_TBENCH ]; then + return 0 +else + FILE_TBENCH=3DDONE +fi + +tbench_name=3D"dbench-4.0" +tbench_tar=3D"$tbench_name.tar.gz" +tbench_url=3D"https://ftp.samba.org/pub/pub/tridge/dbench/dbench-4.0.tar.g= z" +tbench_governors=3D("ondemand" "schedutil") + +# $1: governor, $2: round, $3: des-perf, $4: freq, $5: load, $6: performan= ce, $7: energy, $8: performance per watt +store_csv_tbench() +{ + echo "$1, $2, $3, $4, $5, $6, $7, $8" | tee -a $OUTFILE_TBENCH.csv > /dev= /null 2>&1 +} + +# clear some special lines +clear_csv_tbench() +{ + if [ -f $OUTFILE_TBENCH.csv ]; then + sed -i '/Comprison(%)/d' $OUTFILE_TBENCH.csv + sed -i "/$(scaling_name)/d" $OUTFILE_TBENCH.csv + fi +} + +# find string $1 in file csv and get the number of lines +get_lines_csv_tbench() +{ + if [ -f $OUTFILE_TBENCH.csv ]; then + return `grep -c "$1" $OUTFILE_TBENCH.csv` + else + return 0 + fi +} + +pre_clear_tbench() +{ + post_clear_tbench + rm -rf tbench_*.png + clear_csv_tbench +} + +post_clear_tbench() +{ + rm -rf results/tracer-tbench* + rm -rf $OUTFILE_TBENCH*.log + rm -rf $OUTFILE_TBENCH*.result + +} + +install_tbench() +{ + if [ ! -d $tbench_name ]; then + printf "Download tbench, please wait a moment ...\n\n" + wget -O $tbench_tar $tbench_url > /dev/null 2>&1 + + printf "Tar tbench ...\n\n" + tar -xzf $tbench_tar + + printf "Compile and install tbench ...\n\n" + cd $tbench_name + ./autogen.sh + ./configure > /dev/null 2>&1 + make > /dev/null 2>&1 + make install > /dev/null 2>&1 + cd .. + fi +} + +# $1: governor, $2: loop +run_tbench() +{ + echo "Launching amd pstate tracer for $1 #$2 tracer_interval: $TRACER_INT= ERVAL" + ./amd_pstate_trace.py -n tracer-tbench-$1-$2 -i $TRACER_INTERVAL > /dev/n= ull 2>&1 & + + printf "Test tbench for $1 #$2 time_limit: $TIME_LIMIT procs_num: $PROCES= S_NUM\n" + cd $tbench_name + ./tbench_srv > /dev/null 2>&1 & + ./../perf stat -a --per-socket -I 1000 -e power/energy-pkg/ ./tbench -t $= TIME_LIMIT $PROCESS_NUM > ../$OUTFILE_TBENCH-perf-$1-$2.log 2>&1 + cd .. + + pid=3D`pidof tbench_srv` + kill $pid + + for job in `jobs -p` + do + echo "Waiting for job id $job" + wait $job + done +} + +# $1: governor, $2: loop +parse_tbench() +{ + awk '{print $5}' results/tracer-tbench-$1-$2/cpu.csv | sed -e '1d' | sed = s/,// > $OUTFILE_TBENCH-des-perf-$1-$2.log + avg_des_perf=3D$(awk 'BEGIN {i=3D0; sum=3D0};{i++; sum +=3D $1};END {prin= t sum/i}' $OUTFILE_TBENCH-des-perf-$1-$2.log) + printf "Tbench-$1-#$2 avg des perf: $avg_des_perf\n" | tee -a $OUTFILE_TB= ENCH.result + + awk '{print $7}' results/tracer-tbench-$1-$2/cpu.csv | sed -e '1d' | sed = s/,// > $OUTFILE_TBENCH-freq-$1-$2.log + avg_freq=3D$(awk 'BEGIN {i=3D0; sum=3D0};{i++; sum +=3D $1};END {print su= m/i}' $OUTFILE_TBENCH-freq-$1-$2.log) + printf "Tbench-$1-#$2 avg freq: $avg_freq\n" | tee -a $OUTFILE_TBENCH.res= ult + + awk '{print $11}' results/tracer-tbench-$1-$2/cpu.csv | sed -e '1d' | sed= s/,// > $OUTFILE_TBENCH-load-$1-$2.log + avg_load=3D$(awk 'BEGIN {i=3D0; sum=3D0};{i++; sum +=3D $1};END {print su= m/i}' $OUTFILE_TBENCH-load-$1-$2.log) + printf "Tbench-$1-#$2 avg load: $avg_load\n" | tee -a $OUTFILE_TBENCH.res= ult + + grep Throughput $OUTFILE_TBENCH-perf-$1-$2.log | awk '{print $2}' > $OUTF= ILE_TBENCH-throughput-$1-$2.log + tp_sum=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum}' $OUTFILE_T= BENCH-throughput-$1-$2.log) + printf "Tbench-$1-#$2 throughput(MB/s): $tp_sum\n" | tee -a $OUTFILE_TBEN= CH.result + + grep Joules $OUTFILE_TBENCH-perf-$1-$2.log | awk '{print $4}' > $OUTFILE_= TBENCH-energy-$1-$2.log + en_sum=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum}' $OUTFILE_T= BENCH-energy-$1-$2.log) + printf "Tbench-$1-#$2 power consumption(J): $en_sum\n" | tee -a $OUTFILE_= TBENCH.result + + # Permance is throughput per second, denoted T/t, where T is throught ren= dered in t seconds. + # It is well known that P=3DE/t, where P is power measured in watts(W), E= is energy measured in joules(J), + # and t is time measured in seconds(s). This means that performance per w= att becomes + # T/t T/t T + # --- =3D --- =3D --- + # P E/t E + # with unit given by MB per joule. + ppw=3D`echo "scale=3D4;($TIME_LIMIT-1)*$tp_sum/$en_sum" | bc | awk '{prin= tf "%.4f", $0}'` + printf "Tbench-$1-#$2 performance per watt(MB/J): $ppw\n" | tee -a $OUTFI= LE_TBENCH.result + printf "\n" | tee -a $OUTFILE_TBENCH.result + + driver_name=3D`echo $(scaling_name)` + store_csv_tbench "$driver_name-$1" $2 $avg_des_perf $avg_freq $avg_load $= tp_sum $en_sum $ppw +} + +# $1: governor +loop_tbench() +{ + printf "\nTbench total test times is $LOOP_TIMES for $1\n\n" + for i in `seq 1 $LOOP_TIMES` + do + run_tbench $1 $i + parse_tbench $1 $i + done +} + +# $1: governor +gather_tbench() +{ + printf "Tbench test result for $1 (loops:$LOOP_TIMES)" | tee -a $OUTFILE_= TBENCH.result + printf "\n--------------------------------------------------\n" | tee -a = $OUTFILE_TBENCH.result + + grep "Tbench-$1-#" $OUTFILE_TBENCH.result | grep "avg des perf:" | awk '{= print $NF}' > $OUTFILE_TBENCH-des-perf-$1.log + avg_des_perf=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum/'$LOOP= _TIMES'}' $OUTFILE_TBENCH-des-perf-$1.log) + printf "Tbench-$1 avg des perf: $avg_des_perf\n" | tee -a $OUTFILE_TBENCH= .result + + grep "Tbench-$1-#" $OUTFILE_TBENCH.result | grep "avg freq:" | awk '{prin= t $NF}' > $OUTFILE_TBENCH-freq-$1.log + avg_freq=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum/'$LOOP_TIM= ES'}' $OUTFILE_TBENCH-freq-$1.log) + printf "Tbench-$1 avg freq: $avg_freq\n" | tee -a $OUTFILE_TBENCH.result + + grep "Tbench-$1-#" $OUTFILE_TBENCH.result | grep "avg load:" | awk '{prin= t $NF}' > $OUTFILE_TBENCH-load-$1.log + avg_load=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum/'$LOOP_TIM= ES'}' $OUTFILE_TBENCH-load-$1.log) + printf "Tbench-$1 avg load: $avg_load\n" | tee -a $OUTFILE_TBENCH.result + + grep "Tbench-$1-#" $OUTFILE_TBENCH.result | grep "throughput(MB/s):" | aw= k '{print $NF}' > $OUTFILE_TBENCH-throughput-$1.log + tp_sum=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum}' $OUTFILE_T= BENCH-throughput-$1.log) + printf "Tbench-$1 total throughput(MB/s): $tp_sum\n" | tee -a $OUTFILE_TB= ENCH.result + + avg_tp=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum/'$LOOP_TIMES= '}' $OUTFILE_TBENCH-throughput-$1.log) + printf "Tbench-$1 avg throughput(MB/s): $avg_tp\n" | tee -a $OUTFILE_TBEN= CH.result + + grep "Tbench-$1-#" $OUTFILE_TBENCH.result | grep "power consumption(J):" = | awk '{print $NF}' > $OUTFILE_TBENCH-energy-$1.log + en_sum=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum}' $OUTFILE_T= BENCH-energy-$1.log) + printf "Tbench-$1 total power consumption(J): $en_sum\n" | tee -a $OUTFIL= E_TBENCH.result + + avg_en=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum/'$LOOP_TIMES= '}' $OUTFILE_TBENCH-energy-$1.log) + printf "Tbench-$1 avg power consumption(J): $avg_en\n" | tee -a $OUTFILE_= TBENCH.result + + # Permance is throughput per second, denoted T/t, where T is throught ren= dered in t seconds. + # It is well known that P=3DE/t, where P is power measured in watts(W), E= is energy measured in joules(J), + # and t is time measured in seconds(s). This means that performance per w= att becomes + # T/t T/t T + # --- =3D --- =3D --- + # P E/t E + # with unit given by MB per joule. + ppw=3D`echo "scale=3D4;($TIME_LIMIT-1)*$avg_tp/$avg_en" | bc | awk '{prin= tf "%.4f", $0}'` + printf "Tbench-$1 performance per watt(MB/J): $ppw\n" | tee -a $OUTFILE_T= BENCH.result + printf "\n" | tee -a $OUTFILE_TBENCH.result + + driver_name=3D`echo $(scaling_name)` + store_csv_tbench "$driver_name-$1" "Average" $avg_des_perf $avg_freq $avg= _load $avg_tp $avg_en $ppw +} + +# $1: base scaling_driver $2: base governor $3: comparative scaling_driver= $4: comparative governor +__calc_comp_tbench() +{ + base=3D`grep "$1-$2" $OUTFILE_TBENCH.csv | grep "Average"` + comp=3D`grep "$3-$4" $OUTFILE_TBENCH.csv | grep "Average"` + + if [ -n "$base" -a -n "$comp" ]; then + printf "\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D\n" | tee -a $OUTFILE_TBENCH.result + printf "Tbench comparison $1-$2 VS $3-$4" | tee -a $OUTFILE_TBENCH.result + printf "\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D\n" | tee -a $OUTFILE_TBENCH.result + + # get the base values + des_perf_base=3D`echo "$base" | awk '{print $3}' | sed s/,//` + freq_base=3D`echo "$base" | awk '{print $4}' | sed s/,//` + load_base=3D`echo "$base" | awk '{print $5}' | sed s/,//` + perf_base=3D`echo "$base" | awk '{print $6}' | sed s/,//` + energy_base=3D`echo "$base" | awk '{print $7}' | sed s/,//` + ppw_base=3D`echo "$base" | awk '{print $8}' | sed s/,//` + + # get the comparative values + des_perf_comp=3D`echo "$comp" | awk '{print $3}' | sed s/,//` + freq_comp=3D`echo "$comp" | awk '{print $4}' | sed s/,//` + load_comp=3D`echo "$comp" | awk '{print $5}' | sed s/,//` + perf_comp=3D`echo "$comp" | awk '{print $6}' | sed s/,//` + energy_comp=3D`echo "$comp" | awk '{print $7}' | sed s/,//` + ppw_comp=3D`echo "$comp" | awk '{print $8}' | sed s/,//` + + # compare the base and comp values + des_perf_drop=3D`echo "scale=3D4;($des_perf_comp-$des_perf_base)*100/$de= s_perf_base" | bc | awk '{printf "%.4f", $0}'` + printf "Tbench-$1 des perf base: $des_perf_base comprison: $des_perf_com= p percent: $des_perf_drop\n" | tee -a $OUTFILE_TBENCH.result + + freq_drop=3D`echo "scale=3D4;($freq_comp-$freq_base)*100/$freq_base" | b= c | awk '{printf "%.4f", $0}'` + printf "Tbench-$1 freq base: $freq_base comprison: $freq_comp percent: $= freq_drop\n" | tee -a $OUTFILE_TBENCH.result + + load_drop=3D`echo "scale=3D4;($load_comp-$load_base)*100/$load_base" | b= c | awk '{printf "%.4f", $0}'` + printf "Tbench-$1 load base: $load_base comprison: $load_comp percent: $= load_drop\n" | tee -a $OUTFILE_TBENCH.result + + perf_drop=3D`echo "scale=3D4;($perf_comp-$perf_base)*100/$perf_base" | b= c | awk '{printf "%.4f", $0}'` + printf "Tbench-$1 perf base: $perf_base comprison: $perf_comp percent: $= perf_drop\n" | tee -a $OUTFILE_TBENCH.result + + energy_drop=3D`echo "scale=3D4;($energy_comp-$energy_base)*100/$energy_b= ase" | bc | awk '{printf "%.4f", $0}'` + printf "Tbench-$1 energy base: $energy_base comprison: $energy_comp perc= ent: $energy_drop\n" | tee -a $OUTFILE_TBENCH.result + + ppw_drop=3D`echo "scale=3D4;($ppw_comp-$ppw_base)*100/$ppw_base" | bc | = awk '{printf "%.4f", $0}'` + printf "Tbench-$1 performance per watt base: $ppw_base comprison: $ppw_c= omp percent: $ppw_drop\n" | tee -a $OUTFILE_TBENCH.result + printf "\n" | tee -a $OUTFILE_TBENCH.result + + store_csv_tbench "$1-$2 VS $3-$4" "Comprison(%)" "$des_perf_drop" "$freq= _drop" "$load_drop" "$perf_drop" "$energy_drop" "$ppw_drop" + fi +} + +# calculate the comparison(%) +calc_comp_tbench() +{ + # acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil + __calc_comp_tbench ${all_scaling_names[0]} ${tbench_governors[0]} ${all_s= caling_names[0]} ${tbench_governors[1]} + + # amd-pstate-ondemand VS amd-pstate-schedutil + __calc_comp_tbench ${all_scaling_names[1]} ${tbench_governors[0]} ${all_s= caling_names[1]} ${tbench_governors[1]} + + # acpi-cpufreq-ondemand VS amd-pstate-ondemand + __calc_comp_tbench ${all_scaling_names[0]} ${tbench_governors[0]} ${all_s= caling_names[1]} ${tbench_governors[0]} + + # acpi-cpufreq-schedutil VS amd-pstate-schedutil + __calc_comp_tbench ${all_scaling_names[0]} ${tbench_governors[1]} ${all_s= caling_names[1]} ${tbench_governors[1]} +} + +# $1: file_name, $2: title, $3: ylable, $4: column +plot_png_tbench() +{ + # all_scaling_names[1] all_scaling_names[0] flag + # amd-pstate acpi-cpufreq + # N N 0 + # N Y 1 + # Y N 2 + # Y Y 3 + ret=3D`grep -c "${all_scaling_names[1]}" $OUTFILE_TBENCH.csv` + if [ $ret -eq 0 ]; then + ret=3D`grep -c "${all_scaling_names[0]}" $OUTFILE_TBENCH.csv` + if [ $ret -eq 0 ]; then + flag=3D0 + else + flag=3D1 + fi + else + ret=3D`grep -c "${all_scaling_names[0]}" $OUTFILE_TBENCH.csv` + if [ $ret -eq 0 ]; then + flag=3D2 + else + flag=3D3 + fi + fi + + gnuplot << EOF + set term png + set output "$1" + + set title "$2" + set xlabel "Test Cycles (round)" + set ylabel "$3" + + set grid + set style data histogram + set style fill solid 0.5 border + set boxwidth 0.8 + + if ($flag =3D=3D 1) { + plot \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${tbench_governors[0= ]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[0]}= -${tbench_governors[0]}", \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${tbench_governors[1= ]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[0]}= -${tbench_governors[1]}" + } else { + if ($flag =3D=3D 2) { + plot \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${tbench_governors[= 0]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[1]= }-${tbench_governors[0]}", \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${tbench_governors[= 1]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[1]= }-${tbench_governors[1]}" + } else { + if ($flag =3D=3D 3 ) { + plot \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${tbench_governors= [0]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[0= ]}-${tbench_governors[0]}", \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${tbench_governors= [1]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[0= ]}-${tbench_governors[1]}", \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${tbench_governors= [0]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[1= ]}-${tbench_governors[0]}", \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${tbench_governors= [1]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[1= ]}-${tbench_governors[1]}" + } + } + } + quit +EOF +} + +amd_pstate_tbench() +{ + printf "\n---------------------------------------------\n" + printf "*** Running tbench ***" + printf "\n---------------------------------------------\n" + + pre_clear_tbench + + install_tbench + + get_lines_csv_tbench "Governor" + if [ $? -eq 0 ]; then + # add titles and unit for csv file + store_csv_tbench "Governor" "Round" "Des-perf" "Freq" "Load" "Performanc= e" "Energy" "Performance Per Watt" + store_csv_tbench "Unit" "" "" "GHz" "" "MB/s" "J" "MB/J" + fi + + for_each_policy backup_governor + for governor in ${tbench_governors[*]} ; do + printf "\nSpecified governor is $governor\n\n" + for_each_policy switch_governor $governor + loop_tbench $governor + gather_tbench $governor + done + restore_governor + + plot_png_tbench "tbench_perfromance.png" "Tbench Benchmark Performance" "= Performance" 6 + plot_png_tbench "tbench_energy.png" "Tbench Benchmark Energy" "Energy (J)= " 7 + plot_png_tbench "tbench_ppw.png" "Tbench Benchmark Performance Per Watt" = "Performance Per Watt (MB/J)" 8 + + calc_comp_tbench + + post_clear_tbench +} --=20 2.25.1 From nobody Sat Apr 11 22:46:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23686C00144 for ; Thu, 4 Aug 2022 05:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239101AbiHDFsT (ORCPT ); Thu, 4 Aug 2022 01:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238990AbiHDFrj (ORCPT ); Thu, 4 Aug 2022 01:47:39 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2069.outbound.protection.outlook.com [40.107.100.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB5CB61132; Wed, 3 Aug 2022 22:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ELegaB4/zGtQ1jBcYUE9i5E+JemnJeaWY+2j4gZOzHbUe1j3fgvluh9aIY+4epQkkOda5Ql+17+2GMcK8v3HmNOkxIFFrVOzdtBiv/7Agw3tkUnMdIEQIDKUwFSaT3RkwtJXLAcokD5UfrqpLClusqy6AIvbe5iQpIso9LNzZ36FdbuwLnmjMm+2efBRwXZXdsoH8VFK4TYduxcfzhJKQ22YrS4sJjsnjPB5DT7d/2JdCrKGYSIX9hXeeWmB47Cg/fxi+jiKK6iMpnv5fgnlalaNvknx2n+BT4PmaAmQRWuzoyzvPavBhfMiG5iPg+1txy96LbXXb00HJ1mRIzpJ3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=q/kFjcpOSMeIWVCCzoMChAjpEKgFHcU50mKz4PTCuF0=; b=lE6gzV8PNV5Xlr9IkK6ldkJMhKR29TpZejXpqum0NbggF7YvMmnTDmTa7kp73DMtaX4BXNk0gnQK4lyKdWyMsMNRieR/hAC1KtRrucfFC5lnRYtBIo4gAdNGp/feFa3nx7ixlvvhAkJbIBk4c9/2odvhVbpwtBYNsMiBqIKhoEQ4wNuulM/oFjmc36zXMnWuxVIa75mM3yKduSHHNOtGGbLVPEfpO2M7hE3iYIXz9k63EetKCKvTBEPiVvyoojtLVEMftHKiqJJ/okCIcWaWClJR76NpL2YWwDP6VqVJMyIqPI3pPK0oFtPdd0rJ1eRxb4Xc7efgijFw0Pcqw/hD2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=q/kFjcpOSMeIWVCCzoMChAjpEKgFHcU50mKz4PTCuF0=; b=fbXg/XYB3a5/twsg4KswM8ra36L8ujd/WvVkVa2GRPTWT10/qydrkM84z5KkM5xycWVXECZpqjuRityKI/FzzwfWp165BfOEeEx0Sve6YRSOkC3HyjRvqrxgHDuBn/CliFM/fHgEPc8y7WCJ471LPcSxVbMDLqTq4EKvkIfakVY= Received: from DS7PR07CA0004.namprd07.prod.outlook.com (2603:10b6:5:3af::13) by BN8PR12MB3251.namprd12.prod.outlook.com (2603:10b6:408:9b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.15; Thu, 4 Aug 2022 05:47:24 +0000 Received: from DM6NAM11FT049.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3af:cafe::b3) by DS7PR07CA0004.outlook.office365.com (2603:10b6:5:3af::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14 via Frontend Transport; Thu, 4 Aug 2022 05:47:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT049.mail.protection.outlook.com (10.13.172.188) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5504.14 via Frontend Transport; Thu, 4 Aug 2022 05:47:23 +0000 Received: from jasmine-meng.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 4 Aug 2022 00:47:14 -0500 From: Meng Li To: Shuah Khan , Huang Rui , CC: "Rafael J . Wysocki" , Nathan Fontenot , Deepak Sharma , "Alex Deucher" , Mario Limonciello , Jinzhou Su , Perry Yuan , Xiaojian Du , Viresh Kumar , Borislav Petkov , , Meng Li Subject: [PATCH V2 3/4] selftests: amd-pstate: Trigger gitsource benchmark and test cpus Date: Thu, 4 Aug 2022 13:44:13 +0800 Message-ID: <20220804054414.1510764-4-li.meng@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804054414.1510764-1-li.meng@amd.com> References: <20220804054414.1510764-1-li.meng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 148e770c-6416-4262-b491-08da75dcce43 X-MS-TrafficTypeDiagnostic: BN8PR12MB3251:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uTzmS8hB1r+Yq2R1yCKQQzVGpFqzmPQVKzNdrMzg1HHGl4PSG66y+kqrjJCbI8kV7EIECGl8CLXPkasDJpXPRWpnQASXrv+9g3uCkKUqMwpsXjTevvGoAIDJr43ZvD1zyr4+1J9+LBluGbK0jhm9QmIX+5BMP62b/6Ei2HrAsvId1zSWHfM3W4mvhl2OK/lGrKn1P69WEjGutB9gYHSTofpMdbpsJ+ct2iJ2Hg4SsasHetvDUNK5j8VjOSwGXbt5CdbsyUm0Y0ZyoXeSJd1jTVHzCqZ/te4KcRhq4DRubGUo6huWDC0vhZdtcEPKqjeAI/WiD2uH+9QwzafRi23avviL1aUeU0fQxyOEbKVVtWGhF45GrUO7LUUutpGgLWFIRwBuP8B45J3W533v3irfBhfURnfzpjrzMTkIfFZGCm8j75KnKVWd2H/MK9U0UfvXA7hB7HkJCITlJfwb030fVxIFm8IVuBpAkj+2Xojg6QocrAIRfGKokT7Hper5dMAx5O5aM6LpVHrfJ106B8PbiOqGs3s0OtcK4qYuH+8Bwx1SXzEQcxHkVlVMJF4OrODuYzyCNsg61HxBPv3j1sQksUflsqrW4wv0QGmHczVVV7cJ2alzrTRhWLueVtYvZFN/XNsgoucQ597WPBppNWCBKqmAg75uU5MwalDGJ/DVyTxr5CL5qQtr5zqtDyw9lqCRxXjVEXNmRTZLp9muKAXmokw46LMGKTm2DDW3biPRVvSHLl6qmFazpa55tITjY+pak1MBK5kPRm2CJVb1p/8GPnPhOupIbYVxHiXH0akjnAfk2RNwaT9J3EZ3LPxqB7mYptfkmQ3DQlI96UNtmhEPxrR5/aS163xa6i4BCZpFPkk9UVv1Sh/iJZ+scqwRNov9 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230016)(4636009)(136003)(376002)(396003)(346002)(39860400002)(46966006)(40470700004)(36840700001)(41300700001)(5660300002)(2906002)(36756003)(356005)(81166007)(82310400005)(40460700003)(83380400001)(30864003)(478600001)(110136005)(2616005)(54906003)(7696005)(8936002)(82740400003)(70206006)(36860700001)(1076003)(4326008)(186003)(8676002)(16526019)(316002)(47076005)(426003)(336012)(26005)(40480700001)(70586007)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 05:47:23.9207 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 148e770c-6416-4262-b491-08da75dcce43 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT049.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3251 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add gitsource.sh trigger the gitsource testing and monitor the cpu desire performance, frequency, load, power consumption and throughput etc. Signed-off-by: Meng Li --- tools/testing/selftests/amd-pstate/Makefile | 2 +- .../testing/selftests/amd-pstate/gitsource.sh | 345 ++++++++++++++++++ tools/testing/selftests/amd-pstate/run.sh | 26 +- 3 files changed, 367 insertions(+), 6 deletions(-) create mode 100755 tools/testing/selftests/amd-pstate/gitsource.sh diff --git a/tools/testing/selftests/amd-pstate/Makefile b/tools/testing/se= lftests/amd-pstate/Makefile index cac8dedb7226..5f195ee756d6 100644 --- a/tools/testing/selftests/amd-pstate/Makefile +++ b/tools/testing/selftests/amd-pstate/Makefile @@ -13,6 +13,6 @@ TEST_GEN_FILES +=3D ../../../power/x86/intel_pstate_trace= r/intel_pstate_tracer.py endif =20 TEST_PROGS :=3D run.sh -TEST_FILES :=3D basic.sh tbench.sh +TEST_FILES :=3D basic.sh tbench.sh gitsource.sh =20 include ../lib.mk diff --git a/tools/testing/selftests/amd-pstate/gitsource.sh b/tools/testin= g/selftests/amd-pstate/gitsource.sh new file mode 100755 index 000000000000..3d5cd465ad43 --- /dev/null +++ b/tools/testing/selftests/amd-pstate/gitsource.sh @@ -0,0 +1,345 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +# Testing and monitor the cpu frequency and performance when +# this script trigger gitsource test. + +# protect against multiple inclusion +if [ $FILE_GITSOURCE ]; then + return 0 +else + FILE_GITSOURCE=3DDONE +fi + +git_name=3D"git-2.15.1" +git_tar=3D"$git_name.tar.gz" +gitsource_url=3D"https://github.com/git/git/archive/refs/tags/v2.15.1.tar.= gz" +gitsource_governors=3D("ondemand" "schedutil") + +# $1: governor, $2: round, $3: des-perf, $4: freq, $5: load, $6: time $7: = energy, $8: PPW +store_csv_gitsource() +{ + echo "$1, $2, $3, $4, $5, $6, $7, $8" | tee -a $OUTFILE_GIT.csv > /dev/nu= ll 2>&1 +} + +# clear some special lines +clear_csv_gitsource() +{ + if [ -f $OUTFILE_GIT.csv ]; then + sed -i '/Comprison(%)/d' $OUTFILE_GIT.csv + sed -i "/$(scaling_name)/d" $OUTFILE_GIT.csv + fi +} + +# find string $1 in file csv and get the number of lines +get_lines_csv_gitsource() +{ + if [ -f $OUTFILE_GIT.csv ]; then + return `grep -c "$1" $OUTFILE_GIT.csv` + else + return 0 + fi +} + +pre_clear_gitsource() +{ + post_clear_gitsource + rm -rf gitsource_*.png + clear_csv_gitsource +} + +post_clear_gitsource() +{ + rm -rf results/tracer-gitsource* + rm -rf $OUTFILE_GIT*.log + rm -rf $OUTFILE_GIT*.result +} + +install_gitsource() +{ + if [ ! -d $git_name ]; then + printf "Download gitsource, please wait a moment ...\n\n" + wget -O $git_tar $gitsource_url > /dev/null 2>&1 + + printf "Tar gitsource ...\n\n" + tar -xzf $git_tar + fi +} + +# $1: governor, $2: loop +run_gitsource() +{ + echo "Launching amd pstate tracer for $1 #$2 tracer_interval: $TRACER_INT= ERVAL" + ./amd_pstate_trace.py -n tracer-gitsource-$1-$2 -i $TRACER_INTERVAL > /de= v/null 2>&1 & + + printf "Make and test gitsource for $1 #$2 make_cpus: $MAKE_CPUS\n" + cd $git_name + ./../perf stat -a --per-socket -I 1000 -e power/energy-pkg/ /usr/bin/time= -o ../$OUTFILE_GIT.time-gitsource-$1-$2.log make test -j$MAKE_CPUS > ../$O= UTFILE_GIT-perf-$1-$2.log 2>&1 + cd .. + + for job in `jobs -p` + do + echo "Waiting for job id $job" + wait $job + done +} + +# $1: governor, $2: loop +parse_gitsource() +{ + awk '{print $5}' results/tracer-gitsource-$1-$2/cpu.csv | sed -e '1d' | s= ed s/,// > $OUTFILE_GIT-des-perf-$1-$2.log + avg_des_perf=3D$(awk 'BEGIN {i=3D0; sum=3D0};{i++; sum +=3D $1};END {prin= t sum/i}' $OUTFILE_GIT-des-perf-$1-$2.log) + printf "Gitsource-$1-#$2 avg des perf: $avg_des_perf\n" | tee -a $OUTFILE= _GIT.result + + awk '{print $7}' results/tracer-gitsource-$1-$2/cpu.csv | sed -e '1d' | s= ed s/,// > $OUTFILE_GIT-freq-$1-$2.log + avg_freq=3D$(awk 'BEGIN {i=3D0; sum=3D0};{i++; sum +=3D $1};END {print su= m/i}' $OUTFILE_GIT-freq-$1-$2.log) + printf "Gitsource-$1-#$2 avg freq: $avg_freq\n" | tee -a $OUTFILE_GIT.res= ult + + awk '{print $11}' results/tracer-gitsource-$1-$2/cpu.csv | sed -e '1d' | = sed s/,// > $OUTFILE_GIT-load-$1-$2.log + avg_load=3D$(awk 'BEGIN {i=3D0; sum=3D0};{i++; sum +=3D $1};END {print su= m/i}' $OUTFILE_GIT-load-$1-$2.log) + printf "Gitsource-$1-#$2 avg load: $avg_load\n" | tee -a $OUTFILE_GIT.res= ult + + grep user $OUTFILE_GIT.time-gitsource-$1-$2.log | awk '{print $1}' | sed = -e 's/user//' > $OUTFILE_GIT-time-$1-$2.log + time_sum=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum}' $OUTFILE= _GIT-time-$1-$2.log) + printf "Gitsource-$1-#$2 user time(s): $time_sum\n" | tee -a $OUTFILE_GIT= .result + + grep Joules $OUTFILE_GIT-perf-$1-$2.log | awk '{print $4}' > $OUTFILE_GIT= -energy-$1-$2.log + en_sum=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum}' $OUTFILE_G= IT-energy-$1-$2.log) + printf "Gitsource-$1-#$2 power consumption(J): $en_sum\n" | tee -a $OUTFI= LE_GIT.result + + # Permance is the number of run gitsource per second, denoted 1/t, where = 1 is the number of run gitsource in t + # senconds. It is well known that P=3DE/t, where P is power measured in w= atts(W), E is energy measured in joules(J), + # and t is time measured in seconds(s). This means that performance per w= att becomes + # 1/t 1/t 1 + # ----- =3D ----- =3D --- + # P E/t E + # with unit given by 1 per joule. + ppw=3D`echo "scale=3D9;1/$en_sum" | bc | awk '{printf "%.9f", $0}'` + printf "Gitsource-$1-#$2 performance per watt(1/J): $ppw\n" | tee -a $OUT= FILE_GIT.result + printf "\n" | tee -a $OUTFILE_GIT.result + + driver_name=3D`echo $(scaling_name)` + store_csv_gitsource "$driver_name-$1" $2 $avg_des_perf $avg_freq $avg_loa= d $time_sum $en_sum $ppw +} + +# $1: governor +loop_gitsource() +{ + printf "\nGitsource total test times is $LOOP_TIMES for $1\n\n" + for i in `seq 1 $LOOP_TIMES` + do + run_gitsource $1 $i + parse_gitsource $1 $i + done +} + +# $1: governor +gather_gitsource() +{ + printf "Gitsource test result for $1 (loops:$LOOP_TIMES)" | tee -a $OUTFI= LE_GIT.result + printf "\n--------------------------------------------------\n" | tee -a = $OUTFILE_GIT.result + + grep "Gitsource-$1-#" $OUTFILE_GIT.result | grep "avg des perf:" | awk '{= print $NF}' > $OUTFILE_GIT-des-perf-$1.log + avg_des_perf=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum/'$LOOP= _TIMES'}' $OUTFILE_GIT-des-perf-$1.log) + printf "Gitsource-$1 avg des perf: $avg_des_perf\n" | tee -a $OUTFILE_GIT= .result + + grep "Gitsource-$1-#" $OUTFILE_GIT.result | grep "avg freq:" | awk '{prin= t $NF}' > $OUTFILE_GIT-freq-$1.log + avg_freq=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum/'$LOOP_TIM= ES'}' $OUTFILE_GIT-freq-$1.log) + printf "Gitsource-$1 avg freq: $avg_freq\n" | tee -a $OUTFILE_GIT.result + + grep "Gitsource-$1-#" $OUTFILE_GIT.result | grep "avg load:" | awk '{prin= t $NF}' > $OUTFILE_GIT-load-$1.log + avg_load=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum/'$LOOP_TIM= ES'}' $OUTFILE_GIT-load-$1.log) + printf "Gitsource-$1 avg load: $avg_load\n" | tee -a $OUTFILE_GIT.result + + grep "Gitsource-$1-#" $OUTFILE_GIT.result | grep "user time(s):" | awk '{= print $NF}' > $OUTFILE_GIT-time-$1.log + time_sum=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum}' $OUTFILE= _GIT-time-$1.log) + printf "Gitsource-$1 total user time(s): $time_sum\n" | tee -a $OUTFILE_G= IT.result + + avg_time=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum/'$LOOP_TIM= ES'}' $OUTFILE_GIT-time-$1.log) + printf "Gitsource-$1 avg user times(s): $avg_time\n" | tee -a $OUTFILE_GI= T.result + + grep "Gitsource-$1-#" $OUTFILE_GIT.result | grep "power consumption(J):" = | awk '{print $NF}' > $OUTFILE_GIT-energy-$1.log + en_sum=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum}' $OUTFILE_G= IT-energy-$1.log) + printf "Gitsource-$1 total power consumption(J): $en_sum\n" | tee -a $OUT= FILE_GIT.result + + avg_en=3D$(awk 'BEGIN {sum=3D0};{sum +=3D $1};END {print sum/'$LOOP_TIMES= '}' $OUTFILE_GIT-energy-$1.log) + printf "Gitsource-$1 avg power consumption(J): $avg_en\n" | tee -a $OUTFI= LE_GIT.result + + # Permance is the number of run gitsource per second, denoted 1/t, where = 1 is the number of run gitsource in t + # senconds. It is well known that P=3DE/t, where P is power measured in w= atts(W), E is energy measured in joules(J), + # and t is time measured in seconds(s). This means that performance per w= att becomes + # 1/t 1/t 1 + # ----- =3D ----- =3D --- + # P E/t E + # with unit given by 1 per joule. + ppw=3D`echo "scale=3D9;1/$avg_en" | bc | awk '{printf "%.9f", $0}'` + printf "Gitsource-$1 performance per watt(1/J): $ppw\n" | tee -a $OUTFILE= _GIT.result + printf "\n" | tee -a $OUTFILE_GIT.result + + driver_name=3D`echo $(scaling_name)` + store_csv_gitsource "$driver_name-$1" "Average" $avg_des_perf $avg_freq $= avg_load $avg_time $avg_en $ppw +} + +# $1: base scaling_driver $2: base governor $3: comparison scaling_driver = $4: comparison governor +__calc_comp_gitsource() +{ + base=3D`grep "$1-$2" $OUTFILE_GIT.csv | grep "Average"` + comp=3D`grep "$3-$4" $OUTFILE_GIT.csv | grep "Average"` + + if [ -n "$base" -a -n "$comp" ]; then + printf "\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D\n" | tee -a $OUTFILE_GIT.result + printf "Gitsource comparison $1-$2 VS $3-$4" | tee -a $OUTFILE_GIT.result + printf "\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D\n" | tee -a $OUTFILE_GIT.result + + # get the base values + des_perf_base=3D`echo "$base" | awk '{print $3}' | sed s/,//` + freq_base=3D`echo "$base" | awk '{print $4}' | sed s/,//` + load_base=3D`echo "$base" | awk '{print $5}' | sed s/,//` + time_base=3D`echo "$base" | awk '{print $6}' | sed s/,//` + energy_base=3D`echo "$base" | awk '{print $7}' | sed s/,//` + ppw_base=3D`echo "$base" | awk '{print $8}' | sed s/,//` + + # get the comparison values + des_perf_comp=3D`echo "$comp" | awk '{print $3}' | sed s/,//` + freq_comp=3D`echo "$comp" | awk '{print $4}' | sed s/,//` + load_comp=3D`echo "$comp" | awk '{print $5}' | sed s/,//` + time_comp=3D`echo "$comp" | awk '{print $6}' | sed s/,//` + energy_comp=3D`echo "$comp" | awk '{print $7}' | sed s/,//` + ppw_comp=3D`echo "$comp" | awk '{print $8}' | sed s/,//` + + # compare the base and comp values + des_perf_drop=3D`echo "scale=3D4;($des_perf_comp-$des_perf_base)*100/$de= s_perf_base" | bc | awk '{printf "%.4f", $0}'` + printf "Gitsource-$1 des perf base: $des_perf_base comprison: $des_perf_= comp percent: $des_perf_drop\n" | tee -a $OUTFILE_GIT.result + + freq_drop=3D`echo "scale=3D4;($freq_comp-$freq_base)*100/$freq_base" | b= c | awk '{printf "%.4f", $0}'` + printf "Gitsource-$1 freq base: $freq_base comprison: $freq_comp percent= : $freq_drop\n" | tee -a $OUTFILE_GIT.result + + load_drop=3D`echo "scale=3D4;($load_comp-$load_base)*100/$load_base" | b= c | awk '{printf "%.4f", $0}'` + printf "Gitsource-$1 load base: $load_base comprison: $load_comp percent= : $load_drop\n" | tee -a $OUTFILE_GIT.result + + time_drop=3D`echo "scale=3D4;($time_comp-$time_base)*100/$time_base" | b= c | awk '{printf "%.4f", $0}'` + printf "Gitsource-$1 perf base: $time_base comprison: $time_comp percent= : $time_drop\n" | tee -a $OUTFILE_GIT.result + + energy_drop=3D`echo "scale=3D4;($energy_comp-$energy_base)*100/$energy_b= ase" | bc | awk '{printf "%.4f", $0}'` + printf "Gitsource-$1 energy base: $energy_base comprison: $energy_comp p= ercent: $energy_drop\n" | tee -a $OUTFILE_GIT.result + + ppw_drop=3D`echo "scale=3D4;($ppw_comp-$ppw_base)*100/$ppw_base" | bc | = awk '{printf "%.4f", $0}'` + printf "Gitsource-$1 performance per watt base: $ppw_base comprison: $pp= w_comp percent: $ppw_drop\n" | tee -a $OUTFILE_GIT.result + printf "\n" | tee -a $OUTFILE_GIT.result + + store_csv_gitsource "$1-$2 VS $3-$4" "Comprison(%)" "$des_perf_drop" "$f= req_drop" "$load_drop" "$time_drop" "$energy_drop" "$ppw_drop" + fi +} + +# calculate the comparison(%) +calc_comp_gitsource() +{ + # acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil + __calc_comp_gitsource ${all_scaling_names[0]} ${gitsource_governors[0]} $= {all_scaling_names[0]} ${gitsource_governors[1]} + + # amd-pstate-ondemand VS amd-pstate-schedutil + __calc_comp_gitsource ${all_scaling_names[1]} ${gitsource_governors[0]} $= {all_scaling_names[1]} ${gitsource_governors[1]} + + # acpi-cpufreq-ondemand VS amd-pstate-ondemand + __calc_comp_gitsource ${all_scaling_names[0]} ${gitsource_governors[0]} $= {all_scaling_names[1]} ${gitsource_governors[0]} + + # acpi-cpufreq-schedutil VS amd-pstate-schedutil + __calc_comp_gitsource ${all_scaling_names[0]} ${gitsource_governors[1]} $= {all_scaling_names[1]} ${gitsource_governors[1]} +} + +# $1: file_name, $2: title, $3: ylable, $4: column +plot_png_gitsource() +{ + # all_scaling_names[1] all_scaling_names[0] flag + # amd-pstate acpi-cpufreq + # N N 0 + # N Y 1 + # Y N 2 + # Y Y 3 + ret=3D`grep -c "${all_scaling_names[1]}" $OUTFILE_GIT.csv` + if [ $ret -eq 0 ]; then + ret=3D`grep -c "${all_scaling_names[0]}" $OUTFILE_GIT.csv` + if [ $ret -eq 0 ]; then + flag=3D0 + else + flag=3D1 + fi + else + ret=3D`grep -c "${all_scaling_names[0]}" $OUTFILE_GIT.csv` + if [ $ret -eq 0 ]; then + flag=3D2 + else + flag=3D3 + fi + fi + + gnuplot << EOF + set term png + set output "$1" + + set title "$2" + set xlabel "Test Cycles (round)" + set ylabel "$3" + + set grid + set style data histogram + set style fill solid 0.5 border + set boxwidth 0.8 + + if ($flag =3D=3D 1) { + plot \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${gitsource_governor= s[0]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[0]}= -${gitsource_governors[0]}", \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${gitsource_governor= s[1]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[0]}= -${gitsource_governors[1]}" + } else { + if ($flag =3D=3D 2) { + plot \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${gitsource_governo= rs[0]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[1]= }-${gitsource_governors[0]}", \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${gitsource_governo= rs[1]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[1]= }-${gitsource_governors[1]}" + } else { + if ($flag =3D=3D 3 ) { + plot \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${gitsource_govern= ors[0]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[0= ]}-${gitsource_governors[0]}", \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${gitsource_govern= ors[1]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[0= ]}-${gitsource_governors[1]}", \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${gitsource_govern= ors[0]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[1= ]}-${gitsource_governors[0]}", \ + "<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${gitsource_govern= ors[1]}/p' $OUTFILE_GIT.csv)" using $4:xtic(2) title "${all_scaling_names[1= ]}-${gitsource_governors[1]}" + } + } + } + quit +EOF +} + +amd_pstate_gitsource() +{ + printf "\n---------------------------------------------\n" + printf "*** Running gitsource ***" + printf "\n---------------------------------------------\n" + + pre_clear_gitsource + + install_gitsource + + get_lines_csv_gitsource "Governor" + if [ $? -eq 0 ]; then + # add titles and unit for csv file + store_csv_gitsource "Governor" "Round" "Des-perf" "Freq" "Load" "Time" "= Energy" "Performance Per Watt" + store_csv_gitsource "Unit" "" "" "GHz" "" "s" "J" "1/J" + fi + + for_each_policy backup_governor + for governor in ${gitsource_governors[*]} ; do + printf "\nSpecified governor is $governor\n\n" + for_each_policy switch_governor $governor + loop_gitsource $governor + gather_gitsource $governor + done + restore_governor + + plot_png_gitsource "gitsouce_time.png" "Gitsource Benchmark Time" "Time (= s)" 6 + plot_png_gitsource "gitsource_energy.png" "Gitsource Benchmark Energy" "E= nergy (J)" 7 + plot_png_gitsource "gitsource_ppw.png" "Gitsource Benchmark Performance P= er Watt" "Performance Per Watt (1/J)" 8 + + calc_comp_gitsource + + post_clear_gitsource +} diff --git a/tools/testing/selftests/amd-pstate/run.sh b/tools/testing/self= tests/amd-pstate/run.sh index aa264e96a6e6..ccfceee8b13f 100755 --- a/tools/testing/selftests/amd-pstate/run.sh +++ b/tools/testing/selftests/amd-pstate/run.sh @@ -10,6 +10,7 @@ fi =20 source basic.sh source tbench.sh +source gitsource.sh =20 # amd-pstate-ut only run on x86/x86_64 AMD systems. ARCH=3D$(uname -m 2>/dev/null | sed -e 's/i.86/x86/' -e 's/x86_64/x86/') @@ -18,6 +19,7 @@ VENDOR=3D$(cat /proc/cpuinfo | grep -m 1 'vendor_id' | aw= k '{print $NF}') FUNC=3Dall OUTFILE=3Dselftest OUTFILE_TBENCH=3D"$OUTFILE.tbench" +OUTFILE_GIT=3D"$OUTFILE.gitsource" =20 SYSFS=3D CPUROOT=3D @@ -139,6 +141,9 @@ amd_pstate_all() =20 # tbench amd_pstate_tbench + + # gitsource + amd_pstate_gitsource } =20 helpme() @@ -148,7 +153,8 @@ helpme() [-o ] [-c ] + tbench: Tbench testing, + gitsource: Gitsource testing.>] [-t ] [-p ] [-l ] @@ -167,7 +173,7 @@ parse_arguments() helpme ;; =20 - c) # --func_type (Function to perform: basic, tbench (default: all)) + c) # --func_type (Function to perform: basic, tbench, gitsource (defaul= t: all)) FUNC=3D$OPTARG ;; =20 @@ -183,7 +189,7 @@ parse_arguments() PROCESS_NUM=3D$OPTARG ;; =20 - l) # --tbench-loop-times + l) # --tbench/gitsource-loop-times LOOP_TIMES=3D$OPTARG ;; =20 @@ -224,9 +230,9 @@ prerequisite() fi else case "$FUNC" in - "tbench") + "tbench" | "gitsource") if [ "$scaling_driver" !=3D "$COMPARATIVE_TEST" ]; then - echo "$0 # Skipped: Comparison test can only run on $COMPARATIVE_TEST= driver." + echo "$0 # Skipped: Comparison test can only run on $COMPARISON_TEST = driver." echo "$0 # Current cpufreq scaling drvier is $scaling_driver." exit $ksft_skip fi @@ -296,6 +302,10 @@ do_test() amd_pstate_tbench ;; =20 + "gitsource") + amd_pstate_gitsource + ;; + *) echo "Invalid [-f] function type" helpme @@ -319,6 +329,12 @@ pre_clear_dumps() rm -rf tbench_*.png ;; =20 + "gitsource") + rm -rf $OUTFILE.log + rm -rf $OUTFILE.backup_governor.log + rm -rf gitsource_*.png + ;; + *) ;; esac --=20 2.25.1 From nobody Sat Apr 11 22:46:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCA81C19F2D for ; Thu, 4 Aug 2022 05:49:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239036AbiHDFtJ (ORCPT ); Thu, 4 Aug 2022 01:49:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237990AbiHDFst (ORCPT ); Thu, 4 Aug 2022 01:48:49 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2074.outbound.protection.outlook.com [40.107.100.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD1B46113C; Wed, 3 Aug 2022 22:48:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VrVvXD1uIZP527OL43VhfMQvp/5Y5tR5sQJdHhu0m4twNY9Vm+iyYtkMHp3a033hyIMCrrnSHbjXUNpgJMoqanrKe+wx//qGqb1ytaA+LZO7tYp8L13r/npPjGDH6gm/YozNXyRyXrkCG4d9nKht5Y8IFuwASkFl4HaJNmwbX9IgdynsjRbWlVp3nO2BlNOiRTgh+VGibEFnUGT+/qjJ6xdaM3wIRuOwH6ApPxjrCyzA/hRjikZWfgv6bYDSFNzLxllI/toUUAhh1Qci6IapmCFkXcHjoZu9UGCCgZWn9WExqiWafkA+9cw1u07C4PBBrvNvtnTchO6vLK3wSztL5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eOwDG3uMPqEDhPtNZjCsq+JGp9RdhQ3GIbRUGU8ALjU=; b=SB1h2T6zKIpHAxIWPvphEcD/91+0FhmL5mxCUpPhlyyogpYKGK/IuJ+MKCUQ7sa0HpeR1VCP5GMlyopkSIfsqTZ0R7E8B7V+Ux26ifhPYkqDnLP5zTXWsF+0bJHDZVBhkm4gNFIQPAzhbCo7UB5TZ2uMzRVfwY+Do0JcZGQgUl1Jv9sXokB6tOMoc8CbtpSQTk5dKm7Jpb3FsslGz2RrRIdnx1J+hWzvmQqzVU2hJYDIvmhwtdftSu8IKqzCwKGYnpGbmrZvYya1c6UshNhokWK9Sn4a69wbPPLvyyyQ7s6UBFI4IcQM1mEjUEO4rsHiN+cc/qLOsfLogyQ1Np0dwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eOwDG3uMPqEDhPtNZjCsq+JGp9RdhQ3GIbRUGU8ALjU=; b=raCr3CvnecZZjsVKjQlY4cWjYu2ty4jnnmflRod0/v2E4B+UAuVCj3iAzQFzPTldffe8njOSX4gagspsJTIYZy8BqdrzXPX8Bg6eB9zCZJdkn1D27RExprxNLyiC8naOgW8jb7U1XL9iY7f8QKp6xczX8O58AOPIbrxSaXPHU00= Received: from DS7PR03CA0307.namprd03.prod.outlook.com (2603:10b6:8:2b::13) by DM6PR12MB3835.namprd12.prod.outlook.com (2603:10b6:5:1c7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Thu, 4 Aug 2022 05:47:56 +0000 Received: from DM6NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2b:cafe::ab) by DS7PR03CA0307.outlook.office365.com (2603:10b6:8:2b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.12 via Frontend Transport; Thu, 4 Aug 2022 05:47:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT051.mail.protection.outlook.com (10.13.172.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5504.14 via Frontend Transport; Thu, 4 Aug 2022 05:47:55 +0000 Received: from jasmine-meng.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 4 Aug 2022 00:47:23 -0500 From: Meng Li To: Shuah Khan , Huang Rui , CC: "Rafael J . Wysocki" , Nathan Fontenot , Deepak Sharma , "Alex Deucher" , Mario Limonciello , Jinzhou Su , Perry Yuan , Xiaojian Du , Viresh Kumar , Borislav Petkov , , Meng Li Subject: [PATCH V2 4/4] Documentation: amd-pstate: Add tbench and gitsource test introduction Date: Thu, 4 Aug 2022 13:44:14 +0800 Message-ID: <20220804054414.1510764-5-li.meng@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220804054414.1510764-1-li.meng@amd.com> References: <20220804054414.1510764-1-li.meng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 285e8960-20f4-4a4e-c115-08da75dce14e X-MS-TrafficTypeDiagnostic: DM6PR12MB3835:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ly0TaUJN6TBSL41dTeQcl8SLr51j4/G4sHrMYVbkYWlzGw2MZtUuPbEU+625XIeftCntqXDMOPYRMQvlZov7ApYFz4eciDdVx1IgDSS6T2Zm/0gi3uuKjxxATv9q4Dlf647b2OMLq8atAAF14+EwyFhmbUSvHzScVAOVMzZXWS6i8uGS5Wavjj3yWPyyLpIYYZJ4Ni0dmVL/mThZqpX0a9YnkTKgxhs0wsXSOnaQrozzXzzxCU1tf9HYd9wDmZkVDLRIzDiiWyLgF2xKIIqZfQMmHvfj7AnAYR/F4nN3SO2EfPGL6Q31b/cx6deS6tyGfdmqSzYlgg0yTUzzJTBIzGR8O5/L6L7aWksKBrkISw16782PH3QA0PqMLmCg6HGoUI/KwYX8zatQLIZb4SX7JFuavHUwYuglFt6tFzYME30694OERBtfjctacYbZ7MpPmdrWNcTs0l0sQjs9nwWPlAGzaOKjRmyUsNtj7AURa6AqdsSU0OyamUz1oJlweW8VSEA4Z1Iix8sUFpmsPMZp3v4jXr9IWKwxn2ZEg/TJvzRoZxRxh01pS5JVxGRf+Jgyy8+whbdmiEyMg9t2sGB1Ykd7AmCXyblopVhs/7N23HvwAvd/qfivpOOTQ5sP9/X4QkPPNrcGu14oCfmRAoLfs+eib0ZFIsezt/8gfsQx/dZEZbalAcKFuLBy5byNG8pVkBLlBiMj2VK2+VPEDqtw+cQiavaMxTczgzQ8jEWsq3CJncRpSJ7kOmle1FqQWvyUQhkGGNh0mv7fNbvOTEtlt6E81QgHO4ntPET2NLblWZXggqTpQI7jzUFydTnlqjons/1YZH/keW2U/pOX+t+gJQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230016)(4636009)(396003)(39860400002)(346002)(136003)(376002)(40470700004)(46966006)(36840700001)(478600001)(6666004)(41300700001)(7696005)(26005)(82310400005)(40480700001)(5660300002)(2906002)(30864003)(86362001)(36756003)(110136005)(54906003)(316002)(356005)(81166007)(1076003)(186003)(16526019)(336012)(426003)(47076005)(2616005)(82740400003)(8936002)(70206006)(70586007)(4326008)(8676002)(83380400001)(40460700003)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 05:47:55.8542 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 285e8960-20f4-4a4e-c115-08da75dce14e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3835 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Introduce tbench and gitsource test cases design and implementation. Monitor cpus changes about performance and power consumption etc. Signed-off-by: Meng Li --- Documentation/admin-guide/pm/amd-pstate.rst | 192 ++++++++++++++++++-- 1 file changed, 173 insertions(+), 19 deletions(-) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/ad= min-guide/pm/amd-pstate.rst index 8f3d30c5a0d8..3716f08beeb8 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -409,37 +409,55 @@ Unit Tests for amd-pstate =20 1. Test case decriptions =20 + 1). basic tests + + Test prerequisite and basic functions for the ``amd-pstate`` drive= r. + +---------+--------------------------------+----------------------= --------------------------------------------------------------+ | Index | Functions | Description = | +=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D+ - | 0 | amd_pstate_ut_acpi_cpc_valid || Check whether the _C= PC object is present in SBIOS. | + | 1 | amd_pstate_ut_acpi_cpc_valid || Check whether the _C= PC object is present in SBIOS. | | | || = | | | || The detail refer to = `Processor Support `_. | +---------+--------------------------------+----------------------= --------------------------------------------------------------+ - | 1 | amd_pstate_ut_check_enabled || Check whether AMD P-= State is enabled. | + | 2 | amd_pstate_ut_check_enabled || Check whether AMD P-= State is enabled. | | | || = | | | || AMD P-States and ACP= I hardware P-States always can be supported in one processor. | | | | But AMD P-States has = the higher priority and if it is enabled with | | | | :c:macro:`MSR_AMD_CPP= C_ENABLE` or ``cppc_set_enable``, it will respond to the | | | | request from AMD P-St= ates. | +---------+--------------------------------+----------------------= --------------------------------------------------------------+ - | 2 | amd_pstate_ut_check_perf || Check if the each pe= rformance values are reasonable. | + | 3 | amd_pstate_ut_check_perf || Check if the each pe= rformance values are reasonable. | | | || highest_perf >=3D no= minal_perf > lowest_nonlinear_perf > lowest_perf > 0. | +---------+--------------------------------+----------------------= --------------------------------------------------------------+ - | 3 | amd_pstate_ut_check_freq || Check if the each fr= equency values and max freq when set support boost mode | + | 4 | amd_pstate_ut_check_freq || Check if the each fr= equency values and max freq when set support boost mode | | | | are reasonable. = | | | || max_freq >=3D nomina= l_freq > lowest_nonlinear_freq > min_freq > 0 | | | || If boost is not acti= ve but supported, this maximum frequency will be larger than | | | | the one in ``cpuinfo`= `. | +---------+--------------------------------+----------------------= --------------------------------------------------------------+ =20 + 2). Tbench test + + Test and monitor the cpu changes when running tbench benchmark und= er the specified governor. + These changes include desire performance, frequency, load, perform= ance, energy etc. + The specified governor is ondemand or schedutil. + Tbench can also be tested on the acpi-cpufreq kernel driver for co= mparison. + + 3). Gitsource test + + Test and monitor the cpu changes when running gitsource benchmark = under the specified governor. + These changes include desire performance, frequency, load, time, e= nergy etc. + The specified governor is ondemand or schedutil. + Gitsource can also be tested on the acpi-cpufreq kernel driver for= comparison. + #. How to execute the tests =20 We use test module in the kselftest frameworks to implement it. We create amd-pstate-ut module and tie it into kselftest.(for details refer to Linux Kernel Selftests [4]_). =20 - 1. Build + 1). Build =20 + open the :c:macro:`CONFIG_X86_AMD_PSTATE` configuration option. + set the :c:macro:`CONFIG_X86_AMD_PSTATE_UT` configuration option= to M. @@ -449,23 +467,159 @@ Unit Tests for amd-pstate $ cd linux $ make -C tools/testing/selftests =20 - #. Installation & Steps :: + + make perf :: + + $ cd tools/perf/ + $ make + + + 2). Installation & Steps :: =20 $ make -C tools/testing/selftests install INSTALL_PATH=3D~/kselfte= st + $ cp tools/perf/perf ~/kselftest/amd-pstate/ $ sudo ./kselftest/run_kselftest.sh -c amd-pstate - TAP version 13 - 1..1 - # selftests: amd-pstate: amd-pstate-ut.sh - # amd-pstate-ut: ok - ok 1 selftests: amd-pstate: amd-pstate-ut.sh - - #. Results :: - - $ dmesg | grep "amd_pstate_ut" | tee log.txt - [12977.570663] amd_pstate_ut: 1 amd_pstate_ut_acpi_cpc_valid = success! - [12977.570673] amd_pstate_ut: 2 amd_pstate_ut_check_enabled = success! - [12977.571207] amd_pstate_ut: 3 amd_pstate_ut_check_perf = success! - [12977.571212] amd_pstate_ut: 4 amd_pstate_ut_check_freq = success! + + 3). Specified test case :: + + $ cd ~/kselftest/amd-pstate + $ sudo ./run.sh -t basic + $ sudo ./run.sh -t tbench + $ sudo ./run.sh -t tbench -m acpi-cpufreq + $ sudo ./run.sh -t gitsource + $ sudo ./run.sh -t gitsource -m acpi-cpufreq + $ ./run.sh --help + ./run.sh: illegal option -- - + Usage: ./run.sh [OPTION...] + [-h ] + [-o ] + [-c ] + [-t ] + [-p ] + [-l ] + [-i ] + [-m ] + + + 4). Results + + + basic + + When you finish test, you will get the following log info :: + + $ dmesg | grep "amd_pstate_ut" | tee log.txt + [12977.570663] amd_pstate_ut: 1 amd_pstate_ut_acpi_cpc_valid = success! + [12977.570673] amd_pstate_ut: 2 amd_pstate_ut_check_enabled = success! + [12977.571207] amd_pstate_ut: 3 amd_pstate_ut_check_perf = success! + [12977.571212] amd_pstate_ut: 4 amd_pstate_ut_check_freq = success! + + + tbench + + When you finish test, you will get selftest.tbench.csv and png im= ages. + The selftest.tbench.csv file contains the raw data and the drop o= f the comparative test. + The png images shows the performance, energy and performan per wa= tt of each test. + Open selftest.tbench.csv : + + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + Governor | Round = | Des-perf | Freq | Load | Performance | Energy | Performance Per W= att | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + Unit | = | | GHz | | MB/s | J | MB/J = | + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ + + amd-pstate-ondemand | 1 = | | | | 2504.05 | 1563.67 | 158.5378 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + amd-pstate-ondemand | 2 = | | | | 2243.64 | 1430.32 | 155.2941 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + amd-pstate-ondemand | 3 = | | | | 2183.88 | 1401.32 | 154.2860 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + amd-pstate-ondemand | Average = | | | | 2310.52 | 1465.1 | 156.1268 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + amd-pstate-schedutil | 1 = | 165.329 | 1.62257 | 99.798 | 2136.54 | 1395.26 | 151.5971 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + amd-pstate-schedutil | 2 = | 166 | 1.49761 | 99.9993 | 2100.56 | 1380.5 | 150.6377 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + amd-pstate-schedutil | 3 = | 166 | 1.47806 | 99.9993 | 2084.12 | 1375.76 | 149.9737 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + amd-pstate-schedutil | Average = | 165.776 | 1.53275 | 99.9322 | 2107.07 | 1383.84 | 150.7399 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + acpi-cpufreq-ondemand | 1 = | | | | 2529.9 | 1564.4 | 160.0997 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + acpi-cpufreq-ondemand | 2 = | | | | 2249.76 | 1432.97 | 155.4297 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + acpi-cpufreq-ondemand | 3 = | | | | 2181.46 | 1406.88 | 153.5060 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + acpi-cpufreq-ondemand | Average = | | | | 2320.37 | 1468.08 | 156.4741 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + acpi-cpufreq-schedutil | 1 = | | | | 2137.64 | 1385.24 | 152.7723 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + acpi-cpufreq-schedutil | 2 = | | | | 2107.05 | 1372.23 | 152.0138 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + acpi-cpufreq-schedutil | 3 = | | | | 2085.86 | 1365.35 | 151.2433 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + acpi-cpufreq-schedutil | Average = | | | | 2110.18 | 1374.27 | 152.0136 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) = | | | | -9.0584 | -6.3899 | -2.8506 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + amd-pstate-ondemand VS amd-pstate-schedutil | Comprison(%) = | | | | 8.8053 | -5.5463 | -3.4503 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + acpi-cpufreq-ondemand VS amd-pstate-ondemand | Comprison(%) = | | | | -0.4245 | -0.2029 | -0.2219 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + acpi-cpufreq-schedutil VS amd-pstate-schedutil | Comprison(%) = | | | | -0.1473 | 0.6963 | -0.8378 = | + +-------------------------------------------------+--------------= +----------+---------+----------+-------------+---------+------------------= ----+ + + + gitsource + + When you finish test, you will get selftest.gitsource.csv and png= images. + The selftest.gitsource.csv file contains the raw data and the dro= p of the comparative test. + The png images shows the performance, energy and performan per wa= tt of each test. + Open selftest.gitsource.csv : + + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + Governor | Round = | Des-perf | Freq | Load | Time | Energy | Performance Per = Watt | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + Unit | = | | GHz | | s | J | 1/J = | + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ + + amd-pstate-ondemand | 1 = | 50.119 | 2.10509 | 23.3076 | 475.69 | 865.78 | 0.001155027 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + amd-pstate-ondemand | 2 = | 94.8006 | 1.98771 | 56.6533 | 467.1 | 839.67 | 0.001190944 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + amd-pstate-ondemand | 3 = | 76.6091 | 2.53251 | 43.7791 | 467.69 | 855.85 | 0.001168429 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + amd-pstate-ondemand | Average = | 73.8429 | 2.20844 | 41.2467 | 470.16 | 853.767 | 0.001171279 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + amd-pstate-schedutil | 1 = | 165.919 | 1.62319 | 98.3868 | 464.17 | 866.8 | 0.001153668 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + amd-pstate-schedutil | 2 = | 165.97 | 1.31309 | 99.5712 | 480.15 | 880.4 | 0.001135847 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + amd-pstate-schedutil | 3 = | 165.973 | 1.28448 | 99.9252 | 481.79 | 867.02 | 0.001153375 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + amd-pstate-schedutil | Average = | 165.954 | 1.40692 | 99.2944 | 475.37 | 871.407 | 0.001147569 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + acpi-cpufreq-ondemand | 1 = | | | | 2379.62 | 742.96 | 0.001345967 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + acpi-cpufreq-ondemand | 2 = | | | | 441.74 | 817.49 | 0.001223256 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + acpi-cpufreq-ondemand | 3 = | | | | 455.48 | 820.01 | 0.001219497 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + acpi-cpufreq-ondemand | Average = | | | | 425.613 | 793.487 | 0.001260260 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + acpi-cpufreq-schedutil | 1 = | | | | 459.69 | 838.54 | 0.001192548 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + acpi-cpufreq-schedutil | 2 = | | | | 466.55 | 830.89 | 0.001203528 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + acpi-cpufreq-schedutil | 3 = | | | | 470.38 | 837.32 | 0.001194286 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + acpi-cpufreq-schedutil | Average = | | | | 465.54 | 835.583 | 0.001196769 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) = | | | | 9.3810 | 5.3051 | -5.0379 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + amd-pstate-ondemand VS amd-pstate-schedutil | Comprison(%) = | 124.7392 | -36.2934 | 140.7329 | 1.1081 | 2.0661 | -2.0242 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + acpi-cpufreq-ondemand VS amd-pstate-ondemand | Comprison(%) = | | | | 10.4665 | 7.5968 | -7.0605 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ + + acpi-cpufreq-schedutil VS amd-pstate-schedutil | Comprison(%) = | | | | 2.1115 | 4.2873 | -4.1110 = | + +-------------------------------------------------+--------------= +----------+----------+----------+-------------+---------+-----------------= -----+ =20 Reference =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --=20 2.25.1