softmmu/dirtylimit: Implement virtual CPU throttle

Setup a negative feedback system when vCPU thread
handling KVM_EXIT_DIRTY_RING_FULL exit by introducing
throttle_us_per_full field in struct CPUState. Sleep
throttle_us_per_full microseconds to throttle vCPU
if dirtylimit is in service.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <977e808e03a1cef5151cae75984658b6821be618.1656177590.git.huangy81@chinatelecom.cn>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
Hyman Huang(黄勇) 2022-06-26 01:38:35 +08:00 committed by Dr. David Alan Gilbert
parent 4a06a7cc05
commit baa609832e
5 changed files with 338 additions and 1 deletions

View file

@ -418,6 +418,12 @@ struct CPUState {
*/
bool throttle_thread_scheduled;
/*
* Sleep throttle_us_per_full microseconds once dirty ring is full
* if dirty page rate limit is enabled.
*/
int64_t throttle_us_per_full;
bool ignore_memory_transaction_failures;
/* Used for user-only emulation of prctl(PR_SET_UNALIGN). */