Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp8114426pxb; Fri, 19 Feb 2021 07:44:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHml+5ftAMlHHirtd50eguqeQ1hS6JOyYOahTODarzs/bradh159yp9+qlrYutR2V7cila X-Received: by 2002:a17:906:38a:: with SMTP id b10mr9336228eja.438.1613749499804; Fri, 19 Feb 2021 07:44:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613749499; cv=none; d=google.com; s=arc-20160816; b=cRVuLqiQBplZbXUyFqB2gXxvs5Cl5i6iaSK6pNLRNxygLhT9nDCOJOQwafNGFw7gjD 6G9onCIEbO8TkQiTWuHqRxrQlFQkLlm+OWBNMjORC5uCWdQ+QnrlSRGlKWO08SMRypWn qPZEkPfevu11FDZIXlRDkHTAwBVug+cEvVmfFJGAUaHNgGFRVR1R9ibiLs5iDJyhSNZh 7hVZ9okY91wr0BaG375TM9mKDDIdUtxV41/IP2iF4VgsFyNqJbGxPBtomfVDV7emKT/n KZ9Dzl6PcNT8NvC0S2MleQT9osyVjrP/ci7t8Zr9E76e7phsBzQrAa+E+Q6eQpBriL1b P3lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nYiBLOOS0jKaGXZR/xdp5WHTi+5sOW1v2m88NDrZNbI=; b=zQ2PfCk4/P8bXUCEKfx2NEMX+sq1Zx7QTmRHbv/v/J+dQs2B9IPF1AcK0q3+N0ixns OB/WR0DzatwbIqw2q7D3QoZAa899KYMTKAAntgf6cnzRypowg0xrHXH6X6TNnA7LusgE oavO3FRcvSQRbytnu9gWzHIZfKJ5eqAvZGBzw2zIYrFYwD7DUNNIw80u2GMttf1ciJMi mTg8XLx2C+WCBVmFUAtdFvH2bbOrwbN5LcuCgqMsxwuiOiXA7+//QjYvforDKiLeaPH5 1IRuN+VMyabToJk25eYS4Pe1EFClvxBd3VsiOFMrHQ2DaHwAVCRtca/C/oAPqALJhtij Doww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=mqlyaLZe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp8si5821065ejc.253.2021.02.19.07.44.35; Fri, 19 Feb 2021 07:44:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=mqlyaLZe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230020AbhBSPnq (ORCPT + 99 others); Fri, 19 Feb 2021 10:43:46 -0500 Received: from mx2.suse.de ([195.135.220.15]:48184 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229943AbhBSPmO (ORCPT ); Fri, 19 Feb 2021 10:42:14 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1613749239; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nYiBLOOS0jKaGXZR/xdp5WHTi+5sOW1v2m88NDrZNbI=; b=mqlyaLZe/YgvYSsQIvPpN9XoaMOuiHW3Pbur9d3Wz3NOMHY4Oy4s66u3aQWq9fxarixX/O Ey3afn8U9k0KK6JKqUCXGc1zWME5EppFL1W/JOkfTp3ilVzkPrWMZUrxql+Y+EqqtO2aWl dpSxPChifLttkm90i7WQkWP8NL1KFr4= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8FC36B114; Fri, 19 Feb 2021 15:40:39 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: Juergen Gross , Boris Ostrovsky , Stefano Stabellini , Andrew Cooper , Jan Beulich Subject: [PATCH v3 7/8] xen/evtchn: use smp barriers for user event ring Date: Fri, 19 Feb 2021 16:40:29 +0100 Message-Id: <20210219154030.10892-8-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219154030.10892-1-jgross@suse.com> References: <20210219154030.10892-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ring buffer for user events is local to the given kernel instance, so smp barriers are fine for ensuring consistency. Reported-by: Andrew Cooper Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- drivers/xen/evtchn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index a7a85719a8c8..421382c73d88 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c @@ -173,7 +173,7 @@ static irqreturn_t evtchn_interrupt(int irq, void *data) if ((u->ring_prod - u->ring_cons) < u->ring_size) { *evtchn_ring_entry(u, u->ring_prod) = evtchn->port; - wmb(); /* Ensure ring contents visible */ + smp_wmb(); /* Ensure ring contents visible */ if (u->ring_cons == u->ring_prod++) { wake_up_interruptible(&u->evtchn_wait); kill_fasync(&u->evtchn_async_queue, @@ -245,7 +245,7 @@ static ssize_t evtchn_read(struct file *file, char __user *buf, } rc = -EFAULT; - rmb(); /* Ensure that we see the port before we copy it. */ + smp_rmb(); /* Ensure that we see the port before we copy it. */ if (copy_to_user(buf, evtchn_ring_entry(u, c), bytes1) || ((bytes2 != 0) && copy_to_user(&buf[bytes1], &u->ring[0], bytes2))) -- 2.26.2