DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: "Krakowiak, LukaszX" <lukaszx.krakowiak@intel.com>,
	"Hunt, David" <david.hunt@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 3/3] test: add UT for power turbo feature
Date: Wed, 3 Apr 2019 11:01:04 +0100	[thread overview]
Message-ID: <f769c7af-216d-e3f7-95f8-e415c0147223@intel.com> (raw)
In-Reply-To: <DC695E1BE92F754CA2AE786BE043D81318DDD43C@hasmsx107.ger.corp.intel.com>

On 03-Apr-19 10:07 AM, Krakowiak, LukaszX wrote:
> Hi,
> 
>> 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?
> 
> I think this is correctly: if env was initialized, pointer != NULL, otherwise env wasn't initialized.
> Rest of all, you are right: coding style issues. Thanks.

The check is if rte_power_turbo_status is equal to NULL. If the check 
fails (i.e. rte_power_turbo_status is not NULL), we get an error message 
saying that rte_power_turbo_status should not be NULL. That doesn't 
compute :) Either it should not be NULL and the check is wrong, or it 
should be NULL and the error message is wrong.

>>
>>> +		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


-- 
Thanks,
Anatoly

  parent reply	other threads:[~2019-04-03 10:01 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07 13:59 [dpdk-dev] [PATCH 0/3] test: improve test coverage for power library Lukasz Krakowiak
2019-03-07 13:59 ` [dpdk-dev] [PATCH 1/3] test: rename test_power_acpi_cpufreq.c -> app/test/test_power_cpufreq.c Lukasz Krakowiak
2019-03-27 15:05   ` Burakov, Anatoly
2019-03-27 15:05     ` Burakov, Anatoly
2019-03-07 13:59 ` [dpdk-dev] [PATCH 2/3] test: remove prefix _acpi from UT power function/test names Lukasz Krakowiak
2019-03-27 15:07   ` Burakov, Anatoly
2019-03-27 15:07     ` Burakov, Anatoly
2019-03-29 22:40     ` Thomas Monjalon
2019-03-29 22:40       ` Thomas Monjalon
2019-03-07 13:59 ` [dpdk-dev] [PATCH 3/3] test: add UT for power turbo feature Lukasz Krakowiak
2019-03-27 15:13   ` Burakov, Anatoly
2019-03-27 15:13     ` Burakov, Anatoly
2019-04-03  9:07     ` Krakowiak, LukaszX
2019-04-03  9:07       ` Krakowiak, LukaszX
2019-04-03 10:01       ` Burakov, Anatoly [this message]
2019-04-03 10:01         ` Burakov, Anatoly
2019-04-03 10:32 ` [dpdk-dev] [PATCH v2 0/3] test: improve test coverage for power library Lukasz Krakowiak
2019-04-03 10:32   ` Lukasz Krakowiak
2019-04-03 10:32   ` [dpdk-dev] [PATCH v2 1/3] test: rename test_power_acpi_cpufreq.c -> app/test/test_power_cpufreq.c Lukasz Krakowiak
2019-04-03 10:32     ` Lukasz Krakowiak
2019-04-03 10:32   ` [dpdk-dev] [PATCH v2 2/3] test: remove prefix _acpi from UT power function/test names Lukasz Krakowiak
2019-04-03 10:32     ` Lukasz Krakowiak
2019-04-15 15:14     ` Hunt, David
2019-04-15 15:14       ` Hunt, David
2019-04-15 15:32     ` Kevin Traynor
2019-04-15 15:32       ` Kevin Traynor
2019-04-03 10:32   ` [dpdk-dev] [PATCH v2 3/3] test: add UT for power turbo feature Lukasz Krakowiak
2019-04-03 10:32     ` Lukasz Krakowiak
2019-04-15 15:22     ` Hunt, David
2019-04-15 15:22       ` Hunt, David
2019-06-07  8:45     ` Hajkowski, MarcinX
2019-04-22 20:42   ` [dpdk-dev] [PATCH v2 0/3] test: improve test coverage for power library Thomas Monjalon
2019-04-22 20:42     ` Thomas Monjalon
2019-07-05  7:35   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f769c7af-216d-e3f7-95f8-e415c0147223@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=lukaszx.krakowiak@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).