Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1975032pxx; Sat, 31 Oct 2020 04:32:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyX6EC8nfhkRWiV/Pv78I+sMqqDafBxdSHVQBCjTKXM0VRjaFZR9rZsvZp5kdQml2K9rZqa X-Received: by 2002:a17:906:c114:: with SMTP id do20mr6622667ejc.169.1604143950249; Sat, 31 Oct 2020 04:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604143950; cv=none; d=google.com; s=arc-20160816; b=ZX+teyAD7yKVdEha6VQ6qOXCHldkR1mPZTMgA2spnnbBW/KBIFluxmY8kDNeAltdRQ QGindq90Xackn+0Jvf68Mlf6p0uI60PMJZR7e6TlhdFINZ1EXHOFq4b/HUuuRrUfl78U mPP6C949iBlwTwRvrBQK36Cv4CIQZaMWZ6+2mXLfz+yLow1ReV/xn7sN23//7fyrI3U5 igh0SJRMYtGB49r6HcrKzY++Hz5cKGCXpB6imafxxdBU3cm8OtmUkzGQTVXJx8BiLgfN R11LwHHKfovLJpK1oOVvY17eDicEG41WDpktVwFgoYvRbr1tVuJVTXBCmcJxEzY5E7n7 ejTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=WPebnvNRiqX7QhCj9a2SOjvwfUZxd5GMQdlKZqwMIGc=; b=omfGsxtJwu5vOsODrmBMWTBINCQBLEIGhaE/ZG2WKSBPlvndxqIm1lMhzWCOYUXi6l V1UqyUUxXpfEkeZQfQexvVsarvSQN3PYeuukrVF3i1bfFpxBfDB1BijczbxeTCSX0ZjP kRkM11OHqPtxeqncp3UJtkzanr+dUfoR5awOPlN+sz9kDYvzZImYwR7fKbHkiIvAWQoV 8uuT7ZusqhUkAFI11tPj0QKSEifheceXxUpufTod38hw4v94Z9l0UAGHpMmZfqA9HY1/ vZgkdZsQXy5n3a4KTTJQdTqQ+CoqU2G1ZRVCe61FoFfff+4rV+Kg/yeQEk7Tw3uREOoJ T+Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hwFcqJhT; dkim=neutral (no key) header.i=@linutronix.de header.b=fCDRGst3; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u25si6537476eds.353.2020.10.31.04.32.07; Sat, 31 Oct 2020 04:32:30 -0700 (PDT) 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=@linutronix.de header.s=2020 header.b=hwFcqJhT; dkim=neutral (no key) header.i=@linutronix.de header.b=fCDRGst3; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726935AbgJaLak (ORCPT + 99 others); Sat, 31 Oct 2020 07:30:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726815AbgJaLaf (ORCPT ); Sat, 31 Oct 2020 07:30:35 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C06FFC0613D7; Sat, 31 Oct 2020 04:30:34 -0700 (PDT) Date: Sat, 31 Oct 2020 11:30:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1604143833; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WPebnvNRiqX7QhCj9a2SOjvwfUZxd5GMQdlKZqwMIGc=; b=hwFcqJhTNL8TPLQYQouKKnNKxmPhQc6+Qgba7oPDQeBKNZrgvuB5RjEuzIf7YJPjGeqeLh mOZthXNxDHtZh1kw+djSwJpxHewutRUSenY4mrBjCTJRG+z2Cb7hjDtDOE6o1uEAxQEgf2 2xIBo8EZf6P0ddbGkDoV7vNST1StMoW1IycXKV646BwiFAPqLjmvophbZyWRKmxqzoyMMl bXJnRQl5ydFH8cCD3ZqyPot139QCQSBUlS26yKeRhTcBkVuCdzdmJuPxlVBJXSi9bhQpE0 P8v+fyxGMBaeCiY+ZNrekvLWEkZqAEedyJKL3PduYRVSt3tySqV5iRdJ461CIw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1604143833; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WPebnvNRiqX7QhCj9a2SOjvwfUZxd5GMQdlKZqwMIGc=; b=fCDRGst3JYHVnCkxOrH560KuHhWI5u5WL1wPTGYSwmd9aAh3nmmsYpdQPxfjZMlKOy/tBQ X9NkUa7zuSl9N5Aw== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/urgent] locking/lockdep: Remove more raw_cpu_read() usage Cc: "Peter Zijlstra (Intel)" , x86 , LKML In-Reply-To: <20201026152256.GB2651@hirez.programming.kicks-ass.net> References: <20201026152256.GB2651@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Message-ID: <160414383224.397.2729117464840782339.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/urgent branch of tip: Commit-ID: d48e3850030623e1c20785bceaaf78f916d0b1a3 Gitweb: https://git.kernel.org/tip/d48e3850030623e1c20785bceaaf78f916d0b1a3 Author: Peter Zijlstra AuthorDate: Mon, 26 Oct 2020 16:22:56 +01:00 Committer: Peter Zijlstra CommitterDate: Fri, 30 Oct 2020 17:07:18 +01:00 locking/lockdep: Remove more raw_cpu_read() usage I initially thought raw_cpu_read() was OK, since if it is !0 we have IRQs disabled and can't get migrated, so if we get migrated both CPUs must have 0 and it doesn't matter which 0 we read. And while that is true; it isn't the whole store, on pretty much all architectures (except x86) this can result in computing the address for one CPU, getting migrated, the old CPU continuing execution with another task (possibly setting recursion) and then the new CPU reading the value of the old CPU, which is no longer 0. Similer to: baffd723e44d ("lockdep: Revert "lockdep: Use raw_cpu_*() for per-cpu variables"") Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20201026152256.GB2651@hirez.programming.kicks-ass.net --- kernel/locking/lockdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index fc206ae..1102849 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -84,7 +84,7 @@ static inline bool lockdep_enabled(void) if (!debug_locks) return false; - if (raw_cpu_read(lockdep_recursion)) + if (this_cpu_read(lockdep_recursion)) return false; if (current->lockdep_recursion)