From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: gettimeofday "slow" in RHEL4 guests Date: Mon, 29 Dec 2008 18:29:15 +0200 Message-ID: <4958FADB.60306@redhat.com> References: <492AE8AC.2090502@cisco.com> <492B8204.5@cisco.com> <87d4gkcdsy.fsf@basil.nowhere.org> <426B9829-823B-40BE-9A7E-9F7EF2ED3412@suse.de> <20081125114815.GG6703@one.firstfloor.org> <20081125125259.GH6703@one.firstfloor.org> <20081228183807.GA3883@amt.cnet> <4958CC9A.5050008@redhat.com> <4958F6E7.9020309@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , "Yang, Sheng" , Alexander Graf , "David S. Ahern" , kvm-devel , Glauber de Oliveira Costa , Gleb Natapov To: dlaor@redhat.com Return-path: Received: from mx2.redhat.com ([66.187.237.31]:43327 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751529AbYL2Q3Y (ORCPT ); Mon, 29 Dec 2008 11:29:24 -0500 In-Reply-To: <4958F6E7.9020309@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Dor Laor wrote: >>> >>> + if (atomic_read(&pt->pending) > 1) >>> + atomic_set(&pt->pending, 1); >>> + >>> >> >> Replace the atomic_inc() with atomic_set(, 1) instead? One less test, >> and more important, the logic is scattered less around the source. > But having only a pending bit instead of a counter will cause kvm to > drop pit irqs on rare high load situations. > The disable reinjection option is better. Both variants disable reinjection. Forcing a counter to 1 every time it exceeds 1 is equivalent to maintaining a bit. In both variants, there is a missing 'if (disable_reinjection)' (Marcelo mentioned this in the original message). > Except for these 'tsc compensate' guest, what are the occasions where > the guest writes his tsc? > If this is the only case we can disable reinjection once we trap tsc > writes. I don't think these guests write to the tsc. Rather, they read the tsc and the pit counters and try to correlate. And fail. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.