LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.15 258/279] signal/powerpc: On swapcontext failure force SIGSEGV
From: Greg Kroah-Hartman @ 2021-11-24 11:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Paul Mackerras, Thomas Backlund,
	linuxppc-dev, Eric W. Biederman
In-Reply-To: <20211124115718.776172708@linuxfoundation.org>

From: Eric W. Biederman <ebiederm@xmission.com>

commit 83a1f27ad773b1d8f0460d3a676114c7651918cc upstream.

If the register state may be partial and corrupted instead of calling
do_exit, call force_sigsegv(SIGSEGV).  Which properly kills the
process with SIGSEGV and does not let any more userspace code execute,
instead of just killing one thread of the process and potentially
confusing everything.

Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
History-tree: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git
Fixes: 756f1ae8a44e ("PPC32: Rework signal code and add a swapcontext system call.")
Fixes: 04879b04bf50 ("[PATCH] ppc64: VMX (Altivec) support & signal32 rework, from Ben Herrenschmidt")
Link: https://lkml.kernel.org/r/20211020174406.17889-7-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Thomas Backlund <tmb@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/powerpc/kernel/signal_32.c |    6 ++++--
 arch/powerpc/kernel/signal_64.c |    9 ++++++---
 2 files changed, 10 insertions(+), 5 deletions(-)

