Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2987866imu; Sun, 9 Dec 2018 14:23:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/XMfCF2+cto4f6KuGUc+BU2ylbQscxjvdRtSGiqhPppAMuAIOK10lr2zY3zJSjGMHJua325 X-Received: by 2002:a17:902:6113:: with SMTP id t19mr9567622plj.248.1544394197039; Sun, 09 Dec 2018 14:23:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544394197; cv=none; d=google.com; s=arc-20160816; b=KOgIabLh46q9BFuBLx2P5lK5Cjn0XbQV9BaI9i9XhscwUUUeDvEXwn//TEVVtY8eDY Ch+UjIossoO2epqTllOlYyU3Tr5r3uRahgtHG+InjVv9jQgPFzJY0urEXxE5eK3QFW+j Swo0foxjoNnQRlxfXvT6XKEhq7h8bb39pO25ctTjdBDwiBshRvLFBSY9uq+x6Z/i6vEv plwLExd+rvzcUHb4sXTzSsCR0p5wxE4UhupGF1JZuxw2R6N4R6sZ6kp6igEM15kDm0cf P9/mMAU9V7jYGWTks4/IoYk4sEi6KZTM24FkojLGsKXwY+xIGn8viDoQIrQjB8kfkXT7 nP3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=QJ18fhfSymeo1/9Omn90TMNyuICysdZles/H7ujgOls=; b=G9WhOkUwguK6UuSm0QBbQO8lag2K4VM8Q5Ig0DIWYF3i5pyGnck0xmMDqvyD2zbu00 CtMLrko7v9kTchW2smdClNFan5MIIEk7cgpu77I8lrzmiQruDnHmwj5+qTQ32Tuy5MRo j1QIRz6yDZLQeuzGJwnip+Shyjsuyus3XGY0aVFQ3TEANn2i3w0e3DpdvZphwReDv/Q1 xj7Y4JfUmjOYO9YED2Di1KBaelFDzCuNTw8coZsA5n0dYwgLBMCaR9nstlvfbiFQPrMi fdbbSB6JWYFzfKGngJOleWYchNNBejVwxc6xaOVI3plqsFJsRAc9CmtisqAznPtNDzuW 6Quw== 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 h129si9489067pfb.253.2018.12.09.14.23.01; Sun, 09 Dec 2018 14:23:17 -0800 (PST) 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 S1727850AbeLIWUf (ORCPT + 99 others); Sun, 9 Dec 2018 17:20:35 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:35406 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726549AbeLIVzY (ORCPT ); Sun, 9 Dec 2018 16:55:24 -0500 Received: from pub.yeoldevic.com ([81.174.156.145] helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gW72n-0002io-Sg; Sun, 09 Dec 2018 21:55:22 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gW72l-0003gY-8b; Sun, 09 Dec 2018 21:55:19 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Eric Dumazet" , bp@alien8.de, "Peter Zijlstra" , "Thomas Gleixner" , eric.dumazet@gmail.com, hpa@zytor.com Date: Sun, 09 Dec 2018 21:50:33 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 311/328] x86/percpu: Fix this_cpu_read() In-Reply-To: X-SA-Exim-Connect-IP: 81.174.156.145 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.62-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Peter Zijlstra commit b59167ac7bafd804c91e49ad53c6d33a7394d4c8 upstream. 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 Link: https://lkml.kernel.org/r/20181011104019.748208519@infradead.org [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- arch/x86/include/asm/percpu.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- 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__) \ : constraint); \ break; \ case 2: \ - asm(op "w "__percpu_arg(1)",%0" \ + asm volatile(op "w "__percpu_arg(1)",%0"\ : "=r" (pfo_ret__) \ : constraint); \ break; \ case 4: \ - asm(op "l "__percpu_arg(1)",%0" \ + asm volatile(op "l "__percpu_arg(1)",%0"\ : "=r" (pfo_ret__) \ : constraint); \ break; \ case 8: \ - asm(op "q "__percpu_arg(1)",%0" \ + asm volatile(op "q "__percpu_arg(1)",%0"\ : "=r" (pfo_ret__) \ : constraint); \ break; \