All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: stable@vger.kernel.org
Subject: [PATCH v2 02/13] xen/events: add a proper barrier to 2-level uevent unmasking
Date: Tue,  3 Nov 2020 15:13:10 +0100	[thread overview]
Message-ID: <20201103141321.20346-3-jgross@suse.com> (raw)
In-Reply-To: <20201103141321.20346-1-jgross@suse.com>

A follow-up patch will require certain write to happen before an event
channel is unmasked.

While the memory barrier is not strictly necessary for all the callers,
the main one will need it. In order to avoid an extra memory barrier
when using fifo event channels, mandate evtchn_unmask() to provide
write ordering.

The 2-level event handling unmask operation is missing an appropriate
barrier, so add it. Fifo event channels are fine in this regard due to
using sync_cmpxchg().

This is part of XSA-332.

This is upstream commit 4d3fe31bd993ef504350989786858aefdb877daa

Cc: stable@vger.kernel.org
Suggested-by: Julien Grall <julien@xen.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Wei Liu <wl@xen.org>
---
 drivers/xen/events/events_2l.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/xen/events/events_2l.c b/drivers/xen/events/events_2l.c
index 8edef51c92e5..e4b75693600e 100644
--- a/drivers/xen/events/events_2l.c
+++ b/drivers/xen/events/events_2l.c
@@ -91,6 +91,8 @@ static void evtchn_2l_unmask(unsigned port)
 
 	BUG_ON(!irqs_disabled());
 
+	smp_wmb();	/* All writes before unmask must be visible. */
+
 	if (unlikely((cpu != cpu_from_evtchn(port))))
 		do_hypercall = 1;
 	else {
-- 
2.26.2


  parent reply	other threads:[~2020-11-03 14:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03 14:13 [PATCH v2 00/13] Backport of patch series for stable 5.4 branch Juergen Gross
2020-11-03 14:13 ` [PATCH v2 01/13] xen/events: avoid removing an event channel while handling it Juergen Gross
2020-11-03 14:13 ` Juergen Gross [this message]
2020-11-03 14:13 ` [PATCH v2 03/13] xen/events: fix race in evtchn_fifo_unmask() Juergen Gross
2020-11-03 14:13 ` [PATCH v2 04/13] xen/events: add a new "late EOI" evtchn framework Juergen Gross
2020-11-03 14:13 ` [PATCH v2 05/13] xen/blkback: use lateeoi irq binding Juergen Gross
2020-11-03 14:13 ` [PATCH v2 06/13] xen/netback: " Juergen Gross
2020-11-03 14:13 ` [PATCH v2 07/13] xen/scsiback: " Juergen Gross
2020-11-03 14:13 ` [PATCH v2 08/13] xen/pvcallsback: " Juergen Gross
2020-11-03 14:13 ` [PATCH v2 09/13] xen/pciback: " Juergen Gross
2020-11-03 14:13 ` [PATCH v2 10/13] xen/events: switch user event channels to lateeoi model Juergen Gross
2020-11-03 14:13 ` [PATCH v2 11/13] xen/events: use a common cpu hotplug hook for event channels Juergen Gross
2020-11-03 14:13 ` [PATCH v2 12/13] xen/events: defer eoi in case of excessive number of events Juergen Gross
2020-11-03 14:13 ` [PATCH v2 13/13] xen/events: block rogue events for some time Juergen Gross
2020-11-03 16:21 ` [PATCH v2 00/13] Backport of patch series for stable 5.4 branch Greg KH

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=20201103141321.20346-3-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=stable@vger.kernel.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.