--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -1062,8 +1062,10 @@ SYSCALL_DEFINE3(swapcontext, struct ucon
 	 * or if another thread unmaps the region containing the context.
 	 * We kill the task with a SIGSEGV in this situation.
 	 */
-	if (do_setcontext(new_ctx, regs, 0))
-		do_exit(SIGSEGV);
+	if (do_setcontext(new_ctx, regs, 0)) {
+		force_sigsegv(SIGSEGV);
+		return -EFAULT;
+	}
 
 	set_thread_flag(TIF_RESTOREALL);
 	return 0;
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -703,15 +703,18 @@ SYSCALL_DEFINE3(swapcontext, struct ucon
 	 * We kill the task with a SIGSEGV in this situation.
 	 */
 
-	if (__get_user_sigset(&set, &new_ctx->uc_sigmask))
-		do_exit(SIGSEGV);
+	if (__get_user_sigset(&set, &new_ctx->uc_sigmask)) {
+		force_sigsegv(SIGSEGV);
+		return -EFAULT;
+	}
 	set_current_blocked(&set);
 
 	if (!user_read_access_begin(new_ctx, ctx_size))
 		return -EFAULT;
 	if (__unsafe_restore_sigcontext(current, NULL, 0, &new_ctx->uc_mcontext)) {
 		user_read_access_end();
-		do_exit(SIGSEGV);
+		force_sigsegv(SIGSEGV);
+		return -EFAULT;
 	}
 	user_read_access_end();
 



^ permalink raw reply

* Re: [PATCH 0/8] Convert powerpc to default topdown mmap layout
From: Nicholas Piggin @ 2021-11-24 13:21 UTC (permalink / raw)
  To: alex, Benjamin Herrenschmidt, Christophe Leroy, Michael Ellerman,
	Paul Mackerras
  Cc: linux-mm, linuxppc-dev, linux-kernel
In-Reply-To: <cover.1637570556.git.christophe.leroy@csgroup.eu>

Excerpts from Christophe Leroy's message of November 22, 2021 6:48 pm:
> This series converts powerpc to default topdown mmap layout.
> 
> powerpc provides its own arch_get_unmapped_area() only when
> slices are needed, which is only for book3s/64. First part of
> the series moves slices into book3s/64 specific directories
> and cleans up other subarchitectures.
> 
> Then a small modification is done to core mm to allow
> powerpc to still provide its own arch_randomize_brk()
> 
> Last part converts to default topdown mmap layout.

A nice series but will clash badly with the CONFIG_HASH_MMU 
series of course. One will have to be rebased if they are
both to be merged.

Thanks,
Nick

^ permalink raw reply

* Re: [PATCH 0/3] KEXEC_SIG with appended signature
From: Michal Suchánek @ 2021-11-24 13:27 UTC (permalink / raw)
  To: Mimi Zohar
  Cc: Thiago Jung Bauermann, linux-s390, Vasily Gorbik, Rob Herring,
	Philipp Rudo, Heiko Carstens, Nayna, linux-kernel, David Howells,
	Lakshmi Ramasubramanian, Luis Chamberlain, keyrings,
	Paul Mackerras, Frank van der Linden, Jessica Yu,
	Alexander Gordeev, buendgen, linuxppc-dev, Christian Borntraeger,
	Hari Bathini, Daniel Axtens
In-Reply-To: <290c0097271c68f5a9fd1e8f6fdb542631981b33.camel@linux.ibm.com>

On Wed, Nov 24, 2021 at 08:10:10AM -0500, Mimi Zohar wrote:
> On Wed, 2021-11-24 at 12:09 +0100, Philipp Rudo wrote:
> > Now Michal wants to adapt KEXEC_SIG for ppc too so distros can rely on all
> > architectures using the same mechanism and thus reduce maintenance cost.
> > On the way there he even makes some absolutely reasonable improvements
> > for everybody.
> > 
> > Why is that so controversial? What is the real problem that should be
> > discussed here?
> 
> Nothing is controversial with what Michal wants to do.  I've already
> said, "As for adding KEXEC_SIG appended signature support on PowerPC
> based on the s390 code, it sounds reasonable."

Ok, I will resend the series with the arch-specific changes first to be
independent of the core cleanup.

Thanks

Michal

^ permalink raw reply

* Re: [PATCH 0/8] Convert powerpc to default topdown mmap layout
From: Christophe Leroy @ 2021-11-24 13:40 UTC (permalink / raw)
  To: Nicholas Piggin, alex, Benjamin Herrenschmidt, Michael Ellerman,
	Paul Mackerras
  Cc: linux-mm, linuxppc-dev, linux-kernel
In-Reply-To: <1637759994.e3mppl4ly7.astroid@bobo.none>



Le 24/11/2021 à 14:21, Nicholas Piggin a écrit :
> Excerpts from Christophe Leroy's message of November 22, 2021 6:48 pm:
>> This series converts powerpc to default topdown mmap layout.
>>
>> powerpc provides its own arch_get_unmapped_area() only when
>> slices are needed, which is only for book3s/64. First part of
>> the series moves slices into book3s/64 specific directories
>> and cleans up other subarchitectures.
>>
>> Then a small modification is done to core mm to allow
>> powerpc to still provide its own arch_randomize_brk()
>>
>> Last part converts to default topdown mmap layout.
> 
> A nice series but will clash badly with the CONFIG_HASH_MMU
> series of course. One will have to be rebased if they are
> both to be merged.
> 

No worry, it should be an issue.

If you already forsee that series being merged soon, I can rebase my 
series on top of it just now.

Christophe

^ permalink raw reply

* Re: [PATCH v2 6/8] inotify: simplify subdirectory registration with register_sysctl()
From: Luis Chamberlain @ 2021-11-24 13:40 UTC (permalink / raw)
  To: Jan Kara
  Cc: airlied, amir73il, clemens, dri-devel, phil, joseph.qi, mark,
	yzaikin, joonas.lahtinen, keescook, arnd, intel-gfx, jani.nikula,
	viro, rodrigo.vivi, nixiaoming, tvrtko.ursulin, gregkh,
	linux-kernel, julia.lawall, ebiederm, linux-fsdevel, akpm,
	linuxppc-dev, ocfs2-devel, jlbec
In-Reply-To: <20211124094409.GF8583@quack2.suse.cz>

On Wed, Nov 24, 2021 at 10:44:09AM +0100, Jan Kara wrote:
> On Tue 23-11-21 12:24:20, Luis Chamberlain wrote:
> > From: Xiaoming Ni <nixiaoming@huawei.com>
> > 
> > There is no need to user boiler plate code to specify a set of base
> > directories we're going to stuff sysctls under. Simplify this by using
> > register_sysctl() and specifying the directory path directly.
> > 
> > Move inotify_user sysctl to inotify_user.c while at it to remove clutter
> > from kernel/sysctl.c.
> > 
> > Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
> > [mcgrof: update commit log to reflect new path we decided to take]
> > Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> 
> This looks fishy. You register inotify_table but not fanotify_table and
> remove both...

Indeed, the following was missing, I'll roll it in:

diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 559bc1e9926d..a35693eb1f36 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -59,7 +59,7 @@ static int fanotify_max_queued_events __read_mostly;
 static long ft_zero = 0;
 static long ft_int_max = INT_MAX;
 
-struct ctl_table fanotify_table[] = {
+static struct ctl_table fanotify_table[] = {
 	{
 		.procname	= "max_user_groups",
 		.data	= &init_user_ns.ucount_max[UCOUNT_FANOTIFY_GROUPS],
@@ -88,6 +88,13 @@ struct ctl_table fanotify_table[] = {
 	},
 	{ }
 };
+
+static void __init fanotify_sysctls_init(void)
+{
+	register_sysctl("fs/fanotify", fanotify_table);
+}
+#else
+#define fanotify_sysctls_init() do { } while (0)
 #endif /* CONFIG_SYSCTL */
 
 /*
@@ -1685,6 +1692,7 @@ static int __init fanotify_user_setup(void)
 	init_user_ns.ucount_max[UCOUNT_FANOTIFY_GROUPS] =
 					FANOTIFY_DEFAULT_MAX_GROUPS;
 	init_user_ns.ucount_max[UCOUNT_FANOTIFY_MARKS] = max_marks;
+	fanotify_sysctls_init();
 
 	return 0;
 }
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
index 616af2ea20f3..556cc63c88ee 100644
--- a/include/linux/fanotify.h
+++ b/include/linux/fanotify.h
@@ -5,8 +5,6 @@
 #include <linux/sysctl.h>
 #include <uapi/linux/fanotify.h>
 
-extern struct ctl_table fanotify_table[]; /* for sysctl */
-
 #define FAN_GROUP_FLAG(group, flag) \
 	((group)->fanotify_data.flags & (flag))
 

^ permalink raw reply related

* [PATCH 1/1] futex: Wireup futex_waitv syscall
From: André Almeida @ 2021-11-24 13:21 UTC (permalink / raw)
  To: linux-kernel, arnd, geert, monstr, mpe, ysato, dalias, davem,
	chris, jcmvbkbc, linux-alpha, linux-ia64, linux-m68k,
	linuxppc-dev, linux-sh, sparclinux, linux-xtensa
  Cc: sfr, senozhatsky, peterz, will, boqun.feng, lkft-triage, minchan,
	naresh.kamboju, linux-next, umgwanakikbuti, rob, andrealmeid,
	longman, akpm, mingo, bigeasy
In-Reply-To: <CAK8P3a3pQW59NVF=5P+ZiBjNJmnWh+iTZUHvqHBrXkHA6pMd4g@mail.gmail.com>

Wireup futex_waitv syscall for all remaining archs.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
---
 arch/alpha/kernel/syscalls/syscall.tbl      | 1 +
 arch/ia64/kernel/syscalls/syscall.tbl       | 1 +
 arch/m68k/kernel/syscalls/syscall.tbl       | 1 +
 arch/microblaze/kernel/syscalls/syscall.tbl | 1 +
 arch/powerpc/kernel/syscalls/syscall.tbl    | 1 +
 arch/sh/kernel/syscalls/syscall.tbl         | 1 +
 arch/sparc/kernel/syscalls/syscall.tbl      | 1 +
 arch/xtensa/kernel/syscalls/syscall.tbl     | 1 +
 8 files changed, 8 insertions(+)

diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl
index e4a041cd5715..ca5a32228cd6 100644
--- a/arch/alpha/kernel/syscalls/syscall.tbl
+++ b/arch/alpha/kernel/syscalls/syscall.tbl
@@ -488,3 +488,4 @@
 556	common	landlock_restrict_self		sys_landlock_restrict_self
 # 557 reserved for memfd_secret
 558	common	process_mrelease		sys_process_mrelease
+559	common  futex_waitv                     sys_futex_waitv
diff --git a/arch/ia64/kernel/syscalls/syscall.tbl b/arch/ia64/kernel/syscalls/syscall.tbl
index 6fea1844fb95..707ae121f6d3 100644
--- a/arch/ia64/kernel/syscalls/syscall.tbl
+++ b/arch/ia64/kernel/syscalls/syscall.tbl
@@ -369,3 +369,4 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+449	common  futex_waitv                     sys_futex_waitv
diff --git a/arch/m68k/kernel/syscalls/syscall.tbl b/arch/m68k/kernel/syscalls/syscall.tbl
index 7976dff8f879..45bc32a41b90 100644
--- a/arch/m68k/kernel/syscalls/syscall.tbl
+++ b/arch/m68k/kernel/syscalls/syscall.tbl
@@ -448,3 +448,4 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+449	common  futex_waitv                     sys_futex_waitv
diff --git a/arch/microblaze/kernel/syscalls/syscall.tbl b/arch/microblaze/kernel/syscalls/syscall.tbl
index 6b0e11362bd2..2204bde3ce4a 100644
--- a/arch/microblaze/kernel/syscalls/syscall.tbl
+++ b/arch/microblaze/kernel/syscalls/syscall.tbl
@@ -454,3 +454,4 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+449	common  futex_waitv                     sys_futex_waitv
diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
index 7bef917cc84e..15109af9d075 100644
--- a/arch/powerpc/kernel/syscalls/syscall.tbl
+++ b/arch/powerpc/kernel/syscalls/syscall.tbl
@@ -528,3 +528,4 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+449	common  futex_waitv                     sys_futex_waitv
diff --git a/arch/sh/kernel/syscalls/syscall.tbl b/arch/sh/kernel/syscalls/syscall.tbl
index 208f131659c5..d9539d28bdaa 100644
--- a/arch/sh/kernel/syscalls/syscall.tbl
+++ b/arch/sh/kernel/syscalls/syscall.tbl
@@ -451,3 +451,4 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+449	common  futex_waitv                     sys_futex_waitv
diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl
index c37764dc764d..46adabcb1720 100644
--- a/arch/sparc/kernel/syscalls/syscall.tbl
+++ b/arch/sparc/kernel/syscalls/syscall.tbl
@@ -494,3 +494,4 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+449	common  futex_waitv                     sys_futex_waitv
diff --git a/arch/xtensa/kernel/syscalls/syscall.tbl b/arch/xtensa/kernel/syscalls/syscall.tbl
index 104b327f8ac9..3e3e1a506bed 100644
--- a/arch/xtensa/kernel/syscalls/syscall.tbl
+++ b/arch/xtensa/kernel/syscalls/syscall.tbl
@@ -419,3 +419,4 @@
 446	common	landlock_restrict_self		sys_landlock_restrict_self
 # 447 reserved for memfd_secret
 448	common	process_mrelease		sys_process_mrelease
+449	common  futex_waitv                     sys_futex_waitv
-- 
2.33.1


^ permalink raw reply related

* Re: [PATCH 1/8] powerpc/mm: Make slice specific to book3s/64
From: Christophe Leroy @ 2021-11-24 13:49 UTC (permalink / raw)
  To: kernel test robot, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, alex
  Cc: linux-mm, kbuild-all, linuxppc-dev, linux-kernel
In-Reply-To: <adefca8d-5fd4-b9ad-dfb8-0cf334440935@csgroup.eu>



Le 24/11/2021 à 13:10, Christophe Leroy a écrit :
> 
> 
> Le 22/11/2021 à 15:48, kernel test robot a écrit :
>> Hi Christophe,
>>
>> I love your patch! Perhaps something to improve:
>>
>> [auto build test WARNING on powerpc/next]
>> [also build test WARNING on hnaz-mm/master linus/master v5.16-rc2 
>> next-20211118]
>> [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]
>>
>> url:    
>> https://github.com/0day-ci/linux/commits/Christophe-Leroy/Convert-powerpc-to-default-topdown-mmap-layout/20211122-165115 
>>
>> base:   
>> https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
>> config: powerpc64-randconfig-s031-20211122 (attached as .config)
>> compiler: powerpc64-linux-gcc (GCC) 11.2.0
>> reproduce:
>>          wget 
>> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross 
>> -O ~/bin/make.cross
>>          chmod +x ~/bin/make.cross
>>          # apt-get install sparse
>>          # sparse version: v0.6.4-dirty
>>          # 
>> https://github.com/0day-ci/linux/commit/1d0b7cc86d08f25f595b52d8c39ba9ca1d29a30a 
>>
>>          git remote add linux-review https://github.com/0day-ci/linux
>>          git fetch --no-tags linux-review 
>> Christophe-Leroy/Convert-powerpc-to-default-topdown-mmap-layout/20211122-165115 
>>
>>          git checkout 1d0b7cc86d08f25f595b52d8c39ba9ca1d29a30a
>>          # save the attached .config to linux build tree
>>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 
>> make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc64
>>
>> 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 >>):
>>
>>     arch/powerpc/mm/book3s64/slice.c: In function 
>> 'slice_get_unmapped_area':
>>>> arch/powerpc/mm/book3s64/slice.c:639:1: warning: the frame size of 
>>>> 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>>       639 | }
>>           | ^
> 
> 
> The problem was already existing when slice.c was in arch/powerpc/mm/
> 
> This patch doesn't introduce the problem.
> 

In fact the problem is really added by yourself mister 'kernel test robot'.

CONFIG_FRAME_WARN is supposed to be 2048 on 64 bit architectures.

It the robot starts to reduce that value, it is on its own ....


config FRAME_WARN
	int "Warn for stack frames larger than"
	range 0 8192
	default 2048 if GCC_PLUGIN_LATENT_ENTROPY
	default 1536 if (!64BIT && (PARISC || XTENSA))
	default 1024 if (!64BIT && !PARISC)
	default 2048 if 64BIT
	help
	  Tell gcc to warn at build time for stack frames larger than this.
	  Setting this too low will cause a lot of warnings.
	  Setting it to 0 disables the warning.


^ permalink raw reply

* Re: [PATCH 1/1] futex: Wireup futex_waitv syscall
From: Geert Uytterhoeven @ 2021-11-24 13:49 UTC (permalink / raw)
  To: André Almeida
  Cc: Rich Felker, linux-ia64@vger.kernel.org, Linux-sh list,
	Peter Zijlstra, Sebastian Andrzej Siewior, lkft-triage,
	Max Filippov, Mike Galbraith, sparclinux, Will Deacon,
	Stephen Rothwell, Yoshinori Sato, Sergey Senozhatsky,
	Naresh Kamboju, Linux-Next, Waiman Long,
	open list:TENSILICA XTENSA PORT (xtensa), Arnd Bergmann,
	Boqun Feng, linux-m68k, Ingo Molnar, Chris Zankel, Michal Simek,
	Linux Kernel Mailing List, Minchan Kim, Rob Landley, alpha,
	Andrew Morton, linuxppc-dev, David S. Miller
In-Reply-To: <20211124132112.11641-1-andrealmeid@collabora.com>

On Wed, Nov 24, 2021 at 2:21 PM André Almeida <andrealmeid@collabora.com> wrote:
> Wireup futex_waitv syscall for all remaining archs.
>
> Signed-off-by: André Almeida <andrealmeid@collabora.com>

>  arch/m68k/kernel/syscalls/syscall.tbl       | 1 +

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply

* Re: [PATCH 1/1] futex: Wireup futex_waitv syscall
From: Arnd Bergmann @ 2021-11-24 14:29 UTC (permalink / raw)
  To: André Almeida
  Cc: Rich Felker, linux-ia64, Linux-sh list, Peter Zijlstra,
	Sebastian Andrzej Siewior, lkft-triage, Max Filippov,
	Mike Galbraith, sparclinux, Will Deacon, Stephen Rothwell,
	Yoshinori Sato, Sergey Senozhatsky, Naresh Kamboju,
	Linux-Next Mailing List, Geert Uytterhoeven, Waiman Long,
	open list:TENSILICA XTENSA PORT (xtensa), Arnd Bergmann,
	Boqun Feng, linux-m68k, Ingo Molnar, Chris Zankel, Michal Simek,
	Linux Kernel Mailing List, Minchan Kim, Rob Landley, alpha,
	Andrew Morton, linuxppc-dev, David Miller
In-Reply-To: <20211124132112.11641-1-andrealmeid@collabora.com>

On Wed, Nov 24, 2021 at 2:21 PM André Almeida <andrealmeid@collabora.com> wrote:
>
> Wireup futex_waitv syscall for all remaining archs.
>
> Signed-off-by: André Almeida <andrealmeid@collabora.com>

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

I double-checked that futex_waitv() doesn't need any architecture specific
hacks, and that the list above is complete.

Should I take this through the asm-generic tree, or would you send it
through the
tip tree?

        Arnd

^ permalink raw reply

* [PATCH] recordmcount: Support empty section from recent binutils
From: Christophe Leroy @ 2021-11-24 14:43 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Steven Rostedt, linuxppc-dev, linux-kernel

Looks like recent binutils (2.36 and over ?) may empty some section,
leading to failure like:

	Cannot find symbol for section 11: .text.unlikely.
	kernel/kexec_file.o: failed
	make[1]: *** [scripts/Makefile.build:287: kernel/kexec_file.o] Error 1

In order to avoid that, ensure that the section has a content before
returning it's name in has_rel_mcount().

Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Link: https://github.com/linuxppc/issues/issues/388
Link: https://lore.kernel.org/all/20210215162209.5e2a475b@gandalf.local.home/
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 scripts/recordmcount.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 1e9baa5c4fc6..cc6600b729ae 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -575,6 +575,8 @@ static char const *has_rel_mcount(Elf_Shdr const *const relhdr,
 				  char const *const shstrtab,
 				  char const *const fname)
 {
+	if (!shdr0->sh_size)
+		return NULL;
 	if (w(relhdr->sh_type) != SHT_REL && w(relhdr->sh_type) != SHT_RELA)
 		return NULL;
 	return __has_rel_mcount(relhdr, shdr0, shstrtab, fname);
-- 
2.33.1


^ permalink raw reply related

* Re: [PATCH 1/1] futex: Wireup futex_waitv syscall
From: André Almeida @ 2021-11-24 15:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Rich Felker, linux-ia64, Linux-sh list, Peter Zijlstra,
	Sebastian Andrzej Siewior, lkft-triage, Max Filippov,
	Mike Galbraith, sparclinux, Will Deacon, Stephen Rothwell,
	Yoshinori Sato, Sergey Senozhatsky, Naresh Kamboju,
	Linux-Next Mailing List, Geert Uytterhoeven, Waiman Long,
	open list:TENSILICA XTENSA PORT (xtensa), Boqun Feng, linux-m68k,
	Ingo Molnar, Chris Zankel, Michal Simek,
	Linux Kernel Mailing List, Minchan Kim, Rob Landley, alpha,
	Andrew Morton, linuxppc-dev, David Miller
In-Reply-To: <CAK8P3a2BXefTw68yoZ9U0F=ASC3=EZDc5PDQCJ16MmXtynd59g@mail.gmail.com>

Às 11:29 de 24/11/21, Arnd Bergmann escreveu:
> On Wed, Nov 24, 2021 at 2:21 PM André Almeida <andrealmeid@collabora.com> wrote:
>>
>> Wireup futex_waitv syscall for all remaining archs.
>>
>> Signed-off-by: André Almeida <andrealmeid@collabora.com>
> 
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> 
> I double-checked that futex_waitv() doesn't need any architecture specific
> hacks, and that the list above is complete.

Thanks!

> 
> Should I take this through the asm-generic tree, or would you send it
> through the
> tip tree?
> 
I think that adding it to asm-generic tree make sense to me.

^ permalink raw reply

* Re: [PATCH 1/3] of/fdt: Rework early_init_dt_scan_chosen() to call directly
From: Frank Rowand @ 2021-11-24 16:13 UTC (permalink / raw)
  To: Rob Herring, Benjamin Herrenschmidt, John Crispin,
	Michael Ellerman, Paul Mackerras, Thomas Bogendoerfer
  Cc: devicetree, linuxppc-dev, linux-kernel, linux-mips
In-Reply-To: <20211118181213.1433346-2-robh@kernel.org>

On 11/18/21 1:12 PM, Rob Herring wrote:
> Use of the of_scan_flat_dt() function predates libfdt and is discouraged
> as libfdt provides a nicer set of APIs. Rework
> early_init_dt_scan_chosen() to be called directly and use libfdt.
> 
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Frank Rowand <frowand.list@gmail.com>
> Cc: linuxppc-dev@lists.ozlabs.org
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  arch/powerpc/kernel/prom.c           |  2 +-
>  arch/powerpc/mm/nohash/kaslr_booke.c |  4 +--
>  drivers/of/fdt.c                     | 39 ++++++++++++++--------------
>  include/linux/of_fdt.h               |  3 +--
>  4 files changed, 22 insertions(+), 26 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 2e67588f6f6e..c6c398ccd98a 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -402,7 +402,7 @@ static int __init early_init_dt_scan_chosen_ppc(unsigned long node,
>  	const unsigned long *lprop; /* All these set by kernel, so no need to convert endian */
>  
>  	/* Use common scan routine to determine if this is the chosen node */
> -	if (early_init_dt_scan_chosen(node, uname, depth, data) == 0)
> +	if (early_init_dt_scan_chosen(data) < 0)
>  		return 0;
>  
>  #ifdef CONFIG_PPC64
> diff --git a/arch/powerpc/mm/nohash/kaslr_booke.c b/arch/powerpc/mm/nohash/kaslr_booke.c
> index 8fc49b1b4a91..90debe19ab4c 100644
> --- a/arch/powerpc/mm/nohash/kaslr_booke.c
> +++ b/arch/powerpc/mm/nohash/kaslr_booke.c
> @@ -44,9 +44,7 @@ struct regions __initdata regions;
>  
>  static __init void kaslr_get_cmdline(void *fdt)
>  {
> -	int node = fdt_path_offset(fdt, "/chosen");
> -
> -	early_init_dt_scan_chosen(node, "chosen", 1, boot_command_line);
> +	early_init_dt_scan_chosen(boot_command_line);
>  }
>  
>  static unsigned long __init rotate_xor(unsigned long hash, const void *area,
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index bdca35284ceb..1f1705f76263 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -1124,18 +1124,18 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
>  	return 0;
>  }
>  
> -int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
> -				     int depth, void *data)
> +int __init early_init_dt_scan_chosen(char *cmdline)
>  {
> -	int l;
> +	int l, node;
>  	const char *p;
>  	const void *rng_seed;
> +	const void *fdt = initial_boot_params;
>  
> -	pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
> -
> -	if (depth != 1 || !data ||
> -	    (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
> -		return 0;
> +	node = fdt_path_offset(fdt, "/chosen");
> +	if (node < 0)
> +		node = fdt_path_offset(fdt, "/chosen@0");
> +	if (node < 0)
> +		return -ENOENT;
>  
>  	early_init_dt_check_for_initrd(node);
>  	early_init_dt_check_for_elfcorehdr(node);
> @@ -1144,7 +1144,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
>  	/* Retrieve command line */
>  	p = of_get_flat_dt_prop(node, "bootargs", &l);
>  	if (p != NULL && l > 0)
> -		strlcpy(data, p, min(l, COMMAND_LINE_SIZE));
> +		strlcpy(cmdline, p, min(l, COMMAND_LINE_SIZE));
>  
>  	/*
>  	 * CONFIG_CMDLINE is meant to be a default in case nothing else
> @@ -1153,18 +1153,18 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
>  	 */
>  #ifdef CONFIG_CMDLINE
>  #if defined(CONFIG_CMDLINE_EXTEND)
> -	strlcat(data, " ", COMMAND_LINE_SIZE);
> -	strlcat(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> +	strlcat(cmdline, " ", COMMAND_LINE_SIZE);
> +	strlcat(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
>  #elif defined(CONFIG_CMDLINE_FORCE)
> -	strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> +	strlcpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
>  #else
>  	/* No arguments from boot loader, use kernel's  cmdl*/
> -	if (!((char *)data)[0])
> -		strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> +	if (!((char *)cmdline)[0])
> +		strlcpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
>  #endif
>  #endif /* CONFIG_CMDLINE */
>  
> -	pr_debug("Command line is: %s\n", (char *)data);
> +	pr_debug("Command line is: %s\n", (char *)cmdline);
>  
>  	rng_seed = of_get_flat_dt_prop(node, "rng-seed", &l);
>  	if (rng_seed && l > 0) {
> @@ -1178,8 +1178,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
>  				fdt_totalsize(initial_boot_params));
>  	}
>  
> -	/* break now */
> -	return 1;
> +	return 0;
>  }
>  
>  #ifndef MIN_MEMBLOCK_ADDR
> @@ -1261,14 +1260,14 @@ bool __init early_init_dt_verify(void *params)
>  
>  void __init early_init_dt_scan_nodes(void)
>  {
> -	int rc = 0;
> +	int rc;
>  
>  	/* Initialize {size,address}-cells info */
>  	of_scan_flat_dt(early_init_dt_scan_root, NULL);
>  
>  	/* Retrieve various information from the /chosen node */
> -	rc = of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
> -	if (!rc)
> +	rc = early_init_dt_scan_chosen(boot_command_line);
> +	if (rc)
>  		pr_warn("No chosen node found, continuing without\n");
>  
>  	/* Setup memory, calling early_init_dt_add_memory_arch */
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index cf48983d3c86..654722235df6 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -58,8 +58,7 @@ extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
>  extern unsigned long of_get_flat_dt_root(void);
>  extern uint32_t of_get_flat_dt_phandle(unsigned long node);
>  
> -extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
> -				     int depth, void *data);
> +extern int early_init_dt_scan_chosen(char *cmdline);
>  extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
>  				     int depth, void *data);
>  extern int early_init_dt_scan_chosen_stdout(void);
> 

patch 1/3

Reviewed-by: Frank Rowand <frank.rowand@sony.com>


^ permalink raw reply

* Re: [PATCH 2/3] of/fdt: Rework early_init_dt_scan_root() to call directly
From: Frank Rowand @ 2021-11-24 16:20 UTC (permalink / raw)
  To: Rob Herring, Benjamin Herrenschmidt, John Crispin,
	Michael Ellerman, Paul Mackerras, Thomas Bogendoerfer
  Cc: devicetree, linuxppc-dev, linux-kernel, linux-mips
In-Reply-To: <20211118181213.1433346-3-robh@kernel.org>

On 11/18/21 1:12 PM, Rob Herring wrote:
> Use of the of_scan_flat_dt() function predates libfdt and is discouraged
> as libfdt provides a nicer set of APIs. Rework early_init_dt_scan_root()
> to be called directly and use libfdt.
> 
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Frank Rowand <frowand.list@gmail.com>
> Cc: linuxppc-dev@lists.ozlabs.org
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  arch/powerpc/kernel/prom.c |  4 ++--
>  drivers/of/fdt.c           | 14 +++++++-------
>  include/linux/of_fdt.h     |  3 +--
>  3 files changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index c6c398ccd98a..6e1a106f02eb 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -748,7 +748,7 @@ void __init early_init_devtree(void *params)
>  	of_scan_flat_dt(early_init_dt_scan_chosen_ppc, boot_command_line);
>  
>  	/* Scan memory nodes and rebuild MEMBLOCKs */
> -	of_scan_flat_dt(early_init_dt_scan_root, NULL);
> +	early_init_dt_scan_root();
>  	of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL);
>  
>  	parse_early_param();
> @@ -857,7 +857,7 @@ void __init early_get_first_memblock_info(void *params, phys_addr_t *size)
>  	 * mess the memblock.
>  	 */
>  	add_mem_to_memblock = 0;
> -	of_scan_flat_dt(early_init_dt_scan_root, NULL);
> +	early_init_dt_scan_root();
>  	of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL);
>  	add_mem_to_memblock = 1;
>  
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 1f1705f76263..5e216555fe4f 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -1042,13 +1042,14 @@ int __init early_init_dt_scan_chosen_stdout(void)
>  /*
>   * early_init_dt_scan_root - fetch the top level address and size cells
>   */
> -int __init early_init_dt_scan_root(unsigned long node, const char *uname,
> -				   int depth, void *data)
> +int __init early_init_dt_scan_root(void)
>  {
>  	const __be32 *prop;
> +	const void *fdt = initial_boot_params;
> +	int node = fdt_path_offset(fdt, "/");
>  
> -	if (depth != 0)
> -		return 0;
> +	if (node < 0)
> +		return -ENODEV;
>  
>  	dt_root_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT;
>  	dt_root_addr_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT;
> @@ -1063,8 +1064,7 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
>  		dt_root_addr_cells = be32_to_cpup(prop);
>  	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
>  
> -	/* break now */
> -	return 1;
> +	return 0;
>  }
>  
>  u64 __init dt_mem_next_cell(int s, const __be32 **cellp)
> @@ -1263,7 +1263,7 @@ void __init early_init_dt_scan_nodes(void)
>  	int rc;
>  
>  	/* Initialize {size,address}-cells info */
> -	of_scan_flat_dt(early_init_dt_scan_root, NULL);
> +	early_init_dt_scan_root();
>  
>  	/* Retrieve various information from the /chosen node */
>  	rc = early_init_dt_scan_chosen(boot_command_line);
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 654722235df6..df3d31926c3c 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -68,8 +68,7 @@ extern void early_init_dt_add_memory_arch(u64 base, u64 size);
>  extern u64 dt_mem_next_cell(int s, const __be32 **cellp);
>  
>  /* Early flat tree scan hooks */
> -extern int early_init_dt_scan_root(unsigned long node, const char *uname,
> -				   int depth, void *data);
> +extern int early_init_dt_scan_root(void);
>  
>  extern bool early_init_dt_scan(void *params);
>  extern bool early_init_dt_verify(void *params);
> 

Reviewed-by: Frank Rowand <frank.rowand@sony.com>

^ permalink raw reply

* Re: [PATCH 3/3] of/fdt: Rework early_init_dt_scan_memory() to call directly
From: Frank Rowand @ 2021-11-24 16:58 UTC (permalink / raw)
  To: Rob Herring, Benjamin Herrenschmidt, John Crispin,
	Michael Ellerman, Paul Mackerras, Thomas Bogendoerfer
  Cc: devicetree, linuxppc-dev, linux-kernel, linux-mips
In-Reply-To: <20211118181213.1433346-4-robh@kernel.org>

On 11/18/21 1:12 PM, Rob Herring wrote:
> Use of the of_scan_flat_dt() function predates libfdt and is discouraged
> as libfdt provides a nicer set of APIs. Rework
> early_init_dt_scan_memory() to be called directly and use libfdt.
> 
> Cc: John Crispin <john@phrozen.org>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Frank Rowand <frowand.list@gmail.com>
> Cc: linux-mips@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  arch/mips/ralink/of.c      | 16 ++-------
>  arch/powerpc/kernel/prom.c | 16 ++++-----
>  drivers/of/fdt.c           | 68 ++++++++++++++++++++------------------
>  include/linux/of_fdt.h     |  3 +-
>  4 files changed, 47 insertions(+), 56 deletions(-)
> 
> diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
> index 0135376c5de5..e1d79523343a 100644
> --- a/arch/mips/ralink/of.c
> +++ b/arch/mips/ralink/of.c
> @@ -53,17 +53,6 @@ void __init device_tree_init(void)
>  	unflatten_and_copy_device_tree();
>  }
>  
> -static int memory_dtb;
> -
> -static int __init early_init_dt_find_memory(unsigned long node,
> -				const char *uname, int depth, void *data)
> -{
> -	if (depth == 1 && !strcmp(uname, "memory@0"))
> -		memory_dtb = 1;
> -
> -	return 0;
> -}
> -
>  void __init plat_mem_setup(void)
>  {
>  	void *dtb;
> @@ -77,9 +66,8 @@ void __init plat_mem_setup(void)
>  	dtb = get_fdt();
>  	__dt_setup_arch(dtb);
>  
> -	of_scan_flat_dt(early_init_dt_find_memory, NULL);
> -	if (memory_dtb)
> -		of_scan_flat_dt(early_init_dt_scan_memory, NULL);
> +	if (!early_init_dt_scan_memory())
> +		return;
>  	else if (soc_info.mem_detect)

The previous chunk is now:

   if (XXX)
      return;

instead of:

   if (XXX)
      YYY();

so "else if (soc_info.mem_detect)" should be:

  if (soc_info.mem_detect)

>  		soc_info.mem_detect();
>  	else if (soc_info.mem_size)
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index 6e1a106f02eb..63762a3b75e8 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -532,19 +532,19 @@ static int  __init early_init_drmem_lmb(struct drmem_lmb *lmb,
>  }
>  #endif /* CONFIG_PPC_PSERIES */
>  
> -static int __init early_init_dt_scan_memory_ppc(unsigned long node,
> -						const char *uname,
> -						int depth, void *data)
> +static int __init early_init_dt_scan_memory_ppc(void)
>  {
>  #ifdef CONFIG_PPC_PSERIES
> -	if (depth == 1 &&
> -	    strcmp(uname, "ibm,dynamic-reconfiguration-memory") == 0) {
> +	const void *fdt = initial_boot_params;
> +	int node = fdt_path_offset(fdt, "/ibm,dynamic-reconfiguration-memory");
> +
> +	if (node > 0) {
>  		walk_drmem_lmbs_early(node, NULL, early_init_drmem_lmb);
>  		return 0;
>  	}
>  #endif
>  	
> -	return early_init_dt_scan_memory(node, uname, depth, data);
> +	return early_init_dt_scan_memory();
>  }
>  
>  /*
> @@ -749,7 +749,7 @@ void __init early_init_devtree(void *params)
>  
>  	/* Scan memory nodes and rebuild MEMBLOCKs */
>  	early_init_dt_scan_root();
> -	of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL);
> +	early_init_dt_scan_memory_ppc();
>  
>  	parse_early_param();
>  
> @@ -858,7 +858,7 @@ void __init early_get_first_memblock_info(void *params, phys_addr_t *size)
>  	 */
>  	add_mem_to_memblock = 0;
>  	early_init_dt_scan_root();
> -	of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL);
> +	early_init_dt_scan_memory_ppc();
>  	add_mem_to_memblock = 1;
>  
>  	if (size)
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 5e216555fe4f..a799117886f4 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -1078,49 +1078,53 @@ u64 __init dt_mem_next_cell(int s, const __be32 **cellp)
>  /*
>   * early_init_dt_scan_memory - Look for and parse memory nodes
>   */
> -int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
> -				     int depth, void *data)
> +int __init early_init_dt_scan_memory(void)
>  {
> -	const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> -	const __be32 *reg, *endp;
> -	int l;
> -	bool hotpluggable;
> +	int node;
> +	const void *fdt = initial_boot_params;
>  
> -	/* We are scanning "memory" nodes only */
> -	if (type == NULL || strcmp(type, "memory") != 0)
> -		return 0;
> +	fdt_for_each_subnode(node, fdt, 0) {
> +		const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> +		const __be32 *reg, *endp;
> +		int l;
> +		bool hotpluggable;
>  
> -	reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
> -	if (reg == NULL)
> -		reg = of_get_flat_dt_prop(node, "reg", &l);
> -	if (reg == NULL)
> -		return 0;
> +		/* We are scanning "memory" nodes only */
> +		if (type == NULL || strcmp(type, "memory") != 0)
> +			continue;
>  
> -	endp = reg + (l / sizeof(__be32));
> -	hotpluggable = of_get_flat_dt_prop(node, "hotpluggable", NULL);
> +		reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
> +		if (reg == NULL)
> +			reg = of_get_flat_dt_prop(node, "reg", &l);
> +		if (reg == NULL)
> +			return 0;

                        Should be "continue" instead of "return 0"?

>  
> -	pr_debug("memory scan node %s, reg size %d,\n", uname, l);
> +		endp = reg + (l / sizeof(__be32));
> +		hotpluggable = of_get_flat_dt_prop(node, "hotpluggable", NULL);
>  
> -	while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
> -		u64 base, size;
> +		pr_debug("memory scan node %s, reg size %d,\n",
> +			fdt_get_name(fdt, node, NULL), l);

Second line of pr_debug() should be indented one more space.

>  
> -		base = dt_mem_next_cell(dt_root_addr_cells, &reg);
> -		size = dt_mem_next_cell(dt_root_size_cells, &reg);
> +		while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
> +			u64 base, size;
>  
> -		if (size == 0)
> -			continue;
> -		pr_debug(" - %llx, %llx\n", base, size);
> +			base = dt_mem_next_cell(dt_root_addr_cells, &reg);
> +			size = dt_mem_next_cell(dt_root_size_cells, &reg);
>  
> -		early_init_dt_add_memory_arch(base, size);
> +			if (size == 0)
> +				continue;
> +			pr_debug(" - %llx, %llx\n", base, size);
>  
> -		if (!hotpluggable)
> -			continue;
> +			early_init_dt_add_memory_arch(base, size);
>  
> -		if (memblock_mark_hotplug(base, size))
> -			pr_warn("failed to mark hotplug range 0x%llx - 0x%llx\n",
> -				base, base + size);
> -	}
> +			if (!hotpluggable)
> +				continue;
>  
> +			if (memblock_mark_hotplug(base, size))
> +				pr_warn("failed to mark hotplug range 0x%llx - 0x%llx\n",
> +					base, base + size);
> +		}
> +	}
>  	return 0;
>  }
>  
> @@ -1271,7 +1275,7 @@ void __init early_init_dt_scan_nodes(void)
>  		pr_warn("No chosen node found, continuing without\n");
>  
>  	/* Setup memory, calling early_init_dt_add_memory_arch */
> -	of_scan_flat_dt(early_init_dt_scan_memory, NULL);
> +	early_init_dt_scan_memory();
>  
>  	/* Handle linux,usable-memory-range property */
>  	memblock_cap_memory_range(cap_mem_addr, cap_mem_size);
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index df3d31926c3c..914739f3c192 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -59,8 +59,7 @@ extern unsigned long of_get_flat_dt_root(void);
>  extern uint32_t of_get_flat_dt_phandle(unsigned long node);
>  
>  extern int early_init_dt_scan_chosen(char *cmdline);
> -extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
> -				     int depth, void *data);
> +extern int early_init_dt_scan_memory(void);
>  extern int early_init_dt_scan_chosen_stdout(void);
>  extern void early_init_fdt_scan_reserved_mem(void);
>  extern void early_init_fdt_reserve_self(void);
> 



