2018-02-12 22:35:45

by Guenter Roeck

[permalink] [raw]
Subject: [PATCH 1/2] powerpc/kdump: Add missing optional dummy functions

If KEXEC_CORE is not enabled, PowerNV builds fail as follows.

arch/powerpc/platforms/powernv/smp.c: In function 'pnv_smp_cpu_kill_self':
arch/powerpc/platforms/powernv/smp.c:236:4: error:
implicit declaration of function 'crash_ipi_callback'

Add dummy function calls, similar to kdump_in_progress(), to solve the
problem.

Fixes: 4145f358644b ("powernv/kdump: Fix cases where the kdump kernel ...")
Cc: Balbir Singh <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
---
arch/powerpc/include/asm/kexec.h | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h
index 9dcbfa6bbb91..d8b1e8e7e035 100644
--- a/arch/powerpc/include/asm/kexec.h
+++ b/arch/powerpc/include/asm/kexec.h
@@ -140,6 +140,12 @@ static inline bool kdump_in_progress(void)
return false;
}

+static inline void crash_ipi_callback(struct pt_regs *regs) { }
+
+static inline void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *))
+{
+}
+
#endif /* CONFIG_KEXEC_CORE */
#endif /* ! __ASSEMBLY__ */
#endif /* __KERNEL__ */
--
2.7.4



2018-02-12 22:35:16

by Guenter Roeck

[permalink] [raw]
Subject: [PATCH 2/2] powerpc/pseries: Declare optional dummy function for find_and_online_cpu_nid

