Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-23 Thread Hyman Huang
在 2022/1/17 15:32, Peter Xu 写道: On Wed, Jan 05, 2022 at 01:14:08AM +0800, huang...@chinatelecom.cn wrote: ## +# @DirtyLimitInfo: +# +# Dirty page rate limit information of virtual CPU. +# +# @cpu-index: index of virtual CPU. +# +# @limit-rate: upper limit of dirty page rate for virtual CPU.

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-23 Thread Peter Xu
On Sat, Jan 22, 2022 at 11:54:07AM +0800, Hyman Huang wrote: > > > > +static void *dirtylimit_thread(void *opaque) > > > +{ > > > +CPUState *cpu; > > > + > > > +rcu_register_thread(); > > > + > > > +while (!qatomic_read(&dirtylimit_quit)) { > > > +sleep(DIRTYLIMIT_CALC_TIME_MS

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-21 Thread Hyman Huang
+static void *dirtylimit_thread(void *opaque) +{ +CPUState *cpu; + +rcu_register_thread(); + +while (!qatomic_read(&dirtylimit_quit)) { +sleep(DIRTYLIMIT_CALC_TIME_MS / 1000); Sorry to have not mentioned this: I think we probably don't even need this dirtylimit thread. It

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-21 Thread Hyman Huang
Again, I won't ask for a good algorithm as the 1st version, but then I think it's nicer we have the simplest algorithm merged first, which should be very easy to verify. Hi, Peter, i'm working on simplifying the algorithm. Current throttle logic is like the following: 1. If error value(|qu

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-21 Thread Peter Xu
On Fri, Jan 21, 2022 at 04:07:24PM +0800, Hyman Huang wrote: > Hi, Peter, i'm working on simplifying the algorithm. > Current throttle logic is like the following: > > 1. If error value(|quota - current|) less than 25MB/s, we assert throttle > already done and do nothing. > > 2. Start to throttle

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-20 Thread Peter Xu
On Thu, Jan 20, 2022 at 07:03:30PM +0800, Hyman Huang wrote: > Ok, i'll try this out. You could even add a unit test if you want: see test_migrate_auto_converge() in migration-test.c. -- Peter Xu

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-20 Thread Hyman Huang
在 2022/1/20 17:25, Peter Xu 写道: ... I think what you explained makes sense to me. Note that there's also the reaper thread running in the background that can reap all the cores too. It only runs once per second so it shouldn't bring a lot of differences, but I'm also wondering whether we s

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-20 Thread Hyman Huang
在 2022/1/19 20:16, Markus Armbruster 写道: huang...@chinatelecom.cn writes: From: Hyman Huang(黄勇) 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

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-20 Thread Hyman Huang
在 2022/1/20 18:56, Peter Xu 写道: On Thu, Jan 20, 2022 at 06:39:01PM +0800, Hyman Huang wrote: It only runs once per second so it shouldn't bring a lot of differences, but I'm also wondering whether we should also turn that temporarily off too when dirtylimit is enabled - we can simply let it k

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-20 Thread Hyman Huang
在 2022/1/20 17:25, Peter Xu 写道: On Thu, Jan 20, 2022 at 04:26:09PM +0800, Hyman Huang wrote: Hi,Peter. I'm working on this problem and found the reason is kind of the same as i metioned in cover letter of v10, the following is what i posted: 2. The new implementaion of throttle algo enlig

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-20 Thread Peter Xu
On Thu, Jan 20, 2022 at 06:03:45PM +0800, Hyman Huang wrote: > > > 在 2022/1/20 17:25, Peter Xu 写道: > > On Thu, Jan 20, 2022 at 04:26:09PM +0800, Hyman Huang wrote: > > > Hi,Peter. I'm working on this problem and found the reason is kind of the > > > same as i metioned in cover letter of v10, the

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-20 Thread Peter Xu
On Thu, Jan 20, 2022 at 06:39:01PM +0800, Hyman Huang wrote: > > It only runs once per second so it shouldn't bring a lot of differences, but > > I'm also wondering whether we should also turn that temporarily off too when > > dirtylimit is enabled - we can simply let it keep sleeping if dirtylimit

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-20 Thread Peter Xu
On Thu, Jan 20, 2022 at 04:26:09PM +0800, Hyman Huang wrote: > Hi,Peter. I'm working on this problem and found the reason is kind of the > same as i metioned in cover letter of v10, the following is what i posted: > > 2. The new implementaion of throttle algo enlightened by Peter > responds

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-20 Thread Hyman Huang
在 2022/1/17 15:32, Peter Xu 写道: On Wed, Jan 05, 2022 at 01:14:08AM +0800, huang...@chinatelecom.cn wrote: ## +# @DirtyLimitInfo: +# +# Dirty page rate limit information of virtual CPU. +# +# @cpu-index: index of virtual CPU. +# +# @limit-rate: upper limit of dirty page rate for virtual CPU.

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-19 Thread Markus Armbruster
huang...@chinatelecom.cn writes: > From: Hyman Huang(黄勇) > > 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 ena

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-17 Thread Hyman Huang
在 2022/1/18 9:00, Peter Xu 写道: On Mon, Jan 17, 2022 at 10:00:57PM +0800, Hyman Huang wrote: This algorithm seems works even worse than the previous version, could you have a look on what's wrong? What number the dirty-ring-size of qemu be configured? is it the same as previous version test?

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-17 Thread Peter Xu
On Mon, Jan 17, 2022 at 10:00:57PM +0800, Hyman Huang wrote: > > This algorithm seems works even worse than the previous version, could you > > have > > a look on what's wrong? > What number the dirty-ring-size of qemu be configured? is it the same as > previous version test? It should be the sam

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-17 Thread Hyman Huang
On 1/17/22 15:32, Peter Xu wrote: On Wed, Jan 05, 2022 at 01:14:08AM +0800, huang...@chinatelecom.cn wrote: ## +# @DirtyLimitInfo: +# +# Dirty page rate limit information of virtual CPU. +# +# @cpu-index: index of virtual CPU. +# +# @limit-rate: upper limit of dirty page rate for virtual CP

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-17 Thread Peter Xu
On Wed, Jan 05, 2022 at 01:14:08AM +0800, huang...@chinatelecom.cn wrote: > +uint32_t kvm_dirty_ring_size(void) > +{ > +return kvm_state->kvm_dirty_ring_size; > +} You may need to touch up stub too to fix build on non-x86: = diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-st

Re: [PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-16 Thread Peter Xu
On Wed, Jan 05, 2022 at 01:14:08AM +0800, huang...@chinatelecom.cn wrote: > ## > +# @DirtyLimitInfo: > +# > +# Dirty page rate limit information of virtual CPU. > +# > +# @cpu-index: index of virtual CPU. > +# > +# @limit-rate: upper limit of dirty page rate for virtual CPU. > +# > +# @current-rat

[PATCH v11 3/4] softmmu/dirtylimit: implement virtual CPU throttle

2022-01-04 Thread huangy81
From: Hyman Huang(黄勇) 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 enabled. Start a thread to track current dirty pa