^ permalink raw reply

* Re: [PATCH 0/3] of/fdt: Rework early FDT scanning functions
From: Frank Rowand @ 2021-11-24 17:01 UTC (permalink / raw)
  To: Rob Herring, Benjamin Herrenschmidt, John Crispin,
	Michael Ellerman, Paul Mackerras, Thomas Bogendoerfer
  Cc: devicetree, linuxppc-dev, linux-kernel, linux-mips
In-Reply-To: <20211118181213.1433346-1-robh@kernel.org>

On 11/18/21 1:12 PM, Rob Herring wrote:
> The early FDT scanning functions use of_scan_flat_dt() which implements 
> its own node walking method. This function predates libfdt and is an 
> unnecessary indirection. This series reworks 
> early_init_dt_scan_chosen(), early_init_dt_scan_root(), and 
> early_init_dt_scan_memory() to be called directly and use libfdt calls.
> 
> Ultimately, I want to remove of_scan_flat_dt(). Most of the remaining 
> of_scan_flat_dt() users are in powerpc.
> 
> Rob
> 
> 
> Rob Herring (3):
>   of/fdt: Rework early_init_dt_scan_chosen() to call directly
>   of/fdt: Rework early_init_dt_scan_root() to call directly
>   of/fdt: Rework early_init_dt_scan_memory() to call directly
> 
>  arch/mips/ralink/of.c                |  16 +---
>  arch/powerpc/kernel/prom.c           |  22 ++---
>  arch/powerpc/mm/nohash/kaslr_booke.c |   4 +-
>  drivers/of/fdt.c                     | 121 ++++++++++++++-------------
>  include/linux/of_fdt.h               |   9 +-
>  5 files changed, 79 insertions(+), 93 deletions(-)
> 