Commit e67e02a544e9 ("powerpc/pseries: Fix cpu hotplug crash with
memoryless nodes") adds an unconditional call to find_and_online_cpu_nid(),
which is only declared if CONFIG_PPC_SPLPAR is enabled. This results in
the following build error if this is not the case.

arch/powerpc/platforms/pseries/hotplug-cpu.o: In function `dlpar_online_cpu':
arch/powerpc/platforms/pseries/hotplug-cpu.c:369:
undefined reference to `.find_and_online_cpu_nid'

Follow the guideline provided by similar functions and provide a dummy
function if CONFIG_PPC_SPLPAR is not enabled. This also moves the external
function declaration into an include file where it should be.

Fixes: e67e02a544e9 ("powerpc/pseries: Fix cpu hotplug crash with ...")
Cc: Michael Bringmann <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Nathan Fontenot <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
---
arch/powerpc/include/asm/topology.h | 5 +++++
arch/powerpc/platforms/pseries/hotplug-cpu.c | 2 --
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 88187c285c70..52815982436f 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -82,6 +82,7 @@ static inline int numa_update_cpu_topology(bool cpus_locked)
extern int start_topology_update(void);
extern int stop_topology_update(void);
extern int prrn_is_enabled(void);
+extern int find_and_online_cpu_nid(int cpu);
#else
static inline int start_topology_update(void)
{
@@ -95,6 +96,10 @@ static inline int prrn_is_enabled(void)
{
return 0;
}
+static inline int find_and_online_cpu_nid(int cpu)
+{
+ return 0;
+}
#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */

#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_NEED_MULTIPLE_NODES)
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index dceb51454d8d..f5c6a8cd2926 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -340,8 +340,6 @@ static void pseries_remove_processor(struct device_node *np)
cpu_maps_update_done();
}

-extern int find_and_online_cpu_nid(int cpu);
-
static int dlpar_online_cpu(struct device_node *dn)
{
int rc = 0;
--
2.7.4


2018-02-12 23:03:27

by Balbir Singh

[permalink] [raw]
Subject: Re: [PATCH 1/2] powerpc/kdump: Add missing optional dummy functions

On Tue, Feb 13, 2018 at 9:34 AM, Guenter Roeck <[email protected]> wrote:
> If KEXEC_CORE is not enabled, PowerNV builds fail as follows.
>
> arch/powerpc/platforms/powernv/smp.c: In function 'pnv_smp_cpu_kill_self':
> arch/powerpc/platforms/powernv/smp.c:236:4: error:
> implicit declaration of function 'crash_ipi_callback'
>
> Add dummy function calls, similar to kdump_in_progress(), to solve the
> problem.
>
> Fixes: 4145f358644b ("powernv/kdump: Fix cases where the kdump kernel ...")
> Cc: Balbir Singh <[email protected]>
> Cc: Michael Ellerman <[email protected]>
> Cc: Nicholas Piggin <[email protected]>
> Signed-off-by: Guenter Roeck <[email protected]>
> ---

Thanks for working on this.

You've added two functions, I understand the crash_send_ipi() bits
that I broke. Looks like crash_ipi_callback broken without KEXEC_CORE?

I am going to test these patches, for now

Acked-by: Balbir Singh <[email protected]>

Balbir Singh

2018-02-12 23:27:30

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 1/2] powerpc/kdump: Add missing optional dummy functions

On Tue, Feb 13, 2018 at 10:01:57AM +1100, Balbir Singh wrote:
> On Tue, Feb 13, 2018 at 9:34 AM, Guenter Roeck <[email protected]> wrote:
> > If KEXEC_CORE is not enabled, PowerNV builds fail as follows.
> >
> > arch/powerpc/platforms/powernv/smp.c: In function 'pnv_smp_cpu_kill_self':
> > arch/powerpc/platforms/powernv/smp.c:236:4: error:
> > implicit declaration of function 'crash_ipi_callback'
> >
> > Add dummy function calls, similar to kdump_in_progress(), to solve the
> > problem.
> >
> > Fixes: 4145f358644b ("powernv/kdump: Fix cases where the kdump kernel ...")
> > Cc: Balbir Singh <[email protected]>
> > Cc: Michael Ellerman <[email protected]>
> > Cc: Nicholas Piggin <[email protected]>
> > Signed-off-by: Guenter Roeck <[email protected]>
> > ---
>
> Thanks for working on this.
>
> You've added two functions, I understand the crash_send_ipi() bits
> that I broke. Looks like crash_ipi_callback broken without KEXEC_CORE?
>

If I recall correctly, 4145f358644b introduced the call to crash_ipi_callback().
After I declared the dummy function for that, I got an error about the missing
crash_send_ipi(). I didn't spend more time on it but just added another dummy
function. It may well be that another problem was introduced in the same time
frame. On the other side, maybe I got it all wrong, and my patch is not worth
the computer it was written on.

Thanks,
Guenter

2018-02-13 11:50:55

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH 1/2] powerpc/kdump: Add missing optional dummy functions

Guenter Roeck <[email protected]> writes:

> If KEXEC_CORE is not enabled, PowerNV builds fail as follows.
>
> arch/powerpc/platforms/powernv/smp.c: In function 'pnv_smp_cpu_kill_self':
> arch/powerpc/platforms/powernv/smp.c:236:4: error:
> implicit declaration of function 'crash_ipi_callback'
>
> Add dummy function calls, similar to kdump_in_progress(), to solve the
> problem.
>
> Fixes: 4145f358644b ("powernv/kdump: Fix cases where the kdump kernel ...")

Personally I prefer these untruncated.

> Cc: Balbir Singh <[email protected]>
> Cc: Michael Ellerman <[email protected]>
> Cc: Nicholas Piggin <[email protected]>
> Signed-off-by: Guenter Roeck <[email protected]>
> ---
> arch/powerpc/include/asm/kexec.h | 6 ++++++
> 1 file changed, 6 insertions(+)

Thanks. Nathan sent a fix for this a few days ago, but I like this
version because it uses the existing #ifdefs.

I've taken this version but used the subject from his patch.

cheers

> diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h
> index 9dcbfa6bbb91..d8b1e8e7e035 100644
> --- a/arch/powerpc/include/asm/kexec.h
> +++ b/arch/powerpc/include/asm/kexec.h
> @@ -140,6 +140,12 @@ static inline bool kdump_in_progress(void)
> return false;
> }
>
> +static inline void crash_ipi_callback(struct pt_regs *regs) { }
> +
> +static inline void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *))
> +{
> +}
> +
> #endif /* CONFIG_KEXEC_CORE */
> #endif /* ! __ASSEMBLY__ */
> #endif /* __KERNEL__ */
> --
> 2.7.4

2018-02-13 19:50:12

by Tyrel Datwyler

[permalink] [raw]
Subject: Re: [PATCH 2/2] powerpc/pseries: Declare optional dummy function for find_and_online_cpu_nid

On 02/12/2018 02:34 PM, Guenter Roeck wrote:
> Commit e67e02a544e9 ("powerpc/pseries: Fix cpu hotplug crash with
> memoryless nodes") adds an unconditional call to find_and_online_cpu_nid(),
> which is only declared if CONFIG_PPC_SPLPAR is enabled. This results in
> the following build error if this is not the case.
>
> arch/powerpc/platforms/pseries/hotplug-cpu.o: In function `dlpar_online_cpu':
> arch/powerpc/platforms/pseries/hotplug-cpu.c:369:
> undefined reference to `.find_and_online_cpu_nid'
>
> Follow the guideline provided by similar functions and provide a dummy
> function if CONFIG_PPC_SPLPAR is not enabled. This also moves the external
> function declaration into an include file where it should be.
>
> Fixes: e67e02a544e9 ("powerpc/pseries: Fix cpu hotplug crash with ...")
> Cc: Michael Bringmann <[email protected]>
> Cc: Michael Ellerman <[email protected]>
> Cc: Nathan Fontenot <[email protected]>
> Signed-off-by: Guenter Roeck <[email protected]>

Nathan already sent a patch on the 9th for this issue to the list.

-Tyrel

> ---
> arch/powerpc/include/asm/topology.h | 5 +++++
> arch/powerpc/platforms/pseries/hotplug-cpu.c | 2 --
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
> index 88187c285c70..52815982436f 100644
> --- a/arch/powerpc/include/asm/topology.h
> +++ b/arch/powerpc/include/asm/topology.h
> @@ -82,6 +82,7 @@ static inline int numa_update_cpu_topology(bool cpus_locked)
> extern int start_topology_update(void);
> extern int stop_topology_update(void);
> extern int prrn_is_enabled(void);
> +extern int find_and_online_cpu_nid(int cpu);
> #else
> static inline int start_topology_update(void)
> {
> @@ -95,6 +96,10 @@ static inline int prrn_is_enabled(void)
> {
> return 0;
> }
> +static inline int find_and_online_cpu_nid(int cpu)
> +{
> + return 0;
> +}
> #endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
>
> #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_NEED_MULTIPLE_NODES)
> diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> index dceb51454d8d..f5c6a8cd2926 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> @@ -340,8 +340,6 @@ static void pseries_remove_processor(struct device_node *np)
> cpu_maps_update_done();
> }
>
> -extern int find_and_online_cpu_nid(int cpu);
> -
> static int dlpar_online_cpu(struct device_node *dn)
> {
> int rc = 0;
>


2018-02-14 02:33:55

by Balbir Singh

[permalink] [raw]
Subject: Re: [PATCH 1/2] powerpc/kdump: Add missing optional dummy functions

On Mon, 12 Feb 2018 15:25:51 -0800
Guenter Roeck <[email protected]> wrote:

> On Tue, Feb 13, 2018 at 10:01:57AM +1100, Balbir Singh wrote:
> > On Tue, Feb 13, 2018 at 9:34 AM, Guenter Roeck <[email protected]> wrote:
> > > If KEXEC_CORE is not enabled, PowerNV builds fail as follows.
> > >
> > > arch/powerpc/platforms/powernv/smp.c: In function 'pnv_smp_cpu_kill_self':
> > > arch/powerpc/platforms/powernv/smp.c:236:4: error:
> > > implicit declaration of function 'crash_ipi_callback'
> > >
> > > Add dummy function calls, similar to kdump_in_progress(), to solve the
> > > problem.
> > >
> > > Fixes: 4145f358644b ("powernv/kdump: Fix cases where the kdump kernel ...")
> > > Cc: Balbir Singh <[email protected]>
> > > Cc: Michael Ellerman <[email protected]>
> > > Cc: Nicholas Piggin <[email protected]>
> > > Signed-off-by: Guenter Roeck <[email protected]>
> > > ---
> >
> > Thanks for working on this.
> >
> > You've added two functions, I understand the crash_send_ipi() bits
> > that I broke. Looks like crash_ipi_callback broken without KEXEC_CORE?
> >
>
> If I recall correctly, 4145f358644b introduced the call to crash_ipi_callback().
> After I declared the dummy function for that, I got an error about the missing
> crash_send_ipi(). I didn't spend more time on it but just added another dummy
> function. It may well be that another problem was introduced in the same time
> frame. On the other side, maybe I got it all wrong, and my patch is not worth
> the computer it was written on.
>

The patches worked for me with CONFIG_KEXEC=n and CONFIG_KEXEC_CORE=n

Tested-by: Balbir Singh <[email protected]>

Balbir Singh

2018-02-14 05:44:58

by Michael Ellerman

[permalink] [raw]
Subject: Re: [2/2] powerpc/pseries: Declare optional dummy function for find_and_online_cpu_nid

On Mon, 2018-02-12 at 22:34:08 UTC, Guenter Roeck wrote:
> Commit e67e02a544e9 ("powerpc/pseries: Fix cpu hotplug crash with
> memoryless nodes") adds an unconditional call to find_and_online_cpu_nid(),
> which is only declared if CONFIG_PPC_SPLPAR is enabled. This results in
> the following build error if this is not the case.
>
> arch/powerpc/platforms/pseries/hotplug-cpu.o: In function `dlpar_online_cpu':
> arch/powerpc/platforms/pseries/hotplug-cpu.c:369:
> undefined reference to `.find_and_online_cpu_nid'
>
> Follow the guideline provided by similar functions and provide a dummy
> function if CONFIG_PPC_SPLPAR is not enabled. This also moves the external
> function declaration into an include file where it should be.
>
> Fixes: e67e02a544e9 ("powerpc/pseries: Fix cpu hotplug crash with ...")
> Cc: Michael Bringmann <[email protected]>
> Cc: Michael Ellerman <[email protected]>
> Cc: Nathan Fontenot <[email protected]>
> Signed-off-by: Guenter Roeck <[email protected]>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/82343484a2d4c97a03bfd81303b549

cheers

2018-02-14 05:45:44

by Michael Ellerman

[permalink] [raw]
Subject: Re: [1/2] powerpc/kdump: Add missing optional dummy functions

On Mon, 2018-02-12 at 22:34:07 UTC, Guenter Roeck wrote:
> If KEXEC_CORE is not enabled, PowerNV builds fail as follows.
>
> arch/powerpc/platforms/powernv/smp.c: In function 'pnv_smp_cpu_kill_self':
> arch/powerpc/platforms/powernv/smp.c:236:4: error:
> implicit declaration of function 'crash_ipi_callback'
>
> Add dummy function calls, similar to kdump_in_progress(), to solve the
> problem.
>
> Fixes: 4145f358644b ("powernv/kdump: Fix cases where the kdump kernel ...")
> Cc: Balbir Singh <[email protected]>
> Cc: Michael Ellerman <[email protected]>
> Cc: Nicholas Piggin <[email protected]>
> Signed-off-by: Guenter Roeck <[email protected]>
> Acked-by: Balbir Singh <[email protected]>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/910961754572a2f4c83ad7e610d180

cheers