From patchwork Tue Apr 10 22:11:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_D=C3=ADaz?= X-Patchwork-Id: 133119 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp30435ljb; Tue, 10 Apr 2018 15:12:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx49ljinAjCWASLBEMKqREH9Z8jncfBaAHHd4yOMEq0a2ik50etv7jGeATW9+7OrLhmtpwb0h X-Received: by 2002:a17:902:d03:: with SMTP id 3-v6mr2227502plu.245.1523398320509; Tue, 10 Apr 2018 15:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523398320; cv=none; d=google.com; s=arc-20160816; b=DG35rTH7n/qw3y8diyBgR7u5Xk75I6z7BLWnRY1g0a+P4zG9dESpLomSut/HzJdGY+ C6y4240Bo2ccL3xxBPWrwRi3Yk6qP6UZW6zF49epNHvENLTEtcQLGs2yrDi7p5hCiZWV T48EjGGmnuWvhCLMD6TXaA4BUdRGrx9iIAeDRZaDyW3o22h3jLiSoF9XOxQzqqlQu62Z kdtm3I5QOTYIlhfv6mF+Mnaf5HOxxId9p5eCFTZaEcleVJ/+e97n22ku6bf7C2j0DxDI +xpQBAK/wicztWTtfAcxEVR/0IAiF7trXLLt+4M4wpjqUqbe0P1HCd+jnyD+PMQC3Um1 mMJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=FzYdj1ir5hsaCB5SEkneo6//D13q3KA/6xRS5O7atq0=; b=Ih2zCXGiaLbpTb36GepU3Q4+V0z9U5MuNOMBYqAs55p0Kp/kFHNkj9IzcVjA1t4HKU 2ZFH63dAO4NzAbhn93cGqcfnbwcDnA9u0CsLUTHeK2L0BZ0D6YvBN4OgCx87Dkg6TEQd FpDT1aTe5oqys17yBZGkAVpSPULkK4Ccmp47FehkD5P74yoTJ3WWAlMS9XOUFBxPkRfM JFHplHvyO4Bbe1MH6VmTjuoYoZ3Twa2g57T9esGaSoO9QYcBwJGvdba+Z5TcDSGx8boy 9TU4OVxwIdD576C6ksHau9uoFNrUPqIr96+cbMEDqSIDgVhVJERGeoy3MSUtN3mpqGqI W7OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U3HQ513B; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z131si2460496pgz.184.2018.04.10.15.12.00; Tue, 10 Apr 2018 15:12:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U3HQ513B; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752184AbeDJWLz (ORCPT + 29 others); Tue, 10 Apr 2018 18:11:55 -0400 Received: from mail-ot0-f195.google.com ([74.125.82.195]:32851 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751882AbeDJWLy (ORCPT ); Tue, 10 Apr 2018 18:11:54 -0400 Received: by mail-ot0-f195.google.com with SMTP id 23-v6so14569501otj.0 for ; Tue, 10 Apr 2018 15:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FzYdj1ir5hsaCB5SEkneo6//D13q3KA/6xRS5O7atq0=; b=U3HQ513BjvAKmgPSYn0CBb2Qnq7ugBFVnT9/EalenXFNiMobQySKozmi9YKN2giY9w Fw+F1UT8DoHb1j1m948dUrT3s/LZqtYQBUzjfNFepPJzWB1KlifmJ+0NcjzB2wHV519W xZC9KBmzBY7qhwf5pDZozyOoljDDNx5C2P1hw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FzYdj1ir5hsaCB5SEkneo6//D13q3KA/6xRS5O7atq0=; b=ctMudB5xKOdxCvi3k5Xfxzjcj0Asv1ECWGGdO2M0Erhqvr+m0Jt95TNK9tIM2El6hL UqGfun+3FxcLacsKpffhcx9JIennensL/+Jtfc0BIPvSPDX9zlJt/NBmpHVWIvK3d3Ah pB28bqPxhWyHv1to5v7drc0DnhHwE0weguJESQBh3hSPtRuLTGN3uG+e1Ck/N1oYgRcy JDDDS/t/3/hqZ5Y2zWJGbiZBeAcv0dJtvToO5Up2tyWlowKIHjt1DEeo23YXtSTiJM/n CAvcFz0c5e1yTUk1z1xxczOLodAMwqNvIM4dtinw60XMA9DFm/6Odt3jZjEUbMkqGs4J dW8Q== X-Gm-Message-State: ALQs6tBno2lnTGTSYn2ITYqwzfkqNKSws9NGOiR+8+JUU/klgXDv4liI Vai/F3cIsV8tJreSa8db4D6zdQ== X-Received: by 2002:a9d:f28:: with SMTP id 37-v6mr1487146ott.0.1523398313495; Tue, 10 Apr 2018 15:11:53 -0700 (PDT) Received: from aura.cortijodelrio.net (CableLink-187-161-190-249.PCs.InterCable.net. [187.161.190.249]) by smtp.googlemail.com with ESMTPSA id 15-v6sm2199552ois.30.2018.04.10.15.11.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 15:11:52 -0700 (PDT) From: =?utf-8?q?Daniel_D=C3=ADaz?= To: shuahkh@osg.samsung.com, linux-kselftest@vger.kernel.org Cc: =?utf-8?q?Daniel_D=C3=ADaz?= , Shuah Khan , Kate Stewart , Thomas Gleixner , Philippe Ombredanne , Thomas Meyer , Greg Kroah-Hartman , linux-kernel@vger.kernel.org (open list) Subject: [PATCH] selftests/intel_pstate: Improve test, minor fixes Date: Tue, 10 Apr 2018 17:11:15 -0500 Message-Id: <1523398277-2066-1-git-send-email-daniel.diaz@linaro.org> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A few changes improve the overall usability of the test: * fix a hard-coded maximum frequency (3300), * don't adjust the CPU frequency if only evaluating results, * fix a comparison for multiple frequencies. A symptom of that last issue looked like this: ./run.sh: line 107: [: too many arguments ./run.sh: line 110: 3099 3099 3100-3100: syntax error in expression (error token is \"3099 3100-3100\") Because a check will count how many differente frequencies there are among the CPUs of the system, and after they are tallied another read is performed, which might produce different results. Signed-off-by: Daniel Díaz --- tools/testing/selftests/intel_pstate/run.sh | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) -- 2.7.4 diff --git a/tools/testing/selftests/intel_pstate/run.sh b/tools/testing/selftests/intel_pstate/run.sh index c670359..bde31a0 100755 --- a/tools/testing/selftests/intel_pstate/run.sh +++ b/tools/testing/selftests/intel_pstate/run.sh @@ -48,11 +48,12 @@ function run_test () { echo "sleeping for 5 seconds" sleep 5 - num_freqs=$(cat /proc/cpuinfo | grep MHz | sort -u | wc -l) - if [ $num_freqs -le 2 ]; then - cat /proc/cpuinfo | grep MHz | sort -u | tail -1 > /tmp/result.$1 + grep MHz /proc/cpuinfo | sort -u > /tmp/result.freqs + num_freqs=$(wc -l /tmp/result.freqs | awk ' { print $1 } ') + if [ $num_freqs -ge 2 ]; then + tail -n 1 /tmp/result.freqs > /tmp/result.$1 else - cat /proc/cpuinfo | grep MHz | sort -u > /tmp/result.$1 + cp /tmp/result.freqs /tmp/result.$1 fi ./msr 0 >> /tmp/result.$1 @@ -82,21 +83,20 @@ _max_freq=$(cpupower frequency-info -l | tail -1 | awk ' { print $2 } ') max_freq=$(($_max_freq / 1000)) -for freq in `seq $max_freq -100 $min_freq` +[ $EVALUATE_ONLY -eq 0 ] && for freq in `seq $max_freq -100 $min_freq` do echo "Setting maximum frequency to $freq" cpupower frequency-set -g powersave --max=${freq}MHz >& /dev/null - [ $EVALUATE_ONLY -eq 0 ] && run_test $freq + run_test $freq done -echo "==============================================================================" +[ $EVALUATE_ONLY -eq 0 ] && cpupower frequency-set -g powersave --max=${max_freq}MHz >& /dev/null +echo "==============================================================================" echo "The marketing frequency of the cpu is $mkt_freq MHz" echo "The maximum frequency of the cpu is $max_freq MHz" echo "The minimum frequency of the cpu is $min_freq MHz" -cpupower frequency-set -g powersave --max=${max_freq}MHz >& /dev/null - # make a pretty table echo "Target Actual Difference MSR(0x199) max_perf_pct" for freq in `seq $max_freq -100 $min_freq` @@ -104,10 +104,6 @@ do result_freq=$(cat /tmp/result.${freq} | grep "cpu MHz" | awk ' { print $4 } ' | awk -F "." ' { print $1 } ') msr=$(cat /tmp/result.${freq} | grep "msr" | awk ' { print $3 } ') max_perf_pct=$(cat /tmp/result.${freq} | grep "max_perf_pct" | awk ' { print $2 } ' ) - if [ $result_freq -eq $freq ]; then - echo " $freq $result_freq 0 $msr $(($max_perf_pct*3300))" - else - echo " $freq $result_freq $(($result_freq-$freq)) $msr $(($max_perf_pct*$max_freq))" - fi + echo " $freq $result_freq $(($result_freq-$freq)) $msr $(($max_perf_pct*$max_freq))" done exit 0