From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8D228A0544; Fri, 23 Sep 2022 15:15:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 826F542B9C; Fri, 23 Sep 2022 15:15:56 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 815A24003F for ; Fri, 23 Sep 2022 15:15:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663938954; x=1695474954; h=message-id:date:from:subject:to:cc:references: in-reply-to:content-transfer-encoding:mime-version; bh=5u2RL7sjNmf9G861k1Ldvv8Gzpsfo49fuMP0h90Fjmg=; b=YmKwE1OEROJ+q8a2FoG8cLsrb8IRnogHBtfsNop8+ER14MtEkW2a5uV0 3tJilO8XSv7N5//r+lBJqeiFjy5qWorZgeDof3M8rG0BZmtPthajdJAg/ 1uO0PgJPnuh+vNPg3UISy5oVz8sNcUWANa9KjN4o48+ixjI57ii2pjdEq k6+U4S3dO84r4QLlZyKGqLZgXVoEKuDIYg7PDzhe3GFF7dYf2dwpMrT6m f1LXTp2y6l/xzEwKVStcrg9PsOcKpyBKkTDcZz6+yxJ11f8J3117F8O2t a+/EdFZquKaPykz3Ff28hu5QaLt9ZtZBnuSwm6Xz4u16blpRVFBZd1BTc g==; X-IronPort-AV: E=McAfee;i="6500,9779,10479"; a="386877292" X-IronPort-AV: E=Sophos;i="5.93,339,1654585200"; d="scan'208";a="386877292" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2022 06:15:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,339,1654585200"; d="scan'208";a="688711929" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga004.fm.intel.com with ESMTP; 23 Sep 2022 06:15:53 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 23 Sep 2022 06:15:53 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 23 Sep 2022 06:15:52 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Fri, 23 Sep 2022 06:15:52 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.104) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Fri, 23 Sep 2022 06:15:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uz3oV14zc6qJ7umJUALkcyq69xRTa/qi570kPyBOqZi7JLC3JOGA3cN1w9T5ZuS9vv1DRR6QJCrf4ynC+DrmCeIu0XkfrBS9FSMQdWPuMFTyqqm9NdZBYdOETqe5BsjrtfWd4fXCcBRTUow3kCxfbv9/GOqioN9GPn+DwLo5Toez0o2Jiz6EgDoBQgi/ngEqQh2fUZwNzhJf+0GjNNVHAPlC2enEZW88iYmeHfUShrv2vIzfe73yURo2KeXtIeywk9TIc7MkrMIqQF73AxFYS7RGCNY9ICov85JnsyXUJYfYICXudjwa3E5122CWrcOsUDWSFRH+8XXH4lCD6dXxGw== 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=/KltSCorhFGGoJnwSelSKhXyJW0++Y+lGJZUGLeTcLA=; b=oNyeIpeiDWcSwn0d7dmMP20uPDzqSeyeHYdRzjYf9TtbjKcd+p8334bI4z2m+A+DmDc2Rawtswrdo+0c6hbOQIzU3x6JrZo3PcsGyOfhiWt93pQKSa7JV3FTvUYD4UE9Zfv0tU/gB6icZ6Lntb4J1wNE1NGzW9/Ejr0p/m78dI1a1BBbqXVsZ4AsJpMqWOyord/Y8mLfwGDFACuG/0RuBok6FCnlo6Ple77NRfzQV8a7JXkLhDPjzMAx9MY7GyUQaLtmF9vjz2k3+YDC/pI/ZUWoDpshNM2ArSFNoSIYlxNURhHlDqZpw5QmULHIvkbsbplCruIrpUBGoa9aZe7/CA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from BYAPR11MB3799.namprd11.prod.outlook.com (2603:10b6:a03:fb::19) by SJ0PR11MB5119.namprd11.prod.outlook.com (2603:10b6:a03:2d6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.21; Fri, 23 Sep 2022 13:15:50 +0000 Received: from BYAPR11MB3799.namprd11.prod.outlook.com ([fe80::1331:f80e:20cb:3546]) by BYAPR11MB3799.namprd11.prod.outlook.com ([fe80::1331:f80e:20cb:3546%5]) with mapi id 15.20.5654.019; Fri, 23 Sep 2022 13:15:50 +0000 Message-ID: <6f3093d0-de7d-656e-098c-3fae8d5b266c@intel.com> Date: Fri, 23 Sep 2022 14:15:46 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 From: "Hunt, David" Subject: Re: [PATCH v4 3/3] test/power: add unit tests for uncore API To: Tadhg Kearney , CC: , References: <20220920094822.1403168-1-tadhg.kearney@intel.com> <20220920094822.1403168-4-tadhg.kearney@intel.com> Content-Language: en-US In-Reply-To: <20220920094822.1403168-4-tadhg.kearney@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0384.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18f::11) To BYAPR11MB3799.namprd11.prod.outlook.com (2603:10b6:a03:fb::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR11MB3799:EE_|SJ0PR11MB5119:EE_ X-MS-Office365-Filtering-Correlation-Id: f61a77f5-7079-442a-6c9b-08da9d65bc74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0R4Ql5m9HxyYS3wGJqhfKeg1TQmV52om0ojuIU9Lkh4xCHeKCb2Z8Ns8wK4tEZPEqbKzhDXBbwQYK69qlegPYvDNDgFC2x3scWrWSzQJGNt8bIrAXll34OfCEcfhT6X/hOwavRD3t2FBX10eVkmOVNNPj+Ra38sLlL/7i+G4a1HqnCstjDbeOSLKaEG11Jt/5FYFGv+6Oo/1t/V1zZ+a0U2SJqqco8yd2eIVlkNXvAoyfgEC3tcuWZz6z1JkJUxT/fFDQePQl7lyKFhkjbqiRHf+mrEDYCZLlzZPmulTT07qwaYWtpG6WxqAwmvzUvNs651LDn9kquKNaLHU46UJy6vdIp2cK9S8cOODZ6t0wQYRCCddU2ML8w/Ntd3/J4EwuCcfbxDJcRn7aPS4kX90TMN4rDJ8z+JZpRludb24PRRy+HQ58YsifYgf/P829UnqWINaDIZN7ryy6l/eUvsXLeohMLdTt0xGel7Eeb82UU03kWPwXi6aoxQ+gCH2jfaOiUZTsucmK6+XUL+RXb4IsNNdPOsE0Uk7w63cPJh8YW/3Mg4f8sx7fNfkJ7TJ81sZKmkNwo9ABkimwXJJrHsRfFsm7fQU1n7t91E6WVLDpjn/Gzb+7QK8DjevZgtWcOMXPocRIR1rtvhdl8QIehuAJvyR/xdMdXJPSB8H7msKYmy8o+wtsV7o3Hj0tQUU2Hj3tk5a6aCWCyc97VyAE+gVXtEwp832NuEysHBrON6q5tm+H4RISrJbAHrgiAeWa9tyDWDxOc8CwxTJXvaa7nSpkHZTy9RlGBpulgqzVMCybsE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3799.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(396003)(376002)(346002)(39860400002)(136003)(451199015)(38100700002)(6506007)(82960400001)(478600001)(6486002)(8676002)(316002)(26005)(83380400001)(6666004)(53546011)(2906002)(186003)(107886003)(5660300002)(4326008)(66476007)(6512007)(66946007)(8936002)(41300700001)(2616005)(66556008)(36756003)(31696002)(31686004)(86362001)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?d1BGNzZ1L2RsbzJLNnRSUnlCMGJIZzY2TnVvRjQ0QlF2RllYakN3TkRqNG4v?= =?utf-8?B?YzdsU3VyMm1DV2hhR0pkUms4OXdXRTF1MHo3TURRQUQ4L25tNkIwY29LdDU2?= =?utf-8?B?U1ZvbmlWcDdSWjNhYy9pS1lCMVFVa1o4YWx6Wm1YYzU2Z3RVVW90QjhFcEla?= =?utf-8?B?bVl3UGE4d3dWcS9wTWdDc0xGalcwK0c2RXJTMj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-8?B?amV4ZmdUNWV2Yzd2UUdQK2tDZ2RlZVVoSFNjZXN2V0hTZk4wZmt0MHVYQ3dO?= =?utf-8?B?OStQa05PM3U4dW5WT25PY2s4a2QvOHlnQWtPMEUvU002L2NSdkVUL3o3bDB1?= =?utf-8?B?aW1QZmExVWQxK3dCbUxDREREcWsvSEFybzI4ZWF0S2Y5RFJkanRZa2dZd0lp?= =?utf-8?B?TWc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: f61a77f5-7079-442a-6c9b-08da9d65bc74 X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3799.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 13:15:50.7850 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WXVlMWhXj2B5Sg1MN+ltLUqSHpxyPquC6Zn9jPMiXo3tKO89F6rUnHv1hnEOMhONj+Q2KFrHGr6Nv9jkQdYFpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5119 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi Tadhg, On 20/09/2022 10:48, Tadhg Kearney wrote: > Add basic unit tests covering all nine uncore API's. > > Signed-off-by: Tadhg Kearney > --- > app/test/meson.build | 2 + > app/test/test_power_uncore.c | 299 +++++++++++++++++++++++++++++++++++ > 2 files changed, 301 insertions(+) > create mode 100644 app/test/test_power_uncore.c > > diff --git a/app/test/meson.build b/app/test/meson.build > index bf1d81f84a..170401ccdc 100644 > --- a/app/test/meson.build > +++ b/app/test/meson.build > @@ -100,6 +100,7 @@ test_sources = files( > 'test_power.c', > 'test_power_cpufreq.c', > 'test_power_kvm_vm.c', > + 'test_power_uncore.c', > 'test_prefetch.c', > 'test_rand_perf.c', > 'test_rawdev.c', > @@ -240,6 +241,7 @@ fast_tests = [ > ['power_cpufreq_autotest', false, true], > ['power_autotest', true, true], > ['power_kvm_vm_autotest', false, true], > + ['power_uncore_autotest', true, true], > ['reorder_autotest', true, true], > ['service_autotest', true, true], > ['thash_autotest', true, true], > diff --git a/app/test/test_power_uncore.c b/app/test/test_power_uncore.c > new file mode 100644 > index 0000000000..7bc3ed7260 > --- /dev/null > +++ b/app/test/test_power_uncore.c > @@ -0,0 +1,299 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2010-2022 Intel Corporation > + */ > + > +#include "test.h" > + > +#ifndef RTE_LIB_POWER > + > +static int > +test_power_uncore(void) > +{ > + printf("Power management library not supported, skipping test\n"); > + return TEST_SKIPPED; > +} > + > +#else > +#include > +#include > + > +#define MAX_UNCORE_FREQS 32 > + > +#define VALID_PKG 0 > +#define VALID_DIE 0 > +#define INVALID_PKG (rte_power_uncore_get_num_pkgs() + 1) > +#define INVALID_DIE (rte_power_uncore_get_num_dies(VALID_PKG) + 1) > +#define VALID_INDEX 1 > +#define INVALID_INDEX (MAX_UNCORE_FREQS + 1) > + > +static int check_power_uncore_init(void) > +{ > + int ret; > + > + /* Test initialisation of uncore configuration*/ > + ret = rte_power_uncore_init(VALID_PKG, VALID_DIE); > + if (ret < 0) { > + printf("Cannot initialise uncore power management for pkg %u die %u, this " > + "may occur if environment is not configured " > + "correctly(APCI cpufreq) or operating in another valid " > + "Power management environment\n", VALID_PKG, VALID_DIE); > + return -1; > + } > + > + /* Unsuccessful Test */ > + ret = rte_power_uncore_init(INVALID_PKG, INVALID_DIE); > + if (ret == 0) { > + printf("Unexpectedly was able to initialise uncore power management " > + "for pkg %u die %u\n", INVALID_PKG, INVALID_DIE); > + return -1; > + } > + > + return 0; > +} > + > +static int > +check_power_get_uncore_freq(void) > +{ > + int ret; > + > + /* Successfully get uncore freq */ > + ret = rte_power_get_uncore_freq(VALID_PKG, VALID_DIE); > + if (ret < 0) { > + printf("Failed to get uncore frequency for pkg %u die %u\n", > + VALID_PKG, VALID_DIE); > + return -1; > + } > + > + /* Unsuccessful Test */ > + ret = rte_power_get_uncore_freq(INVALID_PKG, INVALID_DIE); > + if (ret >= 0) { > + printf("Unexpectedly got invalid uncore frequency for pkg %u die %u\n", > + INVALID_PKG, INVALID_DIE); > + return -1; > + } > + > + return 0; > +} > + > +static int > +check_power_set_uncore_freq(void) > +{ > + int ret; > + > + /* Successfully set uncore freq */ > + ret = rte_power_set_uncore_freq(VALID_PKG, VALID_DIE, VALID_INDEX); > + if (ret < 0) { > + printf("Failed to set uncore frequency for pkg %u die %u index %u\n", > + VALID_PKG, VALID_DIE, VALID_INDEX); > + return -1; > + } > + > + /* Try to unsuccessfully set invalid uncore freq index */ > + ret = rte_power_set_uncore_freq(VALID_PKG, VALID_DIE, INVALID_INDEX); > + if (ret == 0) { > + printf("Unexpectedly set invalid uncore index for pkg %u die %u index %u\n", > + VALID_PKG, VALID_DIE, INVALID_INDEX); > + return -1; > + } > + > + /* Unsuccessful Test */ > + ret = rte_power_set_uncore_freq(INVALID_PKG, INVALID_DIE, VALID_INDEX); > + if (ret == 0) { > + printf("Unexpectedly set invalid uncore frequency for pkg %u die %u index %u\n", > + INVALID_PKG, INVALID_DIE, VALID_INDEX); > + return -1; > + } > + > + return 0; > +} > + > +static int > +check_power_uncore_freq_max(void) > +{ > + int ret; > + > + /* Successfully get max uncore freq */ > + ret = rte_power_uncore_freq_max(VALID_PKG, VALID_DIE); > + if (ret < 0) { > + printf("Failed to set max uncore frequency for pkg %u die %u\n", > + VALID_PKG, VALID_DIE); > + return -1; > + } > + > + /* Unsuccessful Test */ > + ret = rte_power_uncore_freq_max(INVALID_PKG, INVALID_DIE); > + if (ret == 0) { > + printf("Unexpectedly set invalid max uncore frequency for pkg %u die %u\n", > + INVALID_PKG, INVALID_DIE); > + return -1; > + } > + > + return 0; > +} > + > +static int > +check_power_uncore_freq_min(void) > +{ > + int ret; > + > + /* Successfully get min uncore freq */ > + ret = rte_power_uncore_freq_min(VALID_PKG, VALID_DIE); > + if (ret < 0) { > + printf("Failed to set min uncore frequency for pkg %u die %u\n", > + VALID_PKG, VALID_DIE); > + return -1; > + } > + > + /* Unsuccessful Test */ > + ret = rte_power_uncore_freq_min(INVALID_PKG, INVALID_DIE); > + if (ret == 0) { > + printf("Unexpectedly set invalid min uncore frequency for pkg %u die %u\n", > + INVALID_PKG, INVALID_DIE); > + return -1; > + } > + > + return 0; > +} > + > +static int > +check_power_uncore_get_num_freqs(void) > +{ > + int ret; > + > + /* Successfully get number of uncore freq */ > + ret = rte_power_uncore_get_num_freqs(VALID_PKG, VALID_DIE); > + if (ret < 0) { > + printf("Failed to get number of uncore frequencies for pkg %u die %u\n", > + VALID_PKG, VALID_DIE); > + return -1; > + } > + > + /* Unsuccessful Test */ > + ret = rte_power_uncore_get_num_freqs(INVALID_PKG, INVALID_DIE); > + if (ret >= 0) { > + printf("Unexpectedly got number of invalid frequencies for pkg %u die %u\n", > + INVALID_PKG, INVALID_DIE); > + return -1; > + } > + > + return 0; > +} > + > +static int > +check_power_uncore_get_num_pkgs(void) > +{ > + int ret; > + > + /* Successfully get number of uncore pkgs */ > + ret = rte_power_uncore_get_num_pkgs(); > + if (ret == 0) { > + printf("Failed to get number of uncore pkgs\n"); > + return -1; > + } > + > + return 0; > +} > + > +static int > +check_power_uncore_get_num_dies(void) > +{ > + int ret; > + > + /* Successfully get number of uncore dies */ > + ret = rte_power_uncore_get_num_dies(VALID_PKG); > + if (ret == 0) { > + printf("Failed to get number of uncore dies for pkg %u\n", > + VALID_PKG); > + return -1; > + } > + > + /* Unsuccessful test */ > + ret = rte_power_uncore_get_num_dies(INVALID_PKG); > + if (ret > 0) { > + printf("Unexpectedly got number of invalid dies for pkg %u\n", > + INVALID_PKG); > + return -1; > + } > + > + return 0; > +} > + > +static int > +check_power_uncore_exit(void) > +{ > + int ret; > + > + /* Successfully exit uncore power management */ > + ret = rte_power_uncore_exit(VALID_PKG, VALID_DIE); > + if (ret < 0) { > + printf("Failed to exit uncore power management for pkg %u die %u\n", > + VALID_PKG, VALID_DIE); > + } > + > + /* Unsuccessful Test */ > + ret = rte_power_uncore_exit(INVALID_PKG, INVALID_DIE); > + if (ret == 0) { > + printf("Unexpectedly was able to exit uncore power management for pkg %u die %u\n", > + INVALID_PKG, INVALID_DIE); > + return -1; > + } > + > + return 0; > +} > + > +static int > +test_power_uncore(void) > +{ > + int ret; > + > + ret = rte_power_uncore_get_num_pkgs(); > + if (ret == 0) { > + printf("Uncore frequency management only supported on x86 with linux kernel >= 5.6."); > + return TEST_SKIPPED; > + } > + Suggest re-wording this message. I'm running a 5.17 kernel, and still see this message because CONFIG_INTEL_UNCORE_FREQ_CONTROL is not set. Maybe "Uncore frequency management not supported/enabled on this kernel. Please enable CONFIG_INTEL_UNCORE_FREQ_CONTROL." Also, the '\n' is missing from the end of the line. > + ret = check_power_uncore_init(); > + if (ret < 0) > + goto fail_all; > + > + ret = check_power_get_uncore_freq(); > + if (ret < 0) > + goto fail_all; > + > + ret = check_power_set_uncore_freq(); > + if (ret < 0) > + goto fail_all; > + > + ret = check_power_uncore_freq_max(); > + if (ret < 0) > + goto fail_all; > + > + ret = check_power_uncore_freq_min(); > + if (ret < 0) > + goto fail_all; > + > + ret = check_power_uncore_get_num_freqs(); > + if (ret < 0) > + goto fail_all; > + > + ret = check_power_uncore_get_num_pkgs(); > + if (ret < 0) > + goto fail_all; > + > + ret = check_power_uncore_get_num_dies(); > + if (ret < 0) > + goto fail_all; > + > + ret = check_power_uncore_exit(); > + if (ret < 0) > + return -1; > + > + return 0; > + > +fail_all: > + rte_power_uncore_exit(VALID_PKG, VALID_DIE); > + return -1; > +} > +#endif > + > +REGISTER_TEST_COMMAND(power_uncore_autotest, test_power_uncore); The rest looks good to me, and once the above requested changes are addressed: Reviewed-by: David Hunt