linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64/panic: Unify all three existing notifier blocks
@ 2020-06-16  3:10 Anshuman Khandual
  2020-06-16  8:29 ` kernel test robot
  2020-06-16 16:51 ` kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Anshuman Khandual @ 2020-06-16  3:10 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Anshuman Khandual, Catalin Marinas, Will Deacon, Steve Capper,
	Mark Rutland, linux-kernel

Currently there are three different registered panic notifier blocks. This
unifies all of them into a single one i.e arm64_panic_block, hence reducing
code duplication and required calling sequence during panic. This preserves
the existing dump sequence.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Steve Capper <steve.capper@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
Applies on 5.8-rc1.

 arch/arm64/include/asm/cpufeature.h |  1 +
 arch/arm64/include/asm/memory.h     |  1 +
 arch/arm64/kernel/cpufeature.c      | 15 +--------------
 arch/arm64/kernel/setup.c           | 24 ++++++++++++++----------
 arch/arm64/mm/init.c                | 18 +-----------------
 5 files changed, 18 insertions(+), 41 deletions(-)

diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index 5d1f4ae42799..e375529ca9fc 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -774,6 +774,7 @@ static inline unsigned int get_vmid_bits(u64 mmfr1)
 }
 
 u32 get_kvm_ipa_limit(void);
+void dump_cpu_features(void);
 
 #endif /* __ASSEMBLY__ */
 
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index a1871bb32bb1..2a88cb734d06 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -322,6 +322,7 @@ static inline void *phys_to_virt(phys_addr_t x)
 	__is_lm_address(__addr) && pfn_valid(virt_to_pfn(__addr));	\
 })
 
+void dump_mem_limit(void);
 #endif /* !ASSEMBLY */
 
 /*
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 2270eda9a7fb..756775f4b7d4 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -119,24 +119,11 @@ static inline void finalize_system_capabilities(void)
 	static_branch_enable(&arm64_const_caps_ready);
 }
 
-static int dump_cpu_hwcaps(struct notifier_block *self, unsigned long v, void *p)
+void dump_cpu_features(void)
 {
 	/* file-wide pr_fmt adds "CPU features: " prefix */
 	pr_emerg("0x%*pb\n", ARM64_NCAPS, &cpu_hwcaps);
-	return 0;
-}
-
-static struct notifier_block cpu_hwcaps_notifier = {
-	.notifier_call = dump_cpu_hwcaps
-};
-
-static int __init register_cpu_hwcaps_dumper(void)
-{
-	atomic_notifier_chain_register(&panic_notifier_list,
-				       &cpu_hwcaps_notifier);
-	return 0;
 }
-__initcall(register_cpu_hwcaps_dumper);
 
 DEFINE_STATIC_KEY_ARRAY_FALSE(cpu_hwcap_keys, ARM64_NCAPS);
 EXPORT_SYMBOL(cpu_hwcap_keys);
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 93b3844cf442..312b19263cb7 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -400,11 +400,7 @@ static int __init topology_init(void)
 }
 subsys_initcall(topology_init);
 
-/*
- * Dump out kernel offset information on panic.
- */
-static int dump_kernel_offset(struct notifier_block *self, unsigned long v,
-			      void *p)
+void dump_kernel_offset(void)
 {
 	const unsigned long offset = kaslr_offset();
 
@@ -415,17 +411,25 @@ static int dump_kernel_offset(struct notifier_block *self, unsigned long v,
 	} else {
 		pr_emerg("Kernel Offset: disabled\n");
 	}
+}
+
+static int arm64_panic_block_dump(struct notifier_block *self,
+				  unsigned long v, void *p)
+{
+	dump_kernel_offset();
+	dump_cpu_features();
+	dump_mem_limit();
 	return 0;
 }
 
-static struct notifier_block kernel_offset_notifier = {
-	.notifier_call = dump_kernel_offset
+static struct notifier_block arm64_panic_block = {
+	.notifier_call = arm64_panic_block_dump
 };
 
-static int __init register_kernel_offset_dumper(void)
+static int __init register_arm64_panic_block(void)
 {
 	atomic_notifier_chain_register(&panic_notifier_list,
-				       &kernel_offset_notifier);
+				       &arm64_panic_block);
 	return 0;
 }
-__initcall(register_kernel_offset_dumper);
+__initcall(register_arm64_panic_block);
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index e631e6425165..b88ef04033de 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -558,27 +558,11 @@ void free_initmem(void)
 	unmap_kernel_range((u64)__init_begin, (u64)(__init_end - __init_begin));
 }
 
-/*
- * Dump out memory limit information on panic.
- */
-static int dump_mem_limit(struct notifier_block *self, unsigned long v, void *p)
+void dump_mem_limit(void)
 {
 	if (memory_limit != PHYS_ADDR_MAX) {
 		pr_emerg("Memory Limit: %llu MB\n", memory_limit >> 20);
 	} else {
 		pr_emerg("Memory Limit: none\n");
 	}
-	return 0;
-}
-
-static struct notifier_block mem_limit_notifier = {
-	.notifier_call = dump_mem_limit,
-};
-
-static int __init register_mem_limit_dumper(void)
-{
-	atomic_notifier_chain_register(&panic_notifier_list,
-				       &mem_limit_notifier);
-	return 0;
 }
-__initcall(register_mem_limit_dumper);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64/panic: Unify all three existing notifier blocks
  2020-06-16  3:10 [PATCH] arm64/panic: Unify all three existing notifier blocks Anshuman Khandual