"checkpatch --strict" reports some "CHECK" issues, but review of the patches
for correctness becomes much more difficult if they are addressed, so they
should be ignored for this series.

-Frank

^ permalink raw reply

* Re: [PATCH 1/1] futex: Wireup futex_waitv syscall
From: Max Filippov @ 2021-11-24 17:23 UTC (permalink / raw)
  To: André Almeida
  Cc: Rich Felker, open list:IA64 (Itanium) PL..., open list:SUPERH,
	Peter Zijlstra, Sebastian Andrzej Siewior, lkft-triage,
	umgwanakikbuti, open list:SPARC + UltraSPAR..., Will Deacon,
	Stephen Rothwell, Yoshinori Sato, Sergey Senozhatsky,
	naresh.kamboju, Linux-Next, Geert Uytterhoeven, longman,
	open list:TENSILICA XTENSA PORT (xtensa), Arnd Bergmann,
	boqun.feng, open list:M68K ARCHITECTURE, Ingo Molnar,
	Chris Zankel, Michal Simek, LKML, Minchan Kim, Rob Landley,
	open list:ALPHA PORT, Andrew Morton, linuxppc-dev,
	David S. Miller
In-Reply-To: <20211124132112.11641-1-andrealmeid@collabora.com>

On Wed, Nov 24, 2021 at 5:21 AM André Almeida <andrealmeid@collabora.com> wrote:
>
> Wireup futex_waitv syscall for all remaining archs.
>
> Signed-off-by: André Almeida <andrealmeid@collabora.com>
> ---
>  arch/alpha/kernel/syscalls/syscall.tbl      | 1 +
>  arch/ia64/kernel/syscalls/syscall.tbl       | 1 +
>  arch/m68k/kernel/syscalls/syscall.tbl       | 1 +
>  arch/microblaze/kernel/syscalls/syscall.tbl | 1 +
>  arch/powerpc/kernel/syscalls/syscall.tbl    | 1 +
>  arch/sh/kernel/syscalls/syscall.tbl         | 1 +
>  arch/sparc/kernel/syscalls/syscall.tbl      | 1 +
>  arch/xtensa/kernel/syscalls/syscall.tbl     | 1 +
>  8 files changed, 8 insertions(+)

