xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Malcolm Crossley <malcolm.crossley@citrix.com>,
	Keir Fraser <keir.xen@gmail.com>, "Tim (Xen.org)" <tim@xen.org>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v2 1/2] x86: defer processing events on the NMI exit path
Date: Fri, 1 Mar 2013 11:37:10 +0000	[thread overview]
Message-ID: <513092E6.80902@citrix.com> (raw)
In-Reply-To: <5130977202000078000C250E@nat28.tlf.novell.com>

On 01/03/13 10:56, Jan Beulich wrote:
> Otherwise, we may end up in the scheduler, keeping NMIs masked for a
> possibly unbounded period of time (until whenever the next IRET gets
> executed). Enforce timely event processing by sending a self IPI.
>
> Of course it's open for discussion whether to always use the straight
> exit path from handle_ist_exception.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> v2: Send IPI to ourselves to enforce event processing. Dropped all ACKs.
>
> --- a/xen/arch/x86/x86_64/compat/entry.S
> +++ b/xen/arch/x86/x86_64/compat/entry.S
> @@ -171,7 +171,7 @@ compat_bad_hypercall:
>          jmp  compat_test_all_events
>  
>  /* %rbx: struct vcpu, interrupts disabled */
> -compat_restore_all_guest:
> +ENTRY(compat_restore_all_guest)
>          ASSERT_INTERRUPTS_DISABLED
>          RESTORE_ALL adj=8 compat=1
>  .Lft0:  iretq
> --- a/xen/arch/x86/x86_64/entry.S
> +++ b/xen/arch/x86/x86_64/entry.S
> @@ -11,6 +11,7 @@
>  #include <asm/apicdef.h>
>  #include <asm/page.h>
>  #include <public/xen.h>
> +#include <irq_vectors.h>
>  
>          ALIGN
>  /* %rbx: struct vcpu */
> @@ -635,6 +636,9 @@ ENTRY(early_page_fault)
>          jmp   restore_all_xen
>          .popsection
>  
> +ENTRY(nmi)
> +        pushq $0
> +        movl  $TRAP_nmi,4(%rsp)
>  handle_ist_exception:
>          SAVE_ALL
>          testb $3,UREGS_cs(%rsp)
> @@ -649,12 +653,25 @@ handle_ist_exception:
>          movzbl UREGS_entry_vector(%rsp),%eax
>          leaq  exception_table(%rip),%rdx
>          callq *(%rdx,%rax,8)
> -        jmp   ret_from_intr
> +        cmpb  $TRAP_nmi,UREGS_entry_vector(%rsp)
> +        jne   ret_from_intr
>  
> -ENTRY(nmi)
> -        pushq $0
> -        movl  $TRAP_nmi,4(%rsp)
> -        jmp   handle_ist_exception
> +        /* We want to get straight to the IRET on the NMI exit path. */
> +        testb $3,UREGS_cs(%rsp)
> +        jz    restore_all_xen
> +        GET_CURRENT(%rbx)
> +        /* Send an IPI to ourselves to cover for the lack of event checking. */
> +        movl  VCPU_processor(%rbx),%eax
> +        shll  $IRQSTAT_shift,%eax
> +        leaq  irq_stat(%rip),%rcx
> +        cmpl  $0,(%rcx,%rax,1)

__softirq_pending is an unsigned long.  Would it not be prudent to use
cmpq to save obscure bugs if the implementation changes, or are we
sufficiently sure that this wont happen?

~Andrew

> +        je    1f
> +        movl  $EVENT_CHECK_VECTOR,%edi
> +        call  send_IPI_self
> +1:      movq  VCPU_domain(%rbx),%rax
> +        cmpb  $0,DOMAIN_is_32bit_pv(%rax)
> +        je    restore_all_guest
> +        jmp   compat_restore_all_guest
>  
>  ENTRY(nmi_crash)
>          pushq $0
>
>
>

  reply	other threads:[~2013-03-01 11:37 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22 15:00 [PATCH V3] vmx/nmi: Do not use self_nmi() in VMEXIT handler Andrew Cooper
2012-11-22 15:15 ` Jan Beulich
2012-11-22 15:16   ` Andrew Cooper
2012-11-22 15:21     ` Jan Beulich
2012-11-22 15:37       ` Andrew Cooper
2012-11-22 15:55         ` Jan Beulich
2012-11-22 16:05           ` Andrew Cooper
2012-11-22 16:12             ` Jan Beulich
2012-11-22 16:31               ` Andrew Cooper
2013-02-28  9:58             ` Jan Beulich
2013-02-28 12:32               ` Andrew Cooper
2013-02-28 13:00               ` Tim Deegan
2013-02-28 13:12                 ` Andrew Cooper
2013-02-28 13:39                 ` Jan Beulich
2013-02-28 14:25                   ` Tim Deegan
2013-02-28 14:42                     ` Jan Beulich
2013-02-28 14:45                       ` Andrew Cooper
2013-02-28 14:49                       ` Tim Deegan
2013-02-28 15:01                         ` Jan Beulich
2013-02-28 15:41                       ` Jan Beulich
2013-02-28 15:52                         ` Andrew Cooper
2013-02-28 15:55                         ` Tim Deegan
2013-02-28 16:12                           ` Jan Beulich
2013-02-28 16:01                         ` Keir Fraser
2013-02-28 16:17                           ` Jan Beulich
2013-02-28 19:02                             ` Keir Fraser
2013-03-01 10:49                               ` [PATCH v2 0/2] x86: defer processing events on the NMI exit path Jan Beulich
2013-03-01 10:56                                 ` [PATCH v2 1/2] " Jan Beulich
2013-03-01 11:37                                   ` Andrew Cooper [this message]
2013-03-01 11:53                                     ` Jan Beulich
2013-03-01 15:56                                       ` Keir Fraser
2013-03-01 16:01                                         ` Andrew Cooper
2013-03-01 16:08                                           ` Jan Beulich
2013-03-01 10:57                                 ` [PATCH v2 2/2] x86: don't rely on __softirq_pending to be the first field in irq_cpustat_t Jan Beulich
2013-03-01 15:55                                 ` [PATCH v2 0/2] x86: defer processing events on the NMI exit path Keir Fraser
2013-02-28 13:42                 ` [PATCH V3] vmx/nmi: Do not use self_nmi() in VMEXIT handler Jan Beulich
2013-02-28 14:04                   ` Tim Deegan
2013-02-28 14:51                 ` Konrad Rzeszutek Wilk
2012-11-22 15:22     ` Mats Petersson
2012-11-22 16:00       ` Jan Beulich
2012-11-22 17:34 ` Tim Deegan
2012-11-26 11:50   ` George Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=513092E6.80902@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir.xen@gmail.com \
    --cc=malcolm.crossley@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).