From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <anatoly.burakov@intel.com>
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by dpdk.org (Postfix) with ESMTP id 8F0975F1D
 for <dev@dpdk.org>; Wed, 27 Mar 2019 16:13:19 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga004.jf.intel.com ([10.7.209.38])
 by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 27 Mar 2019 08:13:18 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,277,1549958400"; d="scan'208";a="286379421"
Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.103])
 ([10.237.220.103])
 by orsmga004.jf.intel.com with ESMTP; 27 Mar 2019 08:13:17 -0700
To: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>, david.hunt@intel.com
Cc: dev@dpdk.org
References: <20190307135950.30738-1-lukaszx.krakowiak@intel.com>
 <20190307135950.30738-4-lukaszx.krakowiak@intel.com>
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Message-ID: <f66f1bbe-2538-b776-5043-dd48ce06cdcc@intel.com>
Date: Wed, 27 Mar 2019 15:13:16 +0000
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101
 Thunderbird/60.6.0
MIME-Version: 1.0
In-Reply-To: <20190307135950.30738-4-lukaszx.krakowiak@intel.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH 3/3] test: add UT for power turbo feature
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 27 Mar 2019 15:13:20 -0000

On 07-Mar-19 1:59 PM, Lukasz Krakowiak wrote:
> Add UT check_power_turbo.
> 
> Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
> ---
>   app/test/test_power_cpufreq.c | 72 +++++++++++++++++++++++++++++++++++
>   1 file changed, 72 insertions(+)
> 
> diff --git a/app/test/test_power_cpufreq.c b/app/test/test_power_cpufreq.c
> index d099f2f47..c75c9bf1c 100644
> --- a/app/test/test_power_cpufreq.c
> +++ b/app/test/test_power_cpufreq.c
> @@ -366,6 +366,59 @@ check_power_freq_min(void)
>   	return 0;
>   }
>   
> +/* Check rte_power_turbo() */
> +static int
> +check_power_turbo(void)
> +{
> +	int ret;
> +
> +	if (rte_power_turbo_status(TEST_POWER_LCORE_ID) == 0) {
> +		printf("Turbo not available on lcore %u, skipping test\n",
> +		TEST_POWER_LCORE_ID);

Misleading indentation, please add two tabs to the second line of 
printf() statement.

> +		return 0;
> +	}
> +
> +	/* test with an invalid lcore id */
> +	ret = rte_power_freq_enable_turbo(TEST_POWER_LCORE_INVALID);
> +	if (ret >= 0) {
> +		printf("Unexpectedly enable turbo successfully "
> +				"on lcore %u\n", TEST_POWER_LCORE_INVALID);

Please don't break up strings to multiple lines.

> +		return -1;
> +	}
> +	ret = rte_power_freq_enable_turbo(TEST_POWER_LCORE_ID);
> +	if (ret < 0) {
> +		printf("Fail to enable turbo on lcore %u\n",
> +							TEST_POWER_LCORE_ID);

I wish there was a middle ground between no indentation and way too much 
indentation...

> +		return -1;
> +	}
> +
> +	/* Check the current frequency */
> +	ret = check_cur_freq(TEST_POWER_LCORE_ID, 0);
> +	if (ret < 0)
> +		return -1;
> +
> +	/* test with an invalid lcore id */
> +	ret = rte_power_freq_disable_turbo(TEST_POWER_LCORE_INVALID);
> +	if (ret >= 0) {
> +		printf("Unexpectedly disable turbo successfully "
> +				"on lcore %u\n", TEST_POWER_LCORE_INVALID);

Same as above, don't break up strings.

> +		return -1;
> +	}
> +	ret = rte_power_freq_disable_turbo(TEST_POWER_LCORE_ID);
> +	if (ret < 0) {
> +		printf("Fail to disable turbo on lcore %u\n",
> +							TEST_POWER_LCORE_ID);

Same as above, two tabs is enough indentation.

> +		return -1;
> +	}
> +
> +	/* Check the current frequency */
> +	ret = check_cur_freq(TEST_POWER_LCORE_ID, 1);
> +	if (ret < 0)
> +		return -1;
> +
> +	return 0;
> +}
> +
>   static int
>   test_power_cpufreq(void)
>   {
> @@ -427,6 +480,21 @@ test_power_cpufreq(void)
>   				"been initialised\n");
>   		goto fail_all;
>   	}
> +	if (rte_power_turbo_status == NULL) {
> +		printf("rte_power_turbo_status should not be NULL, environment has not "
> +				"been initialised\n");

Here and below:

I don't think saying *why* it should not be NULL - just saying that it 
shouldn't be NULL is enough. Maybe mention why it's supposed to be not 
NULL in comments here.

Also, i have a suspicion that the message is wrong - why would status be 
null if the environment was initialized? Presumably it's the other way 
around?

> +		goto fail_all;
> +	}
> +	if (rte_power_freq_enable_turbo == NULL) {
> +		printf("rte_power_freq_enable_turbo should not be NULL, environment has not "
> +				"been initialised\n");
> +		goto fail_all;
> +	}
> +	if (rte_power_freq_disable_turbo == NULL) {
> +		printf("rte_power_freq_disable_turbo should not be NULL, environment has not "
> +				"been initialised\n");
> +		goto fail_all;
> +	}
>   
>   	ret = rte_power_exit(TEST_POWER_LCORE_ID);
>   	if (ret < 0) {
> @@ -502,6 +570,10 @@ test_power_cpufreq(void)
>   	if (ret < 0)
>   		goto fail_all;
>   
> +	ret = check_power_turbo();
> +	if (ret < 0)
> +		goto fail_all;
> +
>   	ret = rte_power_exit(TEST_POWER_LCORE_ID);
>   	if (ret < 0) {
>   		printf("Cannot exit power management for lcore %u\n",
> 


-- 
Thanks,
Anatoly

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 1A948A05D3
	for <public@inbox.dpdk.org>; Wed, 27 Mar 2019 16:13:22 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 89BA85F24;
	Wed, 27 Mar 2019 16:13:21 +0100 (CET)
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by dpdk.org (Postfix) with ESMTP id 8F0975F1D
 for <dev@dpdk.org>; Wed, 27 Mar 2019 16:13:19 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga004.jf.intel.com ([10.7.209.38])
 by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 27 Mar 2019 08:13:18 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,277,1549958400"; d="scan'208";a="286379421"
Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.103])
 ([10.237.220.103])
 by orsmga004.jf.intel.com with ESMTP; 27 Mar 2019 08:13:17 -0700
To: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>, david.hunt@intel.com
Cc: dev@dpdk.org
References: <20190307135950.30738-1-lukaszx.krakowiak@intel.com>
 <20190307135950.30738-4-lukaszx.krakowiak@intel.com>
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Message-ID: <f66f1bbe-2538-b776-5043-dd48ce06cdcc@intel.com>
Date: Wed, 27 Mar 2019 15:13:16 +0000
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101
 Thunderbird/60.6.0
MIME-Version: 1.0
In-Reply-To: <20190307135950.30738-4-lukaszx.krakowiak@intel.com>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH 3/3] test: add UT for power turbo feature
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190327151316.bOB-xYa0nxD2_ZAJ6HPuTtU89HnBpAoZNguolrrczm8@z>

