Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1494223rdb; Tue, 30 Jan 2024 23:27:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFG/SWxmb/VrhCn4aCJvgmOanrRzi6QF21uL9h5e3EeGIJN9cpJWtHF8VRJRSrO38WTfaCc X-Received: by 2002:ac8:5755:0:b0:42a:8614:5534 with SMTP id 21-20020ac85755000000b0042a86145534mr1073985qtx.37.1706686063137; Tue, 30 Jan 2024 23:27:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706686063; cv=pass; d=google.com; s=arc-20160816; b=dDJHxxfXm9RyFLX06eUmn/KzCB6DgAmKB3dNaPDocDyphC/SwoHkYxSx6rI2SVsQih M5AV11wnE++dVxxd/Hj8p18OYyRMSZCov9Cf0qSKjlMcOdfhbX7Vj4s860AzMHrC9/85 WQ3vltKn3iuwKDwkpe+Ubom0Zp4oXCYL1I+bbxuhZQYPBRN9ykwytyoWUUu9XUyY51Iq m/hhuDMQy3OluCh/ODtNjrZ5LA94rOjG4P6HFyWU8hx0y7wT7HfMzv7REn1FysNSDdJ4 yCT+ZBSVHDofQEc5Fn3Q/kjJwC8lpI1eNcTmBK5qF1OXgleNfxsDHr6iBsLCNvy/g8wv ReOQ== 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=3E85M8SdaZuSACb5kq3Wz9sWw5u0eQAIYLyKltUUKeU=; fh=xtQLkQYzi4rZm5Nk3bwNvZ2RHNQnl2h7NSiXvxUqXQQ=; b=h8tFgnRqVxUzsDCVus+9/Keb96iLujrdE5XoZkc5r6G5lQys8yzEMLtTYrrSm7QdG+ AAQPZ5CL9V2Elo3RMHk2rowM4UUPHQJuvt9J74z27VDSB0OFBNa7lUm+UxsRJ5Hrhg7S lY2F7khwTg+CmDLYzrcvlQpGCi1+8z27rDt7+y4gGUNb6FuL0g0D4V/VfP5Vf9XHht5D 1Vlprm9pEdBDGwpsxltfDWYNY+QRpL/16bFNssBaK52edkNUsdRYbX3HFLroiEVMNmfC hDp9Vey7y6bpa8F98/m+zh07e0TccZU/0laPQUAbAtdUYvIG2qYUkgUA8jfbvG2Rl4Mj dreA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-45919-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45919-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWjsvlE3PDmOPXzzfC2OcqPpnQjWfm0Bxh9brDgnmriX47gv4EVWXw8CgGks8nxIx/WQ8OiCRJpnf4GTnm45ACxrTifw5r1s40W1W1fYw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g2-20020ac87d02000000b0042afb9fb720si2589645qtb.151.2024.01.30.23.27.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 23:27:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45919-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-45919-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45919-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DEF2D1C264BF for ; Wed, 31 Jan 2024 07:27:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8E2957318; Wed, 31 Jan 2024 07:22:05 +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 0A03656479; Wed, 31 Jan 2024 07:22:04 +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=1706685725; cv=none; b=AItS0LPlBLO3jOcMNXhV+3Wa1qPxBiZTBoiMM6cimyHvEQ8e+v0BUr8xBaey1vgNFXHDF0+pK1PWujGmQLbWHYyoPQasU5bTVV9wM4qw1T+o5vYoaCj4qBwhdliDXFLkje95LSH840Krd77hJxs2WkrBjOPhSmHgYijgSDwAE4o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706685725; c=relaxed/simple; bh=VSPOIQIi1SFSb7BcOqd2hNNK1gD3mDXV74OKv3NfOM4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Y4PH8T7zZZW/eVZpmaN/fu2cQE4ZO2cUvotkHqCCzDe3RVY7zOrH3/qk99Go9I1RQnmuIZaoEMBG5m0hTCqYlYuXuCwd5bnzUi1Cj7c4lnvKXpZhSpMxY6EI0dJmnhmEpp+SMbs2NY7iYnTDJ4AUGr7KZTFMucysv0JlvaiQCqE= 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 DC2FEC433F1; Wed, 31 Jan 2024 07:22:01 +0000 (UTC) From: Huacai Chen To: gregkh@linuxfoundation.org, Huacai Chen Cc: loongarch@lists.linux.dev, stable@vger.kernel.org, Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, Huacai Chen Subject: [PATCH 6.1.y and 6.6.y] LoongArch/smp: Call rcutree_report_cpu_starting() at tlb_init() Date: Wed, 31 Jan 2024 15:21:51 +0800 Message-Id: <20240131072151.1023985-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.39.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Machines which have more than 8 nodes fail to boot SMP after commit a2ccf46333d7b2cf96 ("LoongArch/smp: Call rcutree_report_cpu_starting() earlier"). Because such machines use tlb-based per-cpu base address rather than dmw-based per-cpu base address, resulting per-cpu variables can only be accessed after tlb_init(). But rcutree_report_cpu_starting() is now called before tlb_init() and accesses per-cpu variables indeed. Since the original patch want to avoid the lockdep warning caused by page allocation in tlb_init(), we can move rcutree_report_cpu_starting() to tlb_init() where after tlb exception configuration but before page allocation. Signed-off-by: Huacai Chen --- arch/loongarch/kernel/smp.c | 1 - arch/loongarch/mm/tlb.c | 16 ++++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c index 3f3cdc7ffe7a..4b4ba3f9335d 100644 --- a/arch/loongarch/kernel/smp.c +++ b/arch/loongarch/kernel/smp.c @@ -506,7 +506,6 @@ asmlinkage void start_secondary(void) sync_counter(); cpu = raw_smp_processor_id(); set_my_cpu_offset(per_cpu_offset(cpu)); - rcu_cpu_starting(cpu); cpu_probe(); constant_clockevent_init(); diff --git a/arch/loongarch/mm/tlb.c b/arch/loongarch/mm/tlb.c index 2c51d755fbbc..e71150dd7f4b 100644 --- a/arch/loongarch/mm/tlb.c +++ b/arch/loongarch/mm/tlb.c @@ -284,12 +284,16 @@ static void setup_tlb_handler(int cpu) set_handler(EXCCODE_TLBNR * VECSIZE, handle_tlb_protect, VECSIZE); set_handler(EXCCODE_TLBNX * VECSIZE, handle_tlb_protect, VECSIZE); set_handler(EXCCODE_TLBPE * VECSIZE, handle_tlb_protect, VECSIZE); - } + } else { + int vec_sz __maybe_unused; + void *addr __maybe_unused; + struct page *page __maybe_unused; + + /* Avoid lockdep warning */ + rcu_cpu_starting(cpu); + #ifdef CONFIG_NUMA - else { - void *addr; - struct page *page; - const int vec_sz = sizeof(exception_handlers); + vec_sz = sizeof(exception_handlers); if (pcpu_handlers[cpu]) return; @@ -305,8 +309,8 @@ static void setup_tlb_handler(int cpu) csr_write64(pcpu_handlers[cpu], LOONGARCH_CSR_EENTRY); csr_write64(pcpu_handlers[cpu], LOONGARCH_CSR_MERRENTRY); csr_write64(pcpu_handlers[cpu] + 80*VECSIZE, LOONGARCH_CSR_TLBRENTRY); - } #endif + } } void tlb_init(int cpu) -- 2.39.3