From: John Levon Subject: Re: timer_mode default change?!? Date: Fri, 10 Oct 2008 00:57:57 +0100 Message-ID: <20081009235757.GA9490@totally.trollied.org.uk> References: <20080930220706.GB1748@totally.trollied.org.uk> <37cd8e50-d7df-4d13-8572-a52b3f7b7e54@default> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <37cd8e50-d7df-4d13-8572-a52b3f7b7e54@default> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Dan Magenheimer Cc: "Xen-Devel (E-mail)" , Keir Fraser List-Id: xen-devel@lists.xenproject.org On Thu, Oct 09, 2008 at 10:50:05PM +0000, Dan Magenheimer wrote: > > > Huh? > > > guest prefers timer_mode==1. > > > > Solaris does :) > > Perhaps you can explain what timer_mode==1 does then? > how it differs from timer_mode==0 and timer_mode==2) > never quite understood it and an attempt to document timer_mode > that I posted several months ago left timer_mode==1 rather > vague. Here's a copy of an explanation found etched on a mysterious rock in the Sinai desert (that is, I was forwarded it): """ Timer_mode 0/1 track exact number of timer interrupt which need be injected to guest. If timer interrupts cannot be injected on time, pending_count++. The difference is that for mode 0, guest TSC is also hold back if there are timer interrupts pending, while for mode 1 guest TSC always equals to (host TSC - constant offset) Time mode 2/3 don't inject each pending time interrupt to guest, hoping guest OS itself can handle time interrupt lost and adjust time using platform timer (e.g. HPET)'s counter. """ Empirically, timer mode of 0 makes Solaris SMP almost unusable. Timer mode 0 makes it run OK. I've never been quite able to get my head around exactly why it makes such a big difference. We use the TSC as the basis of our hres timer by default, and there is code that implements microsecond waits by busy-waiting for this value to reach a certain point. My suspicion is that with timer_mode=0, we spend all of time busy-waiting since the TSC doesn't jump forward to the host's TSC, but that doesn't really explain why SMP is bad and UP is OK. regards john