Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp242705pxx; Thu, 29 Oct 2020 01:11:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYuBuj4UhFZ/leWVcIOeqINcp5UEjP9uO/ZVW5SuboqAWUSnL2wp4JCmnQz4iLRQB3zWS6 X-Received: by 2002:a17:906:a110:: with SMTP id t16mr660143ejy.538.1603959103735; Thu, 29 Oct 2020 01:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603959103; cv=none; d=google.com; s=arc-20160816; b=Im1q1+iTQw7FxPD8j9EChxUG3mvlSMydFlOeQkmcGxTHiXAGeTy4pdH6xf56gsxhVI li25qFWBOIRZLuwTpsaGapMG4aLXdzcrQx18sUw02JrwROXcwHdeALX3j4UtWu1IvBQk u+Weyolp6cdCb98rzZwfZ4ao/ic1ARF8g7bDwgA2zhIDLQ9omi2gce5KehW9O21DYdSp 7VEVOMNM9XZR49InD1xD1jj1XvGNt7yoUpzEeTtnLrsEHga9ljdPhAympNL4ZVNo9UiZ sYDTzgRbQtT4t5C189X8FD90TWRwgRGxD8APp2zdroso8jne7IlRagjTIBJiGozfV7ay 21sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=2KBPs+NR8MiccQ9voOcuVrc1Hc++b5yhhKNAJae5GFQ=; b=ETEhGBWnlgWQQnAH8pK9rBqBou8LFpLPKT2ihQ+jdlggZ6NDLJPEriFTuRPl1dmHAw DJAQpw6PIBvrn9CLrcucr0Vbw/Y2zF9zng+dscD0OA/Pg0vB57K1a2kI/GLt7qwipMpS Jt4aseDWfpZtPugwl+zle6+/eGlUkro6mHRcQj2KCM7BgH1OYT5pT3Xkyu83Q/7CiIi1 IjHavk+V0G/XnvEBkfAKoyFdg5yQSyjWjjsGp+Y2us34FfP7enyFKx7JMXvP6DKuRGcx EvOm8Xvke4YrTQ0oiIOfJcUMiK37juBBehGpw0AJhpfq3CHZ6ApTQr3CHEcRhrz9Taw4 8thQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=W64neonP; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f4si1522951edn.495.2020.10.29.01.11.21; Thu, 29 Oct 2020 01:11:43 -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=@ellerman.id.au header.s=201909 header.b=W64neonP; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726513AbgJ2AJ1 (ORCPT + 99 others); Wed, 28 Oct 2020 20:09:27 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:58261 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389114AbgJ2AJR (ORCPT ); Wed, 28 Oct 2020 20:09:17 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4CM5Qb3mqVz9sSP; Thu, 29 Oct 2020 11:09:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1603930155; bh=+IS+oS9wdMYaY7BSv2eRj1FRyLpkX+Kkw+ofCEwFGdM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=W64neonPs5X8EQtVcfwGj7Ov10Oyqi5FxJ9MxFxGHUq5rL/qlyW2uCDK+XbIp9Ece UszKhFGAXmtuZCVHUkQ7TKyddpVcKP6Bjtk3EjsWcofBx/GJ2JSFIakN10XChtL5Zk k3ytx6LIrwXN8RZow6WNQiOq5E1E2/bdqcGCFsSSXvDF2WjIxBSqkvTyMIzlBHGKXT OE6IItGAB0gGTD5jk0oS0UAdq8zgBhNbIcDnUVuEdizVNin4tIrAdFEcxwXhkmqpf6 yypk4g3by3TQX85yG12+a4MJ+LrvI6bCpysEcvpJ4sLOrCtGtl06FiXewq9yDXeObW Sz8kZ7/cJMBog== From: Michael Ellerman To: Qian Cai , "Paul E . McKenney" Cc: Peter Zijlstra , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Qian Cai Subject: Re: [PATCH] powerpc/smp: Move rcu_cpu_starting() earlier In-Reply-To: <20201028182334.13466-1-cai@redhat.com> References: <20201028182334.13466-1-cai@redhat.com> Date: Thu, 29 Oct 2020 11:09:07 +1100 Message-ID: <87lffpx598.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Qian Cai writes: > The call to rcu_cpu_starting() in start_secondary() is not early enough > in the CPU-hotplug onlining process, which results in lockdep splats as > follows: Since when? What kernel version? I haven't seen this running CPU hotplug tests with PROVE_LOCKING=y on v5.10-rc1. Am I missing a CONFIG? cheers > 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: > dump_stack+0xec/0x144 (unreliable) > lockdep_rcu_suspicious+0x128/0x14c > __lock_acquire+0x1060/0x1c60 > lock_acquire+0x140/0x5f0 > _raw_spin_lock_irqsave+0x64/0xb0 > clockevents_register_device+0x74/0x270 > register_decrementer_clockevent+0x94/0x110 > start_secondary+0x134/0x800 > start_secondary_prolog+0x10/0x14 > > This is avoided by moving the call to rcu_cpu_starting up near the > beginning of the start_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 > --- > arch/powerpc/kernel/smp.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c > index 3c6b9822f978..8c2857cbd960 100644 > --- a/arch/powerpc/kernel/smp.c > +++ b/arch/powerpc/kernel/smp.c > @@ -1393,13 +1393,14 @@ static void add_cpu_to_masks(int cpu) > /* Activate a secondary processor. */ > void start_secondary(void *unused) > { > - unsigned int cpu = smp_processor_id(); > + unsigned int cpu = raw_smp_processor_id(); > > mmgrab(&init_mm); > current->active_mm = &init_mm; > > smp_store_cpu_info(cpu); > set_dec(tb_ticks_per_jiffy); > + rcu_cpu_starting(cpu); > preempt_disable(); > cpu_callin_map[cpu] = 1; > > -- > 2.28.0