Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1652680ioo; Sun, 22 May 2022 23:06:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLDK1n+CI5jcXhpoQqBTtbacf7CjXKdvSqIvUe1prkw4ZY0VnGdPhVN/aaXsOyJN62B1Kw X-Received: by 2002:a17:903:40cc:b0:162:7ca:d83b with SMTP id t12-20020a17090340cc00b0016207cad83bmr9484116pld.56.1653285970477; Sun, 22 May 2022 23:06:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653285970; cv=none; d=google.com; s=arc-20160816; b=YXvGS3etxxhABLNN23Wpy4zIoPzO58w5ky/3XtfXWHJ1JFF8YM1y6TNc02BuDQPuOp KbufCjiCR4EozuS+yXnDBw3q0I5og5DVh2BbFZ5WUleZ5EQXPTmfIyC66fcNHQH8vZsz 47+0UGOyqYp/K8I1KQ9NYFP6Dzgof55V8ldkxjgq9ET6eLfDcaWaU9D74FL/5uBhke5h E2c7DFp2Acqgs42u9F4bqBJrLF8cynQ2cP21ef5uNBCnOmyYSmbjdjuUGWvNuV7BP+JI MoqDUk68HmGr5T7GXPnAlwDOW+OJj+LTiSZfBLN9BGigVD2ZPxWtJqDfyox2bR0nd3RG IX5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=80hccpo9jht5r4qiVCPTMS3bJPZP6KLkPvpQ3s/DEvM=; b=O8VslQSfCh+9+Tqyn6vhLMdwhr4v9Er+83m78/UEJnDY7J3ZJJAk+8BGb/gx83g0b6 F4+gimVECUq14EzJZ5WTtBhk1zQ25mhDpl5I0spt095CGuv004ryPknYqeQTTl2JPQNr iPNSv8Jq64uiA2cnebq/g+OU7k3fVpVZMQAA1+Fcq4QaRHu5eun/FKsEZeLW86z4imWA NVh3aODS7txrru+oLaMO8P6JzNbFV/qvCFOMlqa/tVn9jHfeu55csLfMF98X/rD4U3B9 2VLI4jouBdQlWNiGU/eLw1jym51eUOgPosajqQhMNi8T/hhQrkjErRpTi797G4iXl3Ej zu5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=T5+2BwEM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id v184-20020a622fc1000000b004fa3a8dffd1si12513774pfv.136.2022.05.22.23.06.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:06:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=T5+2BwEM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5E4612C114; Sun, 22 May 2022 22:57:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239444AbiESTum (ORCPT + 99 others); Thu, 19 May 2022 15:50:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233971AbiESTul (ORCPT ); Thu, 19 May 2022 15:50:41 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46217F134E for ; Thu, 19 May 2022 12:50:40 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id e3so6836020ios.6 for ; Thu, 19 May 2022 12:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=80hccpo9jht5r4qiVCPTMS3bJPZP6KLkPvpQ3s/DEvM=; b=T5+2BwEMNrFuDfdKOsd5NyrIqe2ZJDSEfiHtwpdH3YrcMB95Z+DzZRv5ifb8tyJ+og 0mQta3DUpQflbSbdWmXtrKMgVNLezTY8p4tZgJi1hGOdqj6D2A1shRPLcFATPEe3oFWq arBs8uEHwpev8FlDANCnQ9vYEUYrGCFHG2Qck= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=80hccpo9jht5r4qiVCPTMS3bJPZP6KLkPvpQ3s/DEvM=; b=7eAL4e9Pm8MsJaqIaPgX+yeTjXTb0bOomNU1x8X6kopYm4L4PMO695FyYsKSAMa3tf rUQOSDA/KHsFhzBGk4XPoqN3yVoExqEmaN04wssiEX8k8J+tVB5kfxT+3WgnvAWilPkG ecnFjSa4zgkrV+zDk7L4maz8qmsVKTkLI0Iz7qqqOYU+9sb92YcmLdVNX0+LV3szeiju jNAtMovyK0J1G88OsEM1Wj3wl6s8Icf7Hr5adwThNlWcEhk4wN12Xxsr+iNdKwGQws73 VtU44aR0ac5EXjMfWzi+S5HB6IAGRK14C0P3cb/udmPawM7sb/P7pCtFrwZR2QJlhhTS zAbg== X-Gm-Message-State: AOAM5334lFRE7llOpZgmaVSKSmIRopSOk+7OoyHB/L2tOs4jHMb1VIOW vH2AhFK8uF0/QKQmfvSxkBvhPQ== X-Received: by 2002:a05:6602:2d8d:b0:649:f82b:c877 with SMTP id k13-20020a0566022d8d00b00649f82bc877mr3307330iow.66.1652989839674; Thu, 19 May 2022 12:50:39 -0700 (PDT) Received: from [192.168.1.128] ([38.15.45.1]) by smtp.gmail.com with ESMTPSA id m7-20020a056638408700b0032b3a78176esm140575jam.50.2022.05.19.12.50.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 May 2022 12:50:39 -0700 (PDT) Subject: Re: [PATCH V6 3/4] selftests: amd-pstate: Add test trigger for amd-pstate driver To: Meng Li , Huang Rui , linux-pm@vger.kernel.org Cc: "Rafael J . Wysocki" , Nathan Fontenot , Deepak Sharma , Alex Deucher , Mario Limonciello , Jinzhou Su , Perry Yuan , Xiaojian Du , Viresh Kumar , Borislav Petkov , linux-kernel@vger.kernel.org, Shuah Khan References: <20220519134737.359290-1-li.meng@amd.com> <20220519134737.359290-4-li.meng@amd.com> From: Shuah Khan Message-ID: Date: Thu, 19 May 2022 13:50:38 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20220519134737.359290-4-li.meng@amd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/19/22 7:47 AM, Meng Li wrote: > Add amd-pstate test trigger in kselftest, it will load/unload > amd-pstate-ut module to test some cases etc. > > Signed-off-by: Meng Li > Acked-by: Huang Rui > --- > tools/testing/selftests/Makefile | 1 + > tools/testing/selftests/amd-pstate/Makefile | 8 +++++ > .../selftests/amd-pstate/amd-pstate-ut.sh | 34 +++++++++++++++++++ > tools/testing/selftests/amd-pstate/config | 1 + > 4 files changed, 44 insertions(+) > create mode 100644 tools/testing/selftests/amd-pstate/Makefile > create mode 100755 tools/testing/selftests/amd-pstate/amd-pstate-ut.sh > create mode 100644 tools/testing/selftests/amd-pstate/config > > diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile > index 2319ec87f53d..975c13368286 100644 > --- a/tools/testing/selftests/Makefile > +++ b/tools/testing/selftests/Makefile > @@ -1,5 +1,6 @@ > # SPDX-License-Identifier: GPL-2.0 > TARGETS += alsa > +TARGETS += amd-pstate > TARGETS += arm64 > TARGETS += bpf > TARGETS += breakpoints > diff --git a/tools/testing/selftests/amd-pstate/Makefile b/tools/testing/selftests/amd-pstate/Makefile > new file mode 100644 > index 000000000000..e1432112fb70 > --- /dev/null > +++ b/tools/testing/selftests/amd-pstate/Makefile > @@ -0,0 +1,8 @@ > +# SPDX-License-Identifier: GPL-2.0-only > +# Makefile for amd-pstate/ function selftests > + > +TEST_PROGS := amd-pstate-ut.sh > + > +include ../lib.mk > + > +$(TEST_GEN_FILES): $(HEADERS) Do you still need this? > diff --git a/tools/testing/selftests/amd-pstate/amd-pstate-ut.sh b/tools/testing/selftests/amd-pstate/amd-pstate-ut.sh > new file mode 100755 > index 000000000000..970f7a76c7d5 > --- /dev/null > +++ b/tools/testing/selftests/amd-pstate/amd-pstate-ut.sh > @@ -0,0 +1,34 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > + > +# amd-pstate-ut is a test module for testing the amd-pstate driver. > +# (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 optimization. > + > +# Kselftest framework requirement - SKIP code is 4. > +ksft_skip=4 > + > +if ! uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ | grep -q x86; then This can be simpler - see prctl/Makefile or other tests that do arch checks. Also does this test run on non-amd x86_64 systems? > + echo "$0 # Skipped: Test can only run on x86 architectures." All x86 or x86_64 AMD systems? Does this run on Intel systems? > + exit $ksft_skip > +fi > + > +msg="Skip all tests:" > +if [ ! -w /dev ]; then > + echo $msg please run this as root >&2 > + exit $ksft_skip > +fi > + > +scaling_driver=$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_driver) > + > +if [ "$scaling_driver" != "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 > + > +$(dirname $0)/../kselftest/module.sh "amd-pstate-ut" amd-pstate-ut What does this do? Has this script been updated after moving the module to drivers/cpufreq? Also doesn't this script need to to load the amd_pstate_ut module? Please take a look at user/test_user_copy.sh for example on modprobe checks and appropriate test exit codes > diff --git a/tools/testing/selftests/amd-pstate/config b/tools/testing/selftests/amd-pstate/config > new file mode 100644 > index 000000000000..f43103c9adc4 > --- /dev/null > +++ b/tools/testing/selftests/amd-pstate/config > @@ -0,0 +1 @@ > +CONFIG_X86_AMD_PSTATE_UT=m > thanks, -- Shuah