Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2221815rdb; Mon, 25 Dec 2023 01:13:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IESNdT+MZtZ7xPvoigBfTnMRH6CifrLUBl0gfiK44Zo388NDm/TOw4izjkaAdRK9TdVViWv X-Received: by 2002:a05:6808:118d:b0:3bb:5f46:fc92 with SMTP id j13-20020a056808118d00b003bb5f46fc92mr5867826oil.32.1703495634461; Mon, 25 Dec 2023 01:13:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703495634; cv=none; d=google.com; s=arc-20160816; b=lVkNuK9IgLVNRyGEmIOiJljXZumpNfQOebRrznzL0FkyBpK5wCh4RhjkRdV3iYzkvf BRnR1vtc6W2S5q5ll7Jr+54yMg98eh92POASpFpxNRVBry443er7N1p3CkPobOChFCaM 3r6dcdeHUtJIF5q6DR2xSXOcCzasQL88An6f2dsUhnhrLRJaMWE2RFk7a1Sp7Ej3t/Ox nzb2LDtz7bZB2gTD2zxoqJKi767eNEfuUgglBhtkG2Wck2oVVqu0fUYd4HXzQJ+EJwsK YC6zQ0VR9fxkEpnmiVXS16bjDIWxx74Wf3kqF5vRLsk+EoD7KnywMKTyhIsYd/U5yFZN trDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=LGzHBv7k7EUsJsbsKlQEvg5Ajc2G83uN7Q5sZ7T8eFY=; fh=GV+Cz/c+q9eZ025PfT2LQ6mA+qhNoE+OS8Lrkzt8n+U=; b=qmX+1bI2OS+xB9qqlfLpC+Uw1lr4SA/EEE4hPwJ9NrnexcQpmmHKGvN4uUSFXS2RSE MYQ5dmH0leFZFYlZ7VOrhzo5yey0RDO7E7FhQ5IRB591v+GSJFe68/bnyN9KiEXPb+9l QmiQbItM3uR9lTy173qgf2X9p3zPd70+sltYhNZ0+0DSgKkxQvBoDmn+1SPdG8dRFhmm oVCiWGVYdQ7YfZEBZ+7WysXSOWo6U0IJ/6V3G3RZUNzyXGKnmRtDkeRiyMmlIV6DzcPE XhJHnqtnGKv0gb5aN/S1zTV8kj1EBBs+TNHejE3iW+rwtY7EGUcsmeCrMnridu8llBue sdyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-10969-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10969-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q24-20020a631f58000000b005be1ee5b9dfsi2756366pgm.454.2023.12.25.01.13.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Dec 2023 01:13:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10969-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-10969-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10969-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id EF6222819AC for ; Mon, 25 Dec 2023 09:13:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9D864A3B; Mon, 25 Dec 2023 09:13:48 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 95F90DDB9 for ; Mon, 25 Dec 2023 09:13:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.20.42.173]) by gateway (Coremail) with SMTP id _____8BxbOnIR4llhWoEAA--.21828S3; Mon, 25 Dec 2023 17:13:44 +0800 (CST) Received: from [10.20.42.173] (unknown [10.20.42.173]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Dx6r3ER4llOJAJAA--.9412S3; Mon, 25 Dec 2023 17:13:43 +0800 (CST) Subject: Re: [PATCH] LoongArch: Let cores_io_master cover the largest NR_CPUS To: loongson-kernel@lists.loongnix.cn, Huacai Chen Cc: loongarch@lists.linux.dev, Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , linux-kernel@vger.kernel.org, Huacai Chen References: <20231225070002.1350705-1-chenhuacai@loongson.cn> From: maobibo Message-ID: <3db5c086-db9b-cb3a-5521-44f18cb55c4a@loongson.cn> Date: Mon, 25 Dec 2023 17:13:26 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20231225070002.1350705-1-chenhuacai@loongson.cn> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-CM-TRANSID:AQAAf8Dx6r3ER4llOJAJAA--.9412S3 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoW7ArW3Cw18GFW5GF1kZrWrJFc_yoW5Jr47pr ZrZFykWrZ5Wrn5JFWUt3s8ur4UAwnxGa12ga1293y8CFy7Xw1jqF10k3srXFnFya1rKFyF qF9Y9an2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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]; Can the hardcoded 4 be defined something like this? DIV_ROUND_UP(CONFIG_NR_CPUS, sizeof(long)) the others LGTM. Regards Bibo Mao > 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 > } > >