From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v2] kvm: Fix accounting of interrupts during guest execution on s390 Date: Thu, 15 Nov 2007 16:23:14 +0200 Message-ID: <473C5652.9070706@qumranet.com> References: <200711141632.37004.borntraeger@de.ibm.com> <200711141647.45810.borntraeger@de.ibm.com> <473B1C97.2010007@qumranet.com> <200711151510.37076.borntraeger@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel , Laurent Vivier To: Christian Borntraeger Return-path: In-Reply-To: <200711151510.37076.borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Christian Borntraeger wrote: > Avi pointed out, that my first patch was broken, here is the 2nd try. > I tested the patch on s390 with CONFIG_VIRT_CPU_ACCOUNTING and on x86_64. > Seems to work. > > Currently the scheduler checks for PF_VCPU to decide if this > timeslice has to be accounted as guest time. On s390 host > interrupts are not disabled during guest execution. This causes > theses interrupts to be accounted as guest time if > CONFIG_VIRT_CPU_ACCOUNTING is set. > Solution is to check if an interrupt triggered account_system_time. > As the tick is timer interrupt based, we have to subtract > hardirq_offset. > > Avi, Ingo, Laurent, feedback is welcome. > > CC: Ingo Molnar > CC: Avi Kivity > CC: Laurent Vivier > Signed-off-by: Christian Borntraeger > --- > kernel/sched.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > Index: kvm/kernel/sched.c > =================================================================== > --- kvm.orig/kernel/sched.c > +++ kvm/kernel/sched.c > @@ -3395,10 +3395,8 @@ void account_system_time(struct task_str > struct rq *rq = this_rq(); > cputime64_t tmp; > > - if (p->flags & PF_VCPU) { > - account_guest_time(p, cputime); > - return; > - } > + if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) > + return account_guest_time(p, cputime); > > p->stime = cputime_add(p->stime, cputime); > > What's irq_count()? Is it defined to ignore the timer tick? Or is that hardirq_offset? -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/