Message ID | 20221028160034.44400-2-ldufour@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp916059wru; Fri, 28 Oct 2022 09:10:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53WI9CkbSiP3qozsweZm0IiiVYDatgqWUMUCTyCjxdS+9twjAweAdz0YVUcOeIpK6vWp6D X-Received: by 2002:a17:902:7d87:b0:17f:9cd0:2e03 with SMTP id a7-20020a1709027d8700b0017f9cd02e03mr80251plm.164.1666973421072; Fri, 28 Oct 2022 09:10:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666973421; cv=none; d=google.com; s=arc-20160816; b=pO12DUdiRBiQbtdWXkjqxhpFZNRxfVkZaJNYkPV+nnIT8wqCdV2TgOUerxQ3PHTOP2 ALEs9dwJmEMdSqiOAftzWHe95M7HTO453YOcRlrGvhAcMrGdHFkVS5sbTrZElOoT+rJV ycs4XjIsd+JBJEC/BPSsw4Rt1P8Z6zzjPZs/EgGQRASyfxtSEssGTra4lDAEnlEVkHJE fuEs1zXaesOSumTYgWKlcjr3ArdElYYtdpx3QXO2Fh6Lr7V4hOiUbgrqVLrl58Nz4USY zzQaHRHNzLlOJOa3iD1IvtDdaR7m8TBSYCKYlnLvuZUw6X5414WHaj7gs1UTfAcls/Kg a10w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=m5gmoe5nzt1dR38vy96xlF8K5GaVfd5hD1tpJKcT8y0=; b=UL8GCEwrJ4Mj8viEfg6F40wAJTfvT1YkRmNDyzaepu+Ld4WxI+xP8G4bImZpwo73fV LSyeYIXXjGJWTzWXUlJRgjA/rf+HcpMc9SqGtI3vnvnk+Of6lp4XyOQ+PxAXVNnqctSd oGzJDV5oKpNIXqGohCoJ4LKZQcrkAzOK8OnkrrrjOco86PmxI/PraS7aqhQPlnvNYUWc rYZPH58xgrb8XMZiMD2QCKp4BkeZ6NsFdnvM2nwCX7VjWAfJuK5KUdNb/oMO4iI9k32U hsjaYpUrpt0ZmdyBZmw7JS3SbVJMsEgv+4RX2s4sx9pX2wbBV4ILr2Z2ZshnygrP5TDu C00g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=fe9RPeqi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f19-20020a056a00239300b0056bce3dfaacsi6356048pfc.25.2022.10.28.09.10.07; Fri, 28 Oct 2022 09:10:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=fe9RPeqi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230423AbiJ1QIC (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Fri, 28 Oct 2022 12:08:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230514AbiJ1QGr (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 28 Oct 2022 12:06:47 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A08BD1DC800 for <linux-kernel@vger.kernel.org>; Fri, 28 Oct 2022 09:05:53 -0700 (PDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29SFnqZp031911; Fri, 28 Oct 2022 16:05:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=m5gmoe5nzt1dR38vy96xlF8K5GaVfd5hD1tpJKcT8y0=; b=fe9RPeqiZw6/Jm6jyYy58khmfLHhqhgbZu9vcgn7n3x0sTbqUlMwaeIq70xrW3CN24FJ SK7xBJTQGdqXuZYXcKltAM9iy4BfxZ30KxKYa8qcBNoGVsik8pyAN39x9JxZLI1nyKIP WcYKsv3kTiieCg+4pvKheBDJo8nGx4htY8y930w8Kbxl5XCwtDni8IfN/7JJHiJeyAbC 3iCbXyR+sJpTCmw/F3CB4FSw54SIRw6Q94d7cdrJn1aFjgMoa9xudS4gcLZbI7GKpnSV vyFVcqecvrCSNBQD3vgJVWAxcacwab7v2s21szJnltz5UaLKaCqvkmuxVFYw6GiFZHEg Gg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kgj2n8he3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Oct 2022 16:05:44 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 29SFnpYW031812; Fri, 28 Oct 2022 16:05:44 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kgj2n8hcr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Oct 2022 16:05:44 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 29SFp6YK023375; Fri, 28 Oct 2022 16:00:38 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma02fra.de.ibm.com with ESMTP id 3kfahmjt7a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Oct 2022 16:00:38 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 29SG1BpG29295026 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Oct 2022 16:01:11 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2DC4111C04A; Fri, 28 Oct 2022 16:00:36 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D9F1011C050; Fri, 28 Oct 2022 16:00:35 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.94.157]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 28 Oct 2022 16:00:35 +0000 (GMT) From: Laurent Dufour <ldufour@linux.ibm.com> To: mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] powerpc: export the CPU node count Date: Fri, 28 Oct 2022 18:00:33 +0200 Message-Id: <20221028160034.44400-2-ldufour@linux.ibm.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221028160034.44400-1-ldufour@linux.ibm.com> References: <20221028160034.44400-1-ldufour@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ILStheXaMmokWjvPpmUjqmkfJvUUO0oR X-Proofpoint-GUID: nRy3YEhyd_d89r4ajn7fB5olKmnQ_TwI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-28_07,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 impostorscore=0 spamscore=0 bulkscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210280100 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747948322460228073?= X-GMAIL-MSGID: =?utf-8?q?1747948322460228073?= |
Series |
Consider the size of the added CPU nodes in the kexec FDT
|
|
Commit Message
Laurent Dufour
Oct. 28, 2022, 4 p.m. UTC
At boot time, the FDT is parsed to compute the number of CPUs.
In addition count the number of CPU nodes and export it.
This is useful when building the FDT for a kexeced kernel since we need to
take in account the CPU node added since the boot time during CPU hotplug
operations.
Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
---
arch/powerpc/include/asm/kexec_ranges.h | 2 ++
arch/powerpc/kernel/prom.c | 4 ++++
2 files changed, 6 insertions(+)
Comments
Hi Laurent,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on powerpc/next]
[also build test WARNING on linus/master v6.1-rc2 next-20221028]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Laurent-Dufour/Consider-the-size-of-the-added-CPU-nodes-in-the-kexec-FDT/20221029-000955
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link: https://lore.kernel.org/r/20221028160034.44400-2-ldufour%40linux.ibm.com
patch subject: [PATCH 1/2] powerpc: export the CPU node count
config: powerpc-allyesconfig
compiler: powerpc-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/938849fa462143b321353bdd62acfd2c5e2b517b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Laurent-Dufour/Consider-the-size-of-the-added-CPU-nodes-in-the-kexec-FDT/20221029-000955
git checkout 938849fa462143b321353bdd62acfd2c5e2b517b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash arch/powerpc/kernel/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from arch/powerpc/kernel/prom.c:59:
>> arch/powerpc/include/asm/kexec_ranges.h:7:32: warning: 'struct crash_mem' declared inside parameter list will not be visible outside of this definition or declaration
7 | void sort_memory_ranges(struct crash_mem *mrngs, bool merge);
| ^~~~~~~~~
vim +7 arch/powerpc/include/asm/kexec_ranges.h
180adfc532a83c Hari Bathini 2020-07-29 6
180adfc532a83c Hari Bathini 2020-07-29 @7 void sort_memory_ranges(struct crash_mem *mrngs, bool merge);
180adfc532a83c Hari Bathini 2020-07-29 8 struct crash_mem *realloc_mem_ranges(struct crash_mem **mem_ranges);
180adfc532a83c Hari Bathini 2020-07-29 9 int add_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size);
b8e55a3e5c2088 Hari Bathini 2020-07-29 10 int add_tce_mem_ranges(struct crash_mem **mem_ranges);
b8e55a3e5c2088 Hari Bathini 2020-07-29 11 int add_initrd_mem_range(struct crash_mem **mem_ranges);
58dbe9b373df28 Murilo Opsfelder Araujo 2022-03-01 12 #ifdef CONFIG_PPC_64S_HASH_MMU
b8e55a3e5c2088 Hari Bathini 2020-07-29 13 int add_htab_mem_range(struct crash_mem **mem_ranges);
b8e55a3e5c2088 Hari Bathini 2020-07-29 14 #else
b8e55a3e5c2088 Hari Bathini 2020-07-29 15 static inline int add_htab_mem_range(struct crash_mem **mem_ranges)
b8e55a3e5c2088 Hari Bathini 2020-07-29 16 {
b8e55a3e5c2088 Hari Bathini 2020-07-29 17 return 0;
b8e55a3e5c2088 Hari Bathini 2020-07-29 18 }
b8e55a3e5c2088 Hari Bathini 2020-07-29 19 #endif
b8e55a3e5c2088 Hari Bathini 2020-07-29 20 int add_kernel_mem_range(struct crash_mem **mem_ranges);
b8e55a3e5c2088 Hari Bathini 2020-07-29 21 int add_rtas_mem_range(struct crash_mem **mem_ranges);
b8e55a3e5c2088 Hari Bathini 2020-07-29 22 int add_opal_mem_range(struct crash_mem **mem_ranges);
b8e55a3e5c2088 Hari Bathini 2020-07-29 23 int add_reserved_mem_ranges(struct crash_mem **mem_ranges);
180adfc532a83c Hari Bathini 2020-07-29 24
Hi Laurent,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on powerpc/next]
[also build test ERROR on linus/master v6.1-rc2 next-20221028]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Laurent-Dufour/Consider-the-size-of-the-added-CPU-nodes-in-the-kexec-FDT/20221029-000955
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link: https://lore.kernel.org/r/20221028160034.44400-2-ldufour%40linux.ibm.com
patch subject: [PATCH 1/2] powerpc: export the CPU node count
config: powerpc-gamecube_defconfig
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/938849fa462143b321353bdd62acfd2c5e2b517b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Laurent-Dufour/Consider-the-size-of-the-added-CPU-nodes-in-the-kexec-FDT/20221029-000955
git checkout 938849fa462143b321353bdd62acfd2c5e2b517b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from include/linux/pci.h:38:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:640:
arch/powerpc/include/asm/io-defs.h:45:1: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:637:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:119:1: note: expanded from here
__do_insw
^
arch/powerpc/include/asm/io.h:578:56: note: expanded from macro '__do_insw'
#define __do_insw(p, b, n) readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from arch/powerpc/kernel/prom.c:20:
In file included from include/linux/pci.h:38:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:640:
arch/powerpc/include/asm/io-defs.h:47:1: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:637:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:121:1: note: expanded from here
__do_insl
^
arch/powerpc/include/asm/io.h:579:56: note: expanded from macro '__do_insl'
#define __do_insl(p, b, n) readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from arch/powerpc/kernel/prom.c:20:
In file included from include/linux/pci.h:38:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:640:
arch/powerpc/include/asm/io-defs.h:49:1: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:637:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:123:1: note: expanded from here
__do_outsb
^
arch/powerpc/include/asm/io.h:580:58: note: expanded from macro '__do_outsb'
#define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from arch/powerpc/kernel/prom.c:20:
In file included from include/linux/pci.h:38:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:640:
arch/powerpc/include/asm/io-defs.h:51:1: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:637:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:125:1: note: expanded from here
__do_outsw
^
arch/powerpc/include/asm/io.h:581:58: note: expanded from macro '__do_outsw'
#define __do_outsw(p, b, n) writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from arch/powerpc/kernel/prom.c:20:
In file included from include/linux/pci.h:38:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:640:
arch/powerpc/include/asm/io-defs.h:53:1: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:637:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:127:1: note: expanded from here
__do_outsl
^
arch/powerpc/include/asm/io.h:582:58: note: expanded from macro '__do_outsl'
#define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from arch/powerpc/kernel/prom.c:59:
>> arch/powerpc/include/asm/kexec_ranges.h:7:32: error: declaration of 'struct crash_mem' will not be visible outside of this function [-Werror,-Wvisibility]
void sort_memory_ranges(struct crash_mem *mrngs, bool merge);
^
7 errors generated.
vim +7 arch/powerpc/include/asm/kexec_ranges.h
180adfc532a83c Hari Bathini 2020-07-29 6
180adfc532a83c Hari Bathini 2020-07-29 @7 void sort_memory_ranges(struct crash_mem *mrngs, bool merge);
180adfc532a83c Hari Bathini 2020-07-29 8 struct crash_mem *realloc_mem_ranges(struct crash_mem **mem_ranges);
180adfc532a83c Hari Bathini 2020-07-29 9 int add_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size);
b8e55a3e5c2088 Hari Bathini 2020-07-29 10 int add_tce_mem_ranges(struct crash_mem **mem_ranges);
b8e55a3e5c2088 Hari Bathini 2020-07-29 11 int add_initrd_mem_range(struct crash_mem **mem_ranges);
58dbe9b373df28 Murilo Opsfelder Araujo 2022-03-01 12 #ifdef CONFIG_PPC_64S_HASH_MMU
b8e55a3e5c2088 Hari Bathini 2020-07-29 13 int add_htab_mem_range(struct crash_mem **mem_ranges);
b8e55a3e5c2088 Hari Bathini 2020-07-29 14 #else
b8e55a3e5c2088 Hari Bathini 2020-07-29 15 static inline int add_htab_mem_range(struct crash_mem **mem_ranges)
b8e55a3e5c2088 Hari Bathini 2020-07-29 16 {
b8e55a3e5c2088 Hari Bathini 2020-07-29 17 return 0;
b8e55a3e5c2088 Hari Bathini 2020-07-29 18 }
b8e55a3e5c2088 Hari Bathini 2020-07-29 19 #endif
b8e55a3e5c2088 Hari Bathini 2020-07-29 20 int add_kernel_mem_range(struct crash_mem **mem_ranges);
b8e55a3e5c2088 Hari Bathini 2020-07-29 21 int add_rtas_mem_range(struct crash_mem **mem_ranges);
b8e55a3e5c2088 Hari Bathini 2020-07-29 22 int add_opal_mem_range(struct crash_mem **mem_ranges);
b8e55a3e5c2088 Hari Bathini 2020-07-29 23 int add_reserved_mem_ranges(struct crash_mem **mem_ranges);
180adfc532a83c Hari Bathini 2020-07-29 24
On Sat Oct 29, 2022 at 2:00 AM AEST, Laurent Dufour wrote: > At boot time, the FDT is parsed to compute the number of CPUs. > In addition count the number of CPU nodes and export it. > > This is useful when building the FDT for a kexeced kernel since we need to > take in account the CPU node added since the boot time during CPU hotplug > operations. It would be nice if it just realloced memory in this case, but that looks like a bigger change. But these patches look okay to me, if you can solve the compile bug. Thanks, Nick > > Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com> > --- > arch/powerpc/include/asm/kexec_ranges.h | 2 ++ > arch/powerpc/kernel/prom.c | 4 ++++ > 2 files changed, 6 insertions(+) > > diff --git a/arch/powerpc/include/asm/kexec_ranges.h b/arch/powerpc/include/asm/kexec_ranges.h > index f83866a19e87..bf35d00ddd09 100644 > --- a/arch/powerpc/include/asm/kexec_ranges.h > +++ b/arch/powerpc/include/asm/kexec_ranges.h > @@ -22,4 +22,6 @@ int add_rtas_mem_range(struct crash_mem **mem_ranges); > int add_opal_mem_range(struct crash_mem **mem_ranges); > int add_reserved_mem_ranges(struct crash_mem **mem_ranges); > > +extern unsigned int boot_cpu_node_count; > + > #endif /* _ASM_POWERPC_KEXEC_RANGES_H */ > diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c > index 1eed87d954ba..d326148fd5a4 100644 > --- a/arch/powerpc/kernel/prom.c > +++ b/arch/powerpc/kernel/prom.c > @@ -56,6 +56,7 @@ > #include <asm/drmem.h> > #include <asm/ultravisor.h> > #include <asm/prom.h> > +#include <asm/kexec_ranges.h> > > #include <mm/mmu_decl.h> > > @@ -72,6 +73,7 @@ int __initdata iommu_is_off; > int __initdata iommu_force_on; > unsigned long tce_alloc_start, tce_alloc_end; > u64 ppc64_rma_size; > +unsigned int boot_cpu_node_count __ro_after_init; > #endif > static phys_addr_t first_memblock_size; > static int __initdata boot_cpu_count; > @@ -335,6 +337,8 @@ static int __init early_init_dt_scan_cpus(unsigned long node, > if (type == NULL || strcmp(type, "cpu") != 0) > return 0; > > + boot_cpu_node_count++; > + > /* Get physical cpuid */ > intserv = of_get_flat_dt_prop(node, "ibm,ppc-interrupt-server#s", &len); > if (!intserv) > -- > 2.38.1
On 07/11/2022 13:11:17, Nicholas Piggin wrote: > On Sat Oct 29, 2022 at 2:00 AM AEST, Laurent Dufour wrote: >> At boot time, the FDT is parsed to compute the number of CPUs. >> In addition count the number of CPU nodes and export it. >> >> This is useful when building the FDT for a kexeced kernel since we need to >> take in account the CPU node added since the boot time during CPU hotplug >> operations. > > It would be nice if it just realloced memory in this case, but that > looks like a bigger change. I agree, and I think the best option in long term would be the series Sourabh Jain sent in June, updating the crash kernel FDT without reloading it (https://lore.kernel.org/linuxppc-dev/20220620070106.93141-1-sourabhjain@linux.ibm.com/) In the meantime, this solves the issue. > > But these patches look okay to me, if you can solve the compile bug. Indeed, the compile bugs are raised because I added the definition of the new variable 'boot_cpu_node_count' in kexec_ranges.h, and add the inclusion of that file in prom.c. I was not confident putting this new variable definition in that header file, but I didn't find a better option. Do you have a better idea of header file to use? Could I just declare this variable "extern" in arch/powerpc/kexec/file_load_64.c? This looks ugly to me. Thanks, Laurent. > Thanks, > Nick > >> >> Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com> >> --- >> arch/powerpc/include/asm/kexec_ranges.h | 2 ++ >> arch/powerpc/kernel/prom.c | 4 ++++ >> 2 files changed, 6 insertions(+) >> >> diff --git a/arch/powerpc/include/asm/kexec_ranges.h b/arch/powerpc/include/asm/kexec_ranges.h >> index f83866a19e87..bf35d00ddd09 100644 >> --- a/arch/powerpc/include/asm/kexec_ranges.h >> +++ b/arch/powerpc/include/asm/kexec_ranges.h >> @@ -22,4 +22,6 @@ int add_rtas_mem_range(struct crash_mem **mem_ranges); >> int add_opal_mem_range(struct crash_mem **mem_ranges); >> int add_reserved_mem_ranges(struct crash_mem **mem_ranges); >> >> +extern unsigned int boot_cpu_node_count; >> + >> #endif /* _ASM_POWERPC_KEXEC_RANGES_H */ >> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c >> index 1eed87d954ba..d326148fd5a4 100644 >> --- a/arch/powerpc/kernel/prom.c >> +++ b/arch/powerpc/kernel/prom.c >> @@ -56,6 +56,7 @@ >> #include <asm/drmem.h> >> #include <asm/ultravisor.h> >> #include <asm/prom.h> >> +#include <asm/kexec_ranges.h> >> >> #include <mm/mmu_decl.h> >> >> @@ -72,6 +73,7 @@ int __initdata iommu_is_off; >> int __initdata iommu_force_on; >> unsigned long tce_alloc_start, tce_alloc_end; >> u64 ppc64_rma_size; >> +unsigned int boot_cpu_node_count __ro_after_init; >> #endif >> static phys_addr_t first_memblock_size; >> static int __initdata boot_cpu_count; >> @@ -335,6 +337,8 @@ static int __init early_init_dt_scan_cpus(unsigned long node, >> if (type == NULL || strcmp(type, "cpu") != 0) >> return 0; >> >> + boot_cpu_node_count++; >> + >> /* Get physical cpuid */ >> intserv = of_get_flat_dt_prop(node, "ibm,ppc-interrupt-server#s", &len); >> if (!intserv) >> -- >> 2.38.1 >
diff --git a/arch/powerpc/include/asm/kexec_ranges.h b/arch/powerpc/include/asm/kexec_ranges.h index f83866a19e87..bf35d00ddd09 100644 --- a/arch/powerpc/include/asm/kexec_ranges.h +++ b/arch/powerpc/include/asm/kexec_ranges.h @@ -22,4 +22,6 @@ int add_rtas_mem_range(struct crash_mem **mem_ranges); int add_opal_mem_range(struct crash_mem **mem_ranges); int add_reserved_mem_ranges(struct crash_mem **mem_ranges); +extern unsigned int boot_cpu_node_count; + #endif /* _ASM_POWERPC_KEXEC_RANGES_H */ diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 1eed87d954ba..d326148fd5a4 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -56,6 +56,7 @@ #include <asm/drmem.h> #include <asm/ultravisor.h> #include <asm/prom.h> +#include <asm/kexec_ranges.h> #include <mm/mmu_decl.h> @@ -72,6 +73,7 @@ int __initdata iommu_is_off; int __initdata iommu_force_on; unsigned long tce_alloc_start, tce_alloc_end; u64 ppc64_rma_size; +unsigned int boot_cpu_node_count __ro_after_init; #endif static phys_addr_t first_memblock_size; static int __initdata boot_cpu_count; @@ -335,6 +337,8 @@ static int __init early_init_dt_scan_cpus(unsigned long node, if (type == NULL || strcmp(type, "cpu") != 0) return 0; + boot_cpu_node_count++; + /* Get physical cpuid */ intserv = of_get_flat_dt_prop(node, "ibm,ppc-interrupt-server#s", &len); if (!intserv)