* Re: [PATCH 3/3] powerpc/qspinlock: Use generic smp_cond_load_relaxed
From: Michal Suchánek @ 2021-03-09 9:39 UTC (permalink / raw)
To: Davidlohr Bueso
Cc: Davidlohr Bueso, peterz, will, linux-kernel, npiggin, mingo,
paulus, longman, linuxppc-dev
In-Reply-To: <20210309015950.27688-4-dave@stgolabs.net>
On Mon, Mar 08, 2021 at 05:59:50PM -0800, Davidlohr Bueso wrote:
> 49a7d46a06c3 (powerpc: Implement smp_cond_load_relaxed()) added
> busy-waiting pausing with a preferred SMT priority pattern, lowering
> the priority (reducing decode cycles) during the whole loop slowpath.
>
> However, data shows that while this pattern works well with simple
^^^^^^^^^^^^^^^^^^^^^^
> spinlocks, queued spinlocks benefit more being kept in medium priority,
> with a cpu_relax() instead, being a low+medium combo on powerpc.
...
>
> diff --git a/arch/powerpc/include/asm/barrier.h b/arch/powerpc/include/asm/barrier.h
> index aecfde829d5d..7ae29cfb06c0 100644
> --- a/arch/powerpc/include/asm/barrier.h
> +++ b/arch/powerpc/include/asm/barrier.h
> @@ -80,22 +80,6 @@ do { \
> ___p1; \
> })
>
> -#ifdef CONFIG_PPC64
Maybe it should be kept for the simple spinlock case then?
Thanks
Michal
> -#define smp_cond_load_relaxed(ptr, cond_expr) ({ \
> - typeof(ptr) __PTR = (ptr); \
> - __unqual_scalar_typeof(*ptr) VAL; \
> - VAL = READ_ONCE(*__PTR); \
> - if (unlikely(!(cond_expr))) { \
> - spin_begin(); \
> - do { \
> - VAL = READ_ONCE(*__PTR); \
> - } while (!(cond_expr)); \
> - spin_end(); \
> - } \
> - (typeof(*ptr))VAL; \
> -})
> -#endif
> -
> #ifdef CONFIG_PPC_BOOK3S_64
> #define NOSPEC_BARRIER_SLOT nop
> #elif defined(CONFIG_PPC_FSL_BOOK3E)
> --
> 2.26.2
>
^ permalink raw reply
* Re: [PATCH v2 5/8] powerpc/xive: Drop check on irq_data in xive_core_debug_show()
From: Greg Kurz @ 2021-03-09 9:18 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: linuxppc-dev, kernel test robot, Dan Carpenter
In-Reply-To: <20210303174857.1760393-6-clg@kaod.org>
On Wed, 3 Mar 2021 18:48:54 +0100
Cédric Le Goater <clg@kaod.org> wrote:
> When looping on IRQ descriptor, irq_data is always valid.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: 930914b7d528 ("powerpc/xive: Add a debugfs file to dump internal XIVE state")
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
Reviewed-by: Greg Kurz <groug@kaod.org>
> arch/powerpc/sysdev/xive/common.c | 21 ++++++++++-----------
> 1 file changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
> index 7581cb12bb53..60ebd6f4b31d 100644
> --- a/arch/powerpc/sysdev/xive/common.c
> +++ b/arch/powerpc/sysdev/xive/common.c
> @@ -1586,6 +1586,8 @@ static void xive_debug_show_irq(struct seq_file *m, struct irq_data *d)
> u32 target;
> u8 prio;
> u32 lirq;
> + struct xive_irq_data *xd;
> + u64 val;
>
> rc = xive_ops->get_irq_config(hw_irq, &target, &prio, &lirq);
> if (rc) {
> @@ -1596,17 +1598,14 @@ static void xive_debug_show_irq(struct seq_file *m, struct irq_data *d)
> seq_printf(m, "IRQ 0x%08x : target=0x%x prio=%02x lirq=0x%x ",
> hw_irq, target, prio, lirq);
>
> - if (d) {
> - struct xive_irq_data *xd = irq_data_get_irq_handler_data(d);
> - u64 val = xive_esb_read(xd, XIVE_ESB_GET);
> -
> - seq_printf(m, "flags=%c%c%c PQ=%c%c",
> - xd->flags & XIVE_IRQ_FLAG_STORE_EOI ? 'S' : ' ',
> - xd->flags & XIVE_IRQ_FLAG_LSI ? 'L' : ' ',
> - xd->flags & XIVE_IRQ_FLAG_H_INT_ESB ? 'H' : ' ',
> - val & XIVE_ESB_VAL_P ? 'P' : '-',
> - val & XIVE_ESB_VAL_Q ? 'Q' : '-');
> - }
> + xd = irq_data_get_irq_handler_data(d);
> + val = xive_esb_read(xd, XIVE_ESB_GET);
> + seq_printf(m, "flags=%c%c%c PQ=%c%c",
> + xd->flags & XIVE_IRQ_FLAG_STORE_EOI ? 'S' : ' ',
> + xd->flags & XIVE_IRQ_FLAG_LSI ? 'L' : ' ',
> + xd->flags & XIVE_IRQ_FLAG_H_INT_ESB ? 'H' : ' ',
> + val & XIVE_ESB_VAL_P ? 'P' : '-',
> + val & XIVE_ESB_VAL_Q ? 'Q' : '-');
> seq_puts(m, "\n");
> }
>
^ permalink raw reply
* Re: [PATCH v2 6/8] powerpc/xive: Simplify the dump of XIVE interrupts under xmon
From: Greg Kurz @ 2021-03-09 9:22 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: linuxppc-dev
In-Reply-To: <20210303174857.1760393-7-clg@kaod.org>
On Wed, 3 Mar 2021 18:48:55 +0100
Cédric Le Goater <clg@kaod.org> wrote:
> Move the xmon routine under XIVE subsystem and rework the loop on the
> interrupts taking into account the xive_irq_domain to filter out IPIs.
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
Nice again ! :)
Reviewed-by: Greg Kurz <groug@kaod.org>
> arch/powerpc/include/asm/xive.h | 1 +
> arch/powerpc/sysdev/xive/common.c | 14 ++++++++++++++
> arch/powerpc/xmon/xmon.c | 28 ++--------------------------
> 3 files changed, 17 insertions(+), 26 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/xive.h b/arch/powerpc/include/asm/xive.h
> index 9a312b975ca8..aa094a8655b0 100644
> --- a/arch/powerpc/include/asm/xive.h
> +++ b/arch/powerpc/include/asm/xive.h
> @@ -102,6 +102,7 @@ void xive_flush_interrupt(void);
> /* xmon hook */
> void xmon_xive_do_dump(int cpu);
> int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d);
> +void xmon_xive_get_irq_all(void);
>
> /* APIs used by KVM */
> u32 xive_native_default_eq_shift(void);
> diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
> index 60ebd6f4b31d..f6b7b15bbb3a 100644
> --- a/arch/powerpc/sysdev/xive/common.c
> +++ b/arch/powerpc/sysdev/xive/common.c
> @@ -291,6 +291,20 @@ int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d)
> return 0;
> }
>
> +void xmon_xive_get_irq_all(void)
> +{
> + unsigned int i;
> + struct irq_desc *desc;
> +
> + for_each_irq_desc(i, desc) {
> + struct irq_data *d = irq_desc_get_irq_data(desc);
> + unsigned int hwirq = (unsigned int)irqd_to_hwirq(d);
> +
> + if (d->domain == xive_irq_domain)
> + xmon_xive_get_irq_config(hwirq, d);
> + }
> +}
> +
> #endif /* CONFIG_XMON */
>
> static unsigned int xive_get_irq(void)
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index 3fe37495f63d..80fbf8968f77 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -2727,30 +2727,6 @@ static void dump_all_xives(void)
> dump_one_xive(cpu);
> }
>
> -static void dump_one_xive_irq(u32 num, struct irq_data *d)
> -{
> - xmon_xive_get_irq_config(num, d);
> -}
> -
> -static void dump_all_xive_irq(void)
> -{
> - unsigned int i;
> - struct irq_desc *desc;
> -
> - for_each_irq_desc(i, desc) {
> - struct irq_data *d = irq_desc_get_irq_data(desc);
> - unsigned int hwirq;
> -
> - if (!d)
> - continue;
> -
> - hwirq = (unsigned int)irqd_to_hwirq(d);
> - /* IPIs are special (HW number 0) */
> - if (hwirq)
> - dump_one_xive_irq(hwirq, d);
> - }
> -}
> -
> static void dump_xives(void)
> {
> unsigned long num;
> @@ -2767,9 +2743,9 @@ static void dump_xives(void)
> return;
> } else if (c == 'i') {
> if (scanhex(&num))
> - dump_one_xive_irq(num, NULL);
> + xmon_xive_get_irq_config(num, NULL);
> else
> - dump_all_xive_irq();
> + xmon_xive_get_irq_all();
> return;
> }
>
^ permalink raw reply
* Re: [PATCH] powerpc: Fix missing declaration of [en/dis]able_kernel_vsx()
From: Geert Uytterhoeven @ 2021-03-09 9:16 UTC (permalink / raw)
To: Christophe Leroy
Cc: Linux Kernel Mailing List, amd-gfx list, Paul Mackerras,
Alex Deucher, linuxppc-dev, Christian König
In-Reply-To: <b12f9128-790b-7d8b-5f3c-e0912f5bec0a@csgroup.eu>
Hi Christophe,
On Tue, Mar 9, 2021 at 9:52 AM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
> Le 09/03/2021 à 09:45, Geert Uytterhoeven a écrit :
> > On Tue, Mar 9, 2021 at 9:39 AM Christophe Leroy
> > <christophe.leroy@csgroup.eu> wrote:
> >> Add stub instances of enable_kernel_vsx() and disable_kernel_vsx()
> >> when CONFIG_VSX is not set, to avoid following build failure.
> >>
> >> CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.o
> >> In file included from ./drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29,
> >> from ./drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:37,
> >> from drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:27:
> >> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c: In function 'dcn_bw_apply_registry_override':
> >> ./drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:64:3: error: implicit declaration of function 'enable_kernel_vsx'; did you mean 'enable_kernel_fp'? [-Werror=implicit-function-declaration]
> >> 64 | enable_kernel_vsx(); \
> >> | ^~~~~~~~~~~~~~~~~
> >> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:640:2: note: in expansion of macro 'DC_FP_START'
> >> 640 | DC_FP_START();
> >> | ^~~~~~~~~~~
> >> ./drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:75:3: error: implicit declaration of function 'disable_kernel_vsx'; did you mean 'disable_kernel_fp'? [-Werror=implicit-function-declaration]
> >> 75 | disable_kernel_vsx(); \
> >> | ^~~~~~~~~~~~~~~~~~
> >> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:676:2: note: in expansion of macro 'DC_FP_END'
> >> 676 | DC_FP_END();
> >> | ^~~~~~~~~
> >> cc1: some warnings being treated as errors
> >> make[5]: *** [drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.o] Error 1
> >>
> >> Fixes: 16a9dea110a6 ("amdgpu: Enable initial DCN support on POWER")
> >> Cc: stable@vger.kernel.org
> >> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> >
> > Thanks for your patch!
> >
> >> --- a/arch/powerpc/include/asm/switch_to.h
> >> +++ b/arch/powerpc/include/asm/switch_to.h
> >> @@ -71,6 +71,16 @@ static inline void disable_kernel_vsx(void)
> >> {
> >> msr_check_and_clear(MSR_FP|MSR_VEC|MSR_VSX);
> >> }
> >> +#else
> >> +static inline void enable_kernel_vsx(void)
> >> +{
> >> + BUILD_BUG();
> >> +}
> >> +
> >> +static inline void disable_kernel_vsx(void)
> >> +{
> >> + BUILD_BUG();
> >> +}
> >> #endif
> >
> > I'm wondering how this is any better than the current situation: using
> > BUILD_BUG() will still cause a build failure?
>
> No it won't cause a failure. In drivers/gpu/drm/amd/display/dc/os_types.h you have:
>
> #define DC_FP_START() { \
> if (cpu_has_feature(CPU_FTR_VSX_COMP)) { \
> preempt_disable(); \
> enable_kernel_vsx(); \
> } else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) { \
> preempt_disable(); \
> enable_kernel_altivec(); \
> } else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) { \
> preempt_disable(); \
> enable_kernel_fp(); \
> } \
>
> When CONFIG_VSX is not selected, cpu_has_feature(CPU_FTR_VSX_COMP) constant folds to 'false' so the
> call to enable_kernel_vsx() is discarded and the build succeeds.
IC. So you might as well have an empty (dummy) function instead?
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 v2 4/8] powerpc/xive: Simplify xive_core_debug_show()
From: Greg Kurz @ 2021-03-09 9:13 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: linuxppc-dev
In-Reply-To: <464b873b-b8d9-c656-fb72-365bfca9d8c6@kaod.org>
On Mon, 8 Mar 2021 19:11:11 +0100
Cédric Le Goater <clg@kaod.org> wrote:
> On 3/8/21 7:07 PM, Greg Kurz wrote:
> > On Wed, 3 Mar 2021 18:48:53 +0100
> > Cédric Le Goater <clg@kaod.org> wrote:
> >
> >> Now that the IPI interrupt has its own domain, the checks on the HW
> >> interrupt number XIVE_IPI_HW_IRQ and on the chip can be replaced by a
> >> check on the domain.
> >>
> >> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> >> ---
> >
> > Shouldn't this have the following tags ?
> >
> > Reported-by: kernel test robot <lkp@intel.com>
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Fixes: 930914b7d528 ("powerpc/xive: Add a debugfs file to dump internal XIVE state")
>
> The next patch has because it removes the useless check on irq_data.
>
Ok I get it. This report isn't about an actual crash. Just a false
positive because of the not needed check in the caller.
> C.
>
> >
> > Anyway,
> >
> > Reviewed-by: Greg Kurz <groug@kaod.org>
> >
> >> arch/powerpc/sysdev/xive/common.c | 18 ++++--------------
> >> 1 file changed, 4 insertions(+), 14 deletions(-)
> >>
> >> diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
> >> index 678680531d26..7581cb12bb53 100644
> >> --- a/arch/powerpc/sysdev/xive/common.c
> >> +++ b/arch/powerpc/sysdev/xive/common.c
> >> @@ -1579,17 +1579,14 @@ static void xive_debug_show_cpu(struct seq_file *m, int cpu)
> >> seq_puts(m, "\n");
> >> }
> >>
> >> -static void xive_debug_show_irq(struct seq_file *m, u32 hw_irq, struct irq_data *d)
> >> +static void xive_debug_show_irq(struct seq_file *m, struct irq_data *d)
> >> {
> >> - struct irq_chip *chip = irq_data_get_irq_chip(d);
> >> + unsigned int hw_irq = (unsigned int)irqd_to_hwirq(d);
> >> int rc;
> >> u32 target;
> >> u8 prio;
> >> u32 lirq;
> >>
> >> - if (!is_xive_irq(chip))
> >> - return;
> >> -
> >> rc = xive_ops->get_irq_config(hw_irq, &target, &prio, &lirq);
> >> if (rc) {
> >> seq_printf(m, "IRQ 0x%08x : no config rc=%d\n", hw_irq, rc);
> >> @@ -1627,16 +1624,9 @@ static int xive_core_debug_show(struct seq_file *m, void *private)
> >>
> >> for_each_irq_desc(i, desc) {
> >> struct irq_data *d = irq_desc_get_irq_data(desc);
> >> - unsigned int hw_irq;
> >> -
> >> - if (!d)
> >> - continue;
> >> -
> >> - hw_irq = (unsigned int)irqd_to_hwirq(d);
> >>
> >> - /* IPIs are special (HW number 0) */
> >> - if (hw_irq != XIVE_IPI_HW_IRQ)
> >> - xive_debug_show_irq(m, hw_irq, d);
> >> + if (d->domain == xive_irq_domain)
> >> + xive_debug_show_irq(m, d);
> >> }
> >> return 0;
> >> }
> >
>
^ permalink raw reply
* Re: [PATCH 0/6] mm: some config cleanups
From: Anshuman Khandual @ 2021-03-09 9:04 UTC (permalink / raw)
To: linux-mm
Cc: linux-s390, linux-ia64, linux-parisc, linux-sh, x86, linux-mips,
linux-kernel, linux-fsdevel, linux-riscv, linux-snps-arc,
linuxppc-dev, linux-arm-kernel
In-Reply-To: <1615278790-18053-1-git-send-email-anshuman.khandual@arm.com>
On 3/9/21 2:03 PM, Anshuman Khandual wrote:
> This series contains config cleanup patches which reduces code duplication
> across platforms and also improves maintainability. There is no functional
> change intended with this series. This has been boot tested on arm64 but
> only build tested on some other platforms.
>
> This applies on 5.12-rc2
>
> Cc: x86@kernel.org
> Cc: linux-ia64@vger.kernel.org
> Cc: linux-s390@vger.kernel.org
> Cc: linux-snps-arc@lists.infradead.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-mips@vger.kernel.org
> Cc: linux-parisc@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-riscv@lists.infradead.org
> Cc: linux-sh@vger.kernel.org
> Cc: linux-fsdevel@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
>
> Anshuman Khandual (6):
> mm: Generalize ARCH_HAS_CACHE_LINE_SIZE
> mm: Generalize SYS_SUPPORTS_HUGETLBFS (rename as ARCH_SUPPORTS_HUGETLBFS)
> mm: Generalize ARCH_ENABLE_MEMORY_[HOTPLUG|HOTREMOVE]
> mm: Drop redundant ARCH_ENABLE_[HUGEPAGE|THP]_MIGRATION
> mm: Drop redundant ARCH_ENABLE_SPLIT_PMD_PTLOCK
> mm: Drop redundant HAVE_ARCH_TRANSPARENT_HUGEPAGE
Again the same thing happened.
https://patchwork.kernel.org/project/linux-mm/list/?series=444393
https://lore.kernel.org/linux-mm/1615278790-18053-1-git-send-email-anshuman.khandual@arm.com/
From past experiences, this problem might be just related to many
entries on the CC list. But this time even dropped the --cc-cover
parameter which would have expanded the CC list on each individual
patches further, like last time.
If it helps, have hosted these six patches on v5.12-rc2
https://gitlab.arm.com/linux-arm/linux-anshuman/-/commits/mm/mm_config_cleanups/v1/
- Anshuman
^ permalink raw reply
* Re: [PATCH] powerpc: Fix missing declaration of [en/dis]able_kernel_vsx()
From: Christophe Leroy @ 2021-03-09 8:52 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linux Kernel Mailing List, amd-gfx list, Paul Mackerras,
Alex Deucher, linuxppc-dev, Christian König
In-Reply-To: <CAMuHMdW0Cn1So8ckvhsT+N+p2hiPiksmCS32jzM0xCUYU4UAdQ@mail.gmail.com>
Le 09/03/2021 à 09:45, Geert Uytterhoeven a écrit :
> Hi Christophe,
>
> On Tue, Mar 9, 2021 at 9:39 AM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>> Add stub instances of enable_kernel_vsx() and disable_kernel_vsx()
>> when CONFIG_VSX is not set, to avoid following build failure.
>>
>> CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.o
>> In file included from ./drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29,
>> from ./drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:37,
>> from drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:27:
>> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c: In function 'dcn_bw_apply_registry_override':
>> ./drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:64:3: error: implicit declaration of function 'enable_kernel_vsx'; did you mean 'enable_kernel_fp'? [-Werror=implicit-function-declaration]
>> 64 | enable_kernel_vsx(); \
>> | ^~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:640:2: note: in expansion of macro 'DC_FP_START'
>> 640 | DC_FP_START();
>> | ^~~~~~~~~~~
>> ./drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:75:3: error: implicit declaration of function 'disable_kernel_vsx'; did you mean 'disable_kernel_fp'? [-Werror=implicit-function-declaration]
>> 75 | disable_kernel_vsx(); \
>> | ^~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:676:2: note: in expansion of macro 'DC_FP_END'
>> 676 | DC_FP_END();
>> | ^~~~~~~~~
>> cc1: some warnings being treated as errors
>> make[5]: *** [drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.o] Error 1
>>
>> Fixes: 16a9dea110a6 ("amdgpu: Enable initial DCN support on POWER")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>
> Thanks for your patch!
>
>> --- a/arch/powerpc/include/asm/switch_to.h
>> +++ b/arch/powerpc/include/asm/switch_to.h
>> @@ -71,6 +71,16 @@ static inline void disable_kernel_vsx(void)
>> {
>> msr_check_and_clear(MSR_FP|MSR_VEC|MSR_VSX);
>> }
>> +#else
>> +static inline void enable_kernel_vsx(void)
>> +{
>> + BUILD_BUG();
>> +}
>> +
>> +static inline void disable_kernel_vsx(void)
>> +{
>> + BUILD_BUG();
>> +}
>> #endif
>
> I'm wondering how this is any better than the current situation: using
> BUILD_BUG() will still cause a build failure?
No it won't cause a failure. In drivers/gpu/drm/amd/display/dc/os_types.h you have:
#define DC_FP_START() { \
if (cpu_has_feature(CPU_FTR_VSX_COMP)) { \
preempt_disable(); \
enable_kernel_vsx(); \
} else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) { \
preempt_disable(); \
enable_kernel_altivec(); \
} else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) { \
preempt_disable(); \
enable_kernel_fp(); \
} \
When CONFIG_VSX is not selected, cpu_has_feature(CPU_FTR_VSX_COMP) constant folds to 'false' so the
call to enable_kernel_vsx() is discarded and the build succeeds.
>
> What about adding "depends on !POWERPC || VSX" instead, to prevent
> the issue from happening in the first place?
CONFIG_VSX is not required as pointed by the DC_FP_START() macro above and the matching DC_FP_END()
macro.
>
> Gr{oetje,eeting}s,
>
> Geert
>
Christophe
^ permalink raw reply
* Re: [PATCH] powerpc: Fix missing declaration of [en/dis]able_kernel_vsx()
From: Geert Uytterhoeven @ 2021-03-09 8:45 UTC (permalink / raw)
To: Christophe Leroy
Cc: Linux Kernel Mailing List, amd-gfx list, Paul Mackerras,
Alex Deucher, linuxppc-dev, Christian König
In-Reply-To: <8d7d285a027e9d21f5ff7f850fa71a2655b0c4af.1615279170.git.christophe.leroy@csgroup.eu>
Hi Christophe,
On Tue, Mar 9, 2021 at 9:39 AM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
> Add stub instances of enable_kernel_vsx() and disable_kernel_vsx()
> when CONFIG_VSX is not set, to avoid following build failure.
>
> CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.o
> In file included from ./drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29,
> from ./drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:37,
> from drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:27:
> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c: In function 'dcn_bw_apply_registry_override':
> ./drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:64:3: error: implicit declaration of function 'enable_kernel_vsx'; did you mean 'enable_kernel_fp'? [-Werror=implicit-function-declaration]
> 64 | enable_kernel_vsx(); \
> | ^~~~~~~~~~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:640:2: note: in expansion of macro 'DC_FP_START'
> 640 | DC_FP_START();
> | ^~~~~~~~~~~
> ./drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:75:3: error: implicit declaration of function 'disable_kernel_vsx'; did you mean 'disable_kernel_fp'? [-Werror=implicit-function-declaration]
> 75 | disable_kernel_vsx(); \
> | ^~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:676:2: note: in expansion of macro 'DC_FP_END'
> 676 | DC_FP_END();
> | ^~~~~~~~~
> cc1: some warnings being treated as errors
> make[5]: *** [drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.o] Error 1
>
> Fixes: 16a9dea110a6 ("amdgpu: Enable initial DCN support on POWER")
> Cc: stable@vger.kernel.org
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Thanks for your patch!
> --- a/arch/powerpc/include/asm/switch_to.h
> +++ b/arch/powerpc/include/asm/switch_to.h
> @@ -71,6 +71,16 @@ static inline void disable_kernel_vsx(void)
> {
> msr_check_and_clear(MSR_FP|MSR_VEC|MSR_VSX);
> }
> +#else
> +static inline void enable_kernel_vsx(void)
> +{
> + BUILD_BUG();
> +}
> +
> +static inline void disable_kernel_vsx(void)
> +{
> + BUILD_BUG();
> +}
> #endif
I'm wondering how this is any better than the current situation: using
BUILD_BUG() will still cause a build failure?
What about adding "depends on !POWERPC || VSX" instead, to prevent
the issue from happening in the first place?
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
* [PATCH] powerpc: Fix missing declaration of [en/dis]able_kernel_vsx()
From: Christophe Leroy @ 2021-03-09 8:39 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, geert
Cc: alexdeucher, linuxppc-dev, linux-kernel, amd-gfx,
christian.koenig
Add stub instances of enable_kernel_vsx() and disable_kernel_vsx()
when CONFIG_VSX is not set, to avoid following build failure.
CC [M] drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.o
In file included from ./drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29,
from ./drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:37,
from drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:27:
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c: In function 'dcn_bw_apply_registry_override':
./drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:64:3: error: implicit declaration of function 'enable_kernel_vsx'; did you mean 'enable_kernel_fp'? [-Werror=implicit-function-declaration]
64 | enable_kernel_vsx(); \
| ^~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:640:2: note: in expansion of macro 'DC_FP_START'
640 | DC_FP_START();
| ^~~~~~~~~~~
./drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:75:3: error: implicit declaration of function 'disable_kernel_vsx'; did you mean 'disable_kernel_fp'? [-Werror=implicit-function-declaration]
75 | disable_kernel_vsx(); \
| ^~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:676:2: note: in expansion of macro 'DC_FP_END'
676 | DC_FP_END();
| ^~~~~~~~~
cc1: some warnings being treated as errors
make[5]: *** [drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.o] Error 1
Fixes: 16a9dea110a6 ("amdgpu: Enable initial DCN support on POWER")
Cc: stable@vger.kernel.org
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/include/asm/switch_to.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
index fdab93428372..9d1fbd8be1c7 100644
--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -71,6 +71,16 @@ static inline void disable_kernel_vsx(void)
{
msr_check_and_clear(MSR_FP|MSR_VEC|MSR_VSX);
}
+#else
+static inline void enable_kernel_vsx(void)
+{
+ BUILD_BUG();
+}
+
+static inline void disable_kernel_vsx(void)
+{
+ BUILD_BUG();
+}
#endif
#ifdef CONFIG_SPE
--
2.25.0
^ permalink raw reply related
* [PATCH 5/6] mm: Drop redundant ARCH_ENABLE_SPLIT_PMD_PTLOCK
From: Anshuman Khandual @ 2021-03-09 8:33 UTC (permalink / raw)
To: linux-mm
Cc: Rich Felker, linux-ia64, linux-sh, Catalin Marinas,
Paul Mackerras, H. Peter Anvin, Will Deacon, linux-s390,
Yoshinori Sato, x86, Christian Borntraeger, Ingo Molnar,
Vasily Gorbik, Anshuman Khandual, Heiko Carstens, Thomas Gleixner,
linux-arm-kernel, linux-kernel, Andrew Morton, linuxppc-dev
In-Reply-To: <1615278790-18053-1-git-send-email-anshuman.khandual@arm.com>
ARCH_ENABLE_SPLIT_PMD_PTLOCKS has duplicate definitions on platforms that
subscribe it. Drop these reduntant definitions and instead just select it
on applicable platforms.
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-ia64@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-s390@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/arm64/Kconfig | 4 +---
arch/powerpc/platforms/Kconfig.cputype | 5 +----
arch/s390/Kconfig | 4 +---
arch/x86/Kconfig | 5 +----
4 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index c0e75f62f08c..fb5b1630a4eb 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -14,6 +14,7 @@ config ARM64
select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
select ARCH_ENABLE_MEMORY_HOTPLUG
select ARCH_ENABLE_MEMORY_HOTREMOVE
+ select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
select ARCH_HAS_CACHE_LINE_SIZE
select ARCH_HAS_DEBUG_VIRTUAL
@@ -1054,9 +1055,6 @@ config HW_PERF_EVENTS
config ARCH_WANT_HUGE_PMD_SHARE
-config ARCH_ENABLE_SPLIT_PMD_PTLOCK
- def_bool y if PGTABLE_LEVELS > 2
-
# Supported by clang >= 7.0
config CC_HAVE_SHADOW_CALL_STACK
def_bool $(cc-option, -fsanitize=shadow-call-stack -ffixed-x18)
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 4465b71b2bff..be0e29f18dd4 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -97,6 +97,7 @@ config PPC_BOOK3S_64
select PPC_HAVE_PMU_SUPPORT
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
+ select ARCH_ENABLE_PMD_SPLIT_PTLOCK
select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
select ARCH_SUPPORTS_HUGETLBFS
select ARCH_SUPPORTS_NUMA_BALANCING
@@ -356,10 +357,6 @@ config SPE
If in doubt, say Y here.
-config ARCH_ENABLE_SPLIT_PMD_PTLOCK
- def_bool y
- depends on PPC_BOOK3S_64
-
config PPC_RADIX_MMU
bool "Radix MMU Support"
depends on PPC_BOOK3S_64
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index f8b356550daa..d72989591223 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -62,6 +62,7 @@ config S390
select ARCH_BINFMT_ELF_STATE
select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM
select ARCH_ENABLE_MEMORY_HOTREMOVE
+ select ARCH_ENABLE_SPLIT_PMD_PTLOCK
select ARCH_HAS_DEBUG_VM_PGTABLE
select ARCH_HAS_DEBUG_WX
select ARCH_HAS_DEVMEM_IS_ALLOWED
@@ -628,9 +629,6 @@ config ARCH_SPARSEMEM_ENABLE
config ARCH_SPARSEMEM_DEFAULT
def_bool y
-config ARCH_ENABLE_SPLIT_PMD_PTLOCK
- def_bool y
-
config MAX_PHYSMEM_BITS
int "Maximum size of supported physical memory in bits (42-53)"
range 42 53
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 10702ef1eb57..5dd70c798167 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -63,6 +63,7 @@ config X86
select ARCH_ENABLE_HUGEPAGE_MIGRATION if x86_64 && HUGETLB_PAGE && MIGRATION
select ARCH_ENABLE_MEMORY_HOTPLUG if X86_64 || (X86_32 && HIGHMEM)
select ARCH_ENABLE_MEMORY_HOTREMOVE if MEMORY_HOTPLUG
+ select ARCH_ENABLE_SPLIT_PMD_PTLOCK if X86_64 || X86_PAE
select ARCH_ENABLE_THP_MIGRATION if x86_64 && TRANSPARENT_HUGEPAGE
select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
select ARCH_HAS_CACHE_LINE_SIZE
@@ -2431,10 +2432,6 @@ config USE_PERCPU_NUMA_NODE_ID
def_bool y
depends on NUMA
-config ARCH_ENABLE_SPLIT_PMD_PTLOCK
- def_bool y
- depends on X86_64 || X86_PAE
-
menu "Power management and ACPI options"
config ARCH_HIBERNATION_HEADER
--
2.20.1
^ permalink raw reply related
* [PATCH 4/6] mm: Drop redundant ARCH_ENABLE_[HUGEPAGE|THP]_MIGRATION
From: Anshuman Khandual @ 2021-03-09 8:33 UTC (permalink / raw)
To: linux-mm
Cc: x86, Anshuman Khandual, Catalin Marinas, H. Peter Anvin,
linuxppc-dev, linux-kernel, Ingo Molnar, Paul Mackerras,
Thomas Gleixner, Will Deacon, Andrew Morton, linux-arm-kernel
In-Reply-To: <1615278790-18053-1-git-send-email-anshuman.khandual@arm.com>
ARCH_ENABLE_[HUGEPAGE|THP]_MIGRATION configs have duplicate definitions on
platforms that subscribe them. Drop these reduntant definitions and instead
just select them appropriately.
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: x86@kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/arm64/Kconfig | 10 ++--------
arch/powerpc/platforms/Kconfig.cputype | 5 +----
arch/x86/Kconfig | 10 ++--------
3 files changed, 5 insertions(+), 20 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 67e904b0f32a..c0e75f62f08c 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -11,8 +11,10 @@ config ARM64
select ACPI_PPTT if ACPI
select ARCH_HAS_DEBUG_WX
select ARCH_BINFMT_ELF_STATE
+ select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
select ARCH_ENABLE_MEMORY_HOTPLUG
select ARCH_ENABLE_MEMORY_HOTREMOVE
+ select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
select ARCH_HAS_CACHE_LINE_SIZE
select ARCH_HAS_DEBUG_VIRTUAL
select ARCH_HAS_DEBUG_VM_PGTABLE
@@ -1903,14 +1905,6 @@ config SYSVIPC_COMPAT
def_bool y
depends on COMPAT && SYSVIPC
-config ARCH_ENABLE_HUGEPAGE_MIGRATION
- def_bool y
- depends on HUGETLB_PAGE && MIGRATION
-
-config ARCH_ENABLE_THP_MIGRATION
- def_bool y
- depends on TRANSPARENT_HUGEPAGE
-
menu "Power management options"
source "kernel/power/Kconfig"
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index cec1017813f8..4465b71b2bff 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -96,6 +96,7 @@ config PPC_BOOK3S_64
select PPC_FPU
select PPC_HAVE_PMU_SUPPORT
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
+ select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
select ARCH_SUPPORTS_HUGETLBFS
select ARCH_SUPPORTS_NUMA_BALANCING
@@ -420,10 +421,6 @@ config PPC_PKEY
depends on PPC_BOOK3S_64
depends on PPC_MEM_KEYS || PPC_KUAP || PPC_KUEP
-config ARCH_ENABLE_HUGEPAGE_MIGRATION
- def_bool y
- depends on PPC_BOOK3S_64 && HUGETLB_PAGE && MIGRATION
-
config PPC_MMU_NOHASH
def_bool y
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 503d8b2e8676..10702ef1eb57 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -60,8 +60,10 @@ config X86
select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
select ARCH_32BIT_OFF_T if X86_32
select ARCH_CLOCKSOURCE_INIT
+ select ARCH_ENABLE_HUGEPAGE_MIGRATION if x86_64 && HUGETLB_PAGE && MIGRATION
select ARCH_ENABLE_MEMORY_HOTPLUG if X86_64 || (X86_32 && HIGHMEM)
select ARCH_ENABLE_MEMORY_HOTREMOVE if MEMORY_HOTPLUG
+ select ARCH_ENABLE_THP_MIGRATION if x86_64 && TRANSPARENT_HUGEPAGE
select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
select ARCH_HAS_CACHE_LINE_SIZE
select ARCH_HAS_DEBUG_VIRTUAL
@@ -2433,14 +2435,6 @@ config ARCH_ENABLE_SPLIT_PMD_PTLOCK
def_bool y
depends on X86_64 || X86_PAE
-config ARCH_ENABLE_HUGEPAGE_MIGRATION
- def_bool y
- depends on X86_64 && HUGETLB_PAGE && MIGRATION
-
-config ARCH_ENABLE_THP_MIGRATION
- def_bool y
- depends on X86_64 && TRANSPARENT_HUGEPAGE
-
menu "Power management and ACPI options"
config ARCH_HIBERNATION_HEADER
--
2.20.1
^ permalink raw reply related
* [PATCH 3/6] mm: Generalize ARCH_ENABLE_MEMORY_[HOTPLUG|HOTREMOVE]
From: Anshuman Khandual @ 2021-03-09 8:33 UTC (permalink / raw)
To: linux-mm
Cc: Rich Felker, linux-ia64, linux-sh, Catalin Marinas,
Paul Mackerras, H. Peter Anvin, Will Deacon, linux-s390,
Yoshinori Sato, x86, Christian Borntraeger, Ingo Molnar,
Vasily Gorbik, Anshuman Khandual, Heiko Carstens, Thomas Gleixner,
linux-arm-kernel, linux-kernel, Andrew Morton, linuxppc-dev
In-Reply-To: <1615278790-18053-1-git-send-email-anshuman.khandual@arm.com>
ARCH_ENABLE_MEMORY_[HOTPLUG|HOTREMOVE] configs have duplicate definitions
on platforms that subscribe them. Instead, just make them generic options
which can be selected on applicable platforms.
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-ia64@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-s390@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/arm64/Kconfig | 8 ++------
arch/ia64/Kconfig | 8 ++------
arch/powerpc/Kconfig | 8 ++------
arch/s390/Kconfig | 8 ++------
arch/sh/Kconfig | 2 ++
arch/sh/mm/Kconfig | 8 --------
arch/x86/Kconfig | 10 ++--------
mm/Kconfig | 6 ++++++
8 files changed, 18 insertions(+), 40 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 68fe3b5bf17a..67e904b0f32a 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -11,6 +11,8 @@ config ARM64
select ACPI_PPTT if ACPI
select ARCH_HAS_DEBUG_WX
select ARCH_BINFMT_ELF_STATE
+ select ARCH_ENABLE_MEMORY_HOTPLUG
+ select ARCH_ENABLE_MEMORY_HOTREMOVE
select ARCH_HAS_CACHE_LINE_SIZE
select ARCH_HAS_DEBUG_VIRTUAL
select ARCH_HAS_DEBUG_VM_PGTABLE
@@ -305,12 +307,6 @@ config ZONE_DMA32
bool "Support DMA32 zone" if EXPERT
default y
-config ARCH_ENABLE_MEMORY_HOTPLUG
- def_bool y
-
-config ARCH_ENABLE_MEMORY_HOTREMOVE
- def_bool y
-
config SMP
def_bool y
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 2ad7a8d29fcc..96ce53ad5c9d 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -13,6 +13,8 @@ config IA64
select ARCH_MIGHT_HAVE_PC_SERIO
select ACPI
select ACPI_NUMA if NUMA
+ select ARCH_ENABLE_MEMORY_HOTPLUG
+ select ARCH_ENABLE_MEMORY_HOTREMOVE
select ARCH_SUPPORTS_ACPI
select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
@@ -250,12 +252,6 @@ config HOTPLUG_CPU
can be controlled through /sys/devices/system/cpu/cpu#.
Say N if you want to disable CPU hotplug.
-config ARCH_ENABLE_MEMORY_HOTPLUG
- def_bool y
-
-config ARCH_ENABLE_MEMORY_HOTREMOVE
- def_bool y
-
config SCHED_SMT
bool "SMT scheduler support"
depends on SMP
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index a74c211e55b1..02a05a24659d 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -118,6 +118,8 @@ config PPC
# Please keep this list sorted alphabetically.
#
select ARCH_32BIT_OFF_T if PPC32
+ select ARCH_ENABLE_MEMORY_HOTPLUG
+ select ARCH_ENABLE_MEMORY_HOTREMOVE
select ARCH_HAS_DEBUG_VIRTUAL
select ARCH_HAS_DEVMEM_IS_ALLOWED
select ARCH_HAS_ELF_RANDOMIZE
@@ -515,12 +517,6 @@ config ARCH_CPU_PROBE_RELEASE
def_bool y
depends on HOTPLUG_CPU
-config ARCH_ENABLE_MEMORY_HOTPLUG
- def_bool y
-
-config ARCH_ENABLE_MEMORY_HOTREMOVE
- def_bool y
-
config PPC64_SUPPORTS_MEMORY_FAILURE
bool "Add support for memory hwpoison"
depends on PPC_BOOK3S_64
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index c1ff874e6c2e..f8b356550daa 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -60,6 +60,8 @@ config S390
imply IMA_SECURE_AND_OR_TRUSTED_BOOT
select ARCH_32BIT_USTAT_F_TINODE
select ARCH_BINFMT_ELF_STATE
+ select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM
+ select ARCH_ENABLE_MEMORY_HOTREMOVE
select ARCH_HAS_DEBUG_VM_PGTABLE
select ARCH_HAS_DEBUG_WX
select ARCH_HAS_DEVMEM_IS_ALLOWED
@@ -626,12 +628,6 @@ config ARCH_SPARSEMEM_ENABLE
config ARCH_SPARSEMEM_DEFAULT
def_bool y
-config ARCH_ENABLE_MEMORY_HOTPLUG
- def_bool y if SPARSEMEM
-
-config ARCH_ENABLE_MEMORY_HOTREMOVE
- def_bool y
-
config ARCH_ENABLE_SPLIT_PMD_PTLOCK
def_bool y
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index a54b0c5de37b..68129537e350 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -2,6 +2,8 @@
config SUPERH
def_bool y
select ARCH_32BIT_OFF_T
+ select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM && MMU
+ select ARCH_ENABLE_MEMORY_HOTREMOVE if SPARSEMEM && MMU
select ARCH_HAVE_CUSTOM_GPIO_H
select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A)
select ARCH_HAS_BINFMT_FLAT if !MMU
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 77aa2f802d8d..d551a9cac41e 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -136,14 +136,6 @@ config ARCH_SPARSEMEM_DEFAULT
config ARCH_SELECT_MEMORY_MODEL
def_bool y
-config ARCH_ENABLE_MEMORY_HOTPLUG
- def_bool y
- depends on SPARSEMEM && MMU
-
-config ARCH_ENABLE_MEMORY_HOTREMOVE
- def_bool y
- depends on SPARSEMEM && MMU
-
config ARCH_MEMORY_PROBE
def_bool y
depends on MEMORY_HOTPLUG
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 51d171abb57a..503d8b2e8676 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -60,6 +60,8 @@ config X86
select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
select ARCH_32BIT_OFF_T if X86_32
select ARCH_CLOCKSOURCE_INIT
+ select ARCH_ENABLE_MEMORY_HOTPLUG if X86_64 || (X86_32 && HIGHMEM)
+ select ARCH_ENABLE_MEMORY_HOTREMOVE if MEMORY_HOTPLUG
select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
select ARCH_HAS_CACHE_LINE_SIZE
select ARCH_HAS_DEBUG_VIRTUAL
@@ -2423,14 +2425,6 @@ config ARCH_HAS_ADD_PAGES
def_bool y
depends on X86_64 && ARCH_ENABLE_MEMORY_HOTPLUG
-config ARCH_ENABLE_MEMORY_HOTPLUG
- def_bool y
- depends on X86_64 || (X86_32 && HIGHMEM)
-
-config ARCH_ENABLE_MEMORY_HOTREMOVE
- def_bool y
- depends on MEMORY_HOTPLUG
-
config USE_PERCPU_NUMA_NODE_ID
def_bool y
depends on NUMA
diff --git a/mm/Kconfig b/mm/Kconfig
index 1c9a37fc651a..9b58fa08847d 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -149,6 +149,9 @@ config MEMORY_ISOLATION
config HAVE_BOOTMEM_INFO_NODE
def_bool n
+config ARCH_ENABLE_MEMORY_HOTPLUG
+ bool
+
# eventually, we can have this option just 'select SPARSEMEM'
config MEMORY_HOTPLUG
bool "Allow for memory hot-add"
@@ -177,6 +180,9 @@ config MEMORY_HOTPLUG_DEFAULT_ONLINE
Say N here if you want the default policy to keep all hot-plugged
memory blocks in 'offline' state.
+config ARCH_ENABLE_MEMORY_HOTREMOVE
+ bool
+
config MEMORY_HOTREMOVE
bool "Allow for memory hot remove"
select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64)
--
2.20.1
^ permalink raw reply related
* [PATCH 2/6] mm: Generalize SYS_SUPPORTS_HUGETLBFS (rename as ARCH_SUPPORTS_HUGETLBFS)
From: Anshuman Khandual @ 2021-03-09 8:33 UTC (permalink / raw)
To: linux-mm
Cc: Rich Felker, linux-sh, linux-kernel, James E.J. Bottomley,
Paul Mackerras, linux-riscv, Will Deacon, Yoshinori Sato,
Helge Deller, Russell King, Catalin Marinas, Albert Ou,
Anshuman Khandual, Alexander Viro, Paul Walmsley,
linux-arm-kernel, Thomas Bogendoerfer, linux-parisc, linux-mips,
Palmer Dabbelt, linux-fsdevel, linuxppc-dev
In-Reply-To: <1615278790-18053-1-git-send-email-anshuman.khandual@arm.com>
SYS_SUPPORTS_HUGETLBFS config has duplicate definitions on platforms that
subscribe it. Instead, just make it a generic option which can be selected
on applicable platforms. Also rename it as ARCH_SUPPORTS_HUGETLBFS instead.
This reduces code duplication and makes it cleaner.
Cc: Russell King <linux@armlinux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mips@vger.kernel.org
Cc: linux-parisc@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-riscv@lists.infradead.org
Cc: linux-sh@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/arm/Kconfig | 5 +----
arch/arm64/Kconfig | 4 +---
arch/mips/Kconfig | 6 +-----
arch/parisc/Kconfig | 5 +----
arch/powerpc/Kconfig | 3 ---
arch/powerpc/platforms/Kconfig.cputype | 6 +++---
arch/riscv/Kconfig | 5 +----
arch/sh/Kconfig | 5 +----
fs/Kconfig | 5 ++++-
9 files changed, 13 insertions(+), 31 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 853aab5ab327..d612d2be6859 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -31,6 +31,7 @@ config ARM
select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7
select ARCH_SUPPORTS_ATOMIC_RMW
+ select ARCH_SUPPORTS_HUGETLBFS if ARM_LPAE
select ARCH_USE_BUILTIN_BSWAP
select ARCH_USE_CMPXCHG_LOCKREF
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
@@ -1503,10 +1504,6 @@ config HW_PERF_EVENTS
def_bool y
depends on ARM_PMU
-config SYS_SUPPORTS_HUGETLBFS
- def_bool y
- depends on ARM_LPAE
-
config HAVE_ARCH_TRANSPARENT_HUGEPAGE
def_bool y
depends on ARM_LPAE
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 606a2323e002..68fe3b5bf17a 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -72,6 +72,7 @@ config ARM64
select ARCH_USE_QUEUED_SPINLOCKS
select ARCH_USE_SYM_ANNOTATIONS
select ARCH_SUPPORTS_DEBUG_PAGEALLOC
+ select ARCH_SUPPORTS_HUGETLBFS
select ARCH_SUPPORTS_MEMORY_FAILURE
select ARCH_SUPPORTS_SHADOW_CALL_STACK if CC_HAVE_SHADOW_CALL_STACK
select ARCH_SUPPORTS_LTO_CLANG if CPU_LITTLE_ENDIAN
@@ -1053,9 +1054,6 @@ config HW_PERF_EVENTS
def_bool y
depends on ARM_PMU
-config SYS_SUPPORTS_HUGETLBFS
- def_bool y
-
config ARCH_WANT_HUGE_PMD_SHARE
config ARCH_ENABLE_SPLIT_PMD_PTLOCK
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d89efba3d8a4..73ea9b7558c1 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -16,6 +16,7 @@ config MIPS
select ARCH_USE_CMPXCHG_LOCKREF if 64BIT
select ARCH_USE_QUEUED_RWLOCKS
select ARCH_USE_QUEUED_SPINLOCKS
+ select ARCH_SUPPORTS_HUGETLBFS if CPU_SUPPORTS_HUGEPAGES
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
select ARCH_WANT_IPC_PARSE_VERSION
select ARCH_WANT_LD_ORPHAN_WARN
@@ -1281,11 +1282,6 @@ config SYS_SUPPORTS_BIG_ENDIAN
config SYS_SUPPORTS_LITTLE_ENDIAN
bool
-config SYS_SUPPORTS_HUGETLBFS
- bool
- depends on CPU_SUPPORTS_HUGEPAGES
- default y
-
config MIPS_HUGE_TLB_SUPPORT
def_bool HUGETLB_PAGE || TRANSPARENT_HUGEPAGE
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 4e53ac46e857..4ce68e640474 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -12,6 +12,7 @@ config PARISC
select ARCH_HAS_STRICT_KERNEL_RWX
select ARCH_HAS_UBSAN_SANITIZE_ALL
select ARCH_NO_SG_CHAIN
+ select ARCH_SUPPORTS_HUGETLBFS if PA20
select ARCH_SUPPORTS_MEMORY_FAILURE
select DMA_OPS
select RTC_CLASS
@@ -138,10 +139,6 @@ config PGTABLE_LEVELS
default 3 if 64BIT && PARISC_PAGE_SIZE_4KB
default 2
-config SYS_SUPPORTS_HUGETLBFS
- def_bool y if PA20
-
-
menu "Processor type and features"
choice
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 386ae12d8523..a74c211e55b1 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -700,9 +700,6 @@ config ARCH_SPARSEMEM_DEFAULT
def_bool y
depends on PPC_BOOK3S_64
-config SYS_SUPPORTS_HUGETLBFS
- bool
-
config ILLEGAL_POINTER_VALUE
hex
# This is roughly half way between the top of user space and the bottom
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 3ce907523b1e..cec1017813f8 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -40,8 +40,8 @@ config PPC_85xx
config PPC_8xx
bool "Freescale 8xx"
+ select ARCH_SUPPORTS_HUGETLBFS
select FSL_SOC
- select SYS_SUPPORTS_HUGETLBFS
select PPC_HAVE_KUEP
select PPC_HAVE_KUAP
select HAVE_ARCH_VMAP_STACK
@@ -95,9 +95,9 @@ config PPC_BOOK3S_64
bool "Server processors"
select PPC_FPU
select PPC_HAVE_PMU_SUPPORT
- select SYS_SUPPORTS_HUGETLBFS
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
+ select ARCH_SUPPORTS_HUGETLBFS
select ARCH_SUPPORTS_NUMA_BALANCING
select IRQ_WORK
select PPC_MM_SLICES
@@ -278,9 +278,9 @@ config FSL_BOOKE
# this is for common code between PPC32 & PPC64 FSL BOOKE
config PPC_FSL_BOOK3E
bool
+ select ARCH_SUPPORTS_HUGETLBFS if PHYS_64BIT || PPC64
select FSL_EMB_PERFMON
select PPC_SMP_MUXED_IPI
- select SYS_SUPPORTS_HUGETLBFS if PHYS_64BIT || PPC64
select PPC_DOORBELL
default y if FSL_BOOKE
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 85d626b8ce5e..69954db3aca9 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -30,6 +30,7 @@ config RISCV
select ARCH_HAS_STRICT_KERNEL_RWX if MMU
select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
+ select ARCH_SUPPORTS_HUGETLBFS if MMU
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
select ARCH_WANT_FRAME_POINTERS
select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
@@ -165,10 +166,6 @@ config ARCH_WANT_GENERAL_HUGETLB
config ARCH_SUPPORTS_UPROBES
def_bool y
-config SYS_SUPPORTS_HUGETLBFS
- depends on MMU
- def_bool y
-
config STACKTRACE_SUPPORT
def_bool y
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index e798e55915c2..a54b0c5de37b 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -101,9 +101,6 @@ config SYS_SUPPORTS_APM_EMULATION
bool
select ARCH_SUSPEND_POSSIBLE
-config SYS_SUPPORTS_HUGETLBFS
- bool
-
config SYS_SUPPORTS_SMP
bool
@@ -175,12 +172,12 @@ config CPU_SH3
config CPU_SH4
bool
+ select ARCH_SUPPORTS_HUGETLBFS if MMU
select CPU_HAS_INTEVT
select CPU_HAS_SR_RB
select CPU_HAS_FPU if !CPU_SH4AL_DSP
select SH_INTC
select SYS_SUPPORTS_SH_TMU
- select SYS_SUPPORTS_HUGETLBFS if MMU
config CPU_SH4A
bool
diff --git a/fs/Kconfig b/fs/Kconfig
index 462253ae483a..1b1be98e3b85 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -222,10 +222,13 @@ config TMPFS_INODE64
If unsure, say N.
+config ARCH_SUPPORTS_HUGETLBFS
+ def_bool n
+
config HUGETLBFS
bool "HugeTLB file system support"
depends on X86 || IA64 || SPARC64 || (S390 && 64BIT) || \
- SYS_SUPPORTS_HUGETLBFS || BROKEN
+ ARCH_SUPPORTS_HUGETLBFS || BROKEN
help
hugetlbfs is a filesystem backing for HugeTLB pages, based on
ramfs. For architectures that support it, say Y here and read
--
2.20.1
^ permalink raw reply related
* [PATCH 0/6] mm: some config cleanups
From: Anshuman Khandual @ 2021-03-09 8:33 UTC (permalink / raw)
To: linux-mm
Cc: linux-s390, linux-ia64, linux-parisc, Anshuman Khandual, linux-sh,
x86, linux-mips, linux-kernel, linux-fsdevel, linux-riscv,
linux-snps-arc, linuxppc-dev, linux-arm-kernel
This series contains config cleanup patches which reduces code duplication
across platforms and also improves maintainability. There is no functional
change intended with this series. This has been boot tested on arm64 but
only build tested on some other platforms.
This applies on 5.12-rc2
Cc: x86@kernel.org
Cc: linux-ia64@vger.kernel.org
Cc: linux-s390@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mips@vger.kernel.org
Cc: linux-parisc@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-riscv@lists.infradead.org
Cc: linux-sh@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Anshuman Khandual (6):
mm: Generalize ARCH_HAS_CACHE_LINE_SIZE
mm: Generalize SYS_SUPPORTS_HUGETLBFS (rename as ARCH_SUPPORTS_HUGETLBFS)
mm: Generalize ARCH_ENABLE_MEMORY_[HOTPLUG|HOTREMOVE]
mm: Drop redundant ARCH_ENABLE_[HUGEPAGE|THP]_MIGRATION
mm: Drop redundant ARCH_ENABLE_SPLIT_PMD_PTLOCK
mm: Drop redundant HAVE_ARCH_TRANSPARENT_HUGEPAGE
arch/arc/Kconfig | 9 ++------
arch/arm/Kconfig | 10 ++-------
arch/arm64/Kconfig | 30 ++++++--------------------
arch/ia64/Kconfig | 8 ++-----
arch/mips/Kconfig | 6 +-----
arch/parisc/Kconfig | 5 +----
arch/powerpc/Kconfig | 11 ++--------
arch/powerpc/platforms/Kconfig.cputype | 16 +++++---------
arch/riscv/Kconfig | 5 +----
arch/s390/Kconfig | 12 +++--------
arch/sh/Kconfig | 7 +++---
arch/sh/mm/Kconfig | 8 -------
arch/x86/Kconfig | 29 ++++++-------------------
fs/Kconfig | 5 ++++-
mm/Kconfig | 9 ++++++++
15 files changed, 48 insertions(+), 122 deletions(-)
--
2.20.1
^ permalink raw reply
* Re: [PATCH v2 4/7] CMDLINE: powerpc: convert to generic builtin command line
From: Christophe Leroy @ 2021-03-09 7:56 UTC (permalink / raw)
To: Daniel Walker, Will Deacon, Rob Herring, Daniel Gimpelevich,
Andrew Morton, x86, linux-mips, linuxppc-dev, xe-linux-external,
Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
Cc: Ruslan Ruslichenko, Ruslan Bilovol, linux-kernel
In-Reply-To: <20210309000247.2989531-5-danielwa@cisco.com>
Le 09/03/2021 à 01:02, Daniel Walker a écrit :
> This updates the powerpc code to use the CONFIG_GENERIC_CMDLINE
> option.
>
> Cc: xe-linux-external@cisco.com
> Signed-off-by: Ruslan Ruslichenko <rruslich@cisco.com>
> Signed-off-by: Ruslan Bilovol <rbilovol@cisco.com>
> Signed-off-by: Daniel Walker <danielwa@cisco.com>
> ---
> arch/powerpc/Kconfig | 37 +--------------------------------
> arch/powerpc/kernel/prom.c | 1 +
> arch/powerpc/kernel/prom_init.c | 35 ++++++++++++++++++-------------
> 3 files changed, 23 insertions(+), 50 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 107bb4319e0e..276b06d5c961 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -167,6 +167,7 @@ config PPC
> select EDAC_SUPPORT
> select GENERIC_ATOMIC64 if PPC32
> select GENERIC_CLOCKEVENTS_BROADCAST if SMP
> + select GENERIC_CMDLINE
> select GENERIC_CMOS_UPDATE
> select GENERIC_CPU_AUTOPROBE
> select GENERIC_CPU_VULNERABILITIES if PPC_BARRIER_NOSPEC
> @@ -906,42 +907,6 @@ config PPC_DENORMALISATION
> Add support for handling denormalisation of single precision
> values. Useful for bare metal only. If unsure say Y here.
>
> -config CMDLINE
> - string "Initial kernel command string"
> - default ""
> - help
> - On some platforms, there is currently no way for the boot loader to
> - pass arguments to the kernel. For these platforms, you can supply
> - some command-line options at build time by entering them here. In
> - most cases you will need to specify the root device here.
> -
> -choice
> - prompt "Kernel command line type" if CMDLINE != ""
> - default CMDLINE_FROM_BOOTLOADER
> -
> -config CMDLINE_FROM_BOOTLOADER
> - bool "Use bootloader kernel arguments if available"
> - help
> - Uses the command-line options passed by the boot loader. If
> - the boot loader doesn't provide any, the default kernel command
> - string provided in CMDLINE will be used.
> -
> -config CMDLINE_EXTEND
> - bool "Extend bootloader kernel arguments"
> - help
> - The command-line arguments provided by the boot loader will be
> - appended to the default kernel command string.
> -
> -config CMDLINE_FORCE
> - bool "Always use the default kernel command string"
> - help
> - Always use the default kernel command string, even if the boot
> - loader passes other arguments to the kernel.
> - This is useful if you cannot or don't want to change the
> - command-line options your boot loader passes to the kernel.
> -
> -endchoice
> -
> config EXTRA_TARGETS
> string "Additional default image types"
> help
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index ae3c41730367..96d0a01be1b4 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -27,6 +27,7 @@
> #include <linux/irq.h>
> #include <linux/memblock.h>
> #include <linux/of.h>
> +#include <linux/cmdline.h>
Why is this needed in prom.c ?
> #include <linux/of_fdt.h>
> #include <linux/libfdt.h>
> #include <linux/cpu.h>
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index e9d4eb6144e1..657241534d69 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -27,6 +27,7 @@
> #include <linux/initrd.h>
> #include <linux/bitops.h>
> #include <linux/pgtable.h>
> +#include <linux/cmdline.h>
> #include <asm/prom.h>
> #include <asm/rtas.h>
> #include <asm/page.h>
> @@ -242,15 +243,6 @@ static int __init prom_strcmp(const char *cs, const char *ct)
> return 0;
> }
>
> -static char __init *prom_strcpy(char *dest, const char *src)
> -{
> - char *tmp = dest;
> -
> - while ((*dest++ = *src++) != '\0')
> - /* nothing */;
> - return tmp;
> -}
> -
This game with prom_strcpy() should go a separate preceeding patch.
Also, it looks like checkpatch.pl recommends to use strscpy() instead of strlcpy().
> static int __init prom_strncmp(const char *cs, const char *ct, size_t count)
> {
> unsigned char c1, c2;
> @@ -276,6 +268,20 @@ static size_t __init prom_strlen(const char *s)
> return sc - s;
> }
>
> +static size_t __init prom_strlcpy(char *dest, const char *src, size_t size)
> +{
> + size_t ret = prom_strlen(src);
> +
> + if (size) {
> + size_t len = (ret >= size) ? size - 1 : ret;
> +
> + memcpy(dest, src, len);
> + dest[len] = '\0';
> + }
> + return ret;
> +}
> +
> +
> static int __init prom_memcmp(const void *cs, const void *ct, size_t count)
> {
> const unsigned char *su1, *su2;
> @@ -304,6 +310,7 @@ static char __init *prom_strstr(const char *s1, const char *s2)
> return NULL;
> }
>
> +#ifdef GENERIC_CMDLINE_NEED_STRLCAT
> static size_t __init prom_strlcat(char *dest, const char *src, size_t count)
> {
> size_t dsize = prom_strlen(dest);
> @@ -323,6 +330,7 @@ static size_t __init prom_strlcat(char *dest, const char *src, size_t count)
> return res;
>
> }
> +#endif
>
> #ifdef CONFIG_PPC_PSERIES
> static int __init prom_strtobool(const char *s, bool *res)
> @@ -775,12 +783,11 @@ static void __init early_cmdline_parse(void)
> prom_cmd_line[0] = 0;
> p = prom_cmd_line;
>
> - if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && (long)prom.chosen > 0)
> + if ((long)prom.chosen > 0)
> l = prom_getprop(prom.chosen, "bootargs", p, COMMAND_LINE_SIZE-1);
>
> - if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) || l <= 0 || p[0] == '\0')
> - prom_strlcat(prom_cmd_line, " " CONFIG_CMDLINE,
> - sizeof(prom_cmd_line));
> + cmdline_add_builtin_custom(prom_cmd_line, (l > 0 ? p : NULL), sizeof(prom_cmd_line),
> + __prombss, prom_strlcpy, prom_strlcat);
So we are referencing a function that doesn't exist (namely prom_strlcat).
But it works because cmdline_add_builtin_custom() looks like a function but is in fact an obscure
macro that doesn't use prom_strlcat() unless GENERIC_CMDLINE_NEED_STRLCAT is defined.
IMHO that's awful for readability and code maintenance.
>
> prom_printf("command line: %s\n", prom_cmd_line);
>
> @@ -2706,7 +2713,7 @@ static void __init flatten_device_tree(void)
>
> /* Add "phandle" in there, we'll need it */
> namep = make_room(&mem_start, &mem_end, 16, 1);
> - prom_strcpy(namep, "phandle");
> + prom_strlcpy(namep, "phandle", 8);
Should be in a separate patch.
> mem_start = (unsigned long)namep + prom_strlen(namep) + 1;
>
> /* Build string array */
>
Christophe
^ permalink raw reply
* Re: [PATCH v2 3/7] powerpc: convert config files to generic cmdline
From: Christophe Leroy @ 2021-03-09 7:47 UTC (permalink / raw)
To: Daniel Walker, Will Deacon, Rob Herring, Daniel Gimpelevich,
Andrew Morton, x86, linux-mips, linuxppc-dev, xe-linux-external
Cc: Paul Mackerras, linux-kernel
In-Reply-To: <20210309000247.2989531-4-danielwa@cisco.com>
Le 09/03/2021 à 01:02, Daniel Walker a écrit :
> This is a scripted mass convert of the config files to use
> the new generic cmdline. There is a bit of a trim effect here.
> It would seems that some of the config haven't been trimmed in
> a while.
If you do that in a separate patch, you loose bisectability.
I think it would have been better to do things in a different way, more or less like I did in my series:
1/ Provide GENERIC cmdline at the same functionnality level as what is spread in the different
architectures
2/ Convert architectures to the generic with least churn.
3/ Add new features to the generic
>
> The bash script used to convert is as follows,
>
> if [[ -z "$1" || -z "$2" ]]; then
> echo "Two arguments are needed."
> exit 1
> fi
> mkdir $1
> cp $2 $1/.config
> sed -i 's/CONFIG_CMDLINE=/CONFIG_CMDLINE_BOOL=y\nCONFIG_CMDLINE_PREPEND=/g' $1/.config
This is not correct.
By default, on powerpc the provided command line is used only if the bootloader doesn't provide one.
Otherwise:
- the builtin command line is appended to the one provided by the bootloader if
CONFIG_CMDLINE_EXTEND is selected
- the builtin command line replaces to the one provided by the bootloader if CONFIG_CMDLINE_FORCE is
selected
> make ARCH=$1 O=$1 olddefconfig
> make ARCH=$1 O=$1 savedefconfig
> cp $1/defconfig $2
> rm -Rf $1
>
> Cc: xe-linux-external@cisco.com
> Signed-off-by: Daniel Walker <danielwa@cisco.com>
> ---
> arch/powerpc/configs/44x/fsp2_defconfig | 33 +++++++++----------
> arch/powerpc/configs/44x/iss476-smp_defconfig | 25 +++++++-------
> arch/powerpc/configs/44x/warp_defconfig | 17 +++++-----
> arch/powerpc/configs/holly_defconfig | 13 ++++----
> arch/powerpc/configs/mvme5100_defconfig | 23 ++++++-------
> arch/powerpc/configs/skiroot_defconfig | 12 +++----
> arch/powerpc/configs/storcenter_defconfig | 18 ++++------
> 7 files changed, 66 insertions(+), 75 deletions(-)
>
> diff --git a/arch/powerpc/configs/44x/fsp2_defconfig b/arch/powerpc/configs/44x/fsp2_defconfig
> index 30845ce0885a..4993db054589 100644
> --- a/arch/powerpc/configs/44x/fsp2_defconfig
> +++ b/arch/powerpc/configs/44x/fsp2_defconfig
> @@ -1,8 +1,6 @@
> -CONFIG_44x=y
> # CONFIG_SWAP is not set
> CONFIG_SYSVIPC=y
> # CONFIG_CROSS_MEMORY_ATTACH is not set
> -# CONFIG_FHANDLE is not set
> CONFIG_NO_HZ=y
> CONFIG_HIGH_RES_TIMERS=y
> CONFIG_IKCONFIG=y
> @@ -13,24 +11,25 @@ CONFIG_BLK_DEV_INITRD=y
> # CONFIG_RD_XZ is not set
> # CONFIG_RD_LZO is not set
> # CONFIG_RD_LZ4 is not set
> +# CONFIG_FHANDLE is not set
> CONFIG_KALLSYMS_ALL=y
> CONFIG_BPF_SYSCALL=y
> CONFIG_EMBEDDED=y
> CONFIG_PROFILING=y
> -CONFIG_OPROFILE=y
> -CONFIG_MODULES=y
> -CONFIG_MODULE_UNLOAD=y
> -# CONFIG_BLK_DEV_BSG is not set
> +CONFIG_CMDLINE_BOOL=y
> +CONFIG_CMDLINE_PREPEND="ip=on rw"
> +CONFIG_44x=y
> CONFIG_PPC_47x=y
> # CONFIG_EBONY is not set
> CONFIG_FSP2=y
> CONFIG_476FPE_ERR46=y
> -CONFIG_SWIOTLB=y
> CONFIG_KEXEC=y
> CONFIG_CRASH_DUMP=y
> -CONFIG_CMDLINE="ip=on rw"
> # CONFIG_SUSPEND is not set
> -# CONFIG_PCI is not set
> +CONFIG_OPROFILE=y
> +CONFIG_MODULES=y
> +CONFIG_MODULE_UNLOAD=y
> +# CONFIG_BLK_DEV_BSG is not set
> CONFIG_NET=y
> CONFIG_PACKET=y
> CONFIG_UNIX=y
> @@ -47,14 +46,12 @@ CONFIG_MTD=y
> CONFIG_MTD_BLOCK=y
> CONFIG_MTD_JEDECPROBE=y
> CONFIG_MTD_CFI_AMDSTD=y
> -CONFIG_MTD_PHYSMAP_OF=y
> CONFIG_BLK_DEV_RAM=y
> CONFIG_BLK_DEV_RAM_SIZE=35000
> # CONFIG_SCSI_PROC_FS is not set
> CONFIG_BLK_DEV_SD=y
> # CONFIG_SCSI_LOWLEVEL is not set
> CONFIG_ATA=y
> -# CONFIG_SATA_PMP is not set
> # CONFIG_ATA_SFF is not set
> CONFIG_NETDEVICES=y
> CONFIG_BONDING=m
> @@ -63,7 +60,6 @@ CONFIG_IBM_EMAC=m
> # CONFIG_SERIO is not set
> # CONFIG_VT is not set
> # CONFIG_LEGACY_PTYS is not set
> -# CONFIG_DEVMEM is not set
> CONFIG_SERIAL_8250=y
> CONFIG_SERIAL_8250_CONSOLE=y
> CONFIG_SERIAL_8250_NR_UARTS=32
> @@ -72,6 +68,7 @@ CONFIG_SERIAL_8250_EXTENDED=y
> CONFIG_SERIAL_8250_SHARE_IRQ=y
> CONFIG_SERIAL_OF_PLATFORM=y
> # CONFIG_HW_RANDOM is not set
> +# CONFIG_DEVMEM is not set
> CONFIG_I2C=y
> CONFIG_I2C_IBM_IIC=y
> CONFIG_PTP_1588_CLOCK=y
> @@ -107,6 +104,12 @@ CONFIG_NFS_V3_ACL=y
> CONFIG_NFS_V4=y
> CONFIG_ROOT_NFS=y
> CONFIG_NLS_DEFAULT="n"
> +CONFIG_CRYPTO_CBC=y
> +CONFIG_CRYPTO_ECB=y
> +CONFIG_CRYPTO_PCBC=y
> +CONFIG_CRYPTO_MD5=y
> +CONFIG_CRYPTO_DES=y
> +# CONFIG_CRYPTO_HW is not set
> CONFIG_XZ_DEC=y
> CONFIG_PRINTK_TIME=y
> CONFIG_MESSAGE_LOGLEVEL_DEFAULT=3
> @@ -114,9 +117,3 @@ CONFIG_DYNAMIC_DEBUG=y
> CONFIG_DEBUG_INFO=y
> CONFIG_MAGIC_SYSRQ=y
> CONFIG_DETECT_HUNG_TASK=y
> -CONFIG_CRYPTO_CBC=y
> -CONFIG_CRYPTO_ECB=y
> -CONFIG_CRYPTO_PCBC=y
> -CONFIG_CRYPTO_MD5=y
> -CONFIG_CRYPTO_DES=y
> -# CONFIG_CRYPTO_HW is not set
> diff --git a/arch/powerpc/configs/44x/iss476-smp_defconfig b/arch/powerpc/configs/44x/iss476-smp_defconfig
> index 2c3834eebca3..b8d97061517a 100644
> --- a/arch/powerpc/configs/44x/iss476-smp_defconfig
> +++ b/arch/powerpc/configs/44x/iss476-smp_defconfig
> @@ -1,5 +1,3 @@
> -CONFIG_44x=y
> -CONFIG_SMP=y
> CONFIG_SYSVIPC=y
> CONFIG_POSIX_MQUEUE=y
> CONFIG_LOG_BUF_SHIFT=14
> @@ -7,20 +5,22 @@ CONFIG_BLK_DEV_INITRD=y
> CONFIG_EXPERT=y
> CONFIG_KALLSYMS_ALL=y
> CONFIG_PROFILING=y
> -CONFIG_OPROFILE=y
> -CONFIG_MODULES=y
> -CONFIG_MODULE_UNLOAD=y
> -# CONFIG_BLK_DEV_BSG is not set
> +CONFIG_CMDLINE_BOOL=y
> +CONFIG_CMDLINE_PREPEND="root=/dev/issblk0"
> +CONFIG_44x=y
> +CONFIG_SMP=y
> CONFIG_PPC_47x=y
> # CONFIG_EBONY is not set
> CONFIG_ISS4xx=y
> CONFIG_HZ_100=y
> CONFIG_MATH_EMULATION=y
> CONFIG_IRQ_ALL_CPUS=y
> -CONFIG_CMDLINE="root=/dev/issblk0"
> -# CONFIG_PCI is not set
> CONFIG_ADVANCED_OPTIONS=y
> CONFIG_DYNAMIC_MEMSTART=y
> +CONFIG_OPROFILE=y
> +CONFIG_MODULES=y
> +CONFIG_MODULE_UNLOAD=y
> +# CONFIG_BLK_DEV_BSG is not set
> CONFIG_NET=y
> CONFIG_PACKET=y
> CONFIG_UNIX=y
> @@ -34,7 +34,6 @@ CONFIG_MTD=y
> CONFIG_MTD_BLOCK=y
> CONFIG_MTD_JEDECPROBE=y
> CONFIG_MTD_CFI_AMDSTD=y
> -CONFIG_MTD_PHYSMAP_OF=y
> CONFIG_BLK_DEV_RAM=y
> CONFIG_BLK_DEV_RAM_SIZE=35000
> # CONFIG_INPUT is not set
> @@ -57,13 +56,13 @@ CONFIG_PROC_KCORE=y
> CONFIG_TMPFS=y
> CONFIG_CRAMFS=y
> # CONFIG_NETWORK_FILESYSTEMS is not set
> -CONFIG_DEBUG_INFO=y
> -CONFIG_MAGIC_SYSRQ=y
> -CONFIG_DETECT_HUNG_TASK=y
> -CONFIG_PPC_EARLY_DEBUG=y
> CONFIG_CRYPTO_CBC=y
> CONFIG_CRYPTO_ECB=y
> CONFIG_CRYPTO_PCBC=y
> CONFIG_CRYPTO_MD5=y
> CONFIG_CRYPTO_DES=y
> # CONFIG_CRYPTO_HW is not set
> +CONFIG_DEBUG_INFO=y
> +CONFIG_MAGIC_SYSRQ=y
> +CONFIG_DETECT_HUNG_TASK=y
> +CONFIG_PPC_EARLY_DEBUG=y
> diff --git a/arch/powerpc/configs/44x/warp_defconfig b/arch/powerpc/configs/44x/warp_defconfig
> index 47252c2d7669..d2e4bbe1492c 100644
> --- a/arch/powerpc/configs/44x/warp_defconfig
> +++ b/arch/powerpc/configs/44x/warp_defconfig
> @@ -1,4 +1,3 @@
> -CONFIG_44x=y
> CONFIG_LOCALVERSION="-pika"
> # CONFIG_LOCALVERSION_AUTO is not set
> CONFIG_SYSVIPC=y
> @@ -7,15 +6,16 @@ CONFIG_IKCONFIG_PROC=y
> CONFIG_LOG_BUF_SHIFT=14
> CONFIG_BLK_DEV_INITRD=y
> CONFIG_EXPERT=y
> -CONFIG_MODULES=y
> -CONFIG_MODULE_UNLOAD=y
> -# CONFIG_BLK_DEV_BSG is not set
> +CONFIG_CMDLINE_BOOL=y
> +CONFIG_CMDLINE_PREPEND="ip=on"
> +CONFIG_44x=y
> # CONFIG_EBONY is not set
> CONFIG_WARP=y
> CONFIG_PPC4xx_GPIO=y
> CONFIG_HZ_1000=y
> -CONFIG_CMDLINE="ip=on"
> -# CONFIG_PCI is not set
> +CONFIG_MODULES=y
> +CONFIG_MODULE_UNLOAD=y
> +# CONFIG_BLK_DEV_BSG is not set
> CONFIG_NET=y
> CONFIG_PACKET=y
> CONFIG_UNIX=y
> @@ -31,7 +31,6 @@ CONFIG_MTD_CMDLINE_PARTS=y
> CONFIG_MTD_BLOCK=y
> CONFIG_MTD_CFI=y
> CONFIG_MTD_CFI_AMDSTD=y
> -CONFIG_MTD_PHYSMAP_OF=y
> CONFIG_MTD_RAW_NAND=y
> CONFIG_MTD_NAND_NDFC=y
> CONFIG_MTD_UBI=y
> @@ -88,9 +87,9 @@ CONFIG_NLS_UTF8=y
> CONFIG_CRC_CCITT=y
> CONFIG_CRC_T10DIF=y
> CONFIG_PRINTK_TIME=y
> +# CONFIG_DEBUG_BUGVERBOSE is not set
> CONFIG_DEBUG_INFO=y
> -CONFIG_DEBUG_FS=y
> CONFIG_MAGIC_SYSRQ=y
> +CONFIG_DEBUG_FS=y
> CONFIG_DETECT_HUNG_TASK=y
> # CONFIG_SCHED_DEBUG is not set
> -# CONFIG_DEBUG_BUGVERBOSE is not set
> diff --git a/arch/powerpc/configs/holly_defconfig b/arch/powerpc/configs/holly_defconfig
> index 271daff47d1d..98c0644e80b4 100644
> --- a/arch/powerpc/configs/holly_defconfig
> +++ b/arch/powerpc/configs/holly_defconfig
> @@ -4,17 +4,18 @@ CONFIG_HIGH_RES_TIMERS=y
> CONFIG_LOG_BUF_SHIFT=14
> CONFIG_BLK_DEV_INITRD=y
> CONFIG_EXPERT=y
> -CONFIG_MODULES=y
> -# CONFIG_BLK_DEV_BSG is not set
> -CONFIG_PARTITION_ADVANCED=y
> +CONFIG_CMDLINE_BOOL=y
> +CONFIG_CMDLINE_PREPEND="console=ttyS0,115200"
> # CONFIG_PPC_CHRP is not set
> # CONFIG_PPC_PMAC is not set
> CONFIG_EMBEDDED6xx=y
> CONFIG_PPC_HOLLY=y
> CONFIG_GEN_RTC=y
> -CONFIG_BINFMT_MISC=y
> -CONFIG_CMDLINE="console=ttyS0,115200"
> # CONFIG_SECCOMP is not set
> +CONFIG_MODULES=y
> +# CONFIG_BLK_DEV_BSG is not set
> +CONFIG_PARTITION_ADVANCED=y
> +CONFIG_BINFMT_MISC=y
> CONFIG_NET=y
> CONFIG_PACKET=y
> CONFIG_UNIX=y
> @@ -53,8 +54,8 @@ CONFIG_PROC_KCORE=y
> CONFIG_TMPFS=y
> CONFIG_NFS_FS=y
> CONFIG_ROOT_NFS=y
> +# CONFIG_DEBUG_BUGVERBOSE is not set
> CONFIG_MAGIC_SYSRQ=y
> # CONFIG_SCHED_DEBUG is not set
> -# CONFIG_DEBUG_BUGVERBOSE is not set
> CONFIG_XMON=y
> CONFIG_XMON_DEFAULT=y
> diff --git a/arch/powerpc/configs/mvme5100_defconfig b/arch/powerpc/configs/mvme5100_defconfig
> index 1fed6be95d53..884a3e0defde 100644
> --- a/arch/powerpc/configs/mvme5100_defconfig
> +++ b/arch/powerpc/configs/mvme5100_defconfig
> @@ -11,16 +11,17 @@ CONFIG_LOG_BUF_SHIFT=14
> # CONFIG_NET_NS is not set
> CONFIG_CC_OPTIMIZE_FOR_SIZE=y
> # CONFIG_COMPAT_BRK is not set
> -CONFIG_MODULES=y
> -CONFIG_MODULE_UNLOAD=y
> -# CONFIG_BLK_DEV_BSG is not set
> +CONFIG_CMDLINE_BOOL=y
> +CONFIG_CMDLINE_PREPEND="console=ttyS0,9600 ip=dhcp root=/dev/nfs"
> # CONFIG_PPC_CHRP is not set
> # CONFIG_PPC_PMAC is not set
> CONFIG_EMBEDDED6xx=y
> CONFIG_MVME5100=y
> CONFIG_KVM_GUEST=y
> CONFIG_HZ_100=y
> -CONFIG_CMDLINE="console=ttyS0,9600 ip=dhcp root=/dev/nfs"
> +CONFIG_MODULES=y
> +CONFIG_MODULE_UNLOAD=y
> +# CONFIG_BLK_DEV_BSG is not set
> # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
> # CONFIG_COMPACTION is not set
> CONFIG_NET=y
> @@ -108,13 +109,6 @@ CONFIG_NLS_CODEPAGE_437=m
> CONFIG_NLS_CODEPAGE_932=m
> CONFIG_NLS_ISO8859_1=m
> CONFIG_NLS_UTF8=m
> -CONFIG_CRC_CCITT=m
> -CONFIG_CRC_T10DIF=y
> -CONFIG_XZ_DEC=y
> -CONFIG_MAGIC_SYSRQ=y
> -CONFIG_DEBUG_KERNEL=y
> -CONFIG_DETECT_HUNG_TASK=y
> -CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=20
> CONFIG_CRYPTO_CBC=y
> CONFIG_CRYPTO_PCBC=m
> CONFIG_CRYPTO_MD5=y
> @@ -125,3 +119,10 @@ CONFIG_CRYPTO_DES=y
> CONFIG_CRYPTO_SERPENT=m
> CONFIG_CRYPTO_TWOFISH=m
> CONFIG_CRYPTO_DEFLATE=m
> +CONFIG_CRC_CCITT=m
> +CONFIG_CRC_T10DIF=y
> +CONFIG_XZ_DEC=y
> +CONFIG_MAGIC_SYSRQ=y
> +CONFIG_DEBUG_KERNEL=y
> +CONFIG_DETECT_HUNG_TASK=y
> +CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=20
> diff --git a/arch/powerpc/configs/skiroot_defconfig b/arch/powerpc/configs/skiroot_defconfig
> index b806a5d3a695..5e11995508d7 100644
> --- a/arch/powerpc/configs/skiroot_defconfig
> +++ b/arch/powerpc/configs/skiroot_defconfig
> @@ -26,6 +26,8 @@ CONFIG_PERF_EVENTS=y
> # CONFIG_SLAB_MERGE_DEFAULT is not set
> CONFIG_SLAB_FREELIST_RANDOM=y
> CONFIG_SLAB_FREELIST_HARDENED=y
> +CONFIG_CMDLINE_BOOL=y
> +CONFIG_CMDLINE_PREPEND="console=tty0 console=hvc0 ipr.fast_reboot=1 quiet"
> CONFIG_PPC64=y
> CONFIG_ALTIVEC=y
> CONFIG_VSX=y
> @@ -42,14 +44,11 @@ CONFIG_KEXEC=y
> CONFIG_KEXEC_FILE=y
> CONFIG_PRESERVE_FA_DUMP=y
> CONFIG_IRQ_ALL_CPUS=y
> -CONFIG_NUMA=y
> CONFIG_PPC_64K_PAGES=y
> CONFIG_SCHED_SMT=y
> -CONFIG_CMDLINE="console=tty0 console=hvc0 ipr.fast_reboot=1 quiet"
> -# CONFIG_SECCOMP is not set
> # CONFIG_PPC_MEM_KEYS is not set
> CONFIG_JUMP_LABEL=y
> -CONFIG_STRICT_KERNEL_RWX=y
> +# CONFIG_SECCOMP is not set
> CONFIG_MODULES=y
> CONFIG_MODULE_UNLOAD=y
> CONFIG_MODULE_SIG_FORCE=y
> @@ -80,7 +79,6 @@ CONFIG_BLK_DEV_NVME=m
> CONFIG_NVME_MULTIPATH=y
> CONFIG_EEPROM_AT24=m
> # CONFIG_CXL is not set
> -# CONFIG_OCXL is not set
> CONFIG_BLK_DEV_SD=m
> CONFIG_BLK_DEV_SR=m
> CONFIG_CHR_DEV_SG=m
> @@ -199,7 +197,6 @@ CONFIG_PHYLIB=y
> CONFIG_INPUT_EVDEV=y
> CONFIG_INPUT_MISC=y
> # CONFIG_SERIO_SERPORT is not set
> -# CONFIG_DEVMEM is not set
> CONFIG_SERIAL_8250=y
> CONFIG_SERIAL_8250_CONSOLE=y
> CONFIG_IPMI_HANDLER=y
> @@ -207,9 +204,10 @@ CONFIG_IPMI_DEVICE_INTERFACE=y
> CONFIG_IPMI_POWERNV=y
> CONFIG_IPMI_WATCHDOG=y
> CONFIG_HW_RANDOM=y
> +# CONFIG_DEVMEM is not set
> +# CONFIG_DEVPORT is not set
> CONFIG_TCG_TPM=y
> CONFIG_TCG_TIS_I2C_NUVOTON=y
> -# CONFIG_DEVPORT is not set
> CONFIG_I2C=y
> # CONFIG_I2C_COMPAT is not set
> CONFIG_I2C_CHARDEV=y
> diff --git a/arch/powerpc/configs/storcenter_defconfig b/arch/powerpc/configs/storcenter_defconfig
> index 47dcfaddc1ac..17a17b8ae160 100644
> --- a/arch/powerpc/configs/storcenter_defconfig
> +++ b/arch/powerpc/configs/storcenter_defconfig
> @@ -2,18 +2,19 @@ CONFIG_SYSVIPC=y
> CONFIG_LOG_BUF_SHIFT=14
> CONFIG_EXPERT=y
> # CONFIG_KALLSYMS is not set
> -CONFIG_MODULES=y
> -CONFIG_MODULE_UNLOAD=y
> -# CONFIG_BLK_DEV_BSG is not set
> -CONFIG_PARTITION_ADVANCED=y
> +CONFIG_CMDLINE_BOOL=y
> +CONFIG_CMDLINE_PREPEND="console=ttyS0,115200"
> # CONFIG_PPC_CHRP is not set
> # CONFIG_PPC_PMAC is not set
> CONFIG_EMBEDDED6xx=y
> CONFIG_STORCENTER=y
> CONFIG_HZ_100=y
> -CONFIG_BINFMT_MISC=y
> -CONFIG_CMDLINE="console=ttyS0,115200"
> # CONFIG_SECCOMP is not set
> +CONFIG_MODULES=y
> +CONFIG_MODULE_UNLOAD=y
> +# CONFIG_BLK_DEV_BSG is not set
> +CONFIG_PARTITION_ADVANCED=y
> +CONFIG_BINFMT_MISC=y
> CONFIG_NET=y
> CONFIG_PACKET=m
> CONFIG_UNIX=y
> @@ -35,7 +36,6 @@ CONFIG_BLK_DEV_SD=y
> CONFIG_BLK_DEV_SR=y
> CONFIG_SCSI_SPI_ATTRS=y
> CONFIG_ATA=y
> -CONFIG_PATA_VIA=y
> CONFIG_MD=y
> CONFIG_BLK_DEV_MD=y
> CONFIG_MD_LINEAR=y
> @@ -44,16 +44,13 @@ CONFIG_MD_RAID1=y
> CONFIG_MD_RAID456=y
> CONFIG_NETDEVICES=y
> CONFIG_DUMMY=m
> -CONFIG_R8169=y
> # CONFIG_INPUT is not set
> # CONFIG_SERIO is not set
> # CONFIG_VT is not set
> CONFIG_SERIAL_8250=y
> CONFIG_SERIAL_8250_CONSOLE=y
> -# CONFIG_SERIAL_8250_PCI is not set
> CONFIG_SERIAL_8250_NR_UARTS=2
> CONFIG_SERIAL_8250_RUNTIME_UARTS=2
> -CONFIG_NVRAM=y
> CONFIG_I2C=y
> CONFIG_I2C_CHARDEV=y
> CONFIG_I2C_MPC=y
> @@ -76,4 +73,3 @@ CONFIG_NLS_CODEPAGE_437=y
> CONFIG_NLS_ISO8859_1=y
> CONFIG_NLS_UTF8=y
> CONFIG_CRC_T10DIF=y
> -# CONFIG_ENABLE_MUST_CHECK is not set
>
^ permalink raw reply
* Re: [PATCH v2 2/7] CMDLINE: drivers: of: ifdef out cmdline section
From: Christophe Leroy @ 2021-03-09 7:36 UTC (permalink / raw)
To: Daniel Walker, Will Deacon, Rob Herring, Daniel Gimpelevich,
Andrew Morton, x86, linux-mips, linuxppc-dev, xe-linux-external,
Rob Herring, Frank Rowand
Cc: devicetree, Ruslan Ruslichenko, linux-kernel
In-Reply-To: <20210309000247.2989531-3-danielwa@cisco.com>
Le 09/03/2021 à 01:02, Daniel Walker a écrit :
> It looks like there's some seepage of cmdline stuff into
> the generic device tree code. This conflicts with the
> generic cmdline implementation so I remove it in the case
> when that's enabled.
>
> Cc: xe-linux-external@cisco.com
> Signed-off-by: Ruslan Ruslichenko <rruslich@cisco.com>
> Signed-off-by: Daniel Walker <danielwa@cisco.com>
> ---
> drivers/of/fdt.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index feb0f2d67fc5..e25240d84632 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -25,6 +25,7 @@
> #include <linux/serial_core.h>
> #include <linux/sysfs.h>
> #include <linux/random.h>
> +#include <linux/cmdline.h>
>
> #include <asm/setup.h> /* for COMMAND_LINE_SIZE */
> #include <asm/page.h>
> @@ -1050,6 +1051,16 @@ 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);
> +
> +#ifdef CONFIG_GENERIC_CMDLINE
> + /*
> + * The builtin command line will be added here, or it can override
> + * with the DT bootargs.
> + */
> + cmdline_add_builtin(data,
> + (l > 0 ? p : NULL), /* This is sanity checking */
> + COMMAND_LINE_SIZE);
I don't think the comment is needed.
Without the comment, it should fit on a single line, would be better for readability and grepability.
> +#else
> if (p != NULL && l > 0)
> strlcpy(data, p, min(l, COMMAND_LINE_SIZE));
>
> @@ -1070,6 +1081,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
> strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> #endif
> #endif /* CONFIG_CMDLINE */
> +#endif /* CONFIG_GENERIC_CMDLINE */
>
> pr_debug("Command line is: %s\n", (char *)data);
>
>
Christophe
^ permalink raw reply
* Re: [PATCH v2 1/7] CMDLINE: add generic builtin command line
From: Christophe Leroy @ 2021-03-09 7:34 UTC (permalink / raw)
To: Daniel Walker, Will Deacon, Rob Herring, Daniel Gimpelevich,
Andrew Morton, x86, linux-mips, linuxppc-dev, xe-linux-external
Cc: Ruslan Bilovol, linux-kernel
In-Reply-To: <20210309000247.2989531-2-danielwa@cisco.com>
Le 09/03/2021 à 01:02, Daniel Walker a écrit :
> This code allows architectures to use a generic builtin command line.
> The state of the builtin command line options across architecture is
> diverse. On x86 and mips they have pretty much the same code and the
> code prepends the builtin command line onto the boot loader provided
> one. On powerpc there is only a builtin override and nothing else.
Same comment as in v1: The above is not correct for powerpc.
>
> The code in this commit unifies the code into a generic
> header file under the CONFIG_GENERIC_CMDLINE option. When this
> option is enabled the architecture can call the cmdline_add_builtin()
> to add the builtin command line.
>
> Cc: xe-linux-external@cisco.com
> Signed-off-by: Ruslan Bilovol <rbilovol@cisco.com>
> Signed-off-by: Daniel Walker <danielwa@cisco.com>
> ---
> include/linux/cmdline.h | 89 +++++++++++++++++++++++++++++++++++++++++
> init/Kconfig | 68 +++++++++++++++++++++++++++++++
> 2 files changed, 157 insertions(+)
> create mode 100644 include/linux/cmdline.h
>
> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h
> new file mode 100644
> index 000000000000..00929b6e49e6
> --- /dev/null
> +++ b/include/linux/cmdline.h
> @@ -0,0 +1,89 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _LINUX_CMDLINE_H
> +#define _LINUX_CMDLINE_H
> +
> +/*
> + *
> + * Copyright (C) 2006,2021. Cisco Systems, Inc.
> + *
> + * Generic Append/Prepend cmdline support.
> + */
> +
> +#if defined(CONFIG_GENERIC_CMDLINE) && defined(CONFIG_CMDLINE_BOOL)
> +
> +#ifndef CONFIG_CMDLINE_OVERRIDE
> +#define GENERIC_CMDLINE_NEED_STRLCAT
> +/*
> + * This function will append or prepend a builtin command line to the command
> + * line provided by the bootloader. Kconfig options can be used to alter
> + * the behavior of this builtin command line.
> + * @dest: The destination of the final appended/prepended string
> + * @src: The starting string or NULL if there isn't one.
> + * @tmp: temporary space used for prepending
> + * @length: the maximum length of the strings above.
> + * @cmdline_strlcpy: point to a compatible strlcpy
> + * @cmdline_strlcat: point to a compatible strlcat
> + */
> +static inline void
> +__cmdline_add_builtin(char *dest, const char *src, char *tmp, unsigned long length,
> + size_t (*cmdline_strlcpy)(char *dest, const char *src, size_t size),
> + size_t (*cmdline_strlcat)(char *dest, const char *src, size_t count))
> +{
> + if (src != dest && src != NULL) {
> + cmdline_strlcpy(dest, " ", length);
> + cmdline_strlcat(dest, src, length);
> + }
> +
> + if (sizeof(CONFIG_CMDLINE_APPEND) > 1)
This test can probably be avoided. if CONFIG_CMDLINE_APPEND is empty, it will add a space at the end
of dest, that's harmless.
> + cmdline_strlcat(dest, " " CONFIG_CMDLINE_APPEND, length);
> +
> + if (sizeof(CONFIG_CMDLINE_PREPEND) > 1) {
Same. Keep it simple. Provide tmp all the time, have only one logic.
> + cmdline_strlcpy(tmp, CONFIG_CMDLINE_PREPEND " ", length);
> + cmdline_strlcat(tmp, dest, length);
> + cmdline_strlcpy(dest, tmp, length);
> + }
> +}
> +
> +#define cmdline_add_builtin_custom(dest, src, length, label, cmdline_strlcpy, cmdline_strlcat) \
> +{ \
> + if (sizeof(CONFIG_CMDLINE_PREPEND) > 1) { \
> + static label char cmdline_tmp_space[length]; \
> + __cmdline_add_builtin(dest, src, cmdline_tmp_space, length, cmdline_strlcpy, cmdline_strlcat); \
> + } else if (sizeof(CONFIG_CMDLINE_APPEND) > 1) { \
> + __cmdline_add_builtin(dest, src, NULL, length, cmdline_strlcpy, cmdline_strlcat); \
> + } \
No need to micro-optimise this, you can provide cmdline_tmp_space all the time and only keep on leg
of the if/elseif
> +}
> +#define cmdline_add_builtin(dest, src, length) \
> + cmdline_add_builtin_custom(dest, src, length, __initdata, strlcpy, strlcat)
> +
> +#else /* CONFIG_CMDLINE_OVERRIDE */
> +
> +static inline void
> +__cmdline_add_builtin_custom(char *dest, const char *src, unsigned long length,
> + size_t (*cmdline_strlcpy)(char *dest, const char *src, size_t size))
Argh ! So the same function as different semantics whether CONFIG_CMDLINE_OVERRIDE and/or
CONFIG_CMDLINE_BOOL is selected ? It means the architecture will have to know it as well in order to
call it right ? That looks like micro-optimisation, I think it is not worth it.
> +{
> + cmdline_strlcpy(dest, CONFIG_CMDLINE_PREPEND " " CONFIG_CMDLINE_APPEND, length);
> +}
> +#define cmdline_add_builtin_custom(dest, src, length, label, cmdline_strlcpy, cmdline_strlcat) \
> + __cmdline_add_builtin_custom(dest, src, length, cmdline_strlcpy)
> +#define cmdline_add_builtin(dest, src, length) \
> + __cmdline_add_builtin_custom(dest, src, length, strlcpy)
> +#endif /* !CONFIG_CMDLINE_OVERRIDE */
> +
> +#else /* !CONFIG_GENERIC_CMDLINE || !CONFIG_CMDLINE_BOOL */
> +
> +static inline void
> +__cmdline_add_builtin_custom(char *dest, const char *src, unsigned long length,
> + size_t (*cmdline_strlcpy)(char *dest, const char *src, size_t size))
> +{
> + if (src != NULL)
> + cmdline_strlcpy(dest, src, length);
> +}
> +#define cmdline_add_builtin_custom(dest, src, length, label, cmdline_strlcpy, cmdline_strlcat) \
> + __cmdline_add_builtin_custom(dest, src, length, cmdline_strlcpy)
> +#define cmdline_add_builtin(dest, src, length) \
> + __cmdline_add_builtin_custom(dest, src, length, strlcpy) \
> +
> +#endif /* CONFIG_GENERIC_CMDLINE */
> +
> +#endif /* _LINUX_CMDLINE_H */
> diff --git a/init/Kconfig b/init/Kconfig
> index 29ad68325028..28363ab07cd4 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -2032,6 +2032,74 @@ config PROFILING
> config TRACEPOINTS
> bool
>
> +config GENERIC_CMDLINE
> + bool
> +
> +if GENERIC_CMDLINE
> +
> +config CMDLINE_BOOL
> + bool "Built-in kernel command line"
> + help
> + Allow for specifying boot arguments to the kernel at
> + build time. On some systems (e.g. embedded ones), it is
> + necessary or convenient to provide some or all of the
> + kernel boot arguments with the kernel itself (that is,
> + to not rely on the boot loader to provide them.)
> +
> + To compile command line arguments into the kernel,
> + set this option to 'Y', then fill in the
> + the boot arguments in CONFIG_CMDLINE.
CONFIG_CMDLINE doesn't exist.
> +
> + Systems with fully functional boot loaders (i.e. non-embedded)
> + should leave this option set to 'N'.
> +
> +config CMDLINE_APPEND
> + string "Built-in kernel command string append"
> + depends on CMDLINE_BOOL
I think it would be better to have CMDLINE_APPEND and CMDLINE_PREPENT defined at all time, and not
leak CMDLINE_BOOL into code. It should just be used here to unable user customisation of
CMDLINE_APPEND, as follows:
config CMDLINE_APPEND
string "Built-in kernel command string append" if CMDLINE_BOOL
default ""
> + default ""
> + help
> + Enter arguments here that should be compiled into the kernel
> + image and used at boot time. If the boot loader provides a
> + command line at boot time, this string is appended to it to
> + form the full kernel command line, when the system boots.
> +
> + However, you can use the CONFIG_CMDLINE_OVERRIDE option to
> + change this behavior.
> +
> + In most cases, the command line (whether built-in or provided
> + by the boot loader) should specify the device for the root
> + file system.
> +
> +config CMDLINE_PREPEND
> + string "Built-in kernel command string prepend"
> + depends on CMDLINE_BOOL
Same comment as for CMDLINE_APPEND
> + default ""
> + help
> + Enter arguments here that should be compiled into the kernel
> + image and used at boot time. If the boot loader provides a
> + command line at boot time, this string is prepended to it to
> + form the full kernel command line, when the system boots.
> +
> + However, you can use the CONFIG_CMDLINE_OVERRIDE option to
> + change this behavior.
> +
> + In most cases, the command line (whether built-in or provided
> + by the boot loader) should specify the device for the root
> + file system.
> +
> +config CMDLINE_OVERRIDE
> + bool "Built-in command line overrides boot loader arguments"
> + depends on CMDLINE_BOOL
> + help
> + Set this option to 'Y' to have the kernel ignore the boot loader
> + command line, and use ONLY the built-in command line. In this case
> + append and prepend strings are concatenated to form the full
> + command line.
> +
> + This is used to work around broken boot loaders. This should
> + be set to 'N' under normal conditions.
In powerpc, by default, when a CMDLINE is provided, it is used only if the bootloader doesn't
provide a command line. I can't see how I can do that here.
> +endif
> +
> endmenu # General setup
>
> source "arch/Kconfig"
>
^ permalink raw reply
* [PATCH] powerpc/64s: Use symbolic macros for function entry encoding
From: Michael Ellerman @ 2021-03-09 7:15 UTC (permalink / raw)
To: linuxppc-dev; +Cc: naveen.n.rao
In ppc_function_entry() we look for a specific set of instructions by
masking the instructions and comparing with a known value. Currently
those known values are just literal hex values, and we recently
discovered one of them was wrong.
Instead construct the values using the existing constants we have for
defining various fields of instructions.
Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/include/asm/code-patching.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h
index d5b3c3bb95b4..f1d029bf906e 100644
--- a/arch/powerpc/include/asm/code-patching.h
+++ b/arch/powerpc/include/asm/code-patching.h
@@ -73,9 +73,10 @@ void __patch_exception(int exc, unsigned long addr);
#endif
#define OP_RT_RA_MASK 0xffff0000UL
-#define LIS_R2 0x3c400000UL
-#define ADDIS_R2_R12 0x3c4c0000UL
-#define ADDI_R2_R2 0x38420000UL
+#define LIS_R2 (PPC_INST_ADDIS | __PPC_RT(R2))
+#define ADDIS_R2_R12 (PPC_INST_ADDIS | __PPC_RT(R2) | __PPC_RA(R12))
+#define ADDI_R2_R2 (PPC_INST_ADDI | __PPC_RT(R2) | __PPC_RA(R2))
+
static inline unsigned long ppc_function_entry(void *func)
{
--
2.25.1
^ permalink raw reply related
* Re: [PATCH v2 7/7] CMDLINE: x86: convert to generic builtin command line
From: Ard Biesheuvel @ 2021-03-09 6:43 UTC (permalink / raw)
To: Daniel Walker
Cc: Rob Herring, Ruslan Ruslichenko, linux-efi, H. Peter Anvin,
Daniel Gimpelevich,
open list:LINUX FOR POWERPC (32-BIT AND 64-BIT), X86 ML,
open list:MIPS, Linux Kernel Mailing List, Ingo Molnar,
Borislav Petkov, Ruslan Bilovol, xe-linux-external, Andrew Morton,
Will Deacon, Thomas Gleixner
In-Reply-To: <20210309000247.2989531-8-danielwa@cisco.com>
On Tue, 9 Mar 2021 at 01:03, Daniel Walker <danielwa@cisco.com> wrote:
>
> This updates the x86 code to use the CONFIG_GENERIC_CMDLINE
> option.
>
> Cc: xe-linux-external@cisco.com
> Signed-off-by: Ruslan Ruslichenko <rruslich@cisco.com>
> Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
> Signed-off-by: Daniel Walker <danielwa@cisco.com>
> ---
> arch/x86/Kconfig | 44 +------------------------
> arch/x86/kernel/setup.c | 18 ++--------
> drivers/firmware/efi/libstub/x86-stub.c | 2 +-
> 3 files changed, 4 insertions(+), 60 deletions(-)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 21f851179ff0..3950f9bf9855 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -115,6 +115,7 @@ config X86
> select EDAC_SUPPORT
> select GENERIC_CLOCKEVENTS_BROADCAST if X86_64 || (X86_32 && X86_LOCAL_APIC)
> select GENERIC_CLOCKEVENTS_MIN_ADJUST
> + select GENERIC_CMDLINE
> select GENERIC_CMOS_UPDATE
> select GENERIC_CPU_AUTOPROBE
> select GENERIC_CPU_VULNERABILITIES
> @@ -2368,49 +2369,6 @@ choice
>
> endchoice
>
> -config CMDLINE_BOOL
> - bool "Built-in kernel command line"
> - help
> - Allow for specifying boot arguments to the kernel at
> - build time. On some systems (e.g. embedded ones), it is
> - necessary or convenient to provide some or all of the
> - kernel boot arguments with the kernel itself (that is,
> - to not rely on the boot loader to provide them.)
> -
> - To compile command line arguments into the kernel,
> - set this option to 'Y', then fill in the
> - boot arguments in CONFIG_CMDLINE.
> -
> - Systems with fully functional boot loaders (i.e. non-embedded)
> - should leave this option set to 'N'.
> -
> -config CMDLINE
> - string "Built-in kernel command string"
> - depends on CMDLINE_BOOL
> - default ""
> - help
> - Enter arguments here that should be compiled into the kernel
> - image and used at boot time. If the boot loader provides a
> - command line at boot time, it is appended to this string to
> - form the full kernel command line, when the system boots.
> -
> - However, you can use the CONFIG_CMDLINE_OVERRIDE option to
> - change this behavior.
> -
> - In most cases, the command line (whether built-in or provided
> - by the boot loader) should specify the device for the root
> - file system.
> -
> -config CMDLINE_OVERRIDE
> - bool "Built-in command line overrides boot loader arguments"
> - depends on CMDLINE_BOOL && CMDLINE != ""
> - help
> - Set this option to 'Y' to have the kernel ignore the boot loader
> - command line, and use ONLY the built-in command line.
> -
> - This is used to work around broken boot loaders. This should
> - be set to 'N' under normal conditions.
> -
> config MODIFY_LDT_SYSCALL
> bool "Enable the LDT (local descriptor table)" if EXPERT
> default y
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 740f3bdb3f61..e748c3e5c1ae 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -48,6 +48,7 @@
> #include <asm/unwind.h>
> #include <asm/vsyscall.h>
> #include <linux/vmalloc.h>
> +#include <linux/cmdline.h>
>
> /*
> * max_low_pfn_mapped: highest directly mapped pfn < 4 GB
> @@ -162,9 +163,6 @@ unsigned long saved_video_mode;
> #define RAMDISK_LOAD_FLAG 0x4000
>
> static char __initdata command_line[COMMAND_LINE_SIZE];
> -#ifdef CONFIG_CMDLINE_BOOL
> -static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
> -#endif
>
> #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
> struct edd edd;
> @@ -884,19 +882,7 @@ void __init setup_arch(char **cmdline_p)
> bss_resource.start = __pa_symbol(__bss_start);
> bss_resource.end = __pa_symbol(__bss_stop)-1;
>
> -#ifdef CONFIG_CMDLINE_BOOL
> -#ifdef CONFIG_CMDLINE_OVERRIDE
> - strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
> -#else
> - if (builtin_cmdline[0]) {
> - /* append boot loader cmdline to builtin */
> - strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
> - strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
> - strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
> - }
> -#endif
> -#endif
> -
> + cmdline_add_builtin(boot_command_line, NULL, COMMAND_LINE_SIZE);
> strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
> *cmdline_p = command_line;
>
> diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
> index f14c4ff5839f..9538c9d4a0bc 100644
> --- a/drivers/firmware/efi/libstub/x86-stub.c
> +++ b/drivers/firmware/efi/libstub/x86-stub.c
> @@ -736,7 +736,7 @@ unsigned long efi_main(efi_handle_t handle,
> }
>
> #ifdef CONFIG_CMDLINE_BOOL
Does this CMDLINE_BOOL check need to be dropped as well?
> - status = efi_parse_options(CONFIG_CMDLINE);
> + status = efi_parse_options(CONFIG_CMDLINE_PREPEND " " CONFIG_CMDLINE_APPEND);
> if (status != EFI_SUCCESS) {
> efi_err("Failed to parse options\n");
> goto fail;
> --
> 2.25.1
>
^ permalink raw reply
* [PATCH] powerpc/vdso32: Add missing _restgpr_31_x to fix build failure
From: Christophe Leroy @ 2021-03-09 6:19 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, segher
Cc: linuxppc-dev, linux-kernel
With some defconfig including CONFIG_CC_OPTIMIZE_FOR_SIZE,
(for instance mvme5100_defconfig and ps3_defconfig), gcc 5
generates a call to _restgpr_31_x.
Until recently it went unnoticed, but
commit 42ed6d56ade2 ("powerpc/vdso: Block R_PPC_REL24 relocations")
made it rise to the surface.
Provide that function (copied from lib/crtsavres.S) in
gettimeofday.S
Fixes: ab037dd87a2f ("powerpc/vdso: Switch VDSO to generic C implementation.")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
I don't know if there is a way to tell GCC not to emit that call, because at the end we get more instructions than needed.
---
arch/powerpc/kernel/vdso32/gettimeofday.S | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S
index a6e29f880e0e..d21d08140a5e 100644
--- a/arch/powerpc/kernel/vdso32/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso32/gettimeofday.S
@@ -65,3 +65,14 @@ V_FUNCTION_END(__kernel_clock_getres)
V_FUNCTION_BEGIN(__kernel_time)
cvdso_call_time __c_kernel_time
V_FUNCTION_END(__kernel_time)
+
+/* Routines for restoring integer registers, called by the compiler. */
+/* Called with r11 pointing to the stack header word of the caller of the */
+/* function, just beyond the end of the integer restore area. */
+_GLOBAL(_restgpr_31_x)
+_GLOBAL(_rest32gpr_31_x)
+ lwz r0,4(r11)
+ lwz r31,-4(r11)
+ mtlr r0
+ mr r1,r11
+ blr
--
2.25.0
^ permalink raw reply related
* Re: Errant readings on LM81 with T2080 SoC
From: Guenter Roeck @ 2021-03-09 5:24 UTC (permalink / raw)
To: Chris Packham, jdelvare@suse.com
Cc: linux-hwmon@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org
In-Reply-To: <d36a85c2-4ec5-6c28-9e2a-282de1eaf955@alliedtelesis.co.nz>
On 3/8/21 8:36 PM, Chris Packham wrote:
>
> On 9/03/21 11:10 am, Chris Packham wrote:
>>
>> On 8/03/21 5:59 pm, Guenter Roeck wrote:
>>> On 3/7/21 8:37 PM, Chris Packham wrote:
>>> [ ... ]
>>>>> That's from -ENXIO which is used in only one place in i2c-mpc.c. I'll
>>>>> enable some debug and see what we get.
>>>> For the errant readings there was nothing abnormal reported by the
>>>> driver.
>>>>
>>>> For the "No such device or address" I saw "mpc-i2c ffe119000.i2c: No
>>>> RXAK" which matches up with the -ENXIO return.
>>>>
>>> Id suggest to check the time until not busy and stop in mpc_xfer().
>>> Those hot loops are unusual, and may well mess up the code especially
>>> if preempt is enabled.
>> Reworking those loops seems to have had a positive result. I'll do a
>> bit more testing and hopefully get a patch out later today.
> D'oh my "fix" was to replace the cond_reshed() with msleep(10) which did
> "fix" the problem but made every i2c read slow. I didn't notice when
> testing just the lm81 but as soon as I booted the system with more i2c
> devices I saw stupidly slow boot times.
msleep() is indeed a bad idea. You'd want something like usleep_range()
with increasing timeout. Like start with a few uS and double the sleep time
with each iteration (eg 4-8 / 8-16 / 16-32 / 32-64 / ...).
Guenter
^ permalink raw reply
* PowerPC64 future proof kernel toc, revised
From: Alan Modra @ 2021-03-09 4:56 UTC (permalink / raw)
To: linuxppc-dev; +Cc: alexey, ellerman
This patch future-proofs the kernel against linker changes that might
put the toc pointer at some location other than .got+0x8000, by
replacing __toc_start+0x8000 with __toc_ptr throughout. __toc_ptr
is set from the symbol .TOC. emitted by ld on a final link, falling
back to .got+0x8000 for older ld that doesn't provide .TOC. If the
kernel's idea of the toc pointer doesn't agree with the linker, bad
things happen.
prom_init.c code relocating its toc is also changed so that a symbolic
__prom_init_toc_start toc-pointer relative address is calculated
rather than assuming that it is always at toc-pointer - 0x8000. The
length calculations loading values from the toc are also avoided.
It's a little incestuous to do that with unreloc_toc picking up
adjusted values (which is fine in practice, they both adjust by the
same amount if all goes well).
I've also changed the way .got is aligned in vmlinux.lds and
zImage.lds, mostly so that dumping out section info by objdump or
readelf plainly shows the alignment is 256. This linker script
feature was added 2005-09-27, available in FSF binutils releases from
2.17 onwards. Should be safe to use in the kernel, I think.
Finally, put *(.got) before the prom_init.o entry which only needs
*(.toc), so that the GOT header goes in the correct place. I don't
believe this makes any difference for the kernel as it would for
dynamic objects being loaded by ld.so. That change is just to stop
lusers who blindly copy kernel scripts being led astray. Of course,
this change needs the prom_init.c changes.
Some notes on .toc and .got.
.toc is a compiler generated section of addresses. .got is a linker
generated section of addresses, generally built when the linker sees
R_*_*GOT* relocations. In the case of powerpc64 ld.bfd, there are
multiple generated .got sections, one per input object file. So you
can somewhat reasonably write in a linker script an input section
statement like *prom_init.o(.got .toc) to mean "the .got and .toc
section for files matching *prom_init.o". On other architectures that
doesn't make sense, because the linker generally has just one .got
section. Even on powerpc64, note well that the GOT entries for
prom_init.o may be merged with GOT entries from other objects. That
means that if prom_init.o references, say, _end via some GOT
relocation, and some other object also references _end via a GOT
relocation, the GOT entry for _end may be in the range
__prom_init_toc_start to __prom_init_toc_end and if the kernel does
something special to GOT/TOC entries in that range then the value of
_end as seen by objects other than prom_init.o will be affected. On
the other hand the GOT entry for _end may not be in the range
__prom_init_toc_start to __prom_init_toc_end. Which way it turns out
is deterministic but a detail of linker operation that should not be
relied on.
A feature of ld.bfd is that input .toc (and .got) sections matching
one linker input section statement may be sorted, to put entries used
by small-model code first, near the toc base. This is why scripts for
powerpc64 normally use *(.got .toc) rather than *(.got) *(.toc), since
the first form allows more freedom to sort.
Another feature of ld.bfd is that indirect addressing sequences using
the GOT/TOC may be edited by the linker to relative addressing. In
many cases relative addressing would be emitted by gcc for
-mcmodel=medium if you appropriately decorate variable declarations
with non-default visibility.
diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
index 1d83966f5ef6..8397af058650 100644
--- a/arch/powerpc/boot/crt0.S
+++ b/arch/powerpc/boot/crt0.S
@@ -28,7 +28,7 @@ p_etext: .8byte _etext
p_bss_start: .8byte __bss_start
p_end: .8byte _end
-p_toc: .8byte __toc_start + 0x8000 - p_base
+p_toc: .8byte __toc_ptr - p_base
p_dyn: .8byte __dynamic_start - p_base
p_rela: .8byte __rela_dyn_start - p_base
p_prom: .8byte 0
diff --git a/arch/powerpc/boot/zImage.lds.S b/arch/powerpc/boot/zImage.lds.S
index d6f072865627..35654cbcd294 100644
--- a/arch/powerpc/boot/zImage.lds.S
+++ b/arch/powerpc/boot/zImage.lds.S
@@ -36,13 +36,11 @@ SECTIONS
}
#ifdef CONFIG_PPC64_BOOT_WRAPPER
- . = ALIGN(256);
- .got :
+ .got : ALIGN(256)
{
- __toc_start = .;
- *(.got)
- *(.toc)
+ *(.got .toc)
}
+ __toc_ptr = DEFINED (.TOC.) ? .TOC. : ADDR (.got) + 0x8000;
#endif
.hash : { *(.hash) }
diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h
index 324d7b298ec3..4c3e84a2a073 100644
--- a/arch/powerpc/include/asm/sections.h
+++ b/arch/powerpc/include/asm/sections.h
@@ -49,13 +49,13 @@ static inline int in_kernel_text(unsigned long addr)
static inline unsigned long kernel_toc_addr(void)
{
/* Defined by the linker, see vmlinux.lds.S */
- extern unsigned long __toc_start;
+ extern unsigned long __toc_ptr;
/*
* The TOC register (r2) points 32kB into the TOC, so that 64kB of
* the TOC can be addressed using a single machine instruction.
*/
- return (unsigned long)(&__toc_start) + 0x8000UL;
+ return (unsigned long)&__toc_ptr;
}
static inline int overlaps_interrupt_vector_text(unsigned long start,
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index ece7f97bafff..1cae5b0943be 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -899,7 +899,7 @@ _GLOBAL(relative_toc)
blr
.balign 8
-p_toc: .8byte __toc_start + 0x8000 - 0b
+p_toc: .8byte __toc_ptr - 0b
/*
* This is where the main kernel code starts.
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index ccf77b985c8f..d309a7787652 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -3220,27 +3220,26 @@ static void unreloc_toc(void)
{
}
#else
-static void __reloc_toc(unsigned long offset, unsigned long nr_entries)
+static void __reloc_toc(unsigned long offset)
{
- unsigned long i;
unsigned long *toc_entry;
+ unsigned long *toc_start, *toc_end;
- /* Get the start of the TOC by using r2 directly. */
- asm volatile("addi %0,2,-0x8000" : "=b" (toc_entry));
+ asm("addis %0,2,__prom_init_toc_start@toc@ha\n\t"
+ "addi %0,%0,__prom_init_toc_start@toc@l" : "=b" (toc_start));
+ asm("addis %0,2,__prom_init_toc_end@toc@ha\n\t"
+ "addi %0,%0,__prom_init_toc_end@toc@l" : "=b" (toc_end));
- for (i = 0; i < nr_entries; i++) {
- *toc_entry = *toc_entry + offset;
- toc_entry++;
+ for (toc_entry = toc_start; toc_entry != toc_end; toc_entry++) {
+ *toc_entry += offset;
}
}
static void reloc_toc(void)
{
unsigned long offset = reloc_offset();
- unsigned long nr_entries =
- (__prom_init_toc_end - __prom_init_toc_start) / sizeof(long);
- __reloc_toc(offset, nr_entries);
+ __reloc_toc(offset);
mb();
}
@@ -3248,12 +3247,10 @@ static void reloc_toc(void)
static void unreloc_toc(void)
{
unsigned long offset = reloc_offset();
- unsigned long nr_entries =
- (__prom_init_toc_end - __prom_init_toc_start) / sizeof(long);
mb();
- __reloc_toc(-offset, nr_entries);
+ __reloc_toc(-offset);
}
#endif
#endif
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 72fa3c00229a..343579080dd5 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -326,17 +326,16 @@ SECTIONS
__end_opd = .;
}
- . = ALIGN(256);
- .got : AT(ADDR(.got) - LOAD_OFFSET) {
- __toc_start = .;
+ .got : AT(ADDR(.got) - LOAD_OFFSET) ALIGN(256) {
+ *(.got)
#ifndef CONFIG_RELOCATABLE
__prom_init_toc_start = .;
- arch/powerpc/kernel/prom_init.o*(.toc .got)
+ arch/powerpc/kernel/prom_init.o*(.toc)
__prom_init_toc_end = .;
#endif
- *(.got)
*(.toc)
}
+ __toc_ptr = DEFINED (.TOC.) ? .TOC. : ADDR (.got) + 0x8000;
#endif
/* The initial task and kernel stack */
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply related
* Re: Errant readings on LM81 with T2080 SoC
From: Chris Packham @ 2021-03-09 4:36 UTC (permalink / raw)
To: Guenter Roeck, jdelvare@suse.com
Cc: linux-hwmon@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org
In-Reply-To: <61f68c59-593b-e393-5520-d9acc14fdf97@alliedtelesis.co.nz>
On 9/03/21 11:10 am, Chris Packham wrote:
>
> On 8/03/21 5:59 pm, Guenter Roeck wrote:
>> On 3/7/21 8:37 PM, Chris Packham wrote:
>> [ ... ]
>>>> That's from -ENXIO which is used in only one place in i2c-mpc.c. I'll
>>>> enable some debug and see what we get.
>>> For the errant readings there was nothing abnormal reported by the
>>> driver.
>>>
>>> For the "No such device or address" I saw "mpc-i2c ffe119000.i2c: No
>>> RXAK" which matches up with the -ENXIO return.
>>>
>> Id suggest to check the time until not busy and stop in mpc_xfer().
>> Those hot loops are unusual, and may well mess up the code especially
>> if preempt is enabled.
> Reworking those loops seems to have had a positive result. I'll do a
> bit more testing and hopefully get a patch out later today.
D'oh my "fix" was to replace the cond_reshed() with msleep(10) which did
"fix" the problem but made every i2c read slow. I didn't notice when
testing just the lm81 but as soon as I booted the system with more i2c
devices I saw stupidly slow boot times.
>> Also, are you using interrupts or polling in
>> your system ? The interrupt handler looks a bit odd, with "Read again
>> to allow register to stabilise".
>>
>> Do you have fsl,timeout set in the devicetree properties and, if so,
>> have you played with it ?
>>
>> Other than that, the only other real idea I have would be to monitor
>> the i2c bus.
>>
>> Guenter
^ permalink raw reply
* Re: [PATCH 0/6] mm: some config cleanups
From: Anshuman Khandual @ 2021-03-09 3:32 UTC (permalink / raw)
To: linux-mm
Cc: linux-s390, linux-ia64, linux-parisc, linux-sh, x86, linux-mips,
linux-kernel, linux-fsdevel, linux-riscv, linux-snps-arc,
linuxppc-dev, linux-arm-kernel
In-Reply-To: <1615185706-24342-1-git-send-email-anshuman.khandual@arm.com>
On 3/8/21 12:11 PM, Anshuman Khandual wrote:
> This series contains config cleanup patches which reduces code duplication
> across platforms and also improves maintainability. There is no functional
> change intended with this series. This has been boot tested on arm64 but
> only build tested on some other platforms.
>
> This applies on 5.12-rc2
>
> Cc: x86@kernel.org
> Cc: linux-ia64@vger.kernel.org
> Cc: linux-s390@vger.kernel.org
> Cc: linux-snps-arc@lists.infradead.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-mips@vger.kernel.org
> Cc: linux-parisc@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-riscv@lists.infradead.org
> Cc: linux-sh@vger.kernel.org
> Cc: linux-fsdevel@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
>
> Anshuman Khandual (6):
> mm: Generalize ARCH_HAS_CACHE_LINE_SIZE
> mm: Generalize SYS_SUPPORTS_HUGETLBFS (rename as ARCH_SUPPORTS_HUGETLBFS)
> mm: Generalize ARCH_ENABLE_MEMORY_[HOTPLUG|HOTREMOVE]
> mm: Drop redundant ARCH_ENABLE_[HUGEPAGE|THP]_MIGRATION
> mm: Drop redundant ARCH_ENABLE_SPLIT_PMD_PTLOCK
> mm: Drop redundant HAVE_ARCH_TRANSPARENT_HUGEPAGE
Seems like there was a problem during the email because some patches
might not have hit the mailing list. Although git send-email never
really reported any problem. Not sure what happened here.
https://patchwork.kernel.org/project/linux-mm/list/?series=443619
https://lore.kernel.org/linux-mm/1615185706-24342-1-git-send-email-anshuman.khandual@arm.com/
Will probably resend the series.
- Anshuman
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox