Re: [PATCH V3] KVM: selftests: Add a new option to rseq_test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 16, 2024, Zide Chen wrote:
> Currently, the migration worker delays 1-10 us, assuming that one
> KVM_RUN iteration only takes a few microseconds.  But if the CPU low
> power wakeup latency is large enough, for example, hundreds or even
> thousands of microseconds deep C-state exit latencies on x86 server
> CPUs, it may happen that it's not able to wakeup the target CPU before
> the migration worker starts to migrate the vCPU thread to the next CPU.
> 
> If the system workload is light, most CPUs could be at a certain low
> power state, which may result in less successful migrations and fail the
> migration/KVM_RUN ratio sanity check.  But this is not supposed to be
> deemed a test failure.
> 
> This patch adds a command line option to skip the sanity check in
> this case.
> 
> Signed-off-by: Zide Chen <zide.chen@xxxxxxxxx>
> Signed-off-by: donsheng <dongsheng.x.zhang@xxxxxxxxx>

Why does this have Donghsheng's SoB?  Is this a Co-developed-by situation?

> 

Put per-patch notes that aren't intended for the final changelog...

> V2:
> - removed the busy loop implementation
> - add the new "-s" option
> 
> V3:
> - drop the usleep randomization code
> - removed the term C-state for less confusion for non-x86 archetectures
> - changed subject
> ---

...down here below the "---", as this section is ignored by `git am`.  That way
the maintainer (me) doesn't need to manually delete the notes when applying.

>  tools/testing/selftests/kvm/rseq_test.c | 40 +++++++++++++++++++++++--
>  1 file changed, 38 insertions(+), 2 deletions(-)

> +static void help(const char *name)
> +{
> +	puts("");
> +	printf("usage: %s [-h] [-s]\n", name);
> +	printf(" -s: skip the sanity check for successful KVM_RUN.\n");

Hmm, -s ends up being somewhat confusing because "sanity" also starts with 's',
e.g. my first thought is that "./rseq_test -s" would be "run the test with sanity
checks".

Maybe -u for unchecked/unverified?

	printf(" -u: Don't sanity check the number of successful KVM_RUNs\n");

> @@ -254,9 +277,22 @@ int main(int argc, char *argv[])
>  	 * getcpu() to stabilize.  A 2:1 migration:KVM_RUN ratio is a fairly
>  	 * conservative ratio on x86-64, which can do _more_ KVM_RUNs than
>  	 * migrations given the 1us+ delay in the migration task.
> +	 *
> +	 * Another reason why it may have small migration:KVM_RUN ratio is that,
> +	 * on systems with large low power mode wakeup latency, it may happen
> +	 * quite often that the scheduler is not able to wake up the target CPU
> +	 * before the vCPU thread is scheduled to another CPU.
>  	 */
> -	TEST_ASSERT(i > (NR_TASK_MIGRATIONS / 2),
> -		    "Only performed %d KVM_RUNs, task stalled too much?", i);
> +	TEST_ASSERT(skip_sanity_check || i > (NR_TASK_MIGRATIONS / 1),
> +		    "Only performed %d KVM_RUNs, task stalled too much? \n"
> +		    "  Try to run it with -s option, or disable deep sleep "
> +		    "states in the system,\n"
> +		    "  e.g., boot the host with cpuidle.off=1 or other driver "
> +		    "specific kernel options,\n"
> +		    "  or do it through the PM QoS interface at runtime: \n"
> +		    "    cat > /dev/cpu_dma_latency <(echo -e -n "
> +		    "\"\\x0\\x0\\x0\\x0\"; sleep inf) &\n"
> +		    "    PID=$! && run_the_test && kill $PID" , i);

I appreciate trying to be helpful, but this is a bit too verbose.  I would also
prefer to call out the command line option last, e.g. so that readers don't
automatically rerun with the sanity check disabled without reading the rest of
the error message.

How about this?


	TEST_ASSERT(skip_sanity_check || i > (NR_TASK_MIGRATIONS / 1),
		    "Only performed %d KVM_RUNs, task stalled too much? \n"
                    "Try disabling deep sleep states to reduce CPU wakeup latency,\n"
		    "e.g. via cpuidle.off=1 or setting /dev/cpu_dma_latency to '0',\n"
                    "or run with -u to disable this sanity check", i);




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux