Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2631682pxb; Sat, 6 Feb 2021 02:58:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRhS/rbqbQvkd+2tluTU7dQPnFde06WEj1KEhL9V3O11y9GEPB2w4+krMfIq5KLYSWcFG6 X-Received: by 2002:a05:6402:3198:: with SMTP id di24mr7880638edb.340.1612609104948; Sat, 06 Feb 2021 02:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612609104; cv=none; d=google.com; s=arc-20160816; b=jLl9FYBGCTGCh463xbu6tRPXBmqDCSsOVgJG+ocqQZCsyncgs7j3TqZ1yDpP05dcvk tPwkugutjH3kJvC12pm63PqQ8cYArqHTRp8kapgBu4rVOv0l3u91RHmX9D3A3O/1yVRB TLxgYzrfGL9LSK3oHgvwCCMge+/ff9JrcyLRJPZxmOA41HDUHBc2kt6dw69HxF2pkbof DyzbH7fPPZX2klrOoud9Ef540yG/BGOPMft2rBz8GzbVpdab1UXIQH1bFbQWLwaRcHuX RLP9mTTB5oPlCryu4O4+Q8P8II4g3P4IFQeWe6bOeIQxhMb7vnEovL6YebM7h+pO/FpA ajEA== 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=+KP59jAs7saISZqMq/sKJ7ioUVrcML6xC9JkBIsqGnM=; b=FA4hcCSww4BH7d/iTBLbIocIWF/3Tmi5KX+lT9d+DoQ6DCio8VB+8ZZXXL6TO57Klq vEn7qkFQRGXEeDHb/Qtd7yWxgFbrGALmM9QWL6cq6R/vxP5msIKihBke7YhIW29u5k5r m1bxl94yDCQGtNy3k7xxuW8fHzansTbqQWxgzHaPdSVY/tLJ4mZkjbqP7sxIc0ocTY5t 10khk/RLlJAAc7f+Xo7RCmNzJrGyJ6vNGVPgrUlbkwwuuAJ3nzDwELXe1BuaWN/9Jk9N GyqX7oIcm01v9/qUxrzRDmTNTfFfjcFl0d4XEGIc4wlKO6Q9D5ysAeWXcoAeUAnRNZ9C bELg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=TsFTkQEp; 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 g13si7016377eds.52.2021.02.06.02.58.00; Sat, 06 Feb 2021 02:58:24 -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=TsFTkQEp; 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 S229931AbhBFKxe (ORCPT + 99 others); Sat, 6 Feb 2021 05:53:34 -0500 Received: from mx2.suse.de ([195.135.220.15]:52952 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229783AbhBFKvb (ORCPT ); Sat, 6 Feb 2021 05:51:31 -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=1612608588; 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=+KP59jAs7saISZqMq/sKJ7ioUVrcML6xC9JkBIsqGnM=; b=TsFTkQEp8+BbnvC9FjNahPV9/OMDu5YaNXS+RFx2/56hsUmQ/m0XUeQohZt+9dc2pfi1Mn ZU+VYw6cMqbxpx1pFdD2FvUGZB/ZCLAbWKkk91aj4rxBdlcpSAkz8uFWYX1MaivEDbUOI9 oCisMByJFL/PfB9JBHXl3fq+xzZFIRs= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 14272AEC4; Sat, 6 Feb 2021 10:49:48 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: Juergen Gross , Boris Ostrovsky , Stefano Stabellini Subject: [PATCH 7/7] xen/evtchn: read producer index only once Date: Sat, 6 Feb 2021 11:49:32 +0100 Message-Id: <20210206104932.29064-8-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210206104932.29064-1-jgross@suse.com> References: <20210206104932.29064-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In evtchn_read() use READ_ONCE() for reading the producer index in order to avoid the compiler generating multiple accesses. Signed-off-by: Juergen Gross --- drivers/xen/evtchn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index 421382c73d88..f6b199b597bf 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c @@ -211,7 +211,7 @@ static ssize_t evtchn_read(struct file *file, char __user *buf, goto unlock_out; c = u->ring_cons; - p = u->ring_prod; + p = READ_ONCE(u->ring_prod); if (c != p) break; -- 2.26.2