All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] device-drivers/cpufreq_boost: skip test on virtual machines
@ 2021-06-23  8:01 Krzysztof Kozlowski
  2021-06-23  8:11 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2021-06-23  8:01 UTC (permalink / raw)
  To: ltp

Testing CPU frequency boost on a virtual machines is not reliable.  Even
if cpufreq driver reports boost frequencies, the underlying hypervisor
might decide otherwise.

For example on AWS x1e.xlarge instance (claimed to be running on Intel
Xeon E7 8880) under Xen hypervisor the test always fails:

    cpufreq_boost    0  TINFO  :  found 'intel_pstate' driver, sysfs knob '/sys/devices/system/cpu/intel_pstate/no_turbo'
    cpufreq_boost    0  TINFO  :  maximum speed is 3100000 KHz
    cpufreq_boost    0  TINFO  :  load CPU0 with boost enabled
    cpufreq_boost    0  TINFO  :  elapsed time is 1155 ms
    cpufreq_boost    0  TINFO  :  load CPU0 with boost disabled
    cpufreq_boost    0  TINFO  :  elapsed time is 1155 ms
    cpufreq_boost    1  TFAIL  :  cpufreq_boost.c:186: compare time spent with and without boost (-2%)

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c b/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
index b9739db37cb7..67917b3fea25 100644
--- a/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
+++ b/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
@@ -90,6 +90,9 @@ static void setup(void)
 	unsigned int i;
 	tst_require_root();
 
+	if (tst_is_virt(VIRT_ANY))
+		tst_brkm(TCONF, NULL, "running in a virtual machine, overclock not reliably measureable");
+
 	for (i = 0; i < ARRAY_SIZE(cdrv); ++i) {
 		fd = open(cdrv[i].file, O_RDWR);
 		if (fd == -1)
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] device-drivers/cpufreq_boost: skip test on virtual machines
  2021-06-23  8:01 [LTP] [PATCH] device-drivers/cpufreq_boost: skip test on virtual machines Krzysztof Kozlowski
@ 2021-06-23  8:11 ` Krzysztof Kozlowski
  2021-06-23 11:38   ` Cyril Hrubis
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2021-06-23  8:11 UTC (permalink / raw)
  To: ltp

On 23/06/2021 10:01, Krzysztof Kozlowski wrote:
> Testing CPU frequency boost on a virtual machines is not reliable.  Even
> if cpufreq driver reports boost frequencies, the underlying hypervisor
> might decide otherwise.
> 
> For example on AWS x1e.xlarge instance (claimed to be running on Intel
> Xeon E7 8880) under Xen hypervisor the test always fails:
> 
>     cpufreq_boost    0  TINFO  :  found 'intel_pstate' driver, sysfs knob '/sys/devices/system/cpu/intel_pstate/no_turbo'
>     cpufreq_boost    0  TINFO  :  maximum speed is 3100000 KHz
>     cpufreq_boost    0  TINFO  :  load CPU0 with boost enabled
>     cpufreq_boost    0  TINFO  :  elapsed time is 1155 ms
>     cpufreq_boost    0  TINFO  :  load CPU0 with boost disabled
>     cpufreq_boost    0  TINFO  :  elapsed time is 1155 ms
>     cpufreq_boost    1  TFAIL  :  cpufreq_boost.c:186: compare time spent with and without boost (-2%)
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>  testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c b/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
> index b9739db37cb7..67917b3fea25 100644
> --- a/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
> +++ b/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
> @@ -90,6 +90,9 @@ static void setup(void)
>  	unsigned int i;
>  	tst_require_root();
>  
> +	if (tst_is_virt(VIRT_ANY))
> +		tst_brkm(TCONF, NULL, "running in a virtual machine, overclock not reliably measureable");
> +
>  	for (i = 0; i < ARRAY_SIZE(cdrv); ++i) {
>  		fd = open(cdrv[i].file, O_RDWR);
>  		if (fd == -1)
> 

Optionally, under virtual machine the test failure could be converted to
accepted pass. This would still allow to test CPUfreq boosting
interface. Any preferences?

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] device-drivers/cpufreq_boost: skip test on virtual machines
  2021-06-23  8:11 ` Krzysztof Kozlowski
@ 2021-06-23 11:38   ` Cyril Hrubis
  2021-06-23 15:33     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2021-06-23 11:38 UTC (permalink / raw)
  To: ltp