@ 2020-06-16  8:29 ` kernel test robot
  2020-06-16 10:49   ` Anshuman Khandual
  2020-06-16 16:51 ` kernel test robot
  1 sibling, 1 reply; 4+ messages in thread
From: kernel test robot @ 2020-06-16  8:29 UTC (permalink / raw)
  To: Anshuman Khandual, linux-arm-kernel
  Cc: kbuild-all, Anshuman Khandual, Catalin Marinas, Will Deacon,
	Steve Capper, Mark Rutland, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2043 bytes --]

Hi Anshuman,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on arm64/for-next/core]
[also build test WARNING on soc/for-next v5.8-rc1 next-20200616]
[cannot apply to arm/for-next xlnx/master kvmarm/next]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Anshuman-Khandual/arm64-panic-Unify-all-three-existing-notifier-blocks/20200616-111111
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> arch/arm64/kernel/setup.c:403:6: warning: no previous prototype for 'dump_kernel_offset' [-Wmissing-prototypes]
403 | void dump_kernel_offset(void)
|      ^~~~~~~~~~~~~~~~~~

vim +/dump_kernel_offset +403 arch/arm64/kernel/setup.c

   402	
 > 403	void dump_kernel_offset(void)
   404	{
   405		const unsigned long offset = kaslr_offset();
   406	
   407		if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && offset > 0) {
   408			pr_emerg("Kernel Offset: 0x%lx from 0x%lx\n",
   409				 offset, KIMAGE_VADDR);
   410			pr_emerg("PHYS_OFFSET: 0x%llx\n", PHYS_OFFSET);
   411		} else {
   412			pr_emerg("Kernel Offset: disabled\n");
   413		}
   414	}
   415	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 71835 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64/panic: Unify all three existing notifier blocks
  2020-06-16  8:29 ` kernel test robot
@ 2020-06-16 10:49   ` Anshuman Khandual
  0 siblings, 0 replies; 4+ messages in thread
From: Anshuman Khandual @ 2020-06-16 10:49 UTC (permalink / raw)
  To: kernel test robot, linux-arm-kernel
  Cc: kbuild-all, Catalin Marinas, Will Deacon, Steve Capper,
	Mark Rutland, linux-kernel



On 06/16/2020 01:59 PM, kernel test robot wrote:
> Hi Anshuman,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on arm64/for-next/core]
> [also build test WARNING on soc/for-next v5.8-rc1 next-20200616]
> [cannot apply to arm/for-next xlnx/master kvmarm/next]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> 
> url:    https://github.com/0day-ci/linux/commits/Anshuman-Khandual/arm64-panic-Unify-all-three-existing-notifier-blocks/20200616-111111
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
> config: arm64-allyesconfig (attached as .config)
> compiler: aarch64-linux-gcc (GCC) 9.3.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
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>, old ones prefixed by <<):
> 
>>> arch/arm64/kernel/setup.c:403:6: warning: no previous prototype for 'dump_kernel_offset' [-Wmissing-prototypes]
> 403 | void dump_kernel_offset(void)
> |      ^~~~~~~~~~~~~~~~~~
> 
> vim +/dump_kernel_offset +403 arch/arm64/kernel/setup.c
> 
>    402	
>  > 403	void dump_kernel_offset(void)

Just missed a 'static' here, which caused this warning with W=1.
Will fix this next time around.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64/panic: Unify all three existing notifier blocks
  2020-06-16  3:10 [PATCH] arm64/panic: Unify all three existing notifier blocks Anshuman Khandual
  2020-06-16  8:29 ` kernel test robot
@ 2020-06-16 16:51 ` kernel test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2020-06-16 16:51 UTC (permalink / raw)
  To: Anshuman Khandual, linux-arm-kernel
  Cc: kbuild-all, clang-built-linux, Anshuman Khandual,
	Catalin Marinas, Will Deacon, Steve Capper, Mark Rutland,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2407 bytes --]

Hi Anshuman,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on arm64/for-next/core]
[also build test WARNING on soc/for-next v5.8-rc1 next-20200616]
[cannot apply to arm/for-next xlnx/master kvmarm/next]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Anshuman-Khandual/arm64-panic-Unify-all-three-existing-notifier-blocks/20200616-111111
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: arm64-randconfig-r005-20200615 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 487ca07fcc75d52755c9fe2ee05bcb3b6eeeec44)
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 arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> arch/arm64/kernel/setup.c:403:6: warning: no previous prototype for function 'dump_kernel_offset' [-Wmissing-prototypes]
void dump_kernel_offset(void)
^
arch/arm64/kernel/setup.c:403:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void dump_kernel_offset(void)
^
static
1 warning generated.

vim +/dump_kernel_offset +403 arch/arm64/kernel/setup.c

   402	
 > 403	void dump_kernel_offset(void)
   404	{
   405		const unsigned long offset = kaslr_offset();
   406	
   407		if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && offset > 0) {
   408			pr_emerg("Kernel Offset: 0x%lx from 0x%lx\n",
   409				 offset, KIMAGE_VADDR);
   410			pr_emerg("PHYS_OFFSET: 0x%llx\n", PHYS_OFFSET);
   411		} else {
   412			pr_emerg("Kernel Offset: disabled\n");
   413		}
   414	}
   415	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31916 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-16 17:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16  3:10 [PATCH] arm64/panic: Unify all three existing notifier blocks Anshuman Khandual
2020-06-16  8:29 ` kernel test robot
2020-06-16 10:49   ` Anshuman Khandual
2020-06-16 16:51 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).