Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3875692pxb; Tue, 17 Nov 2020 06:00:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJyE60exvO9RRC+uputX1PCxonGO1yZU3BkvOrcTGwcb5DQHWHopjPd5xONfHu/dbLCOCsVp X-Received: by 2002:a17:906:4104:: with SMTP id j4mr20143124ejk.439.1605621644963; Tue, 17 Nov 2020 06:00:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605621644; cv=none; d=google.com; s=arc-20160816; b=zfDD9L2USZLubVHuoNM9Z67V59YZarvPE44HGhsqaF4IuIm3+gTP7KABbWINuPpDFu UjnpUwY4wZH0pQvgQ6bFl+hLX4kNUw1n4KaNgO1bx9T/CB79VVf3fDiOhPNQA/C2kkvX 1w9M81qM3n2b78EJ/YvRhhWGvOWSmS8mv7tfdRP1almNoPFwf5Mma6oE5rdIU6ztJwRa Y9mzQv7FNHz8waHsgsOp+Un035A0pgPt4Q4IBYALT/i/BYBNo3kuw1wqLg2tnwcJBOxm BCavtnPhMLdthoNV481g3Cws2ZPjK5zKdnpL7vrH/03hHyC81tjWmB3Xc7vzSbHz81GN MR4A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TAyitNVnmWwcq6ZL7XyzUvMq0jjSc2Tq2sWo8v/VIfI=; b=u2z5rSMwTxDfckIAmx+MyzHFANxnrgESqdft0oALLbexMTQMt4ZV8RDYYUkIcff4ft ePqsk7aSvc0fyP9mopIoj44rf4+rUchhSyMh+EIjd5fG9W/DkwTuq1iretkwdY9KrZJO gwhRH021H3ak3CzY01us/etvX0xaxMCnl0W3kuPR2wQiOuE9Mw3x3472MOr2G6y5cwO3 QrsRFtDDErKuYj38x9GpELmI9uZsE7GKwQW6RxUyMIo9/JiKoa1GSgwlFXpCpzEpgJq6 1YLwtBXIA3YOs3uw7Zp4/hSdZCEUiF3ChnsoB6RPhygBOwlUPEsYVAiPcluKv0FbVDPz A7nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1JFSVskz; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd6si13573600edb.284.2020.11.17.06.00.21; Tue, 17 Nov 2020 06:00:44 -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=@kernel.org header.s=default header.b=1JFSVskz; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730794AbgKQNUt (ORCPT + 99 others); Tue, 17 Nov 2020 08:20:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:54118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729499AbgKQNUh (ORCPT ); Tue, 17 Nov 2020 08:20:37 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 5A0D1241A6; Tue, 17 Nov 2020 13:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619237; bh=6Yev0pjRKHStnjnyUM7qIny4PcOwexPPhGLSFztfQ90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1JFSVskz5KnrPpq1dZVgeexiAmIgih7eY1CiBCBXbvcWPtDFjkEw1UW9lRg+p3kzn syxdAKYtCoAOyzRDObfKZzsqZxQVvd6jJr7aJFzsnnZ4CQq/pmC4vpKq2M+oTf+S55 tbKyV6y7z82PHGJ4cWbsD7t7rOx795+2WIhLsQeM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qian Cai , "Paul E. McKenney" , Heiko Carstens , Sasha Levin Subject: [PATCH 4.19 044/101] s390/smp: move rcu_cpu_starting() earlier Date: Tue, 17 Nov 2020 14:05:11 +0100 Message-Id: <20201117122115.242580393@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122113.128215851@linuxfoundation.org> References: <20201117122113.128215851@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qian Cai [ Upstream commit de5d9dae150ca1c1b5c7676711a9ca139d1a8dec ] The call to rcu_cpu_starting() in smp_init_secondary() is not early enough in the CPU-hotplug onlining process, which results in lockdep splats as follows: WARNING: suspicious RCU usage ----------------------------- kernel/locking/lockdep.c:3497 RCU-list traversed in non-reader section!! other info that might help us debug this: RCU used illegally from offline CPU! rcu_scheduler_active = 1, debug_locks = 1 no locks held by swapper/1/0. Call Trace: show_stack+0x158/0x1f0 dump_stack+0x1f2/0x238 __lock_acquire+0x2640/0x4dd0 lock_acquire+0x3a8/0xd08 _raw_spin_lock_irqsave+0xc0/0xf0 clockevents_register_device+0xa8/0x528 init_cpu_timer+0x33e/0x468 smp_init_secondary+0x11a/0x328 smp_start_secondary+0x82/0x88 This is avoided by moving the call to rcu_cpu_starting up near the beginning of the smp_init_secondary() function. Note that the raw_smp_processor_id() is required in order to avoid calling into lockdep before RCU has declared the CPU to be watched for readers. Link: https://lore.kernel.org/lkml/160223032121.7002.1269740091547117869.tip-bot2@tip-bot2/ Signed-off-by: Qian Cai Acked-by: Paul E. McKenney Signed-off-by: Heiko Carstens Signed-off-by: Sasha Levin --- arch/s390/kernel/smp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 8e31dfd85de32..888f247c9261a 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c @@ -831,7 +831,7 @@ void __init smp_detect_cpus(void) */ static void smp_start_secondary(void *cpuvoid) { - int cpu = smp_processor_id(); + int cpu = raw_smp_processor_id(); S390_lowcore.last_update_clock = get_tod_clock(); S390_lowcore.restart_stack = (unsigned long) restart_stack; @@ -844,6 +844,7 @@ static void smp_start_secondary(void *cpuvoid) set_cpu_flag(CIF_ASCE_PRIMARY); set_cpu_flag(CIF_ASCE_SECONDARY); cpu_init(); + rcu_cpu_starting(cpu); preempt_disable(); init_cpu_timer(); vtime_init(); -- 2.27.0