Hi!
> > diff --git a/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c b/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
> > index b9739db37cb7..67917b3fea25 100644
> > --- a/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
> > +++ b/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
> > @@ -90,6 +90,9 @@ static void setup(void)
> >  	unsigned int i;
> >  	tst_require_root();
> >  
> > +	if (tst_is_virt(VIRT_ANY))
> > +		tst_brkm(TCONF, NULL, "running in a virtual machine, overclock not reliably measureable");
> > +
> >  	for (i = 0; i < ARRAY_SIZE(cdrv); ++i) {
> >  		fd = open(cdrv[i].file, O_RDWR);
> >  		if (fd == -1)
> > 
> 
> Optionally, under virtual machine the test failure could be converted to
> accepted pass. This would still allow to test CPUfreq boosting
> interface. Any preferences?

I wonder what is the likehood of actually dicovering a bug by writing to
the cpufreq boost file from within a VM, I guess that it's non-zero at
least.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] device-drivers/cpufreq_boost: skip test on virtual machines
  2021-06-23 11:38   ` Cyril Hrubis
@ 2021-06-23 15:33     ` Krzysztof Kozlowski
  2021-08-11 10:12       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2021-06-23 15:33 UTC (permalink / raw)
  To: ltp

On 23/06/2021 13:38, Cyril Hrubis wrote:
> Hi!
>>> diff --git a/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c b/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
>>> index b9739db37cb7..67917b3fea25 100644
>>> --- a/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
>>> +++ b/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
>>> @@ -90,6 +90,9 @@ static void setup(void)
>>>  	unsigned int i;
>>>  	tst_require_root();
>>>  
>>> +	if (tst_is_virt(VIRT_ANY))
>>> +		tst_brkm(TCONF, NULL, "running in a virtual machine, overclock not reliably measureable");
>>> +
>>>  	for (i = 0; i < ARRAY_SIZE(cdrv); ++i) {
>>>  		fd = open(cdrv[i].file, O_RDWR);
>>>  		if (fd == -1)
>>>
>>
>> Optionally, under virtual machine the test failure could be converted to
>> accepted pass. This would still allow to test CPUfreq boosting
>> interface. Any preferences?
> 
> I wonder what is the likehood of actually dicovering a bug by writing to
> the cpufreq boost file from within a VM, I guess that it's non-zero at
> least.

It's a test of kernel interface and whether the driver accepts input via
sysfs... so not much of a real cpufreq test. Indeed maybe better to skip
the test explicitly instead of giving some false hopes that cpufreq is
being tested.


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] device-drivers/cpufreq_boost: skip test on virtual machines
  2021-06-23 15:33     ` Krzysztof Kozlowski
@ 2021-08-11 10:12       ` Krzysztof Kozlowski
  2021-09-08 13:03           ` Cyril Hrubis
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2021-08-11 10:12 UTC (permalink / raw)
  To: ltp

On 23/06/2021 17:33, Krzysztof Kozlowski wrote:
> On 23/06/2021 13:38, Cyril Hrubis wrote:
>> Hi!
>>>> diff --git a/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c b/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
>>>> index b9739db37cb7..67917b3fea25 100644
>>>> --- a/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
>>>> +++ b/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
>>>> @@ -90,6 +90,9 @@ static void setup(void)
>>>>  	unsigned int i;
>>>>  	tst_require_root();
>>>>  
>>>> +	if (tst_is_virt(VIRT_ANY))
>>>> +		tst_brkm(TCONF, NULL, "running in a virtual machine, overclock not reliably measureable");
>>>> +
>>>>  	for (i = 0; i < ARRAY_SIZE(cdrv); ++i) {
>>>>  		fd = open(cdrv[i].file, O_RDWR);
>>>>  		if (fd == -1)
>>>>
>>>
>>> Optionally, under virtual machine the test failure could be converted to
>>> accepted pass. This would still allow to test CPUfreq boosting
>>> interface. Any preferences?
>>
>> I wonder what is the likehood of actually dicovering a bug by writing to
>> the cpufreq boost file from within a VM, I guess that it's non-zero at
>> least.
> 
> It's a test of kernel interface and whether the driver accepts input via
> sysfs... so not much of a real cpufreq test. Indeed maybe better to skip
> the test explicitly instead of giving some false hopes that cpufreq is
> being tested.

Hi Cyril and all,

Anything stops this patch from being applied?

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] device-drivers/cpufreq_boost: skip test on virtual machines
@ 2021-09-08 13:03           ` Cyril Hrubis
  0 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2021-09-08 13:03 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: ltp

Hi!
> Hi Cyril and all,
> 
> Anything stops this patch from being applied?

Thanks for the reminded, pushed.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-09-08 13:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23  8:01 [LTP] [PATCH] device-drivers/cpufreq_boost: skip test on virtual machines Krzysztof Kozlowski
2021-06-23  8:11 ` Krzysztof Kozlowski
2021-06-23 11:38   ` Cyril Hrubis
2021-06-23 15:33     ` Krzysztof Kozlowski
2021-08-11 10:12       ` Krzysztof Kozlowski
2021-09-08 13:03         ` Cyril Hrubis
2021-09-08 13:03           ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.