For xtensa:
Acked-by: Max Filippov <jcmvbkbc@gmail.com>

-- 
Thanks.
-- Max

^ permalink raw reply

* Re: [PATCH 0/8] Convert powerpc to default topdown mmap layout
From: Christophe Leroy @ 2021-11-24 18:00 UTC (permalink / raw)
  To: Nicholas Piggin, alex, Benjamin Herrenschmidt, Michael Ellerman,
	Paul Mackerras
  Cc: linux-mm, linuxppc-dev, linux-kernel
In-Reply-To: <e1fea487-8014-658d-84cd-ea1d7c89ee08@csgroup.eu>



Le 24/11/2021 à 14:40, Christophe Leroy a écrit :
> 
> 
> Le 24/11/2021 à 14:21, Nicholas Piggin a écrit :
>> Excerpts from Christophe Leroy's message of November 22, 2021 6:48 pm:
>>> This series converts powerpc to default topdown mmap layout.
>>>
>>> powerpc provides its own arch_get_unmapped_area() only when
>>> slices are needed, which is only for book3s/64. First part of
>>> the series moves slices into book3s/64 specific directories
>>> and cleans up other subarchitectures.
>>>
>>> Then a small modification is done to core mm to allow
>>> powerpc to still provide its own arch_randomize_brk()
>>>
>>> Last part converts to default topdown mmap layout.
>>
>> A nice series but will clash badly with the CONFIG_HASH_MMU
>> series of course. One will have to be rebased if they are
>> both to be merged.
>>
> 
> No worry, it should be an issue.
> 
> If you already forsee that series being merged soon, I can rebase my 
> series on top of it just now.
> 