On 07-Mar-19 1:59 PM, Lukasz Krakowiak wrote:
> Add UT check_power_turbo.
> 
> Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
> ---
>   app/test/test_power_cpufreq.c | 72 +++++++++++++++++++++++++++++++++++
>   1 file changed, 72 insertions(+)
> 
> diff --git a/app/test/test_power_cpufreq.c b/app/test/test_power_cpufreq.c
> index d099f2f47..c75c9bf1c 100644
> --- a/app/test/test_power_cpufreq.c
> +++ b/app/test/test_power_cpufreq.c
> @@ -366,6 +366,59 @@ check_power_freq_min(void)
>   	return 0;
>   }
>   
> +/* Check rte_power_turbo() */
> +static int
> +check_power_turbo(void)
> +{
> +	int ret;
> +
> +	if (rte_power_turbo_status(TEST_POWER_LCORE_ID) == 0) {
> +		printf("Turbo not available on lcore %u, skipping test\n",
> +		TEST_POWER_LCORE_ID);

Misleading indentation, please add two tabs to the second line of 
printf() statement.

> +		return 0;
> +	}
> +
> +	/* test with an invalid lcore id */
> +	ret = rte_power_freq_enable_turbo(TEST_POWER_LCORE_INVALID);
> +	if (ret >= 0) {
> +		printf("Unexpectedly enable turbo successfully "
> +				"on lcore %u\n", TEST_POWER_LCORE_INVALID);

Please don't break up strings to multiple lines.

> +		return -1;
> +	}
> +	ret = rte_power_freq_enable_turbo(TEST_POWER_LCORE_ID);
> +	if (ret < 0) {
> +		printf("Fail to enable turbo on lcore %u\n",
> +							TEST_POWER_LCORE_ID);

I wish there was a middle ground between no indentation and way too much 
indentation...

> +		return -1;
> +	}
> +
> +	/* Check the current frequency */
> +	ret = check_cur_freq(TEST_POWER_LCORE_ID, 0);
> +	if (ret < 0)
> +		return -1;
> +
> +	/* test with an invalid lcore id */
> +	ret = rte_power_freq_disable_turbo(TEST_POWER_LCORE_INVALID);
> +	if (ret >= 0) {
> +		printf("Unexpectedly disable turbo successfully "
> +				"on lcore %u\n", TEST_POWER_LCORE_INVALID);

Same as above, don't break up strings.

> +		return -1;
> +	}
> +	ret = rte_power_freq_disable_turbo(TEST_POWER_LCORE_ID);
> +	if (ret < 0) {
> +		printf("Fail to disable turbo on lcore %u\n",
> +							TEST_POWER_LCORE_ID);

Same as above, two tabs is enough indentation.

> +		return -1;
> +	}
> +
> +	/* Check the current frequency */
> +	ret = check_cur_freq(TEST_POWER_LCORE_ID, 1);
> +	if (ret < 0)
> +		return -1;
> +
> +	return 0;
> +}
> +
>   static int
>   test_power_cpufreq(void)
>   {
> @@ -427,6 +480,21 @@ test_power_cpufreq(void)
>   				"been initialised\n");
>   		goto fail_all;
>   	}
> +	if (rte_power_turbo_status == NULL) {
> +		printf("rte_power_turbo_status should not be NULL, environment has not "
> +				"been initialised\n");

Here and below:

I don't think saying *why* it should not be NULL - just saying that it 
shouldn't be NULL is enough. Maybe mention why it's supposed to be not 
NULL in comments here.

Also, i have a suspicion that the message is wrong - why would status be 
null if the environment was initialized? Presumably it's the other way 
around?

> +		goto fail_all;
> +	}
> +	if (rte_power_freq_enable_turbo == NULL) {
> +		printf("rte_power_freq_enable_turbo should not be NULL, environment has not "
> +				"been initialised\n");
> +		goto fail_all;
> +	}
> +	if (rte_power_freq_disable_turbo == NULL) {
> +		printf("rte_power_freq_disable_turbo should not be NULL, environment has not "
> +				"been initialised\n");
> +		goto fail_all;
> +	}
>   
>   	ret = rte_power_exit(TEST_POWER_LCORE_ID);
>   	if (ret < 0) {
> @@ -502,6 +570,10 @@ test_power_cpufreq(void)
>   	if (ret < 0)
>   		goto fail_all;
>   
> +	ret = check_power_turbo();
> +	if (ret < 0)
> +		goto fail_all;
> +
>   	ret = rte_power_exit(TEST_POWER_LCORE_ID);
>   	if (ret < 0) {
>   		printf("Cannot exit power management for lcore %u\n",
> 


-- 
Thanks,
Anatoly