From: Tim Deegan Subject: Re: [Patch] x86/HVM: Fix RTC interrupt modelling Date: Mon, 10 Feb 2014 13:19:10 +0100 Message-ID: <20140210121910.GA1370@deinos.phlegethon.org> References: <1392031068-21943-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1392031068-21943-1-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: George Dunlap , Roger Pau =?iso-8859-1?Q?Monn=E9?= , Keir Fraser , Jan Beulich , Xen-devel List-Id: xen-devel@lists.xenproject.org At 11:17 +0000 on 10 Feb (1392027468), Andrew Cooper wrote: > The current code has a pathological case, tickled by the access pattern of > Windows 2003 Server SP2. Occasonally on boot (which I presume is during a > time calibration against the RTC Periodic Timer), Windows gets stuck in an > infinite loop reading RTC REG_C. This affects 32 and 64 bit guests. > > In the pathological case, the VM state looks like this: > * RTC: 64Hz period, periodic interrupts enabled > * RTC_IRQ in IOAPIC as vector 0xd1, edge triggered, not pending > * vector 0xd1 set in LAPIC IRR and ISR, TPR at 0xd0 > * Reads from REG_C return 'RTC_PF | RTC_IRQF' > > With an intstrumented Xen, dumping the periodic timers with a guest in this > state shows a single timer with pt->irq_issued=1 and pt->pending_intr_nr=2. > > Windows is presumably waiting for reads of REG_C to drop to 0 s/presumably/definitely/; we disassembled the kernel code in question. >, and reading > REG_C clears the value each time in the emulated RTC. However: > > * {svm,vmx}_intr_assist() calls pt_update_irq() unconditionally. > * pt_update_irq() always finds the RTC as earliest_pt. This is, AFAICT, because we are in no-missed-ticks mode, and there are multiple RTC ticks queued waiting to be delivered. Cheers, Tim.