* [PATCH 1/2] powerpc/entry: convert to common and generic entry
@ 2024-09-12 8:24 Luming Yu
2024-09-12 9:11 ` Christophe Leroy
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Luming Yu @ 2024-09-12 8:24 UTC (permalink / raw)
To: linuxppc-dev, linux-kernel, mpe, npiggin, christophe.leroy,
jialong.yang, luming.yu
Cc: Luming Yu
From: Yu Luming <luming.yu@gmail.com>
convert powerpc entry code in syscall and fault to use syscall_work
and irqentry_state as well as common calls from generic entry infrastructure.
Signed-off-by: Luming Yu <luming.yu@shingroup.cn>
---
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/hw_irq.h | 5 +++++
arch/powerpc/include/asm/processor.h | 6 ++++++
arch/powerpc/include/asm/syscall.h | 5 +++++
arch/powerpc/include/asm/thread_info.h | 1 +
arch/powerpc/kernel/syscall.c | 6 +++++-
arch/powerpc/mm/fault.c | 5 +++++
7 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index e21f72bcb61f..e94e7e4bfd40 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -202,6 +202,7 @@ config PPC
select GENERIC_IRQ_SHOW_LEVEL
select GENERIC_PCI_IOMAP if PCI
select GENERIC_PTDUMP
+ select GENERIC_ENTRY
select GENERIC_SMP_IDLE_THREAD
select GENERIC_TIME_VSYSCALL
select GENERIC_VDSO_TIME_NS
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index 317659fdeacf..a3d591784c95 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -216,6 +216,11 @@ static inline bool arch_irqs_disabled(void)
return arch_irqs_disabled_flags(arch_local_save_flags());
}
+/*common entry*/
+static __always_inline bool regs_irqs_disabled(struct pt_regs *regs)
+{
+ return arch_irqs_disabled();
+}
static inline void set_pmi_irq_pending(void)
{
/*
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index b2c51d337e60..1292282f8b0e 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -383,6 +383,12 @@ int validate_sp(unsigned long sp, struct task_struct *p);
int validate_sp_size(unsigned long sp, struct task_struct *p,
unsigned long nbytes);
+/*for common entry*/
+static __always_inline bool on_thread_stack(void)
+{
+ return validate_sp(current_stack_pointer, current);
+}
+
/*
* Prefetch macros.
*/
diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
index 3dd36c5e334a..0e94806c7bfe 100644
--- a/arch/powerpc/include/asm/syscall.h
+++ b/arch/powerpc/include/asm/syscall.h
@@ -119,4 +119,9 @@ static inline int syscall_get_arch(struct task_struct *task)
else
return AUDIT_ARCH_PPC64;
}
+
+static inline bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
+{
+ return false;
+}
#endif /* _ASM_SYSCALL_H */
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 47e226032f9c..c52ca3aaebb5 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -58,6 +58,7 @@ struct thread_info {
unsigned int cpu;
#endif
unsigned long local_flags; /* private flags for thread */
+ unsigned long syscall_work;
#ifdef CONFIG_LIVEPATCH_64
unsigned long *livepatch_sp;
#endif
diff --git a/arch/powerpc/kernel/syscall.c b/arch/powerpc/kernel/syscall.c
index 77fedb190c93..cbf0510ed10e 100644
--- a/arch/powerpc/kernel/syscall.c
+++ b/arch/powerpc/kernel/syscall.c
@@ -3,6 +3,7 @@
#include <linux/compat.h>
#include <linux/context_tracking.h>
#include <linux/randomize_kstack.h>
+#include <linux/entry-common.h>
#include <asm/interrupt.h>
#include <asm/kup.h>
@@ -131,7 +132,7 @@ notrace long system_call_exception(struct pt_regs *regs, unsigned long r0)
* and the test against NR_syscalls will fail and the return
* value to be used is in regs->gpr[3].
*/
- r0 = do_syscall_trace_enter(regs);
+ syscall_enter_from_user_mode(regs, r0);
if (unlikely(r0 >= NR_syscalls))
return regs->gpr[3];
@@ -185,5 +186,8 @@ notrace long system_call_exception(struct pt_regs *regs, unsigned long r0)
*/
choose_random_kstack_offset(mftb());
+ /*common entry*/
+ syscall_exit_to_user_mode(regs);
+
return ret;
}
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 9e49ede2bc1c..64c6eb06ebe8 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -23,6 +23,7 @@
#include <linux/mman.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
+#include <linux/entry-common.h>
#include <linux/highmem.h>
#include <linux/extable.h>
#include <linux/kprobes.h>
@@ -569,15 +570,19 @@ NOKPROBE_SYMBOL(___do_page_fault);
static __always_inline void __do_page_fault(struct pt_regs *regs)
{
long err;
+ irqentry_state_t state = irqentry_enter(regs);
err = ___do_page_fault(regs, regs->dar, regs->dsisr);
if (unlikely(err))
bad_page_fault(regs, err);
+ irqentry_exit(regs, state);
}
DEFINE_INTERRUPT_HANDLER(do_page_fault)
{
+ irqentry_state_t state = irqentry_enter(regs);
__do_page_fault(regs);
+ irqentry_exit(regs, state);
}
#ifdef CONFIG_PPC_BOOK3S_64
--
2.42.0.windows.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] powerpc/entry: convert to common and generic entry
2024-09-12 8:24 [PATCH 1/2] powerpc/entry: convert to common and generic entry Luming Yu
@ 2024-09-12 9:11 ` Christophe Leroy
2024-09-12 9:35 ` Christophe Leroy
2024-09-12 10:23 ` Christophe Leroy
2 siblings, 0 replies; 12+ messages in thread
From: Christophe Leroy @ 2024-09-12 9:11 UTC (permalink / raw)
To: Luming Yu, linuxppc-dev, linux-kernel, mpe, npiggin, jialong.yang,
luming.yu
Le 12/09/2024 à 10:24, Luming Yu a écrit :
> From: Yu Luming <luming.yu@gmail.com>
>
> convert powerpc entry code in syscall and fault to use syscall_work
> and irqentry_state as well as common calls from generic entry infrastructure.
Could you add more description about the change ?
When I look at x86, riscv or s390 commits for the same thing, they tell
a lot more:
Commit 27d6b4d14f5c ("x86/entry: Use generic syscall entry function")
Commit f0bddf50586d ("riscv: entry: Convert to generic entry")
Commit 56e62a737028 ("s390: convert to generic entry")
Can you elso provide some benchmark comparisons, at least using the
null_syscall selftest
tools/testing/selftests/powerpc/benchmarks/null_syscall.c
>
> Signed-off-by: Luming Yu <luming.yu@shingroup.cn>
> ---
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/include/asm/hw_irq.h | 5 +++++
> arch/powerpc/include/asm/processor.h | 6 ++++++
> arch/powerpc/include/asm/syscall.h | 5 +++++
> arch/powerpc/include/asm/thread_info.h | 1 +
> arch/powerpc/kernel/syscall.c | 6 +++++-
> arch/powerpc/mm/fault.c | 5 +++++
> 7 files changed, 28 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index e21f72bcb61f..e94e7e4bfd40 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -202,6 +202,7 @@ config PPC
> select GENERIC_IRQ_SHOW_LEVEL
> select GENERIC_PCI_IOMAP if PCI
> select GENERIC_PTDUMP
> + select GENERIC_ENTRY
> select GENERIC_SMP_IDLE_THREAD
> select GENERIC_TIME_VSYSCALL
> select GENERIC_VDSO_TIME_NS
> diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
> index 317659fdeacf..a3d591784c95 100644
> --- a/arch/powerpc/include/asm/hw_irq.h
> +++ b/arch/powerpc/include/asm/hw_irq.h
> @@ -216,6 +216,11 @@ static inline bool arch_irqs_disabled(void)
> return arch_irqs_disabled_flags(arch_local_save_flags());
> }
>
> +/*common entry*/
> +static __always_inline bool regs_irqs_disabled(struct pt_regs *regs)
> +{
> + return arch_irqs_disabled();
> +}
> static inline void set_pmi_irq_pending(void)
> {
> /*
> diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
> index b2c51d337e60..1292282f8b0e 100644
> --- a/arch/powerpc/include/asm/processor.h
> +++ b/arch/powerpc/include/asm/processor.h
> @@ -383,6 +383,12 @@ int validate_sp(unsigned long sp, struct task_struct *p);
> int validate_sp_size(unsigned long sp, struct task_struct *p,
> unsigned long nbytes);
>
> +/*for common entry*/
> +static __always_inline bool on_thread_stack(void)
> +{
> + return validate_sp(current_stack_pointer, current);
I don't understand. Other architectures have something more simple for
on_thread_stack().
Also, validate_sp() will also return true when on irq_stack or emergency
stack.
> +}
> +
> /*
> * Prefetch macros.
> */
> diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
> index 3dd36c5e334a..0e94806c7bfe 100644
> --- a/arch/powerpc/include/asm/syscall.h
> +++ b/arch/powerpc/include/asm/syscall.h
> @@ -119,4 +119,9 @@ static inline int syscall_get_arch(struct task_struct *task)
> else
> return AUDIT_ARCH_PPC64;
> }
> +
> +static inline bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
> +{
> + return false;
> +}
> #endif /* _ASM_SYSCALL_H */
> diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
> index 47e226032f9c..c52ca3aaebb5 100644
> --- a/arch/powerpc/include/asm/thread_info.h
> +++ b/arch/powerpc/include/asm/thread_info.h
> @@ -58,6 +58,7 @@ struct thread_info {
> unsigned int cpu;
> #endif
> unsigned long local_flags; /* private flags for thread */
> + unsigned long syscall_work;
> #ifdef CONFIG_LIVEPATCH_64
> unsigned long *livepatch_sp;
> #endif
> diff --git a/arch/powerpc/kernel/syscall.c b/arch/powerpc/kernel/syscall.c
> index 77fedb190c93..cbf0510ed10e 100644
> --- a/arch/powerpc/kernel/syscall.c
> +++ b/arch/powerpc/kernel/syscall.c
> @@ -3,6 +3,7 @@
> #include <linux/compat.h>
> #include <linux/context_tracking.h>
> #include <linux/randomize_kstack.h>
> +#include <linux/entry-common.h>
>
> #include <asm/interrupt.h>
> #include <asm/kup.h>
> @@ -131,7 +132,7 @@ notrace long system_call_exception(struct pt_regs *regs, unsigned long r0)
> * and the test against NR_syscalls will fail and the return
> * value to be used is in regs->gpr[3].
> */
> - r0 = do_syscall_trace_enter(regs);
> + syscall_enter_from_user_mode(regs, r0);
shouldn't this be:
r0 = syscall_enter_from_user_mode(regs, r0);
> if (unlikely(r0 >= NR_syscalls))
> return regs->gpr[3];
>
> @@ -185,5 +186,8 @@ notrace long system_call_exception(struct pt_regs *regs, unsigned long r0)
> */
> choose_random_kstack_offset(mftb());
>
> + /*common entry*/
> + syscall_exit_to_user_mode(regs);
> +
This seems to do a lot. Isn't there stuff that was previously done by
powerpc and needs to be removed now ?
> return ret;
> }
> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
> index 9e49ede2bc1c..64c6eb06ebe8 100644
> --- a/arch/powerpc/mm/fault.c
> +++ b/arch/powerpc/mm/fault.c
> @@ -23,6 +23,7 @@
> #include <linux/mman.h>
> #include <linux/mm.h>
> #include <linux/interrupt.h>
> +#include <linux/entry-common.h>
> #include <linux/highmem.h>
> #include <linux/extable.h>
> #include <linux/kprobes.h>
> @@ -569,15 +570,19 @@ NOKPROBE_SYMBOL(___do_page_fault);
> static __always_inline void __do_page_fault(struct pt_regs *regs)
> {
> long err;
> + irqentry_state_t state = irqentry_enter(regs);
It is already called below in do_page_fault(), is it normal to do it twice ?
>
> err = ___do_page_fault(regs, regs->dar, regs->dsisr);
> if (unlikely(err))
> bad_page_fault(regs, err);
> + irqentry_exit(regs, state);
> }
>
> DEFINE_INTERRUPT_HANDLER(do_page_fault)
> {
> + irqentry_state_t state = irqentry_enter(regs);
> __do_page_fault(regs);
> + irqentry_exit(regs, state);
No need to do the same in hash__do_page_fault() ?
> }
>
> #ifdef CONFIG_PPC_BOOK3S_64
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] powerpc/entry: convert to common and generic entry
2024-09-12 8:24 [PATCH 1/2] powerpc/entry: convert to common and generic entry Luming Yu
2024-09-12 9:11 ` Christophe Leroy
@ 2024-09-12 9:35 ` Christophe Leroy
2024-09-12 10:23 ` Christophe Leroy
2 siblings, 0 replies; 12+ messages in thread
From: Christophe Leroy @ 2024-09-12 9:35 UTC (permalink / raw)
To: Luming Yu, linuxppc-dev, linux-kernel, mpe, npiggin, jialong.yang,
luming.yu
Le 12/09/2024 à 10:24, Luming Yu a écrit :
> From: Yu Luming <luming.yu@gmail.com>
>
> convert powerpc entry code in syscall and fault to use syscall_work
> and irqentry_state as well as common calls from generic entry infrastructure.
>
> Signed-off-by: Luming Yu <luming.yu@shingroup.cn>
> ---
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/include/asm/hw_irq.h | 5 +++++
> arch/powerpc/include/asm/processor.h | 6 ++++++
> arch/powerpc/include/asm/syscall.h | 5 +++++
> arch/powerpc/include/asm/thread_info.h | 1 +
> arch/powerpc/kernel/syscall.c | 6 +++++-
> arch/powerpc/mm/fault.c | 5 +++++
> 7 files changed, 28 insertions(+), 1 deletion(-)
>
asm/entry-common.h is missing, this patch doesn't build.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] powerpc/entry: convert to common and generic entry
2024-09-12 8:24 [PATCH 1/2] powerpc/entry: convert to common and generic entry Luming Yu
2024-09-12 9:11 ` Christophe Leroy
2024-09-12 9:35 ` Christophe Leroy
@ 2024-09-12 10:23 ` Christophe Leroy
2024-09-13 1:40 ` Luming Yu
2 siblings, 1 reply; 12+ messages in thread
From: Christophe Leroy @ 2024-09-12 10:23 UTC (permalink / raw)
To: Luming Yu, linuxppc-dev, linux-kernel, mpe, npiggin, jialong.yang,
luming.yu
Le 12/09/2024 à 10:24, Luming Yu a écrit :
> From: Yu Luming <luming.yu@gmail.com>
>
> convert powerpc entry code in syscall and fault to use syscall_work
> and irqentry_state as well as common calls from generic entry infrastructure.
>
> Signed-off-by: Luming Yu <luming.yu@shingroup.cn>
> ---
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/include/asm/hw_irq.h | 5 +++++
> arch/powerpc/include/asm/processor.h | 6 ++++++
> arch/powerpc/include/asm/syscall.h | 5 +++++
> arch/powerpc/include/asm/thread_info.h | 1 +
> arch/powerpc/kernel/syscall.c | 6 +++++-
> arch/powerpc/mm/fault.c | 5 +++++
> 7 files changed, 28 insertions(+), 1 deletion(-)
There is another build problem:
CC kernel/entry/common.o
kernel/entry/common.c: In function 'irqentry_exit':
kernel/entry/common.c:335:21: error: implicit declaration of function
'regs_irqs_disabled'; did you mean 'raw_irqs_disabled'?
[-Werror=implicit-function-declaration]
335 | } else if (!regs_irqs_disabled(regs)) {
| ^~~~~~~~~~~~~~~~~~
| raw_irqs_disabled
You have put regs_irqs_disabled() in a section dedicated to PPC64, so it
fails on PPC32.
After fixing this problem and providing an empty asm/entry-common.h it
is now possible to build the kernel. But that's not enough, the board is
stuck after:
...
[ 2.871391] Freeing unused kernel image (initmem) memory: 1228K
[ 2.877990] Run /init as init process
Christophe
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] powerpc/entry: convert to common and generic entry
2024-09-12 10:23 ` Christophe Leroy
@ 2024-09-13 1:40 ` Luming Yu
2024-09-13 6:54 ` Christophe Leroy
0 siblings, 1 reply; 12+ messages in thread
From: Luming Yu @ 2024-09-13 1:40 UTC (permalink / raw)
To: Christophe Leroy
Cc: linuxppc-dev, linux-kernel, mpe, npiggin, jialong.yang, luming.yu
On Thu, Sep 12, 2024 at 12:23:29PM +0200, Christophe Leroy wrote:
>
>
> Le 12/09/2024 à 10:24, Luming Yu a écrit :
> > From: Yu Luming <luming.yu@gmail.com>
> >
> > convert powerpc entry code in syscall and fault to use syscall_work
> > and irqentry_state as well as common calls from generic entry infrastructure.
> >
> > Signed-off-by: Luming Yu <luming.yu@shingroup.cn>
> > ---
> > arch/powerpc/Kconfig | 1 +
> > arch/powerpc/include/asm/hw_irq.h | 5 +++++
> > arch/powerpc/include/asm/processor.h | 6 ++++++
> > arch/powerpc/include/asm/syscall.h | 5 +++++
> > arch/powerpc/include/asm/thread_info.h | 1 +
> > arch/powerpc/kernel/syscall.c | 6 +++++-
> > arch/powerpc/mm/fault.c | 5 +++++
> > 7 files changed, 28 insertions(+), 1 deletion(-)
>
> There is another build problem:
>
> CC kernel/entry/common.o
> kernel/entry/common.c: In function 'irqentry_exit':
> kernel/entry/common.c:335:21: error: implicit declaration of function
> 'regs_irqs_disabled'; did you mean 'raw_irqs_disabled'?
> [-Werror=implicit-function-declaration]
> 335 | } else if (!regs_irqs_disabled(regs)) {
> | ^~~~~~~~~~~~~~~~~~
> | raw_irqs_disabled
>
>
> You have put regs_irqs_disabled() in a section dedicated to PPC64, so it
> fails on PPC32.
>
>
> After fixing this problem and providing an empty asm/entry-common.h it is
> now possible to build the kernel. But that's not enough, the board is stuck
> after:
>
> ...
> [ 2.871391] Freeing unused kernel image (initmem) memory: 1228K
> [ 2.877990] Run /init as init process
Thanks for these questions. :-)
I haven't gotten chance to run it in ppc32 qemu.
the common syscall trace enter lost this hunk
- if (!is_32bit_task())
- audit_syscall_entry(regs->gpr[0], regs->gpr[3], regs->gpr[4],
- regs->gpr[5], regs->gpr[6]);
- else
- audit_syscall_entry(regs->gpr[0],
- regs->gpr[3] & 0xffffffff,
- regs->gpr[4] & 0xffffffff,
- regs->gpr[5] & 0xffffffff,
- regs->gpr[6] & 0xffffffff);
which I don't understand whether we need a arch callbacks for it.
Before I sent out the RFC patch set, the very limited compile and boot test goes well with a ppc64 qemu VM. Surely, there will be a lot of test, debug and following up patch set update that is necessary to make it a complete convert.
And the patch set should really be re-named to RFC and v1.
Cheers
>
>
> Christophe
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] powerpc/entry: convert to common and generic entry
2024-09-13 1:40 ` Luming Yu
@ 2024-09-13 6:54 ` Christophe Leroy
2024-09-13 7:38 ` Luming Yu
0 siblings, 1 reply; 12+ messages in thread
From: Christophe Leroy @ 2024-09-13 6:54 UTC (permalink / raw)
To: Luming Yu
Cc: linuxppc-dev, linux-kernel, mpe, npiggin, jialong.yang, luming.yu
Le 13/09/2024 à 03:40, Luming Yu a écrit :
> On Thu, Sep 12, 2024 at 12:23:29PM +0200, Christophe Leroy wrote:
>>
>>
>> Le 12/09/2024 à 10:24, Luming Yu a écrit :
>>> From: Yu Luming <luming.yu@gmail.com>
>>>
>>> convert powerpc entry code in syscall and fault to use syscall_work
>>> and irqentry_state as well as common calls from generic entry infrastructure.
>>>
>>> Signed-off-by: Luming Yu <luming.yu@shingroup.cn>
>>> ---
>>> arch/powerpc/Kconfig | 1 +
>>> arch/powerpc/include/asm/hw_irq.h | 5 +++++
>>> arch/powerpc/include/asm/processor.h | 6 ++++++
>>> arch/powerpc/include/asm/syscall.h | 5 +++++
>>> arch/powerpc/include/asm/thread_info.h | 1 +
>>> arch/powerpc/kernel/syscall.c | 6 +++++-
>>> arch/powerpc/mm/fault.c | 5 +++++
>>> 7 files changed, 28 insertions(+), 1 deletion(-)
>>
>> There is another build problem:
>>
>> CC kernel/entry/common.o
>> kernel/entry/common.c: In function 'irqentry_exit':
>> kernel/entry/common.c:335:21: error: implicit declaration of function
>> 'regs_irqs_disabled'; did you mean 'raw_irqs_disabled'?
>> [-Werror=implicit-function-declaration]
>> 335 | } else if (!regs_irqs_disabled(regs)) {
>> | ^~~~~~~~~~~~~~~~~~
>> | raw_irqs_disabled
>>
>>
>> You have put regs_irqs_disabled() in a section dedicated to PPC64, so it
>> fails on PPC32.
>>
>>
>> After fixing this problem and providing an empty asm/entry-common.h it is
>> now possible to build the kernel. But that's not enough, the board is stuck
>> after:
>>
>> ...
>> [ 2.871391] Freeing unused kernel image (initmem) memory: 1228K
>> [ 2.877990] Run /init as init process
>
> Thanks for these questions. :-)
> I haven't gotten chance to run it in ppc32 qemu.
> the common syscall trace enter lost this hunk
> - if (!is_32bit_task())
> - audit_syscall_entry(regs->gpr[0], regs->gpr[3], regs->gpr[4],
> - regs->gpr[5], regs->gpr[6]);
> - else
> - audit_syscall_entry(regs->gpr[0],
> - regs->gpr[3] & 0xffffffff,
> - regs->gpr[4] & 0xffffffff,
> - regs->gpr[5] & 0xffffffff,
> - regs->gpr[6] & 0xffffffff);
> which I don't understand whether we need a arch callbacks for it.
I don't thing so.
As far as I can see, audit_syscall_entry() is called by
syscall_enter_audit() in kernel/entry/common.c
And the masking of arguments based on is_32bit_task() is done in
syscall_get_arguments() with is called by
syscall_enter_audit() just before calling audit_syscall_entry() and
which is an arch callback that does the same as the removed hunk.
>
> Before I sent out the RFC patch set, the very limited compile and boot test goes well with a ppc64 qemu VM. Surely, there will be a lot of test, debug and following up patch set update that is necessary to make it a complete convert.
Even on ppc64 it doesn't build, at the first place because
arch/powerpc/include/asm/entry-common.h is missing in your patch. Did
you forget to 'git add' it ?
And same as with PPC32, when I build PPC64 with an empty
asm/entry-common.h, it doesn't work. So, I guess you had some needed
code in that file and you have to send it.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] powerpc/entry: convert to common and generic entry
2024-09-13 6:54 ` Christophe Leroy
@ 2024-09-13 7:38 ` Luming Yu
2024-09-13 8:30 ` Christophe Leroy
0 siblings, 1 reply; 12+ messages in thread
From: Luming Yu @ 2024-09-13 7:38 UTC (permalink / raw)
To: Christophe Leroy
Cc: linuxppc-dev, linux-kernel, mpe, npiggin, jialong.yang, luming.yu
On Fri, Sep 13, 2024 at 08:54:12AM +0200, Christophe Leroy wrote:
>
>
> Le 13/09/2024 à 03:40, Luming Yu a écrit :
> > On Thu, Sep 12, 2024 at 12:23:29PM +0200, Christophe Leroy wrote:
> > >
> > >
> > > Le 12/09/2024 à 10:24, Luming Yu a écrit :
> > > > From: Yu Luming <luming.yu@gmail.com>
> > > >
> > > > convert powerpc entry code in syscall and fault to use syscall_work
> > > > and irqentry_state as well as common calls from generic entry infrastructure.
> > > >
> > > > Signed-off-by: Luming Yu <luming.yu@shingroup.cn>
> > > > ---
> > > > arch/powerpc/Kconfig | 1 +
> > > > arch/powerpc/include/asm/hw_irq.h | 5 +++++
> > > > arch/powerpc/include/asm/processor.h | 6 ++++++
> > > > arch/powerpc/include/asm/syscall.h | 5 +++++
> > > > arch/powerpc/include/asm/thread_info.h | 1 +
> > > > arch/powerpc/kernel/syscall.c | 6 +++++-
> > > > arch/powerpc/mm/fault.c | 5 +++++
> > > > 7 files changed, 28 insertions(+), 1 deletion(-)
> > >
> > > There is another build problem:
> > >
> > > CC kernel/entry/common.o
> > > kernel/entry/common.c: In function 'irqentry_exit':
> > > kernel/entry/common.c:335:21: error: implicit declaration of function
> > > 'regs_irqs_disabled'; did you mean 'raw_irqs_disabled'?
> > > [-Werror=implicit-function-declaration]
> > > 335 | } else if (!regs_irqs_disabled(regs)) {
> > > | ^~~~~~~~~~~~~~~~~~
> > > | raw_irqs_disabled
> > >
> > >
> > > You have put regs_irqs_disabled() in a section dedicated to PPC64, so it
> > > fails on PPC32.
> > >
> > >
> > > After fixing this problem and providing an empty asm/entry-common.h it is
> > > now possible to build the kernel. But that's not enough, the board is stuck
> > > after:
> > >
> > > ...
> > > [ 2.871391] Freeing unused kernel image (initmem) memory: 1228K
> > > [ 2.877990] Run /init as init process
> >
> > Thanks for these questions. :-)
> > I haven't gotten chance to run it in ppc32 qemu.
> > the common syscall trace enter lost this hunk
> > - if (!is_32bit_task())
> > - audit_syscall_entry(regs->gpr[0], regs->gpr[3], regs->gpr[4],
> > - regs->gpr[5], regs->gpr[6]);
> > - else
> > - audit_syscall_entry(regs->gpr[0],
> > - regs->gpr[3] & 0xffffffff,
> > - regs->gpr[4] & 0xffffffff,
> > - regs->gpr[5] & 0xffffffff,
> > - regs->gpr[6] & 0xffffffff);
> > which I don't understand whether we need a arch callbacks for it.
>
> I don't thing so.
>
> As far as I can see, audit_syscall_entry() is called by
> syscall_enter_audit() in kernel/entry/common.c
>
> And the masking of arguments based on is_32bit_task() is done in
> syscall_get_arguments() with is called by
> syscall_enter_audit() just before calling audit_syscall_entry() and which is
> an arch callback that does the same as the removed hunk.
so, syscall_get_arguments is the ppc arch callback. thanks. :-)
> >
> > Before I sent out the RFC patch set, the very limited compile and boot test goes well with a ppc64 qemu VM. Surely, there will be a lot of test, debug and following up patch set update that is necessary to make it a complete convert.
>
> Even on ppc64 it doesn't build, at the first place because
> arch/powerpc/include/asm/entry-common.h is missing in your patch. Did you
> forget to 'git add' it ?
oh, I forget that I was testing this patch on top of the early user notifier patch:
https://github.com/linuxppc/issues/issues/477, https://patchwork.ozlabs.org/project/linuxppc-dev/patch/1FD36D52828D2506+20231218031309.2063-1-luming.yu@shingroup.cn/
and the entry-common.h is as follows:
[root@localhost linux]# cat arch/powerpc/include/asm/entry-common.h
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef ARCH_POWERPC_ENTRY_COMMON_H
#define ARCH_POWERPC_ENTRY_COMMON_H
#include <linux/user-return-notifier.h>
static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs,
unsigned long ti_work)
{
if (ti_work & _TIF_USER_RETURN_NOTIFY)
fire_user_return_notifiers();
}
#define arch_exit_to_user_mode_prepare arch_exit_to_user_mode_prepare
#endif
As you could see , it looks irrelevant.
>
> And same as with PPC32, when I build PPC64 with an empty asm/entry-common.h,
> it doesn't work. So, I guess you had some needed code in that file and you
> have to send it.
please send me your kernel config and let me reproduce and double check
if there could be another bit of code make the difference. My test p8 64bit VM boots
an unmodified fedora 38 user space just fine with the patch.
After boot, the only difference is make install of kernel could hang for a while, that
I'm not sure how that could happen yet. and I plan to do some unit test for many common
features like : lockdep, ptrace, rcu, audit...
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] powerpc/entry: convert to common and generic entry
2024-09-13 7:38 ` Luming Yu
@ 2024-09-13 8:30 ` Christophe Leroy
2024-09-13 12:02 ` Luming Yu
0 siblings, 1 reply; 12+ messages in thread
From: Christophe Leroy @ 2024-09-13 8:30 UTC (permalink / raw)
To: Luming Yu
Cc: linuxppc-dev, linux-kernel, mpe, npiggin, jialong.yang, luming.yu
Le 13/09/2024 à 09:38, Luming Yu a écrit :
> On Fri, Sep 13, 2024 at 08:54:12AM +0200, Christophe Leroy wrote:
>>
>>
>> Le 13/09/2024 à 03:40, Luming Yu a écrit :
>>> On Thu, Sep 12, 2024 at 12:23:29PM +0200, Christophe Leroy wrote:
>>>>
>>>>
>>>> Le 12/09/2024 à 10:24, Luming Yu a écrit :
>>>>> From: Yu Luming <luming.yu@gmail.com>
>>>>>
>>>>> convert powerpc entry code in syscall and fault to use syscall_work
>>>>> and irqentry_state as well as common calls from generic entry infrastructure.
>>>>>
>>>>> Signed-off-by: Luming Yu <luming.yu@shingroup.cn>
>>>>> ---
>>>>> arch/powerpc/Kconfig | 1 +
>>>>> arch/powerpc/include/asm/hw_irq.h | 5 +++++
>>>>> arch/powerpc/include/asm/processor.h | 6 ++++++
>>>>> arch/powerpc/include/asm/syscall.h | 5 +++++
>>>>> arch/powerpc/include/asm/thread_info.h | 1 +
>>>>> arch/powerpc/kernel/syscall.c | 6 +++++-
>>>>> arch/powerpc/mm/fault.c | 5 +++++
>>>>> 7 files changed, 28 insertions(+), 1 deletion(-)
>>>>
>>>> There is another build problem:
>>>>
>>>> CC kernel/entry/common.o
>>>> kernel/entry/common.c: In function 'irqentry_exit':
>>>> kernel/entry/common.c:335:21: error: implicit declaration of function
>>>> 'regs_irqs_disabled'; did you mean 'raw_irqs_disabled'?
>>>> [-Werror=implicit-function-declaration]
>>>> 335 | } else if (!regs_irqs_disabled(regs)) {
>>>> | ^~~~~~~~~~~~~~~~~~
>>>> | raw_irqs_disabled
>>>>
>>>>
>>>> You have put regs_irqs_disabled() in a section dedicated to PPC64, so it
>>>> fails on PPC32.
>>>>
>>>>
>>>> After fixing this problem and providing an empty asm/entry-common.h it is
>>>> now possible to build the kernel. But that's not enough, the board is stuck
>>>> after:
>>>>
>>>> ...
>>>> [ 2.871391] Freeing unused kernel image (initmem) memory: 1228K
>>>> [ 2.877990] Run /init as init process
>>>
>>> Thanks for these questions. :-)
>>> I haven't gotten chance to run it in ppc32 qemu.
>>> the common syscall trace enter lost this hunk
>>> - if (!is_32bit_task())
>>> - audit_syscall_entry(regs->gpr[0], regs->gpr[3], regs->gpr[4],
>>> - regs->gpr[5], regs->gpr[6]);
>>> - else
>>> - audit_syscall_entry(regs->gpr[0],
>>> - regs->gpr[3] & 0xffffffff,
>>> - regs->gpr[4] & 0xffffffff,
>>> - regs->gpr[5] & 0xffffffff,
>>> - regs->gpr[6] & 0xffffffff);
>>> which I don't understand whether we need a arch callbacks for it.
>>
>> I don't thing so.
>>
>> As far as I can see, audit_syscall_entry() is called by
>> syscall_enter_audit() in kernel/entry/common.c
>>
>> And the masking of arguments based on is_32bit_task() is done in
>> syscall_get_arguments() with is called by
>> syscall_enter_audit() just before calling audit_syscall_entry() and which is
>> an arch callback that does the same as the removed hunk.
> so, syscall_get_arguments is the ppc arch callback. thanks. :-)
>>>
>>> Before I sent out the RFC patch set, the very limited compile and boot test goes well with a ppc64 qemu VM. Surely, there will be a lot of test, debug and following up patch set update that is necessary to make it a complete convert.
>>
>> Even on ppc64 it doesn't build, at the first place because
>> arch/powerpc/include/asm/entry-common.h is missing in your patch. Did you
>> forget to 'git add' it ?
> oh, I forget that I was testing this patch on top of the early user notifier patch:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flinuxppc%2Fissues%2Fissues%2F477&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C35a08ca9a81f4c6ff8ce08dcd3c73555%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638618099770810941%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=yCQWLIAXL%2BNHnzrh0e91WIBvF0c5WfF6pY6ZMHstocA%3D&reserved=0, https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Flinuxppc-dev%2Fpatch%2F1FD36D52828D2506%2B20231218031309.2063-1-luming.yu%40shingroup.cn%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C35a08ca9a81f4c6ff8ce08dcd3c73555%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638618099770819779%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=0WBSUlpAbL6EMdPEAtJv1HUHkbeUjjUcP98wYf9IxM4%3D&reserved=0
> and the entry-common.h is as follows:
> [root@localhost linux]# cat arch/powerpc/include/asm/entry-common.h
> /* SPDX-License-Identifier: GPL-2.0 */
> #ifndef ARCH_POWERPC_ENTRY_COMMON_H
> #define ARCH_POWERPC_ENTRY_COMMON_H
>
> #include <linux/user-return-notifier.h>
>
> static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs,
> unsigned long ti_work)
> {
> if (ti_work & _TIF_USER_RETURN_NOTIFY)
> fire_user_return_notifiers();
> }
>
> #define arch_exit_to_user_mode_prepare arch_exit_to_user_mode_prepare
>
> #endif
>
> As you could see , it looks irrelevant.
>>
>> And same as with PPC32, when I build PPC64 with an empty asm/entry-common.h,
>> it doesn't work. So, I guess you had some needed code in that file and you
>> have to send it.
>
> please send me your kernel config and let me reproduce and double check
> if there could be another bit of code make the difference. My test p8 64bit VM boots
> an unmodified fedora 38 user space just fine with the patch.
> After boot, the only difference is make install of kernel could hang for a while, that
> I'm not sure how that could happen yet. and I plan to do some unit test for many common
> features like : lockdep, ptrace, rcu, audit...
>>
>
I tested with both ppc64_defconfig and ppc64le_defconfig. With those two
configs QEMU remains stuck after the following lines. I use QEMU with
machine pseries:
[ 2.701874][ T1] Running code patching self-tests ...
[ 2.734007][ T1] registered taskstats version 1
[ 2.735891][ T1] Loading compiled-in X.509 certificates
[ 2.756472][ T1] Loaded X.509 cert 'Build time autogenerated
kernel key: 003f25410c2285abf44b4685b6d63682a2dc9f11'
[ 2.784474][ T1] Demotion targets for Node 0: null
[ 2.784748][ T1] page_owner is disabled
[ 2.786795][ T1] Secure boot mode disabled
[ 2.787436][ T1] ima: No TPM chip found, activating TPM-bypass!
[ 2.787568][ T1] Loading compiled-in module X.509 certificates
[ 2.790854][ T1] Loaded X.509 cert 'Build time autogenerated
kernel key: 003f25410c2285abf44b4685b6d63682a2dc9f11'
[ 2.791289][ T1] ima: Allocated hash algorithm: sha256
[ 2.796260][ T1] Secure boot mode disabled
[ 2.796448][ T1] Trusted boot mode disabled
[ 2.796560][ T1] ima: No architecture policies found
[ 2.799580][ T1] printk: legacy console [netcon0] enabled
[ 2.799696][ T1] netconsole: network logging started
[ 2.880282][ T1] Freeing unused kernel image (initmem) memory: 6528K
[ 2.884618][ T1] Checked W+X mappings: passed, no W+X pages found
[ 2.885366][ T1] rodata_test: all tests were successful
[ 2.885749][ T1] Run /init as init process
[ 3.214730][ T58] mount (58) used greatest stack depth: 28672 bytes
left
...
nothing happens after that.
For PPC32 I use pmac32_defconfig and QEMU machine mac99
Christophe
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] powerpc/entry: convert to common and generic entry
2024-09-13 8:30 ` Christophe Leroy
@ 2024-09-13 12:02 ` Luming Yu
2024-09-13 12:15 ` Christophe Leroy
0 siblings, 1 reply; 12+ messages in thread
From: Luming Yu @ 2024-09-13 12:02 UTC (permalink / raw)
To: Christophe Leroy
Cc: linuxppc-dev, linux-kernel, mpe, npiggin, jialong.yang, luming.yu
On Fri, Sep 13, 2024 at 10:30:56AM +0200, Christophe Leroy wrote:
>
>
> Le 13/09/2024 à 09:38, Luming Yu a écrit :
> > On Fri, Sep 13, 2024 at 08:54:12AM +0200, Christophe Leroy wrote:
> > >
> > >
> > > Le 13/09/2024 à 03:40, Luming Yu a écrit :
> > > > On Thu, Sep 12, 2024 at 12:23:29PM +0200, Christophe Leroy wrote:
> > > > >
> > > > >
> > > > > Le 12/09/2024 à 10:24, Luming Yu a écrit :
> > > > > > From: Yu Luming <luming.yu@gmail.com>
> > > > > >
> > > > > > convert powerpc entry code in syscall and fault to use syscall_work
> > > > > > and irqentry_state as well as common calls from generic entry infrastructure.
> > > > > >
> > > > > > Signed-off-by: Luming Yu <luming.yu@shingroup.cn>
> > > > > > ---
> > > > > > arch/powerpc/Kconfig | 1 +
> > > > > > arch/powerpc/include/asm/hw_irq.h | 5 +++++
> > > > > > arch/powerpc/include/asm/processor.h | 6 ++++++
> > > > > > arch/powerpc/include/asm/syscall.h | 5 +++++
> > > > > > arch/powerpc/include/asm/thread_info.h | 1 +
> > > > > > arch/powerpc/kernel/syscall.c | 6 +++++-
> > > > > > arch/powerpc/mm/fault.c | 5 +++++
> > > > > > 7 files changed, 28 insertions(+), 1 deletion(-)
> > > > >
> > > > > There is another build problem:
> > > > >
> > > > > CC kernel/entry/common.o
> > > > > kernel/entry/common.c: In function 'irqentry_exit':
> > > > > kernel/entry/common.c:335:21: error: implicit declaration of function
> > > > > 'regs_irqs_disabled'; did you mean 'raw_irqs_disabled'?
> > > > > [-Werror=implicit-function-declaration]
> > > > > 335 | } else if (!regs_irqs_disabled(regs)) {
> > > > > | ^~~~~~~~~~~~~~~~~~
> > > > > | raw_irqs_disabled
> > > > >
> > > > >
> > > > > You have put regs_irqs_disabled() in a section dedicated to PPC64, so it
> > > > > fails on PPC32.
> > > > >
> > > > >
> > > > > After fixing this problem and providing an empty asm/entry-common.h it is
> > > > > now possible to build the kernel. But that's not enough, the board is stuck
> > > > > after:
> > > > >
> > > > > ...
> > > > > [ 2.871391] Freeing unused kernel image (initmem) memory: 1228K
> > > > > [ 2.877990] Run /init as init process
> > > >
> > > > Thanks for these questions. :-)
> > > > I haven't gotten chance to run it in ppc32 qemu.
> > > > the common syscall trace enter lost this hunk
> > > > - if (!is_32bit_task())
> > > > - audit_syscall_entry(regs->gpr[0], regs->gpr[3], regs->gpr[4],
> > > > - regs->gpr[5], regs->gpr[6]);
> > > > - else
> > > > - audit_syscall_entry(regs->gpr[0],
> > > > - regs->gpr[3] & 0xffffffff,
> > > > - regs->gpr[4] & 0xffffffff,
> > > > - regs->gpr[5] & 0xffffffff,
> > > > - regs->gpr[6] & 0xffffffff);
> > > > which I don't understand whether we need a arch callbacks for it.
> > >
> > > I don't thing so.
> > >
> > > As far as I can see, audit_syscall_entry() is called by
> > > syscall_enter_audit() in kernel/entry/common.c
> > >
> > > And the masking of arguments based on is_32bit_task() is done in
> > > syscall_get_arguments() with is called by
> > > syscall_enter_audit() just before calling audit_syscall_entry() and which is
> > > an arch callback that does the same as the removed hunk.
> > so, syscall_get_arguments is the ppc arch callback. thanks. :-)
> > > >
> > > > Before I sent out the RFC patch set, the very limited compile and boot test goes well with a ppc64 qemu VM. Surely, there will be a lot of test, debug and following up patch set update that is necessary to make it a complete convert.
> > >
> > > Even on ppc64 it doesn't build, at the first place because
> > > arch/powerpc/include/asm/entry-common.h is missing in your patch. Did you
> > > forget to 'git add' it ?
> > oh, I forget that I was testing this patch on top of the early user notifier patch:
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flinuxppc%2Fissues%2Fissues%2F477&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C35a08ca9a81f4c6ff8ce08dcd3c73555%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638618099770810941%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=yCQWLIAXL%2BNHnzrh0e91WIBvF0c5WfF6pY6ZMHstocA%3D&reserved=0, https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Flinuxppc-dev%2Fpatch%2F1FD36D52828D2506%2B20231218031309.2063-1-luming.yu%40shingroup.cn%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C35a08ca9a81f4c6ff8ce08dcd3c73555%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638618099770819779%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=0WBSUlpAbL6EMdPEAtJv1HUHkbeUjjUcP98wYf9IxM4%3D&reserved=0
> > and the entry-common.h is as follows:
> > [root@localhost linux]# cat arch/powerpc/include/asm/entry-common.h
> > /* SPDX-License-Identifier: GPL-2.0 */
> > #ifndef ARCH_POWERPC_ENTRY_COMMON_H
> > #define ARCH_POWERPC_ENTRY_COMMON_H
> >
> > #include <linux/user-return-notifier.h>
> >
> > static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs,
> > unsigned long ti_work)
> > {
> > if (ti_work & _TIF_USER_RETURN_NOTIFY)
> > fire_user_return_notifiers();
> > }
> >
> > #define arch_exit_to_user_mode_prepare arch_exit_to_user_mode_prepare
> >
> > #endif
> >
> > As you could see , it looks irrelevant.
> > >
> > > And same as with PPC32, when I build PPC64 with an empty asm/entry-common.h,
> > > it doesn't work. So, I guess you had some needed code in that file and you
> > > have to send it.
> >
> > please send me your kernel config and let me reproduce and double check
> > if there could be another bit of code make the difference. My test p8 64bit VM boots
> > an unmodified fedora 38 user space just fine with the patch.
> > After boot, the only difference is make install of kernel could hang for a while, that
> > I'm not sure how that could happen yet. and I plan to do some unit test for many common
> > features like : lockdep, ptrace, rcu, audit...
> > >
> >
>
>
> I tested with both ppc64_defconfig and ppc64le_defconfig. With those two
> configs QEMU remains stuck after the following lines. I use QEMU with
> machine pseries:
>
> [ 2.701874][ T1] Running code patching self-tests ...
> [ 2.734007][ T1] registered taskstats version 1
> [ 2.735891][ T1] Loading compiled-in X.509 certificates
> [ 2.756472][ T1] Loaded X.509 cert 'Build time autogenerated kernel
> key: 003f25410c2285abf44b4685b6d63682a2dc9f11'
> [ 2.784474][ T1] Demotion targets for Node 0: null
> [ 2.784748][ T1] page_owner is disabled
> [ 2.786795][ T1] Secure boot mode disabled
> [ 2.787436][ T1] ima: No TPM chip found, activating TPM-bypass!
> [ 2.787568][ T1] Loading compiled-in module X.509 certificates
> [ 2.790854][ T1] Loaded X.509 cert 'Build time autogenerated kernel
> key: 003f25410c2285abf44b4685b6d63682a2dc9f11'
> [ 2.791289][ T1] ima: Allocated hash algorithm: sha256
> [ 2.796260][ T1] Secure boot mode disabled
> [ 2.796448][ T1] Trusted boot mode disabled
> [ 2.796560][ T1] ima: No architecture policies found
> [ 2.799580][ T1] printk: legacy console [netcon0] enabled
> [ 2.799696][ T1] netconsole: network logging started
> [ 2.880282][ T1] Freeing unused kernel image (initmem) memory: 6528K
> [ 2.884618][ T1] Checked W+X mappings: passed, no W+X pages found
> [ 2.885366][ T1] rodata_test: all tests were successful
> [ 2.885749][ T1] Run /init as init process
> [ 3.214730][ T58] mount (58) used greatest stack depth: 28672 bytes
> left
> ...
> nothing happens after that.
reproduced with ppc64_defconfig
[ 0.818972][ T1] Run /init as init process
[ 5.851684][ T240] request_module: modprobe binfmt-4c46 cannot be processed, kmod busy with 50 threads for more than 5 seconds now
[ 5.851742][ T240] kworker/u33:18 (240) used greatest stack depth: 13584 bytes left
[ 5.860081][ T232] kworker/u33:16 (232) used greatest stack depth: 13072 bytes left
[ 5.863145][ T210] kworker/u35:13 (210) used greatest stack depth: 12928 bytes left
[ 5.865000][ T1] Failed to execute /init (error -8)
[ 5.868897][ T1] Run /sbin/init as init process
[ 10.891673][ T315] request_module: modprobe binfmt-4c46 cannot be processed, kmod busy with 50 threads for more than 5 seconds now
[ 10.894036][ T1] Starting init: /sbin/init exists but couldn't execute it (error -8)
[ 10.901455][ T1] Run /etc/init as init process
[ 10.903154][ T1] Run /bin/init as init process
[ 10.904747][ T1] Run /bin/sh as init process
[ 15.931679][ T367] request_module: modprobe binfmt-4c46 cannot be processed, kmod busy with 50 threads for more than 5 seconds now
[ 15.934689][ T1] Starting init: /bin/sh exists but couldn't execute it (error -8)
[ 15.940766][ T1] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
[ 15.946981][ T1] CPU: 13 PID: 1 Comm: swapper/0 Not tainted 6.7.0-rc1 #24
[ 15.950050][ T1] Hardware name: IBM pSeries (emulated by qemu) POWER8 (raw) 0x4d0200 0xf000004 of:SLOF,git-3a259d hv:linux,kvm pSeries
[ 15.955633][ T1] Call Trace:
[ 15.956714][ T1] [c0000000080fbd20] [c0000000011811e8] dump_stack_lvl+0x6c/0x9c (unreliable)
[ 15.959302][ T1] [c0000000080fbd50] [c00000000016b654] panic+0x178/0x424
[ 15.961929][ T1] [c0000000080fbdf0] [c00000000001048c] kernel_init+0x19c/0x1a0
[ 15.965310][ T1] [c0000000080fbe50] [c00000000000d394] ret_from_kernel_user_thread+0x14/0x1c
[ 15.968494][ T1] --- interrupt: 0 at 0x0
[ 15.989760][ T1] pstore: backend (nvram) writing error (-1)
qemu-system-ppc64: OS terminated: `
[root@localhost home]#
It would take some time to debug out from the issue. Stay tuned.
Thanks very much!
>
>
> For PPC32 I use pmac32_defconfig and QEMU machine mac99
>
> Christophe
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] powerpc/entry: convert to common and generic entry
2024-09-13 12:02 ` Luming Yu
@ 2024-09-13 12:15 ` Christophe Leroy
2024-09-14 2:22 ` Luming Yu
0 siblings, 1 reply; 12+ messages in thread
From: Christophe Leroy @ 2024-09-13 12:15 UTC (permalink / raw)
To: Luming Yu
Cc: linuxppc-dev, linux-kernel, mpe, npiggin, jialong.yang, luming.yu
Le 13/09/2024 à 14:02, Luming Yu a écrit :
>> ...
>> nothing happens after that.
> reproduced with ppc64_defconfig
> [ 0.818972][ T1] Run /init as init process
> [ 5.851684][ T240] request_module: modprobe binfmt-4c46 cannot be processed, kmod busy with 50 threads for more than 5 seconds now
> [ 5.851742][ T240] kworker/u33:18 (240) used greatest stack depth: 13584 bytes left
> [ 5.860081][ T232] kworker/u33:16 (232) used greatest stack depth: 13072 bytes left
> [ 5.863145][ T210] kworker/u35:13 (210) used greatest stack depth: 12928 bytes left
> [ 5.865000][ T1] Failed to execute /init (error -8)
> [ 5.868897][ T1] Run /sbin/init as init process
> [ 10.891673][ T315] request_module: modprobe binfmt-4c46 cannot be processed, kmod busy with 50 threads for more than 5 seconds now
> [ 10.894036][ T1] Starting init: /sbin/init exists but couldn't execute it (error -8)
> [ 10.901455][ T1] Run /etc/init as init process
> [ 10.903154][ T1] Run /bin/init as init process
> [ 10.904747][ T1] Run /bin/sh as init process
> [ 15.931679][ T367] request_module: modprobe binfmt-4c46 cannot be processed, kmod busy with 50 threads for more than 5 seconds now
> [ 15.934689][ T1] Starting init: /bin/sh exists but couldn't execute it (error -8)
That's something different, this is because you built a big-endian
kernel and you are trying to run a little-endian userspace.
Does it work with ppc64le_defconfig ?
On my side there is absolutely nothing happening after the last line,
the screen remains steady.
Christophe
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] powerpc/entry: convert to common and generic entry
2024-09-13 12:15 ` Christophe Leroy
@ 2024-09-14 2:22 ` Luming Yu
2024-09-18 13:47 ` Christophe Leroy
0 siblings, 1 reply; 12+ messages in thread
From: Luming Yu @ 2024-09-14 2:22 UTC (permalink / raw)
To: Christophe Leroy
Cc: linuxppc-dev, linux-kernel, mpe, npiggin, jialong.yang, luming.yu
On Fri, Sep 13, 2024 at 02:15:40PM +0200, Christophe Leroy wrote:
>
>
> Le 13/09/2024 à 14:02, Luming Yu a écrit :
>
> > > ...
> > > nothing happens after that.
> > reproduced with ppc64_defconfig
> > [ 0.818972][ T1] Run /init as init process
> > [ 5.851684][ T240] request_module: modprobe binfmt-4c46 cannot be processed, kmod busy with 50 threads for more than 5 seconds now
> > [ 5.851742][ T240] kworker/u33:18 (240) used greatest stack depth: 13584 bytes left
> > [ 5.860081][ T232] kworker/u33:16 (232) used greatest stack depth: 13072 bytes left
> > [ 5.863145][ T210] kworker/u35:13 (210) used greatest stack depth: 12928 bytes left
> > [ 5.865000][ T1] Failed to execute /init (error -8)
> > [ 5.868897][ T1] Run /sbin/init as init process
> > [ 10.891673][ T315] request_module: modprobe binfmt-4c46 cannot be processed, kmod busy with 50 threads for more than 5 seconds now
> > [ 10.894036][ T1] Starting init: /sbin/init exists but couldn't execute it (error -8)
> > [ 10.901455][ T1] Run /etc/init as init process
> > [ 10.903154][ T1] Run /bin/init as init process
> > [ 10.904747][ T1] Run /bin/sh as init process
> > [ 15.931679][ T367] request_module: modprobe binfmt-4c46 cannot be processed, kmod busy with 50 threads for more than 5 seconds now
> > [ 15.934689][ T1] Starting init: /bin/sh exists but couldn't execute it (error -8)
>
> That's something different, this is because you built a big-endian kernel
> and you are trying to run a little-endian userspace.
okay
>
> Does it work with ppc64le_defconfig ?
make ppc64le_defconfig
yes, it builds && boots just fine.
the host is a p8 powernv system , the qemu command line is as below:
qemu-system-ppc64 -m 64g -smp 16,cores=4,threads=4 --enable-kvm -nographic -net nic -net tap,ifname=tap0,script=/etc/qemu-ifup-nat,downscript=/etc/qemu-ifdown-nat Downloads/Fedora-Cloud-Base-38-1.6.ppc64le.qcow2
I will try other test configures as well.
>
> On my side there is absolutely nothing happening after the last line, the
> screen remains steady.
>
>
> Christophe
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] powerpc/entry: convert to common and generic entry
2024-09-14 2:22 ` Luming Yu
@ 2024-09-18 13:47 ` Christophe Leroy
0 siblings, 0 replies; 12+ messages in thread
From: Christophe Leroy @ 2024-09-18 13:47 UTC (permalink / raw)
To: Luming Yu
Cc: linuxppc-dev, linux-kernel, mpe, npiggin, jialong.yang, luming.yu
Hi,
Le 14/09/2024 à 04:22, Luming Yu a écrit :
> On Fri, Sep 13, 2024 at 02:15:40PM +0200, Christophe Leroy wrote:
>>
>>
>> Le 13/09/2024 à 14:02, Luming Yu a écrit :
>>
>>>> ...
>>>> nothing happens after that.
>>> reproduced with ppc64_defconfig
>>> [ 0.818972][ T1] Run /init as init process
>>> [ 5.851684][ T240] request_module: modprobe binfmt-4c46 cannot be processed, kmod busy with 50 threads for more than 5 seconds now
>>> [ 5.851742][ T240] kworker/u33:18 (240) used greatest stack depth: 13584 bytes left
>>> [ 5.860081][ T232] kworker/u33:16 (232) used greatest stack depth: 13072 bytes left
>>> [ 5.863145][ T210] kworker/u35:13 (210) used greatest stack depth: 12928 bytes left
>>> [ 5.865000][ T1] Failed to execute /init (error -8)
>>> [ 5.868897][ T1] Run /sbin/init as init process
>>> [ 10.891673][ T315] request_module: modprobe binfmt-4c46 cannot be processed, kmod busy with 50 threads for more than 5 seconds now
>>> [ 10.894036][ T1] Starting init: /sbin/init exists but couldn't execute it (error -8)
>>> [ 10.901455][ T1] Run /etc/init as init process
>>> [ 10.903154][ T1] Run /bin/init as init process
>>> [ 10.904747][ T1] Run /bin/sh as init process
>>> [ 15.931679][ T367] request_module: modprobe binfmt-4c46 cannot be processed, kmod busy with 50 threads for more than 5 seconds now
>>> [ 15.934689][ T1] Starting init: /bin/sh exists but couldn't execute it (error -8)
>>
>> That's something different, this is because you built a big-endian kernel
>> and you are trying to run a little-endian userspace.
> okay
>>
>> Does it work with ppc64le_defconfig ?
> make ppc64le_defconfig
>
> yes, it builds && boots just fine.
> the host is a p8 powernv system , the qemu command line is as below:
> qemu-system-ppc64 -m 64g -smp 16,cores=4,threads=4 --enable-kvm -nographic -net nic -net tap,ifname=tap0,script=/etc/qemu-ifup-nat,downscript=/etc/qemu-ifdown-nat Downloads/Fedora-Cloud-Base-38-1.6.ppc64le.qcow2
With that command you don't boot a freshly built kernel, you boot:
Linux version 6.2.9-300.fc38.ppc64le
(mockbuild@0e2dbea752814aea985bdc5347ce35da) (gcc (GCC) 13.0.1 20230318
(Red Hat 13.0.1-0), GNU ld version 2.39-9.fc38)
Are you sure you tried with the ppc64le_defconfig ? On my side the boot
fails as follows when using a ppc64le_defconfig vmlinux with the file
Fedora-Cloud-Base-38-1.6.ppc64le.qcow2:
...
[ 2.602758][ T1] md: autorun ...
[ 2.602808][ T1] md: ... autorun DONE.
[ 2.612596][ T189] kworker/u73:0 (189) used greatest stack depth:
29008 bytes left
[ 2.617068][ T1] /dev/root: Can't open blockdev
[ 2.618136][ T1] VFS: Cannot open root device "" or
unknown-block(0,0): error -6
[ 2.618239][ T1] Please append a correct "root=" boot option; here
are the available partitions:
[ 2.618611][ T1] 0100 65536 ram0
[ 2.618768][ T1] (driver?)
[ 2.619101][ T1] 0101 65536 ram1
[ 2.619120][ T1] (driver?)
[ 2.619187][ T1] 0102 65536 ram2
[ 2.619199][ T1] (driver?)
[ 2.619251][ T1] 0103 65536 ram3
[ 2.619261][ T1] (driver?)
[ 2.619312][ T1] 0104 65536 ram4
[ 2.619322][ T1] (driver?)
[ 2.619372][ T1] 0105 65536 ram5
[ 2.619382][ T1] (driver?)
[ 2.619436][ T1] 0106 65536 ram6
[ 2.619447][ T1] (driver?)
[ 2.619500][ T1] 0107 65536 ram7
[ 2.619519][ T1] (driver?)
[ 2.619571][ T1] 0108 65536 ram8
[ 2.619581][ T1] (driver?)
[ 2.619631][ T1] 0109 65536 ram9
[ 2.619641][ T1] (driver?)
[ 2.619690][ T1] 010a 65536 ram10
[ 2.619700][ T1] (driver?)
[ 2.619754][ T1] 010b 65536 ram11
[ 2.619764][ T1] (driver?)
[ 2.619818][ T1] 010c 65536 ram12
[ 2.619827][ T1] (driver?)
[ 2.619880][ T1] 010d 65536 ram13
[ 2.619889][ T1] (driver?)
[ 2.619942][ T1] 010e 65536 ram14
[ 2.619952][ T1] (driver?)
[ 2.620023][ T1] 010f 65536 ram15
[ 2.620036][ T1] (driver?)
[ 2.620116][ T1] 0b00 1048575 sr0
[ 2.620150][ T1] driver: sr
[ 2.620221][ T1] 0800 5242880 sda
[ 2.620234][ T1] driver: sd
[ 2.620310][ T1] 0801 4096 sda1
709431c7-74bd-4ec4-bbe8-d4f7e7e3194e
[ 2.620369][ T1]
[ 2.620449][ T1] 0802 1024000 sda2
e0b0a6de-ca8f-4e50-808c-121324c94d04
[ 2.620463][ T1]
[ 2.620531][ T1] 0803 102400 sda3
8ed2fbf1-fd2c-4ab0-b66f-d31df1d24e3e
[ 2.620544][ T1]
[ 2.620599][ T1] 0804 1024 sda4
46dc7fc8-bf10-4166-9bc8-98daabbec06d
[ 2.620610][ T1]
[ 2.620666][ T1] 0805 4109312 sda5
8a52b54b-c379-43a5-bf8d-a43fdef4a370
[ 2.620676][ T1]
[ 2.620838][ T1] List of all bdev filesystems:
[ 2.620884][ T1] ext3
[ 2.620918][ T1] ext2
[ 2.620947][ T1] ext4
[ 2.620971][ T1] msdos
[ 2.620995][ T1] iso9660
[ 2.621018][ T1] xfs
[ 2.621050][ T1]
[ 2.621311][ T1] Kernel panic - not syncing: VFS: Unable to mount
root fs on unknown-block(0,0)
[ 2.621992][ T1] CPU: 2 UID: 0 PID: 1 Comm: swapper/0 Not tainted
6.11.0-06480-gfabc9e955334 #1217
[ 2.622166][ T1] Hardware name: IBM pSeries (emulated by qemu)
POWER9 (architected) 0x4e1200 0xf000005 of:SLOF,HEAD pSeries
[ 2.622456][ T1] Call Trace:
[ 2.622574][ T1] [c000000003797ad0] [c000000001189fe8]
dump_stack_lvl+0xd8/0xf0 (unreliable)
[ 2.623575][ T1] [c000000003797b00] [c00000000014830c]
panic+0x2f8/0x4fc
[ 2.623666][ T1] [c000000003797ba0] [c000000002006858]
mount_root_generic+0x2c8/0x474
[ 2.623748][ T1] [c000000003797c70] [c000000002006f40]
prepare_namespace+0x94/0x3a4
[ 2.623804][ T1] [c000000003797d00] [c000000002005e7c]
kernel_init_freeable+0x4cc/0x530
[ 2.623896][ T1] [c000000003797de0] [c000000000011138]
kernel_init+0x34/0x26c
[ 2.623954][ T1] [c000000003797e50] [c00000000000debc]
ret_from_kernel_user_thread+0x14/0x1c
[ 2.624025][ T1] --- interrupt: 0 at 0x0
[ 4.502550][ T1] pstore: backend (nvram) writing error (-1)
qemu-system-ppc64: OS terminated:
Christophe
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-09-18 13:47 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-12 8:24 [PATCH 1/2] powerpc/entry: convert to common and generic entry Luming Yu
2024-09-12 9:11 ` Christophe Leroy
2024-09-12 9:35 ` Christophe Leroy
2024-09-12 10:23 ` Christophe Leroy
2024-09-13 1:40 ` Luming Yu
2024-09-13 6:54 ` Christophe Leroy
2024-09-13 7:38 ` Luming Yu
2024-09-13 8:30 ` Christophe Leroy
2024-09-13 12:02 ` Luming Yu
2024-09-13 12:15 ` Christophe Leroy
2024-09-14 2:22 ` Luming Yu
2024-09-18 13:47 ` Christophe Leroy
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).