All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>, xen-devel@lists.xen.org
Subject: Re: [PATCH 1/3] x86/xen: use memory barriers when enabling local irqs
Date: Tue, 13 Aug 2013 11:18:41 -0400	[thread overview]
Message-ID: <520A4E51.1080102@oracle.com> (raw)
In-Reply-To: <1376404296-7012-2-git-send-email-david.vrabel@citrix.com>

On 08/13/2013 10:31 AM, David Vrabel wrote:
> From: David Vrabel <david.vrabel@citrix.com>
>
> Because vcpu->evtchn_upcall_mask and vcpu->evtchn_upcall_pending are
> be written by Xen as well as the guest, using barrier() (a
> compiler-only barrier) in xen_enable_irq() and xen_restore_fl() is not
> sufficient.

Unneeded 'be' and xen_enable_irq -> xen_irq_enable
>
> Use mb() (a full memory barrier) instead.

Are evtchn_upcall_mask and evtchn_upcall_pending written from the same
(physical) processor during the potential race? If yes then I am not sure
this will make any difference since I think sysret/iret, syscall and 
interrupts
have implicit mfence.

It won't hurt to have mb(), all I am trying to say that this may not be 
the cause
of lost events.

-boris

>
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
> ---
>   arch/x86/xen/irq.c |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/xen/irq.c b/arch/x86/xen/irq.c
> index 01a4dc0..1a8d0d4 100644
> --- a/arch/x86/xen/irq.c
> +++ b/arch/x86/xen/irq.c
> @@ -60,7 +60,7 @@ static void xen_restore_fl(unsigned long flags)
>   
>   	if (flags == 0) {
>   		preempt_check_resched();
> -		barrier(); /* unmask then check (avoid races) */
> +		mb(); /* unmask then check (avoid races) */
>   		if (unlikely(vcpu->evtchn_upcall_pending))
>   			xen_force_evtchn_callback();
>   	}
> @@ -93,7 +93,7 @@ static void xen_irq_enable(void)
>   	/* Doesn't matter if we get preempted here, because any
>   	   pending event will get dealt with anyway. */
>   
> -	barrier(); /* unmask then check (avoid races) */
> +	mb(); /* unmask then check (avoid races) */
>   	if (unlikely(vcpu->evtchn_upcall_pending))
>   		xen_force_evtchn_callback();
>   }

  parent reply	other threads:[~2013-08-13 15:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-13 14:31 [PATCH 0/3] Linux: fix some event handling bugs David Vrabel
2013-08-13 14:31 ` [PATCH 1/3] x86/xen: use memory barriers when enabling local irqs David Vrabel
2013-08-13 15:16   ` Jan Beulich
2013-08-13 15:18   ` Boris Ostrovsky [this message]
2013-08-13 14:31 ` [PATCH 2/3] x86/xen: disable premption " David Vrabel
2013-08-13 14:31 ` [PATCH 3/3] xen/events: document behaviour when scanning the start word for events David Vrabel
2013-08-13 14:49 ` [PATCH 0/3] Linux: fix some event handling bugs David Vrabel

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=520A4E51.1080102@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.