In patchwork, v3 is flagged as superseded and I can't find a v4. Do you 
have it somewhere ?

Christophe

^ permalink raw reply

* Re: [PATCH v1 0/5] Implement livepatch on PPC32
From: Michael Ellerman @ 2021-11-24 22:34 UTC (permalink / raw)
  To: Christophe Leroy, Josh Poimboeuf, Jiri Kosina, Miroslav Benes,
	Petr Mladek, Joe Lawrence, Steven Rostedt, Ingo Molnar,
	Naveen N . Rao
  Cc: live-patching, linuxppc-dev, linux-kernel
In-Reply-To: <cover.1635423081.git.christophe.leroy@csgroup.eu>

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> This series implements livepatch on PPC32.
>
> This is largely copied from what's done on PPC64.
>
> Christophe Leroy (5):
>   livepatch: Fix build failure on 32 bits processors
>   powerpc/ftrace: No need to read LR from stack in _mcount()
>   powerpc/ftrace: Add module_trampoline_target() for PPC32
>   powerpc/ftrace: Activate HAVE_DYNAMIC_FTRACE_WITH_REGS on PPC32
>   powerpc/ftrace: Add support for livepatch to PPC32

I think we know patch 5 will need a respin because of the STRICT RWX vs
livepatching issue (https://github.com/linuxppc/issues/issues/375).

So should I take patches 2,3,4 for now?

cheers

^ permalink raw reply

* Re: [PATCH 1/1] futex: Wireup futex_waitv syscall
From: Michael Ellerman @ 2021-11-24 23:07 UTC (permalink / raw)
  To: André Almeida, linux-kernel, arnd, geert, monstr, ysato,
	dalias, davem, chris, jcmvbkbc, linux-alpha, linux-ia64,
	linux-m68k, linuxppc-dev, linux-sh, sparclinux, linux-xtensa
  Cc: sfr, senozhatsky, peterz, will, boqun.feng, lkft-triage, minchan,
	naresh.kamboju, linux-next, umgwanakikbuti, rob, andrealmeid,
	longman, akpm, mingo, bigeasy
In-Reply-To: <20211124132112.11641-1-andrealmeid@collabora.com>

André Almeida <andrealmeid@collabora.com> writes:
> diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
> index 7bef917cc84e..15109af9d075 100644
> --- a/arch/powerpc/kernel/syscalls/syscall.tbl
> +++ b/arch/powerpc/kernel/syscalls/syscall.tbl
> @@ -528,3 +528,4 @@
>  446	common	landlock_restrict_self		sys_landlock_restrict_self
>  # 447 reserved for memfd_secret
>  448	common	process_mrelease		sys_process_mrelease
> +449	common  futex_waitv                     sys_futex_waitv

Tested-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

The selftest doesn't build with old headers, I needed this:

diff --git a/tools/testing/selftests/futex/include/futex2test.h b/tools/testing/selftests/futex/include/futex2test.h
index 9d305520e849..e6422321e9d0 100644
--- a/tools/testing/selftests/futex/include/futex2test.h
+++ b/tools/testing/selftests/futex/include/futex2test.h
@@ -8,6 +8,10 @@

 #define u64_to_ptr(x) ((void *)(uintptr_t)(x))

+#ifndef __NR_futex_waitv
+#define __NR_futex_waitv 449
+#endif
+
 /**
  * futex_waitv - Wait at multiple futexes, wake on any
  * @waiters:    Array of waiters


cheers

^ permalink raw reply related

* Re: [PATCH 1/1] futex: Wireup futex_waitv syscall
From: Thomas Gleixner @ 2021-11-24 23:18 UTC (permalink / raw)
  To: Arnd Bergmann, André Almeida
  Cc: Rich Felker, linux-ia64, Linux-sh list, Peter Zijlstra,
	Sebastian Andrzej Siewior, lkft-triage, Max Filippov,
	Mike Galbraith, sparclinux, Will Deacon, Stephen Rothwell,
	Yoshinori Sato, Sergey Senozhatsky, Naresh Kamboju,
	Linux-Next Mailing List, Geert Uytterhoeven, Waiman Long,
	open list:TENSILICA XTENSA PORT (xtensa), Arnd Bergmann,
	Boqun Feng, linux-m68k, Ingo Molnar, Chris Zankel, Michal Simek,
	Linux Kernel Mailing List, Minchan Kim, Rob Landley, alpha,
	Andrew Morton, linuxppc-dev, David Miller
In-Reply-To: <CAK8P3a2BXefTw68yoZ9U0F=ASC3=EZDc5PDQCJ16MmXtynd59g@mail.gmail.com>

On Wed, Nov 24 2021 at 15:29, Arnd Bergmann wrote:
> On Wed, Nov 24, 2021 at 2:21 PM André Almeida <andrealmeid@collabora.com> wrote:
>>
>> Wireup futex_waitv syscall for all remaining archs.
>>
>> Signed-off-by: André Almeida <andrealmeid@collabora.com>
>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
>
> I double-checked that futex_waitv() doesn't need any architecture specific
> hacks, and that the list above is complete.
>
> Should I take this through the asm-generic tree, or would you send it
> through the tip tree?

Feel free to pick it up.

Thanks,

        tglx

^ permalink raw reply

* [PATCH 1/2] tools/perf: Include global and local variants for p_stage_cyc sort key
From: Athira Rajeev @ 2021-11-25  2:48 UTC (permalink / raw)
  To: acme, jolsa
  Cc: maddy, rnsastry, linux-perf-users, kjain, namhyung, linuxppc-dev

Sort key p_stage_cyc is used to present the latency
cycles spend in pipeline stages. perf tool has local
p_stage_cyc sort key to display this info. There is no
global variant available for this sort key. local variant
shows latency in a sinlge sample, whereas, global value
will be useful to present the total latency (sum of
latencies) in the hist entry. It represents latency
number multiplied by the number of samples.

Add global (p_stage_cyc) and local variant
(local_p_stage_cyc) for this sort key. Use the
local_p_stage_cyc as default option for "mem" sort mode.
Also add this to list of dynamic sort keys.

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Reported-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/hist.c |  4 +++-
 tools/perf/util/hist.h |  3 ++-
 tools/perf/util/sort.c | 34 +++++++++++++++++++++++++---------
 tools/perf/util/sort.h |  3 ++-
 4 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index b776465e04ef..0a8033b09e28 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -211,7 +211,9 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
 	hists__new_col_len(hists, HISTC_MEM_BLOCKED, 10);
 	hists__new_col_len(hists, HISTC_LOCAL_INS_LAT, 13);
 	hists__new_col_len(hists, HISTC_GLOBAL_INS_LAT, 13);
-	hists__new_col_len(hists, HISTC_P_STAGE_CYC, 13);
+	hists__new_col_len(hists, HISTC_LOCAL_P_STAGE_CYC, 13);
+	hists__new_col_len(hists, HISTC_GLOBAL_P_STAGE_CYC, 13);
+
 	if (symbol_conf.nanosecs)
 		hists__new_col_len(hists, HISTC_TIME, 16);
 	else
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 5343b62476e6..2752ce681108 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -75,7 +75,8 @@ enum hist_column {
 	HISTC_MEM_BLOCKED,
 	HISTC_LOCAL_INS_LAT,
 	HISTC_GLOBAL_INS_LAT,
-	HISTC_P_STAGE_CYC,
+	HISTC_LOCAL_P_STAGE_CYC,
+	HISTC_GLOBAL_P_STAGE_CYC,
 	HISTC_NR_COLS, /* Last entry */
 };
 
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index e9216a292a04..e978f7883e07 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -37,7 +37,7 @@ const char	default_parent_pattern[] = "^sys_|^do_page_fault";
 const char	*parent_pattern = default_parent_pattern;
 const char	*default_sort_order = "comm,dso,symbol";
 const char	default_branch_sort_order[] = "comm,dso_from,symbol_from,symbol_to,cycles";
