From: Dor Laor <dlaor@redhat.com>
To: "David S. Ahern" <daahern@cisco.com>
Cc: Anthony Liguori <anthony@codemonkey.ws>,
Jan Kiszka <jan.kiszka@web.de>,
Marcelo Tosatti <mtosatti@redhat.com>,
Avi Kivity <avi@redhat.com>, kvm-devel <kvm@vger.kernel.org>
Subject: Re: [PATCH] kvm-userspace: Make PC speaker emulation aware of in-kernel PIT
Date: Tue, 28 Apr 2009 10:02:16 +0300 [thread overview]
Message-ID: <49F6A9F8.1040308@redhat.com> (raw)
In-Reply-To: <49F689B3.6090109@cisco.com>
David S. Ahern wrote:
> Anthony Liguori wrote:
>
>> 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.
>>
>
>
> You are considering timekeeping activities only.
>
> RHEL4 for example reads the PIT for each gettimeofday call. For
> applications that add timestamps to logging the PIT is a *HUGE* overhead
> (and the PMTMR for that matter). I have one example where something like
> 15% of each second is wasted handling the ioport reads and writes for
> get_offset_pit.
>
> david
>
>
I found the link to the previous discussion about moving the pit to
userspace:
http://www.mail-archive.com/kvm@vger.kernel.org/msg02357.html
In the above discussion Marcelo pointed out that we need the pit in the
kernel is
order to have the timer and the vcpu thread running on the same cpu.
Otherwise
IPIs will be sent from the io-thread to the vcpu thread in order of
injection the irq.
I guess we can also do it also using specific timer thread in userspace,
but it is getting
more complex.
btw: I found a type in the patch in the line below:
"fprintf(stderr, "Create kernel PIC irqchip failed\n");"
s/PIC/PIT/
>
>> 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
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2009-04-28 7:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-23 20:24 [PATCH] kvm-userspace: Make PC speaker emulation aware of in-kernel PIT Jan Kiszka
2009-04-25 0:13 ` Marcelo Tosatti
2009-04-25 13:08 ` Anthony Liguori
2009-04-25 16:28 ` Jan Kiszka
2009-04-25 19:59 ` Anthony Liguori
2009-04-27 13:00 ` Sheng Yang
2009-04-28 4:44 ` David S. Ahern
2009-04-28 7:02 ` Dor Laor [this message]
2009-04-27 22:32 ` Marcelo Tosatti
2009-05-04 9:34 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49F6A9F8.1040308@redhat.com \
--to=dlaor@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=daahern@cisco.com \
--cc=jan.kiszka@web.de \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox