From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH] kvm-vmx: add module parameter to avoid trapping HLT instructions (v2) Date: Sat, 04 Dec 2010 07:48:51 -0600 Message-ID: <4CFA46C3.5000805@codemonkey.ws> References: <1291298357-5695-1-git-send-email-aliguori@us.ibm.com> <20101202173733.GA26342@amt.cnet> <4CF97258.9010808@codemonkey.ws> <4CF9F8E2.4030602@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org, Chris Wright , Srivatsa Vaddagiri To: Avi Kivity Return-path: Received: from mail-yw0-f46.google.com ([209.85.213.46]:43948 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755177Ab0LDNsy (ORCPT ); Sat, 4 Dec 2010 08:48:54 -0500 Received: by ywl5 with SMTP id 5so5258753ywl.19 for ; Sat, 04 Dec 2010 05:48:53 -0800 (PST) In-Reply-To: <4CF9F8E2.4030602@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 12/04/2010 02:16 AM, Avi Kivity wrote: > On 12/04/2010 12:42 AM, Anthony Liguori wrote: >> >> In v3, I set the activity state to ACTIVE if the state is currently >> HLT when injecting an exception into a guest. >> >> The effect is that after the exception is handled, if iret is >> executed, the hlt instruction will be restarted. The seems like the >> correct semantics to me. > > No, an interrupt causes the HLT to be executed, and rip advanced past > it. You need to preserve this (both for interrupts and for the apf > completion exception). Yeah, I see in the architecture manual it specifically calls out the rip advancing after NMI. It doesn't say anything about debug exceptions though. It's not clear to me if some exceptions cause hlt to be skipped and others not. But then again, skipping hlt seems to be the most conservative thing to do for all exceptions because it's always going to be run in a loop. Regards, Anthony Liguori