Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2182205rdb; Sun, 24 Dec 2023 23:00:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHS26q35ImbSNoXfDGVSupGEx0H0yfNUhtJw9YBMATD/aLasdk69OVJtYirAjU28XPaelc X-Received: by 2002:a17:902:ec81:b0:1d4:43a7:64ea with SMTP id x1-20020a170902ec8100b001d443a764eamr2996034plg.58.1703487634788; Sun, 24 Dec 2023 23:00:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703487634; cv=none; d=google.com; s=arc-20160816; b=T1zTHZGS7hwKY7ZBp3Sq7FBC7doA0B+fqA3o6HLgR22QlxhAoq4NEX9v5q2aLCuxyc GHTgmug3hnVs2sjqVI4oRZNNhhZtf73XjtkKPwbcOnhtoQ9OPAK4DID/UDvs8Sq95asI 2La9i7kpex0bqMRZEBWKt0mouXvnJdihNplkrpIpuJjIC5Fn4oGsCseTZyXyDBqgbxPw ekAy67TxPV+oKtnJiEXJimDjPoHQ5JgbOf7M38cbMaHUdMOM5Pazna1lTuqA98IEC+sS q9KadWvF0cbVudC0ETYf7KxabPm0bnAteWO18A5PME5BT1JdJkayvvNNU7Fp2/STakbj divg== ARC-Message-Signature: i=1; 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=5sxXnn06dGsVQgk15D4nckV+SLQFUoGpeov8sA5Oi+g=; fh=y7VKX694VLH2eb03/y0ljujQLJGtNdYVa6lu5bfy0Mc=; b=NYQYyteqBE+E7bueHObP1/BuRkjDzuU2YyGN/v90VS+F56zwnVBesDYDSf7/3xWApl 2x06VD2GMPbsackMPDenTI3Cr3qGqQuJy9CLiXSSLVltVfg9Nde7kOSj0zD5NYR9iR9T 7dyrw/KsaTcfZBgpE+C87k/1ZP3uQRia5KQl+DiqV4XzXDdaNRpH7PgDcQC2xNxl+MUW BWniGz+pQZ3BvV8/Mw/mKHSj/VlIMB2yJ2CERfm0pZCtfslhphat1cH73aQ2zYcWZxPy uYSJJodpMM5JYF/GLAwvVGwrEvjvnaSRe283zw+p/92l6fhS9EpGOudhbDD5NBTiionI K7Aw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-10916-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10916-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id c6-20020a170903234600b001d3ed273d50si7656377plh.450.2023.12.24.23.00.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Dec 2023 23:00:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10916-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-10916-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10916-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 7FBCCB20EEB for ; Mon, 25 Dec 2023 07:00:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF37315B9; Mon, 25 Dec 2023 07:00:24 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org 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 5260A1116; Mon, 25 Dec 2023 07:00:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C9C7C433C7; Mon, 25 Dec 2023 07:00:20 +0000 (UTC) From: Huacai Chen To: Huacai Chen Cc: loongarch@lists.linux.dev, Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, Huacai Chen Subject: [PATCH] LoongArch: Let cores_io_master cover the largest NR_CPUS Date: Mon, 25 Dec 2023 15:00:02 +0800 Message-Id: <20231225070002.1350705-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 Now loongson_system_configuration::cores_io_master only covers 64 cpus, if NR_CPUS > 64 there will be memory corruption. So let cores_io_master cover the largest NR_CPUS (256). Signed-off-by: Huacai Chen --- arch/loongarch/include/asm/bootinfo.h | 4 ++-- arch/loongarch/kernel/acpi.c | 2 +- arch/loongarch/kernel/smp.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/loongarch/include/asm/bootinfo.h b/arch/loongarch/include/asm/bootinfo.h index c60796869b2b..32fd0319594a 100644 --- a/arch/loongarch/include/asm/bootinfo.h +++ b/arch/loongarch/include/asm/bootinfo.h @@ -30,7 +30,7 @@ struct loongson_system_configuration { int boot_cpu_id; int cores_per_node; int cores_per_package; - unsigned long cores_io_master; + unsigned long cores_io_master[4]; unsigned long suspend_addr; const char *cpuname; }; @@ -42,7 +42,7 @@ extern struct loongson_system_configuration loongson_sysconf; static inline bool io_master(int cpu) { - return test_bit(cpu, &loongson_sysconf.cores_io_master); + return test_bit(cpu, loongson_sysconf.cores_io_master); } #endif /* _ASM_BOOTINFO_H */ diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c index 8e00a754e548..b6b097bbf866 100644 --- a/arch/loongarch/kernel/acpi.c +++ b/arch/loongarch/kernel/acpi.c @@ -119,7 +119,7 @@ acpi_parse_eio_master(union acpi_subtable_headers *header, const unsigned long e return -EINVAL; core = eiointc->node * CORES_PER_EIO_NODE; - set_bit(core, &(loongson_sysconf.cores_io_master)); + set_bit(core, loongson_sysconf.cores_io_master); return 0; } diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c index 9e33b5e36122..a16e3dbe9f09 100644 --- a/arch/loongarch/kernel/smp.c +++ b/arch/loongarch/kernel/smp.c @@ -208,7 +208,7 @@ static void __init fdt_smp_setup(void) } loongson_sysconf.nr_cpus = num_processors; - set_bit(0, &(loongson_sysconf.cores_io_master)); + set_bit(0, loongson_sysconf.cores_io_master); #endif } -- 2.39.3