WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] NMI handling in HVM

To: "Lv, Hui" <hui.lv@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] NMI handling in HVM
From: Keir Fraser <keir@xxxxxxx>
Date: Fri, 31 Dec 2010 09:01:01 +0000
Cc:
Delivery-date: Fri, 31 Dec 2010 01:02:00 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:user-agent:date :subject:from:to:message-id:thread-topic:thread-index:in-reply-to :mime-version:content-type:content-transfer-encoding; bh=jiiQ/bBPxBBH59auj+Xal9eiTnd3uUeLFB6qVLd60fo=; b=ugMO4W26YvWHGjoTmDt1HBaFbAc52z+xSEcyFPGhrcw3KryL3uhvxceVnansjPcB3l x+HZTPrLapMKj3mmgrkuKMFLeOPPW3la0gqFSoygYx5xde3zeN7My8q6tJwHr+Dhvpy/ wu/yBzm4bUtl33xFzPUpS5MLpXh7d4q1UkNLQ=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:user-agent:date:subject:from:to:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; b=n8u4B5WZ5iXgJF/EyJNizV2LXwQlJlNv7yK/pb4J7nfBCFXiXa2vvGf097bneoQ4uq TH1YuLAys1iKV+O5GOstAIkV4mAAQnd/7TNxhU6Lvw6l06XJabnlp+PKm/Gc/WigEBtU Bz2agM0Sgeuea/yVZUPpogMI4RxsZY6iD5LNg=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C10D3FB0CD45994C8A51FEC1227CE22F1DC19AA50C@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acuoi1ahb1EiyPEIQnCr0nCxd0SaowAPehu1
Thread-topic: [Xen-devel] NMI handling in HVM
User-agent: Microsoft-Entourage/12.28.0.101117
Change needed to avoid getting a real NMI while handling the fake NMI
created by calling do_nmi() directly. It's a very valid fix.

You'll have to fix this subsequent issue by having a per-cpu bool_t exposed
from self_nmi():
 ...
 this_cpu(is_self_nmi) = 1;
 apic_icr_write(APIC_DM_NMI...);
 this_cpu(is_self_nmi) = 0;
 ...

You can check that flag from your NMI handler and if set, and current vcpu
is non-idle, you can go at guest_cpu_user_regs() to get the appropriate cpu
context for profiling. You could even do that check in the generic NMI
handler/dispatcher, and change the regs pointer you pass to the currently
registered specific NMI handler.

 -- Keir

On 31/12/2010 01:37, "Lv, Hui" <hui.lv@xxxxxxxxx> wrote:

> Dear all
>                 I saw a change about NMI handling in C/S 20059. So could
> anyone tell me what¹s the difference of these two ways?  We found that after
> changing to ?self_nmi()¹, xenoprofile cannot work correctly. Since
> ?self_nmi()¹ issue a hypervisor nmi and there is no change for xenoprofile to
> record HVM guest regs information.
> --- a/xen/arch/x86/hvm/vmx/vmx.c      Fri Aug 14 10:57:24 2009 +0100
> +++ b/xen/arch/x86/hvm/vmx/vmx.c      Fri Aug 14 10:58:32 2009 +0100
> @@ -945,8 +945,6 @@ static void vmx_enable_rdtsc_exiting(str
>     vmx_vmcs_exit(v);
>   }
>  
> -void do_nmi(struct cpu_user_regs *);
> -
>  static void vmx_init_hypercall_page(struct domain *d, void *hypercall_page)
>  {
>      char *p;
> @@ -2470,7 +2468,7 @@ asmlinkage void vmx_vmexit_handler(struc
>                  (X86_EVENTTYPE_NMI << 8) )
>                 goto exit_and_crash;
>             HVMTRACE_0D(NMI);
> -           do_nmi(regs); /* Real NMI, vector 2: normal processing. */
> +           self_nmi(); /* Real NMI, vector 2: normal processing. */
>             break;
>         case TRAP_machine_check:
>             HVMTRACE_0D(MCE);
>  
>  
> Best regards!
> Lv,hui
>  
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>