From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH] kvm-userspace: Make PC speaker emulation aware of in-kernel PIT Date: Sat, 25 Apr 2009 14:59:11 -0500 Message-ID: <49F36B8F.2090405@codemonkey.ws> References: <49F0CE65.4050005@web.de> <20090425001319.GB15144@amt.cnet> <49F30B55.6050207@codemonkey.ws> <49F33A1A.3060201@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , Avi Kivity , kvm-devel To: Jan Kiszka Return-path: Received: from mail-gx0-f166.google.com ([209.85.217.166]:53114 "EHLO mail-gx0-f166.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752084AbZDYT7Q (ORCPT ); Sat, 25 Apr 2009 15:59:16 -0400 Received: by gxk10 with SMTP id 10so3446055gxk.13 for ; Sat, 25 Apr 2009 12:59:15 -0700 (PDT) In-Reply-To: <49F33A1A.3060201@web.de> Sender: kvm-owner@vger.kernel.org List-ID: Jan Kiszka wrote: > Anthony Liguori wrote: > >> Marcelo Tosatti wrote: >> >>> Jan, >>> >>> While the patch itself looks fine, IMO it would be better to move all >>> of the timer handling to userspace, except the performance critical >>> parts, >>> since most of it is generic. Either periodic or one-shot timer, with: >>> >>> >> The reason for having the PIT in-kernel is not performance. The PIT is >> not performance sensitive. >> > > I think that depends. Some OSes (in some configurations) use the PIT > counter as clock source and/or program it regularly in one-shot mode. An > aging use case, but still a valid one. > I can't find the thread, but this has been discussed at length before. The justification has always been for time drift correction. If you crunch the numbers, even at a 1024HZ, there just aren't enough exits to really make a difference from a performance perspective. Just to state it more clearly, if you assume an additional 5us to drop to userspace (which is absurdly high, but let's stick with it), 1024 exits per second comes out to about 5ms which is only 0.5% in terms of CPU consumption. The APIC is quite a bit more understandable because especially with SMP, you can generate a very high number of interrupts per second and taking a drop to userspace for every EOI can be start to matter with exit rates in the hundreds of thousands. >> It's because it was easier to do interrupt catch-up by pushing the PIT >> into the kernel which IMHO was the wrong path to go down. >> > > Pushing the emulation of port 0x61 into the kernel was a mistake we now > have to deal with. I'm not that sure about the PIT itself. > I agree re: port 0x61. I'm just saying that there is no point in moving just the non "performance critical" components to userspace as Marcelo suggests because the whole thing is non "performance critical". Regards, Anthony Liguori