Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1022006yba; Thu, 4 Apr 2019 02:37:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJ9cIMTn+rCskJm2VmrnDGc/WocG+pUjdRh8cwb2w1NTMP+qQ+MHauC5pAG/SLKZv2/k3X X-Received: by 2002:a63:d709:: with SMTP id d9mr4658909pgg.38.1554370651702; Thu, 04 Apr 2019 02:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554370651; cv=none; d=google.com; s=arc-20160816; b=t3FqOC3o3XgYuq2u4rJN7g6sMfOMzY/D6yI7U4J1vuBjZ0bxXgK1ZL0pDFnytHMDL0 SWBdd0b349m+92KCJ9t5oW6JXIgFyICy89+YYLD+6Uj9NOvqssOmzEOxUf4OiltDG90q ZK8hWxS6cy8QayO/BEjJeauOQJFLRSDbzwVschTsNrt26FgEJ32h+z6+LrUR/uE4+LFZ 1RN+G3JwfFVj+jg9g/4smXlR4Wwe8nPrCCcRB7PCqmQySh1k2CTdcAfvnkDPVksRuLLM eJJatoCmd9SP6IcoP6Q48SJQXOvrEjAGYVDfRpJe0PMUgpcRzUBMvtSkAQQ5rNiAkdBK mYzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GigMqw3nIyXIn66OYwdvascJYdN5h0Q5IXxUnMfIFdM=; b=BsyRdJ3uHeW6mgLBhYhKQ+QBEHpB6/9O9dq3n88oC32jj3NH3f+G9A0BpjfdfhAcq9 6MjRjGD8q8bDPCw+9GOH2ftzFVxfMKuuyvMFk+rO0pSLNYV+OWeHZUjj3Yxp9/3BD35J ShI8usHJy4VYiTcEaK3avCelxe4OPyZLkTXRBKoQ0AI/etM3cv0XpJBKRBjx8sWbCdiy AYCnjT6wS5+vSxRzYUJLn6giJOi2InWv1u+6lqJAijAv54WIpxiaLfsTGP8ZWv34RTPJ FExUY7UDYP9OZGhqx1eA8Dnz+KV9RV689WaBjRQ28t52Pkj+BSQ8PbrkALyCmhsvk2Rj jj2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="emu/jmn3"; 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 a23si15540539pls.188.2019.04.04.02.37.16; Thu, 04 Apr 2019 02:37:31 -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; dkim=pass header.i=@kernel.org header.s=default header.b="emu/jmn3"; 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 S1732404AbfDDJGw (ORCPT + 99 others); Thu, 4 Apr 2019 05:06:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:45462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731941AbfDDJGu (ORCPT ); Thu, 4 Apr 2019 05:06:50 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D0A8721741; Thu, 4 Apr 2019 09:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368809; bh=xzvXvkrtfM/h0rsSkyA3vuJGj6xblDRKXTvSjLsT+cE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=emu/jmn3+E1B0r7dqpRtTWmGs+1jlsKEmCvtsHk/yQQZHU17f0IhYYL/KyrmAzG/6 BwhjUpCKxSi7NgSg5kPlpoUKMgfReuGW1kPcueTFkdTdEQx1c7dlWdvVs2HdfIwo3d Nu/IEF1sWUzUY82vw93tJ4MLd8zg68Q36NpaZWdk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Zijlstra , Valentin Schneider , Andrew Morton , Linus Torvalds , "Paul E. McKenney" , Thomas Gleixner , Will Deacon , cai@gmx.us, daniel.lezcano@linaro.org, dietmar.eggemann@arm.com, linux-arm-kernel@lists.infradead.org, longman@redhat.com, marc.zyngier@arm.com, mark.rutland@arm.com, Ingo Molnar , Sasha Levin Subject: [PATCH 4.19 162/187] cpu/hotplug: Mute hotplug lockdep during init Date: Thu, 4 Apr 2019 10:48:19 +0200 Message-Id: <20190404084610.733318212@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084603.119654039@linuxfoundation.org> References: <20190404084603.119654039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit ce48c457b95316b9a01b5aa9d4456ce820df94b4 ] Since we've had: commit cb538267ea1e ("jump_label/lockdep: Assert we hold the hotplug lock for _cpuslocked() operations") we've been getting some lockdep warnings during init, such as on HiKey960: [ 0.820495] WARNING: CPU: 4 PID: 0 at kernel/cpu.c:316 lockdep_assert_cpus_held+0x3c/0x48 [ 0.820498] Modules linked in: [ 0.820509] CPU: 4 PID: 0 Comm: swapper/4 Tainted: G S 4.20.0-rc5-00051-g4cae42a #34 [ 0.820511] Hardware name: HiKey960 (DT) [ 0.820516] pstate: 600001c5 (nZCv dAIF -PAN -UAO) [ 0.820520] pc : lockdep_assert_cpus_held+0x3c/0x48 [ 0.820523] lr : lockdep_assert_cpus_held+0x38/0x48 [ 0.820526] sp : ffff00000a9cbe50 [ 0.820528] x29: ffff00000a9cbe50 x28: 0000000000000000 [ 0.820533] x27: 00008000b69e5000 x26: ffff8000bff4cfe0 [ 0.820537] x25: ffff000008ba69e0 x24: 0000000000000001 [ 0.820541] x23: ffff000008fce000 x22: ffff000008ba70c8 [ 0.820545] x21: 0000000000000001 x20: 0000000000000003 [ 0.820548] x19: ffff00000a35d628 x18: ffffffffffffffff [ 0.820552] x17: 0000000000000000 x16: 0000000000000000 [ 0.820556] x15: ffff00000958f848 x14: 455f3052464d4d34 [ 0.820559] x13: 00000000769dde98 x12: ffff8000bf3f65a8 [ 0.820564] x11: 0000000000000000 x10: ffff00000958f848 [ 0.820567] x9 : ffff000009592000 x8 : ffff00000958f848 [ 0.820571] x7 : ffff00000818ffa0 x6 : 0000000000000000 [ 0.820574] x5 : 0000000000000000 x4 : 0000000000000001 [ 0.820578] x3 : 0000000000000000 x2 : 0000000000000001 [ 0.820582] x1 : 00000000ffffffff x0 : 0000000000000000 [ 0.820587] Call trace: [ 0.820591] lockdep_assert_cpus_held+0x3c/0x48 [ 0.820598] static_key_enable_cpuslocked+0x28/0xd0 [ 0.820606] arch_timer_check_ool_workaround+0xe8/0x228 [ 0.820610] arch_timer_starting_cpu+0xe4/0x2d8 [ 0.820615] cpuhp_invoke_callback+0xe8/0xd08 [ 0.820619] notify_cpu_starting+0x80/0xb8 [ 0.820625] secondary_start_kernel+0x118/0x1d0 We've also had a similar warning in sched_init_smp() for every asymmetric system that would enable the sched_asym_cpucapacity static key, although that was singled out in: commit 40fa3780bac2 ("sched/core: Take the hotplug lock in sched_init_smp()") Those warnings are actually harmless, since we cannot have hotplug operations at the time they appear. Instead of starting to sprinkle useless hotplug lock operations in the init codepaths, mute the warnings until they start warning about real problems. Suggested-by: Peter Zijlstra Signed-off-by: Valentin Schneider Signed-off-by: Peter Zijlstra (Intel) Cc: Andrew Morton Cc: Linus Torvalds Cc: Paul E. McKenney Cc: Thomas Gleixner Cc: Will Deacon Cc: cai@gmx.us Cc: daniel.lezcano@linaro.org Cc: dietmar.eggemann@arm.com Cc: linux-arm-kernel@lists.infradead.org Cc: longman@redhat.com Cc: marc.zyngier@arm.com Cc: mark.rutland@arm.com Link: https://lkml.kernel.org/r/1545243796-23224-2-git-send-email-valentin.schneider@arm.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- kernel/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/cpu.c b/kernel/cpu.c index 9d0ecc4a0e79..dc250ec2c096 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -313,6 +313,15 @@ void cpus_write_unlock(void) void lockdep_assert_cpus_held(void) { + /* + * We can't have hotplug operations before userspace starts running, + * and some init codepaths will knowingly not take the hotplug lock. + * This is all valid, so mute lockdep until it makes sense to report + * unheld locks. + */ + if (system_state < SYSTEM_RUNNING) + return; + percpu_rwsem_assert_held(&cpu_hotplug_lock); } -- 2.19.1