Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp221168rdb; Thu, 22 Feb 2024 01:17:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUw1APAgn/08kY7yVDisNVbr0xjK96NAgDnjZ6oBqAQ/2S6FAHxA2maI7f9gC626Th2duKLJszsY4Yq1VhSVq4xHGY+hiaxbDEHC1/e2Q== X-Google-Smtp-Source: AGHT+IGtyy+Wd8WN9zGVXFDU1fwSqtIow+XLnwZoCYO4xgnYjwlhGvqJaKgHaDbm10fFAJAwl7Ki X-Received: by 2002:a05:6808:1644:b0:3c0:3bba:1036 with SMTP id az4-20020a056808164400b003c03bba1036mr23198856oib.58.1708593473228; Thu, 22 Feb 2024 01:17:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708593473; cv=pass; d=google.com; s=arc-20160816; b=PB5j39Iw+xlMJvrzRT2Mh4WqLmUmhRiklNfe4nc9FZENn+jFXEUVKKPksL5wiJbAPt WM91Arua3aBcPMBwvU+e6/tUYGg5VfneMEeDoF8m+WppE80WOtfX3hxnhz0VoVPB0uyy vNWYM6Q8qw4p1Mm6DrtdrsbuAH9xkB8I5DMf613eDJ+j7maT5rAr6sEyis+/c20V9aqx FvObxzFtm1qd3Q6VzYa7IzzHoUCdB5h360ld2pzt88qaeWDsdXWKv8MWxfPEtdAmxj1g oKYQSCsuIKKECHy4J0p1+EJEkmOwGdp2ugOvCQoWx+7Sy6PD9/4jJ4IWsJgOMTeW0B78 7T0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=HJN+KGrq/QKzgi6tvCCF+faku3d2EqiWGZcfQMGOZfk=; fh=Pyy/A1+L5D5jAHJ2u5Nx0LlR9vTI7G+wkhlB2y6WlYE=; b=RtI2cKpN9acziEeG3OXsC47V4lK+L9/uyJ9o3zUUkGXsgwx0+Cg8hVUFUC07FqPLxS z+Qf8gyPq/65gO2hSb8WDqn8bUpZSq3/vVrOE9OHva0gQfpX31UlZrLK/VmTUHP3zYa7 JuBWiscfte6FqU2Niqgh490FBnz7diqpG8Do616Cki+cjgvxKabT0oUGJrhTr0tUVHJy OPKU7kMyjlM2lJCSVjKD92tzE1uak2+uHauH6r2sFWkFIusiZATIdfAb0EM1uQAWWXY7 5U8x8rBWTtozHW//V9inIcMA94l162gEPLkmzGTTfRaYplOk1lbPazFe04afB/s3l/+7 AmHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-76193-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76193-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id j21-20020a056a00235500b006e42bc22722si8064818pfj.86.2024.02.22.01.17.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 01:17:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76193-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-76193-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76193-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id EE4F9B263AF for ; Thu, 22 Feb 2024 09:11:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C2E4376FB; Thu, 22 Feb 2024 09:10:48 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC642376ED; Thu, 22 Feb 2024 09:10:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708593047; cv=none; b=ieixCSBVpzzLJXJCVnA3NGCx/fxe7u/3J3TKym92pTfZWkg72ENAarhsQlN+A3AIP7LElPopQFAqDEEXkC3Mp6DSE8CXg6zifMFgaG4KHM36vBUdtK/swqGRR1xehtj/iGZUT1N2BC2SJsfyOeHfCegn0gn5ewrqYrMeolZx+fI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708593047; c=relaxed/simple; bh=7wttezoz+r/aHCzYQdvjMewRzciTsCi285NrSpusK4E=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=oW+EsNslPE2Je4tAVlvnPd6oQcTccOlWHw5rkYIzjugVZaUIFVrZlDDvZEBy7nYGVj8ezPc+Eu+Ifeao4Xk0mK4Fkcvay2lablB7D+FWB/K9i8kICKF2yOmgXo0MRLYoEEU5xPJkpQq1uhKsjkbJhWARVAQQt4GIMGhsU6Ck1bU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36592C433F1; Thu, 22 Feb 2024 09:10:45 +0000 (UTC) From: Huacai Chen To: Huacai Chen Cc: loongarch@lists.linux.dev, Guo Ren , Xuerui Wang , Jiaxun Yang , linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, Huacai Chen Subject: [PATCH] LoongArch: Disable IRQ before init_fn() for nonboot CPUs Date: Thu, 22 Feb 2024 17:10:08 +0800 Message-ID: <20240222091008.162191-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Disable IRQ before init_fn() for nonboot CPUs when hotplug, in order to silence such warnings (and also avoid potential errors due to unexpected interrupts): WARNING: CPU: 1 PID: 0 at kernel/rcu/tree.c:4503 rcu_cpu_starting+0x214/0x280 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 6.6.17+ #1198 pc 90000000048e3334 ra 90000000047bd56c tp 900000010039c000 sp 900000010039fdd0 a0 0000000000000001 a1 0000000000000006 a2 900000000802c040 a3 0000000000000000 a4 0000000000000001 a5 0000000000000004 a6 0000000000000000 a7 90000000048e3f4c t0 0000000000000001 t1 9000000005c70968 t2 0000000004000000 t3 000000000005e56e t4 00000000000002e4 t5 0000000000001000 t6 ffffffff80000000 t7 0000000000040000 t8 9000000007931638 u0 0000000000000006 s9 0000000000000004 s0 0000000000000001 s1 9000000006356ac0 s2 9000000007244000 s3 0000000000000001 s4 0000000000000001 s5 900000000636f000 s6 7fffffffffffffff s7 9000000002123940 s8 9000000001ca55f8 ra: 90000000047bd56c tlb_init+0x24c/0x528 ERA: 90000000048e3334 rcu_cpu_starting+0x214/0x280 CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE) PRMD: 00000000 (PPLV0 -PIE -PWE) EUEN: 00000000 (-FPE -SXE -ASXE -BTE) ECFG: 00071000 (LIE=12 VS=7) ESTAT: 000c0000 [BRK] (IS= ECode=12 EsubCode=0) PRID: 0014c010 (Loongson-64bit, Loongson-3A5000) CPU: 1 PID: 0 Comm: swapper/1 Not tainted 6.6.17+ #1198 Stack : 0000000000000000 9000000006375000 9000000005b61878 900000010039c000 900000010039fa30 0000000000000000 900000010039fa38 900000000619a140 9000000006456888 9000000006456880 900000010039f950 0000000000000001 0000000000000001 cb0cb028ec7e52e1 0000000002b90000 9000000100348700 0000000000000000 0000000000000001 ffffffff916d12f1 0000000000000003 0000000000040000 9000000007930370 0000000002b90000 0000000000000004 9000000006366000 900000000619a140 0000000000000000 0000000000000004 0000000000000000 0000000000000009 ffffffffffc681f2 9000000002123940 9000000001ca55f8 9000000006366000 90000000047a4828 00007ffff057ded8 00000000000000b0 0000000000000000 0000000000000000 0000000000071000 ... Call Trace: [<90000000047a4828>] show_stack+0x48/0x1a0 [<9000000005b61874>] dump_stack_lvl+0x84/0xcc [<90000000047f60ac>] __warn+0x8c/0x1e0 [<9000000005b0ab34>] report_bug+0x1b4/0x280 [<9000000005b63110>] do_bp+0x2d0/0x480 [<90000000047a2e20>] handle_bp+0x120/0x1c0 [<90000000048e3334>] rcu_cpu_starting+0x214/0x280 [<90000000047bd568>] tlb_init+0x248/0x528 [<90000000047a4c44>] per_cpu_trap_init+0x124/0x160 [<90000000047a19f4>] cpu_probe+0x494/0xa00 [<90000000047b551c>] start_secondary+0x3c/0xc0 [<9000000005b66134>] smpboot_entry+0x50/0x58 Signed-off-by: Huacai Chen --- arch/loongarch/kernel/smp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c index 20a355478c6c..9b07dd5b60bb 100644 --- a/arch/loongarch/kernel/smp.c +++ b/arch/loongarch/kernel/smp.c @@ -334,6 +334,7 @@ void __noreturn arch_cpu_idle_dead(void) addr = iocsr_read64(LOONGARCH_IOCSR_MBUF0); } while (addr == 0); + local_irq_disable(); init_fn = (void *)TO_CACHE(addr); iocsr_write32(0xffffffff, LOONGARCH_IOCSR_IPI_CLEAR); -- 2.43.0