From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Vivier Subject: Re: [PATCH v2] kvm: Fix accounting of interrupts during guest execution on s390 Date: Thu, 15 Nov 2007 16:24:07 +0100 Message-ID: <1195140247.4704.14.camel@frecb07144> 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: multipart/mixed; boundary="===============1222879754==" Cc: kvm-devel , Avi Kivity 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 --===============1222879754== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-pufQkiXosHbFhkZbwE/C" --=-pufQkiXosHbFhkZbwE/C Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable If I remember correctly time accounting on s390 is more accurate than on x86 ? Because on x86, as we make the kvm_guest_exit() after local_irq_enable() we can also have IRQ with PF_VCPU set... and we discussed a lot on probability to know if it was good or not. And on x86 it seems good because it is already working like that with system and user time (we account time to the space where tick appears). see http://lkml.org/lkml/2007/10/15/228 Laurent Le jeudi 15 novembre 2007 =C3=A0 15:10 +0100, Christian Borntraeger a =C3= =A9crit : > 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. >=20 > Currently the scheduler checks for PF_VCPU to decide if this > timeslice has to be accounted as guest time. On s390 host=20 > 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. >=20 > Avi, Ingo, Laurent, feedback is welcome. >=20 > 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(-) >=20 > Index: kvm/kernel/sched.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- kvm.orig/kernel/sched.c > +++ kvm/kernel/sched.c > @@ -3395,10 +3395,8 @@ void account_system_time(struct task_str > struct rq *rq =3D this_rq(); > cputime64_t tmp; > =20 > - if (p->flags & PF_VCPU) { > - account_guest_time(p, cputime); > - return; > - } > + if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset =3D=3D 0)) > + return account_guest_time(p, cputime); > =20 > p->stime =3D cputime_add(p->stime, cputime); > =20 >=20 > ------------------------------------------------------------------------- > 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/ > _______________________________________________ > kvm-devel mailing list > kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > https://lists.sourceforge.net/lists/listinfo/kvm-devel --=20 ------------- Laurent.Vivier-6ktuUTfB/bM@public.gmane.org -------------- "Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke --=-pufQkiXosHbFhkZbwE/C Content-Type: application/pgp-signature; name=signature.asc Content-Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?= -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBHPGSX9Kffa9pFVzwRAmUeAJ9I+tpZX4gLiZTIrR7RvGpJOZtJ3QCfXEyz 1eVC20UnRLw3JEUcxPZdqI8= =sLpz -----END PGP SIGNATURE----- --=-pufQkiXosHbFhkZbwE/C-- --===============1222879754== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- 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/ --===============1222879754== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel --===============1222879754==--