-const char	default_mem_sort_order[] = "local_weight,mem,sym,dso,symbol_daddr,dso_daddr,snoop,tlb,locked,blocked,local_ins_lat,p_stage_cyc";
+const char	default_mem_sort_order[] = "local_weight,mem,sym,dso,symbol_daddr,dso_daddr,snoop,tlb,locked,blocked,local_ins_lat,local_p_stage_cyc";
 const char	default_top_sort_order[] = "dso,symbol";
 const char	default_diff_sort_order[] = "dso,symbol";
 const char	default_tracepoint_sort_order[] = "trace";
@@ -46,8 +46,8 @@ const char	*field_order;
 regex_t		ignore_callees_regex;
 int		have_ignore_callees = 0;
 enum sort_mode	sort__mode = SORT_MODE__NORMAL;
-const char	*dynamic_headers[] = {"local_ins_lat", "p_stage_cyc"};
-const char	*arch_specific_sort_keys[] = {"p_stage_cyc"};
+const char	*dynamic_headers[] = {"local_ins_lat", "ins_lat", "local_p_stage_cyc", "p_stage_cyc"};
+const char	*arch_specific_sort_keys[] = {"local_p_stage_cyc", "p_stage_cyc"};
 
 /*
  * Replaces all occurrences of a char used with the:
@@ -1392,22 +1392,37 @@ struct sort_entry sort_global_ins_lat = {
 };
 
 static int64_t
-sort__global_p_stage_cyc_cmp(struct hist_entry *left, struct hist_entry *right)
+sort__p_stage_cyc_cmp(struct hist_entry *left, struct hist_entry *right)
 {
 	return left->p_stage_cyc - right->p_stage_cyc;
 }
 
+static int hist_entry__global_p_stage_cyc_snprintf(struct hist_entry *he, char *bf,
+					size_t size, unsigned int width)
+{
+	return repsep_snprintf(bf, size, "%-*u", width,
+			he->p_stage_cyc * he->stat.nr_events);
+}
+
+
 static int hist_entry__p_stage_cyc_snprintf(struct hist_entry *he, char *bf,
 					size_t size, unsigned int width)
 {
 	return repsep_snprintf(bf, size, "%-*u", width, he->p_stage_cyc);
 }
 
-struct sort_entry sort_p_stage_cyc = {
-	.se_header      = "Pipeline Stage Cycle",
-	.se_cmp         = sort__global_p_stage_cyc_cmp,
+struct sort_entry sort_local_p_stage_cyc = {
+	.se_header      = "Local Pipeline Stage Cycle",
+	.se_cmp         = sort__p_stage_cyc_cmp,
 	.se_snprintf	= hist_entry__p_stage_cyc_snprintf,
-	.se_width_idx	= HISTC_P_STAGE_CYC,
+	.se_width_idx	= HISTC_LOCAL_P_STAGE_CYC,
+};
+
+struct sort_entry sort_global_p_stage_cyc = {
+	.se_header      = "Pipeline Stage Cycle",
+	.se_cmp         = sort__p_stage_cyc_cmp,
+	.se_snprintf    = hist_entry__global_p_stage_cyc_snprintf,
+	.se_width_idx   = HISTC_GLOBAL_P_STAGE_CYC,
 };
 
 struct sort_entry sort_mem_daddr_sym = {
@@ -1858,7 +1873,8 @@ static struct sort_dimension common_sort_dimensions[] = {
 	DIM(SORT_CODE_PAGE_SIZE, "code_page_size", sort_code_page_size),
 	DIM(SORT_LOCAL_INS_LAT, "local_ins_lat", sort_local_ins_lat),
 	DIM(SORT_GLOBAL_INS_LAT, "ins_lat", sort_global_ins_lat),
-	DIM(SORT_PIPELINE_STAGE_CYC, "p_stage_cyc", sort_p_stage_cyc),
+	DIM(SORT_LOCAL_PIPELINE_STAGE_CYC, "local_p_stage_cyc", sort_local_p_stage_cyc),
+	DIM(SORT_GLOBAL_PIPELINE_STAGE_CYC, "p_stage_cyc", sort_global_p_stage_cyc),
 };
 
 #undef DIM
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 3c7518378d62..83abe5e6812a 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -235,7 +235,8 @@ enum sort_type {
 	SORT_CODE_PAGE_SIZE,
 	SORT_LOCAL_INS_LAT,
 	SORT_GLOBAL_INS_LAT,
-	SORT_PIPELINE_STAGE_CYC,
+	SORT_LOCAL_PIPELINE_STAGE_CYC,
+	SORT_GLOBAL_PIPELINE_STAGE_CYC,
 
 	/* branch stack specific sort keys */
 	__SORT_BRANCH_STACK,
-- 
2.27.0


^ permalink raw reply related

* [PATCH 2/2] tools/perf: Update global/local variants for p_stage_cyc in powerpc
From: Athira Rajeev @ 2021-11-25  2:48 UTC (permalink / raw)
  To: acme, jolsa
  Cc: maddy, rnsastry, linux-perf-users, kjain, namhyung, linuxppc-dev
In-Reply-To: <20211125024851.22895-1-atrajeev@linux.vnet.ibm.com>

Update the arch_support_sort_key() function in powerpc
to enable presenting local and global variants of sort
key: p_stage_cyc. Update the "se_header" strings for
these in arch_perf_header_entry() function along with
instruction latency.

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Reported-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/arch/powerpc/util/event.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/perf/arch/powerpc/util/event.c b/tools/perf/arch/powerpc/util/event.c
index 3bf441257466..cf430a4c55b9 100644
--- a/tools/perf/arch/powerpc/util/event.c
+++ b/tools/perf/arch/powerpc/util/event.c
@@ -40,8 +40,12 @@ const char *arch_perf_header_entry(const char *se_header)
 {
 	if (!strcmp(se_header, "Local INSTR Latency"))
 		return "Finish Cyc";
-	else if (!strcmp(se_header, "Pipeline Stage Cycle"))
+	else if (!strcmp(se_header, "INSTR Latency"))
+		return "Global Finish_cyc";
+	else if (!strcmp(se_header, "Local Pipeline Stage Cycle"))
 		return "Dispatch Cyc";
+	else if (!strcmp(se_header, "Pipeline Stage Cycle"))
+		return "Global Dispatch_cyc";
 	return se_header;
 }
 
