Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2682759imm; Sun, 14 Oct 2018 02:17:43 -0700 (PDT) X-Google-Smtp-Source: ACcGV60XM2BH35yElpcOFllxRN26IV0cOqpb3K5TmAQSqK/h1daMBqOdTyLq9wLmBDfFlVOmaGxZ X-Received: by 2002:a62:68c3:: with SMTP id d186-v6mr4766591pfc.195.1539508663348; Sun, 14 Oct 2018 02:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539508663; cv=none; d=google.com; s=arc-20160816; b=v5esNC9vuBOZb+KzaKVsuSmaXlypa16U4cqbHTCb7Y3SDC4tyr5P7c6XVLmHbYMQ18 Z+hPpI5seP9Y9xbPo9ijZfi538wBv5uofmM216q37iIw5LDnKk/FvCeeFJhM/PLAttPJ WSVVoxi54bz0ZMh66kqyIZ3vx/vffehwxQHSW3cdCs3IUk2y5QJgm2VVbguV9021qiTF OXR+h5JZutkAuZ6D+q7sYRQJGuHB53IUH8LefUyuUYxIeq1cDoBUau8Ss/aRwQ+aGgqM JI7v2LnMh8+xAF6C3+W6gOfg7ChWALqdKT+wjhnLo8/QitwBLpKm+ic53fQyTYSc/CLR SSnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=NlgzoKOOLQsgVJNkW//7wTp+Ycoy1ZtqDBSfZCqeS5E=; b=dOAZWA59/fIzGtbSMWBOC7N/OPT9/nWtThfh2c8wOYsqzqBDRFXqTvCqIHYQCYBqzR hgi05cUPauDtf1tGLfAL2He1UVcmUSMPAj3hAy4Vcx5HyTQZ22XRF57RdcGWez8FlTsf KXLTbNAWdhFwzUIePxcnB6niWIN+qErrzqOXMsAsMC78ZFICDM6py5mP0EYEvkGf7ycN e0EILAytcNsYSrqtDe+YXDRDPpM8dwPQN4+ZaiVWTAhMfpvAKCBn12Xh4C03nGIBYMkP dupycM9EKpZwu5zQBMYppedQkDugNJlrNDjWmZIqYgm7JVj1rl3NmSWHqEp2fqP3GpQZ HIAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b35-v6si2725806plh.177.2018.10.14.02.17.27; Sun, 14 Oct 2018 02:17:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726602AbeJNQ5U (ORCPT + 99 others); Sun, 14 Oct 2018 12:57:20 -0400 Received: from terminus.zytor.com ([198.137.202.136]:35079 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726352AbeJNQ5T (ORCPT ); Sun, 14 Oct 2018 12:57:19 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w9E9Gb6u3116981 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 14 Oct 2018 02:16:37 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w9E9GXZu3116954; Sun, 14 Oct 2018 02:16:33 -0700 Date: Sun, 14 Oct 2018 02:16:33 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Peter Zijlstra Message-ID: Cc: hpa@zytor.com, edumazet@google.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@kernel.org Reply-To: edumazet@google.com, hpa@zytor.com, mingo@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org, tglx@linutronix.de In-Reply-To: <20181011104019.748208519@infradead.org> References: <20181011104019.748208519@infradead.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/percpu: Fix this_cpu_read() Git-Commit-ID: b59167ac7bafd804c91e49ad53c6d33a7394d4c8 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-0.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_48_96 autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: b59167ac7bafd804c91e49ad53c6d33a7394d4c8 Gitweb: https://git.kernel.org/tip/b59167ac7bafd804c91e49ad53c6d33a7394d4c8 Author: Peter Zijlstra AuthorDate: Thu, 11 Oct 2018 12:38:27 +0200 Committer: Thomas Gleixner CommitDate: Sun, 14 Oct 2018 11:11:22 +0200 x86/percpu: Fix this_cpu_read() Eric reported that a sequence count loop using this_cpu_read() got optimized out. This is wrong, this_cpu_read() must imply READ_ONCE() because the interface is IRQ-safe, therefore an interrupt can have changed the per-cpu value. Fixes: 7c3576d261ce ("[PATCH] i386: Convert PDA into the percpu section") Reported-by: Eric Dumazet Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Thomas Gleixner Acked-by: Eric Dumazet Cc: hpa@zytor.com Cc: eric.dumazet@gmail.com Cc: bp@alien8.de Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20181011104019.748208519@infradead.org --- arch/x86/include/asm/percpu.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index e9202a0de8f0..1a19d11cfbbd 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h @@ -185,22 +185,22 @@ do { \ typeof(var) pfo_ret__; \ switch (sizeof(var)) { \ case 1: \ - asm(op "b "__percpu_arg(1)",%0" \ + asm volatile(op "b "__percpu_arg(1)",%0"\ : "=q" (pfo_ret__) \ : "m" (var)); \ break; \ case 2: \ - asm(op "w "__percpu_arg(1)",%0" \ + asm volatile(op "w "__percpu_arg(1)",%0"\ : "=r" (pfo_ret__) \ : "m" (var)); \ break; \ case 4: \ - asm(op "l "__percpu_arg(1)",%0" \ + asm volatile(op "l "__percpu_arg(1)",%0"\ : "=r" (pfo_ret__) \ : "m" (var)); \ break; \ case 8: \ - asm(op "q "__percpu_arg(1)",%0" \ + asm volatile(op "q "__percpu_arg(1)",%0"\ : "=r" (pfo_ret__) \ : "m" (var)); \ break; \