Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2031806pxb; Thu, 11 Feb 2021 02:28:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJyAM/gpQDk2etzpTLmOzib+hAMhuWb1HOd9sqnqa8HyLVUBoeB77StAsVr6RDnEndQTgEds X-Received: by 2002:a50:b765:: with SMTP id g92mr7779241ede.317.1613039336675; Thu, 11 Feb 2021 02:28:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613039336; cv=none; d=google.com; s=arc-20160816; b=uT9rRp/tRFBAd0M/RIEjSiO8CkGFaxAsAcZIKPoQE3/XtqUMMlHDhmbuG4ud4ryrTy jWikJKO5H6kSFlkKf4LWopaGkKBOj/T7i5jSgHvRrLuW3IZnVQtG1DGvcYzFUzZXkP7n x114Xa0fuGrSyE1v3tIlKikjkvc05YGJU/ZXTnmRB2+No/go+Hd7MlTBTla81PLidJKZ rsL1mXDmucw2FDT3CRLrZKOR4vY5CxlKhkcjxBMUfow/A3N0AlfI7VOBKEWHWbeqj3vI h7omL84ueyk1nvzqB6HNmmPNZuVi7/cSIz4qtxd1QQwShcT/XWm61+Q/nkmL6FVPomHw IzpQ== 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=SWMed6FoAO7HQVHfzyv7tnKVfSi8G2deciS5xMF5yCJIZxUhf296TWOK5+AwivtSQ8 9M1JET4NJtP9wDvuCVYQZ0Ey5EBg5ev7RIifs7NmrqHnkhNyr2tycUGVQ2Vi5qgronYV cRZ/jy7mGIGi4F8Pj1t5m+CQVQUVHfwKoD8gdNo9gDirNeRFHy/Y/elOLgt8dJrcdVB2 EDV4t+/sWCCEAg4qcNn9Vsco6w06Am2brZTYNnyktL4/34ssYbQaEx8KSAcK6t3D8Y4o YPv8JSlNC/CCu+bkYjGvIcZxzkHq1vCEhAn8upDN7Oxz2MHpFu2JUvZ0GrZxOrEfJhcu Mr/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="LmkY0cY/"; 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 u22si3492240ejf.705.2021.02.11.02.28.32; Thu, 11 Feb 2021 02:28:56 -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="LmkY0cY/"; 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 S229867AbhBKK0w (ORCPT + 99 others); Thu, 11 Feb 2021 05:26:52 -0500 Received: from mx2.suse.de ([195.135.220.15]:42450 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229919AbhBKKVN (ORCPT ); Thu, 11 Feb 2021 05:21:13 -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=1613038661; 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=LmkY0cY/xUPQabBZ2K6py6iwlNSohSvZqtVGIKhgfs/Vd+e3i0HPowZRhK5GJgyUl5o28/ Lx47YRJ3EXvR1/z8sPJDmrvUc6rf00u386Gf1+f8cdN9vhlSbjkIEU7foEmfSwD4BZQf/a zldb9aBFKnXvuTux4U/p6Gw35AZbFbs= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6FD2CAF49; Thu, 11 Feb 2021 10:17:41 +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 v2 7/8] xen/evtch: use smp barriers for user event ring Date: Thu, 11 Feb 2021 11:16:15 +0100 Message-Id: <20210211101616.13788-8-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210211101616.13788-1-jgross@suse.com> References: <20210211101616.13788-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