@@ -49,5 +53,7 @@ int arch_support_sort_key(const char *sort_key)
 {
 	if (!strcmp(sort_key, "p_stage_cyc"))
 		return 1;
+	if (!strcmp(sort_key, "local_p_stage_cyc"))
+		return 1;
 	return 0;
 }
-- 
2.27.0


^ permalink raw reply related

* Re: [PATCH v2 2/2] powerpc:85xx: fix timebase sync issue when CONFIG_HOTPLUG_CPU=n
From: Martin Kennedy @ 2021-11-25  4:20 UTC (permalink / raw)
  To: nixiaoming
  Cc: chenjianguo3, wangle6, chenhui.zhao, Christian Lamparter, oss,
	linux-kernel, stable, Yuantian.Tang, paul.gortmaker, paulus,
	gregkh, linuxppc-dev, liuwenliang

Hi there,

I have bisected OpenWrt master, and then the Linux kernel down to this
change, to confirm that this change causes a kernel panic on my
P1020RDB-based, dual-core Aerohive HiveAP 370, at initialization of
the second CPU:

:
[    0.000000] Linux version 5.10.80 (labby@lobon)
(powerpc-openwrt-linux-musl-gcc (OpenWrt GCC 11.2.0
r18111+1-ebb6f9287e) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 SMP Thu
Nov 25 02:49:35 2021
[    0.000000] Using P1020 RDB machine description
:
[    0.627233] smp: Bringing up secondary CPUs ...
[    0.681659] kernel tried to execute user page (0) - exploit attempt? (uid: 0)
[    0.766618] BUG: Unable to handle kernel instruction fetch (NULL pointer?)
[    0.848899] Faulting instruction address: 0x00000000
[    0.908273] Oops: Kernel access of bad area, sig: 11 [#1]
[    0.972851] BE PAGE_SIZE=4K SMP NR_CPUS=2 P1020 RDB
[    1.031179] Modules linked in:
[    1.067640] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.80 #0
[    1.139507] NIP:  00000000 LR: c0021d2c CTR: 00000000
[    1.199921] REGS: c1051cf0 TRAP: 0400   Not tainted  (5.10.80)
[    1.269705] MSR:  00021000 <CE,ME>  CR: 84020202  XER: 00000000
[    1.340534]
[    1.340534] GPR00: c0021cb8 c1051da8 c1048000 00000001 00029000
00000000 00000001 00000000
[    1.340534] GPR08: 00000001 00000000 c08b0000 00000040 22000208
00000000 c00032c4 00000000
[    1.340534] GPR16: 00000000 00000000 00000000 00000000 00000000
00000000 00029000 00000001
[    1.340534] GPR24: 1ffff240 20000000 dffff240 c080a1f4 00000001
c08ae0a8 00000001 dffff240
[    1.758220] NIP [00000000] 0x0
[    1.794688] LR [c0021d2c] smp_85xx_kick_cpu+0xe8/0x568
[    1.856126] Call Trace:
[    1.885295] [c1051da8] [c0021cb8] smp_85xx_kick_cpu+0x74/0x568 (unreliable)
[    1.968633] [c1051de8] [c0011460] __cpu_up+0xc0/0x228
[    2.029038] [c1051e18] [c0031bbc] bringup_cpu+0x30/0x224
[    2.092572] [c1051e48] [c0031f3c] cpu_up.constprop.0+0x180/0x33c
[    2.164443] [c1051e88] [c00322e8] bringup_nonboot_cpus+0x88/0xc8
[    2.236326] [c1051eb8] [c07e67bc] smp_init+0x30/0x78
[    2.295698] [c1051ed8] [c07d9e28] kernel_init_freeable+0x118/0x2a8
[    2.369641] [c1051f18] [c00032d8] kernel_init+0x14/0x124
[    2.433176] [c1051f38] [c0010278] ret_from_kernel_thread+0x14/0x1c
[    2.507125] Instruction dump:
[    2.542541] XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
[    2.635242] XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
XXXXXXXX XXXXXXXX
[    2.727952] ---[ end trace 9b796a4bafb6bc14 ]---
[    2.783149]
[    3.800879] Kernel panic - not syncing: Fatal exception
[    3.862353] Rebooting in 1 seconds..
[    5.905097] System Halted, OK to turn off power

Without this patch, the kernel no longer panics:

[    0.627232] smp: Bringing up secondary CPUs ...
[    0.681857] smp: Brought up 1 node, 2 CPUs

Here is the kernel configuration for this built kernel:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob_plain;f=target/linux/mpc85xx/config-5.10;hb=HEAD

In case a force-push is needed for the source repository
(https://github.com/Hurricos/openwrt/commit/ad19bdfc77d60ee1c52b41bb4345fdd02284c4cf),
here is the device tree for this board:
https://paste.c-net.org/TrousersSliced

Martin

^ permalink raw reply

* Re: [PATCH] powerpc/eeh: Delay slot presence check once driver is notified about the pci error.
From: Mahesh J Salgaonkar @ 2021-11-25  5:34 UTC (permalink / raw)
  To: Oliver O'Halloran; +Cc: linuxppc-dev
In-Reply-To: <CAOSf1CEv2kwRqctuwn1xkKTH_FmBLGx_FJefhs7FsTOSc72fdQ@mail.gmail.com>

On 2021-11-24 22:57:13 Wed, Oliver O'Halloran wrote:
> On Wed, Nov 24, 2021 at 7:45 PM Mahesh J Salgaonkar
> <mahesh@linux.ibm.com> wrote:
> >
> > No it doesn't. We will still do a presence check before the recovery
> > process starts. This patch moves the check after notifying the driver to
> > stop active I/O operations. If a presence check finds the device isn't
> > present, we will skip the EEH recovery. However, on a surprise hotplug,
> > the user will see the EEH messages on the console before it finds there
> > is nothing to recover.
> 
> Suppressing the spurious EEH messages was part of why I added that
> check in the first place. If you want to defer the presence check
> until later you should move the stack trace printing, etc to after
> we've confirmed there are still devices present. Considering the

That will help suppressing the spurious EEH messages.

> motivation for this patch is to avoid spurious warnings from the
> driver I don't think printing spurious EEH messages is much of an
> improvement.

Agree.

> 
> The other option would be returning an error from the pseries hotplug
> driver. IIRC that's what pnv_php / OPAL does if the PHB is fenced and
> we can't check the slot presence state.

Yeah. I can change rpaphp_get_sensor_state() to use
rtas_get_sensor_fast() variant which will return immediately with an
error on extended busy error. That way we don't need to move the slot
presence check at all. I did test that and it does fix the problem. But
I wasn't sure if that would have any implications on hotplug driver
behaviour. If pnv_php / OPAL does the same thing then this would be a
cleaner approach to fix this issue. Let me send out the patch with this
other option to fix the pseries hotplug driver instead.

Thanks,
-Mahesh.

-- 
Mahesh J Salgaonkar

^ permalink raw reply

* Re: [PATCH v1 0/5] Implement livepatch on PPC32
From: Christophe Leroy @ 2021-11-25  5:49 UTC (permalink / raw)
  To: Michael Ellerman, Josh Poimboeuf, Jiri Kosina, Miroslav Benes,
	Petr Mladek, Joe Lawrence, Steven Rostedt, Ingo Molnar,
	Naveen N . Rao
  Cc: live-patching, linuxppc-dev, linux-kernel
In-Reply-To: <87r1b5p4hf.fsf@mpe.ellerman.id.au>



Le 24/11/2021 à 23:34, Michael Ellerman a écrit :
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>> This series implements livepatch on PPC32.
>>
>> This is largely copied from what's done on PPC64.
>>
>> Christophe Leroy (5):
>>    livepatch: Fix build failure on 32 bits processors
>>    powerpc/ftrace: No need to read LR from stack in _mcount()
>>    powerpc/ftrace: Add module_trampoline_target() for PPC32
>>    powerpc/ftrace: Activate HAVE_DYNAMIC_FTRACE_WITH_REGS on PPC32
>>    powerpc/ftrace: Add support for livepatch to PPC32
> 
> I think we know patch 5 will need a respin because of the STRICT RWX vs
> livepatching issue (https://github.com/linuxppc/issues/issues/375).
> 
> So should I take patches 2,3,4 for now?
> 

Yes you can take them now I think.

Thanks
Christophe

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox