Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-09-01 Thread Jason J. Herne
On 08/01/2015 05:40 AM, Paolo Bonzini wrote: On 31/07/2015 20:11, Jason J. Herne wrote: Doh! Yep :). This problem is an artifact of moving the timer_mod from cpu_throttle_thread into cpu_throttle_timer_tick. I'll have to go back to the review comments and look at why that was done. So, we

Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-08-01 Thread Paolo Bonzini
On 31/07/2015 20:11, Jason J. Herne wrote: >>> >> >> Doh! Yep :). This problem is an artifact of moving the timer_mod from >> cpu_throttle_thread into cpu_throttle_timer_tick. I'll have to go back >> to the review comments and look at why that was done. > > So, we made that change in v3 to elimi

Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-07-31 Thread Jason J. Herne
On 07/31/2015 01:42 PM, Jason J. Herne wrote: On 07/31/2015 01:16 PM, Paolo Bonzini wrote: On 31/07/2015 19:12, Jason J. Herne wrote: Throttle ratio is relative to CPU_THROTTLE_TIMESLICE. Take a look at how throttle_ratio is used in the calculation: long sleeptime_ms = (long)(throttle_ra

Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-07-31 Thread Jason J. Herne
On 07/31/2015 01:16 PM, Paolo Bonzini wrote: On 31/07/2015 19:12, Jason J. Herne wrote: Throttle ratio is relative to CPU_THROTTLE_TIMESLICE. Take a look at how throttle_ratio is used in the calculation: long sleeptime_ms = (long)(throttle_ratio * CPU_THROTTLE_TIMESLICE); A value of 1 me

Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-07-31 Thread Paolo Bonzini
On 31/07/2015 19:12, Jason J. Herne wrote: >> >> > > Throttle ratio is relative to CPU_THROTTLE_TIMESLICE. Take a look at how > throttle_ratio is used in the calculation: > > long sleeptime_ms = (long)(throttle_ratio * CPU_THROTTLE_TIMESLICE); > > A value of 1 means we sleep the same amount of

Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-07-31 Thread Jason J. Herne
On 07/23/2015 05:59 AM, Paolo Bonzini wrote: On 16/07/2015 16:21, Jason J. Herne wrote: 1. Using atomic operations to manage throttle_percentage. I'm not sure where atomics are applicable here. If this is still a concern hopefully someone can explain. I would use atomic_read/atomic_set in cp

Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-07-23 Thread Paolo Bonzini
On 16/07/2015 16:21, Jason J. Herne wrote: > 1. Using atomic operations to manage throttle_percentage. I'm not sure > where atomics are applicable here. If this is still a concern hopefully > someone can explain. I would use atomic_read/atomic_set in cpu_throttle_set, cpu_throttle_stop, cpu_thr

Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-07-16 Thread Jason J. Herne
On 07/15/2015 08:54 AM, Paolo Bonzini wrote: On 15/07/2015 14:40, Jason J. Herne wrote: I'm not sure how callbacks can pile up here. If the vcpus are running then their thread's will execute the callbacks. If they are not running then the use of QEMU_CLOCK_VIRTUAL_RT will prevent the callbacks

Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-07-15 Thread Paolo Bonzini
On 15/07/2015 14:40, Jason J. Herne wrote: >>> I'm not sure how callbacks can pile up here. If the vcpus are >>> running then their thread's will execute the callbacks. If they >>> are not running then the use of QEMU_CLOCK_VIRTUAL_RT will >>> prevent the callbacks from stacking because the timer

Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-07-15 Thread Jason J. Herne
On 07/13/2015 11:14 AM, Paolo Bonzini wrote: On 13/07/2015 16:43, Jason J. Herne wrote: +CPU_FOREACH(cpu) { +async_run_on_cpu(cpu, cpu_throttle_thread, NULL); +} + +timer_mod(throttle_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) + + CPU

Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-07-13 Thread Paolo Bonzini
On 13/07/2015 16:43, Jason J. Herne wrote: >>> >>> +CPU_FOREACH(cpu) { >>> +async_run_on_cpu(cpu, cpu_throttle_thread, NULL); >>> +} >>> + >>> +timer_mod(throttle_timer, >>> qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) + >>> + CPU_THROTTLE_TIMESLI

Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-07-13 Thread Jason J. Herne
On 07/02/2015 12:43 PM, Paolo Bonzini wrote: On 02/07/2015 18:36, Jason J. Herne wrote: +static void cpu_throttle_thread(void *opaque) +{ +double pct = (double)throttle_percentage/100; +double throttle_ratio = pct / (1 - pct); +long sleeptime_ms = (long)(throttle_ratio * CPU_THROTT

Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-07-02 Thread Dr. David Alan Gilbert
* Paolo Bonzini (pbonz...@redhat.com) wrote: > > > On 02/07/2015 18:36, Jason J. Herne wrote: > > +static void cpu_throttle_thread(void *opaque) > > +{ > > +double pct = (double)throttle_percentage/100; > > +double throttle_ratio = pct / (1 - pct); > > +long sleeptime_ms = (long)(thro

Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-07-02 Thread Andreas Färber
Am 02.07.2015 um 18:36 schrieb Jason J. Herne: > Provide a method to throttle guest cpu execution. CPUState is augmented with > timeout controls and throttle start/stop functions. To throttle the guest cpu > the caller simply has to call the throttle set function and provide a > percentage > of th

Re: [Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-07-02 Thread Paolo Bonzini
On 02/07/2015 18:36, Jason J. Herne wrote: > +static void cpu_throttle_thread(void *opaque) > +{ > +double pct = (double)throttle_percentage/100; > +double throttle_ratio = pct / (1 - pct); > +long sleeptime_ms = (long)(throttle_ratio * CPU_THROTTLE_TIMESLICE); > + > +if (!throttl

[Qemu-devel] [PATCH v4 1/5] cpu: Provide vcpu throttling interface

2015-07-02 Thread Jason J. Herne
Provide a method to throttle guest cpu execution. CPUState is augmented with timeout controls and throttle start/stop functions. To throttle the guest cpu the caller simply has to call the throttle set function and provide a percentage of throttle time. Signed-off-by: Jason J. Herne Reviewed-by: