* Re: [PATCH v3 04/17] y2038: s390: Remove unneeded ipc uapi header files
From: Heiko Carstens @ 2018-04-20 7:54 UTC (permalink / raw)
To: Arnd Bergmann
Cc: y2038, linux-kernel, linux-api, linux-arch, libc-alpha, tglx,
deepa.kernel, viro, ebiederm, albert.aribaud, linux-s390,
schwidefsky, x86, catalin.marinas, will.deacon, linux-mips,
jhogan, ralf, linuxppc-dev, sparclinux
In-Reply-To: <20180419143737.606138-5-arnd@arndb.de>
On Thu, Apr 19, 2018 at 04:37:24PM +0200, Arnd Bergmann wrote:
> The s390 msgbuf/sembuf/shmbuf header files are all identical to the
> version from asm-generic.
>
> This patch removes the files and replaces them with 'generic-y'
> statements, to avoid having to modify each copy when we extend sysvipc
> to deal with 64-bit time_t in 32-bit user space.
>
> Note that unlike alpha and ia64, the ipcbuf.h header file is slightly
> different here, so I'm leaving the private copy.
>
> To deal with 32-bit compat tasks, we also have to adapt the definitions
> of compat_{shm,sem,msg}id_ds to match the changes to the respective
> asm-generic files.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> arch/s390/include/asm/compat.h | 32 ++++++++++++------------
> arch/s390/include/uapi/asm/Kbuild | 3 +++
> arch/s390/include/uapi/asm/msgbuf.h | 38 ----------------------------
> arch/s390/include/uapi/asm/sembuf.h | 30 -----------------------
> arch/s390/include/uapi/asm/shmbuf.h | 49 -------------------------------------
> 5 files changed, 19 insertions(+), 133 deletions(-)
> delete mode 100644 arch/s390/include/uapi/asm/msgbuf.h
> delete mode 100644 arch/s390/include/uapi/asm/sembuf.h
> delete mode 100644 arch/s390/include/uapi/asm/shmbuf.h
FWIW,
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
^ permalink raw reply
* Re: [PATCH v3 04/17] y2038: s390: Remove unneeded ipc uapi header files
From: Arnd Bergmann @ 2018-04-20 7:58 UTC (permalink / raw)
To: Heiko Carstens
Cc: y2038 Mailman List, Linux Kernel Mailing List, Linux API,
linux-arch, GNU C Library, Thomas Gleixner, Deepa Dinamani,
Al Viro, Eric W . Biederman, Albert ARIBAUD, linux-s390,
Martin Schwidefsky, the arch/x86 maintainers, Catalin Marinas,
Will Deacon, open list:RALINK MIPS ARCHITECTURE, James Hogan,
Ralf Baechle, linuxppc-dev, sparclinux
In-Reply-To: <20180420075407.GA7119@osiris>
On Fri, Apr 20, 2018 at 9:54 AM, Heiko Carstens
<heiko.carstens@de.ibm.com> wrote:
> On Thu, Apr 19, 2018 at 04:37:24PM +0200, Arnd Bergmann wrote:
>> The s390 msgbuf/sembuf/shmbuf header files are all identical to the
>> version from asm-generic.
>>
>> This patch removes the files and replaces them with 'generic-y'
>> statements, to avoid having to modify each copy when we extend sysvipc
>> to deal with 64-bit time_t in 32-bit user space.
>>
>> Note that unlike alpha and ia64, the ipcbuf.h header file is slightly
>> different here, so I'm leaving the private copy.
>>
>> To deal with 32-bit compat tasks, we also have to adapt the definitions
>> of compat_{shm,sem,msg}id_ds to match the changes to the respective
>> asm-generic files.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> arch/s390/include/asm/compat.h | 32 ++++++++++++------------
>> arch/s390/include/uapi/asm/Kbuild | 3 +++
>> arch/s390/include/uapi/asm/msgbuf.h | 38 ----------------------------
>> arch/s390/include/uapi/asm/sembuf.h | 30 -----------------------
>> arch/s390/include/uapi/asm/shmbuf.h | 49 -------------------------------------
>> 5 files changed, 19 insertions(+), 133 deletions(-)
>> delete mode 100644 arch/s390/include/uapi/asm/msgbuf.h
>> delete mode 100644 arch/s390/include/uapi/asm/sembuf.h
>> delete mode 100644 arch/s390/include/uapi/asm/shmbuf.h
>
> FWIW,
>
> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Thanks, added to the patch.
Arnd
^ permalink raw reply
* Re: [PATCH v2 3/7] powerpc: use task_pid_nr() for TID allocation
From: Andrew Donnellan @ 2018-04-20 8:43 UTC (permalink / raw)
To: Alastair D'Silva, linuxppc-dev
Cc: linux-kernel, linux-doc, mikey, vaibhav, aneesh.kumar, malat,
felix, pombredanne, sukadev, npiggin, gregkh, arnd, fbarrat,
corbet, Alastair D'Silva, Sukadev Bhattiprolu,
Christophe Lombard
In-Reply-To: <20180418010810.30937-4-alastair@au1.ibm.com>
[+ Sukadev, Christophe]
On 18/04/18 11:08, Alastair D'Silva wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
>
> The current implementation of TID allocation, using a global IDR, may
> result in an errant process starving the system of available TIDs.
> Instead, use task_pid_nr(), as mentioned by the original author. The
> scenario described which prevented it's use is not applicable, as
> set_thread_tidr can only be called after the task struct has been
> populated.
>
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
So it's too late in the evening for me to completely get my head around
what's going on here enough to give my Reviewed-by:, but my current
thinking is:
- In the first version of the patch to add TIDR support
(https://patchwork.ozlabs.org/patch/799494/), it was originally proposed
to call assign_thread_id() (as it was then called) from copy_thread()
- The comment block documents the reason why we can't use task_pid_nr()
but assumes that we're trying to assign a TIDR from within copy_thread()
- The final patch that was accepted
(https://patchwork.ozlabs.org/patch/835552/,
ec233ede4c8654894610ea54f4dae7adc954ac62) instead sets the TIDR to 0
from copy_thread(), so the original reasoning regarding not using
task_pid_nr() within copy_thread() is no longer applicable.
Sukadev: does this sound right?
Andrew
> ---
> arch/powerpc/include/asm/switch_to.h | 1 -
> arch/powerpc/kernel/process.c | 97 +-----------------------------------
> 2 files changed, 1 insertion(+), 97 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
> index be8c9fa23983..5b03d8a82409 100644
> --- a/arch/powerpc/include/asm/switch_to.h
> +++ b/arch/powerpc/include/asm/switch_to.h
> @@ -94,6 +94,5 @@ static inline void clear_task_ebb(struct task_struct *t)
> extern int set_thread_uses_vas(void);
>
> extern int set_thread_tidr(struct task_struct *t);
> -extern void clear_thread_tidr(struct task_struct *t);
>
> #endif /* _ASM_POWERPC_SWITCH_TO_H */
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index 3b00da47699b..87f047fd2762 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -1496,103 +1496,12 @@ int set_thread_uses_vas(void)
> }
>
> #ifdef CONFIG_PPC64
> -static DEFINE_SPINLOCK(vas_thread_id_lock);
> -static DEFINE_IDA(vas_thread_ida);
> -
> -/*
> - * We need to assign a unique thread id to each thread in a process.
> - *
> - * This thread id, referred to as TIDR, and separate from the Linux's tgid,
> - * is intended to be used to direct an ASB_Notify from the hardware to the
> - * thread, when a suitable event occurs in the system.
> - *
> - * One such event is a "paste" instruction in the context of Fast Thread
> - * Wakeup (aka Core-to-core wake up in the Virtual Accelerator Switchboard
> - * (VAS) in POWER9.
> - *
> - * To get a unique TIDR per process we could simply reuse task_pid_nr() but
> - * the problem is that task_pid_nr() is not yet available copy_thread() is
> - * called. Fixing that would require changing more intrusive arch-neutral
> - * code in code path in copy_process()?.
> - *
> - * Further, to assign unique TIDRs within each process, we need an atomic
> - * field (or an IDR) in task_struct, which again intrudes into the arch-
> - * neutral code. So try to assign globally unique TIDRs for now.
> - *
> - * NOTE: TIDR 0 indicates that the thread does not need a TIDR value.
> - * For now, only threads that expect to be notified by the VAS
> - * hardware need a TIDR value and we assign values > 0 for those.
> - */
> -#define MAX_THREAD_CONTEXT ((1 << 16) - 1)
> -static int assign_thread_tidr(void)
> -{
> - int index;
> - int err;
> - unsigned long flags;
> -
> -again:
> - if (!ida_pre_get(&vas_thread_ida, GFP_KERNEL))
> - return -ENOMEM;
> -
> - spin_lock_irqsave(&vas_thread_id_lock, flags);
> - err = ida_get_new_above(&vas_thread_ida, 1, &index);
> - spin_unlock_irqrestore(&vas_thread_id_lock, flags);
> -
> - if (err == -EAGAIN)
> - goto again;
> - else if (err)
> - return err;
> -
> - if (index > MAX_THREAD_CONTEXT) {
> - spin_lock_irqsave(&vas_thread_id_lock, flags);
> - ida_remove(&vas_thread_ida, index);
> - spin_unlock_irqrestore(&vas_thread_id_lock, flags);
> - return -ENOMEM;
> - }
> -
> - return index;
> -}
> -
> -static void free_thread_tidr(int id)
> -{
> - unsigned long flags;
> -
> - spin_lock_irqsave(&vas_thread_id_lock, flags);
> - ida_remove(&vas_thread_ida, id);
> - spin_unlock_irqrestore(&vas_thread_id_lock, flags);
> -}
> -
> -/*
> - * Clear any TIDR value assigned to this thread.
> - */
> -void clear_thread_tidr(struct task_struct *t)
> -{
> - if (!t->thread.tidr)
> - return;
> -
> - if (!cpu_has_feature(CPU_FTR_P9_TIDR)) {
> - WARN_ON_ONCE(1);
> - return;
> - }
> -
> - mtspr(SPRN_TIDR, 0);
> - free_thread_tidr(t->thread.tidr);
> - t->thread.tidr = 0;
> -}
> -
> -void arch_release_task_struct(struct task_struct *t)
> -{
> - clear_thread_tidr(t);
> -}
> -
> /*
> * Assign a unique TIDR (thread id) for task @t and set it in the thread
> * structure. For now, we only support setting TIDR for 'current' task.
> */
> int set_thread_tidr(struct task_struct *t)
> {
> - int rc;
> -
> if (!cpu_has_feature(CPU_FTR_P9_TIDR))
> return -EINVAL;
>
> @@ -1602,11 +1511,7 @@ int set_thread_tidr(struct task_struct *t)
> if (t->thread.tidr)
> return 0;
>
> - rc = assign_thread_tidr();
> - if (rc < 0)
> - return rc;
> -
> - t->thread.tidr = rc;
> + t->thread.tidr = (u16)task_pid_nr(t);
> mtspr(SPRN_TIDR, t->thread.tidr);
>
> return 0;
>
--
Andrew Donnellan OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com IBM Australia Limited
^ permalink raw reply
* Re: [PATCH v3 01/17] y2038: asm-generic: Extend sysvipc data structures
From: Arnd Bergmann @ 2018-04-20 8:54 UTC (permalink / raw)
To: Eric W. Biederman
Cc: y2038 Mailman List, Linux Kernel Mailing List, Linux API,
linux-arch, GNU C Library, Thomas Gleixner, Deepa Dinamani,
Al Viro, Albert ARIBAUD, linux-s390, Martin Schwidefsky,
the arch/x86 maintainers, Catalin Marinas, Will Deacon,
open list:RALINK MIPS ARCHITECTURE, James Hogan, Ralf Baechle,
linuxppc-dev, sparclinux, Ben Hutchings, Jeffrey Walton,
Daniel Schepler, H.J. Lu, Adam Borowski, tg,
John Paul Adrian Glaubitz
In-Reply-To: <87k1t2n8v5.fsf@xmission.com>
On Fri, Apr 20, 2018 at 12:12 AM, Eric W. Biederman
<ebiederm@xmission.com> wrote:
> Arnd Bergmann <arnd@arndb.de> writes:
>
>> On Thu, Apr 19, 2018 at 5:20 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>>> On Thu, Apr 19, 2018 at 4:59 PM, Eric W. Biederman <ebiederm@xmission.com> wrote:
>>>> I suspect you want to use __kernel_ulong_t here instead of a raw
>>>> unsigned long. If nothing else it seems inconsistent to use typedefs
>>>> in one half of the structure and no typedefs in the other half.
>>>
>>> Good catch, there is definitely something wrong here, but I think using
>>> __kernel_ulong_t for all members would also be wrong, as that
>>> still changes the layout on x32, which effectively is
>>>
>>> struct msqid64_ds {
>>> ipc64_perm msg_perm;
>>> u64 msg_stime;
>>> u32 __unused1;
>>> /* 32 bit implict padding */
>>> u64 msg_rtime;
>>> u32 __unused2;
>>> /* 32 bit implict padding */
>>> u64 msg_ctime;
>>> u32 __unused3;
>>> /* 32 bit implict padding */
>>> __kernel_pid_t shm_cpid; /* pid of creator */
>>> __kernel_pid_t shm_lpid; /* pid of last operator */
>>> ....
>>> };
>>>
>>> The choices here would be to either use a mix of
>>> __kernel_ulong_t and unsigned long, or taking the x32
>>> version back into arch/x86/include/uapi/asm/ so the
>>> generic version at least makes some sense.
>>>
>>> I can't use __kernel_time_t for the lower half on 32-bit
>>> since it really should be unsigned.
>>
>> After thinking about it some more, I conclude that the structure is simply
>> incorrect on x32: The __kernel_ulong_t usage was introduced in 2013
>> in commit b9cd5ca22d67 ("uapi: Use __kernel_ulong_t in struct
>> msqid64_ds") and apparently was correct initially as __BITS_PER_LONG
>> evaluated to 64, but it broke with commit f4b4aae18288 ("x86/headers/uapi:
>> Fix __BITS_PER_LONG value for x32 builds") that changed the value
>> of __BITS_PER_LONG and introduced the extra padding in 2015.
>>
>> The same change apparently also broke a lot of other definitions, e.g.
>>
>> $ echo "#include <linux/types.h>" | gcc -mx32 -E -xc - | grep -A3
>> __kernel_size_t
>> typedef unsigned int __kernel_size_t;
>> typedef int __kernel_ssize_t;
>> typedef int __kernel_ptrdiff_t;
>>
>> Those used to be defined as 'unsigned long long' and 'long long'
>> respectively, so now all kernel interfaces using those on x32
>> became incompatible!
>
> Is this just for the uapi header as seen by userspace? I expect we are
> using the a normal kernel interface with 64bit longs and 64bit pointers
> when we build the kernel.
Yes, that patch shouldn't have changed anything in the kernel, which
continues to be built with __BITS_PER_LONG=64. I haven't
checked the vdso, which is the only bit of the kernel that gets built
with -mx32, but I assume it's fine as well.
> If this is just a header as seen from userspace mess it seems
> unfortunate but fixable.
Right. I'll fix the IPC stuff for this series to make it work with
any value of __BITS_PER_LONG on x32, but I don't plan to
do anything about the rest of x32. The patch that caused the
problem was intended as a bugfix, so we can't just revert it
without first understanding how to properly fix the original bug,
and which other interfaces have now come to rely on
__BITS_PER_LONG=32 for x32.
Adding a few other folks that have been involved in the x32
kernel support or the Debian port in the past. Maybe one of
them is motivated to figure out how to fix this properly.
Arnd
^ permalink raw reply
* Re: [PATCH 0/4] LD_DEAD_CODE_DATA_ELIMINATION fixes and enabling for powerpc
From: Mathieu Malaterre @ 2018-04-20 9:59 UTC (permalink / raw)
To: Nicholas Piggin
Cc: linuxppc-dev, linux-arch, Nicolas Pitre, linux-kbuild,
Christophe LEROY
In-Reply-To: <20180420073414.23169-1-npiggin@gmail.com>
On Fri, Apr 20, 2018 at 9:34 AM, Nicholas Piggin <npiggin@gmail.com> wrote:
> A few people have been interested in this again. And I promised
> if it remains dead code it should be removed, so I would like to
> have another try.
>
> I think I got snagged on the modules problem last time and did
> not take the time to work it out, this time I just turned off the
> compile options for modules (the linker option was never set anyway
> so no loss).
>
> This includes some linker script catches and ideas from others, I
> didn't documnt them all, but thanks for looking.
This series works for me. v2 from Christophe was triggering a kernel
panic (call stack mentioned set_pte_at...).
So if needed:
Tested-by: Mathieu Malaterre <malat@debian.org>
Env: Mac Mini G4, with custom config.
> I would be interested to help other archs get this working too, if
> anybody needs some help.
>
> Thanks,
> Nick
>
> Nicholas Piggin (4):
> kbuild: Fix asm-generic/vmlinux.lds.h for
> LD_DEAD_CODE_DATA_ELIMINATION
> kbuild: LD_DEAD_CODE_DATA_ELIMINATION no
> -ffunction-sections/-fdata-sections for module build
> kbuild: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selectable if
> enabled
> powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected
>
> Makefile | 4 +--
> arch/Kconfig | 15 ----------
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/kernel/vmlinux.lds.S | 22 +++++++-------
> include/asm-generic/vmlinux.lds.h | 49 ++++++++++++++++++-------------
> init/Kconfig | 27 +++++++++++++++++
> 6 files changed, 70 insertions(+), 48 deletions(-)
>
> --
> 2.17.0
>
^ permalink raw reply
* Re: [PATCH 4/4] powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected
From: Mathieu Malaterre @ 2018-04-20 10:00 UTC (permalink / raw)
To: Nicholas Piggin; +Cc: linuxppc-dev, linux-arch, Nicolas Pitre, linux-kbuild
In-Reply-To: <20180420073414.23169-5-npiggin@gmail.com>
On Fri, Apr 20, 2018 at 9:34 AM, Nicholas Piggin <npiggin@gmail.com> wrote:
> This requires further changes to linker script to KEEP some tables
> and wildcard compiler generated sections into the right place. This
> includes pp32 modifications from Christophe Leroy.
>
> When compiling powernv_defconfig with this option:
>
> text data bss dec filename
> 11827621 4810490 1341080 17979191 vmlinux
> 11752437 4598858 1338776 17690071 vmlinux.dcde
>
> Resulting kernel is almost 400kB smaller (and still boots).
>
> [ppc32 numbers here]
^^^
Do you want somebody else to provide those numbers ?
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/kernel/vmlinux.lds.S | 22 +++++++++++-----------
> 2 files changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index c32a181a7cbb..ee6dbe2efc8b 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -205,6 +205,7 @@ config PPC
> select HAVE_KPROBES
> select HAVE_KPROBES_ON_FTRACE
> select HAVE_KRETPROBES
> + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
> select HAVE_LIVEPATCH if HAVE_DYNAMIC_FTRACE_WITH_REGS
> select HAVE_MEMBLOCK
> select HAVE_MEMBLOCK_NODE_MAP
> diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
> index c8af90ff49f0..89381dc959ce 100644
> --- a/arch/powerpc/kernel/vmlinux.lds.S
> +++ b/arch/powerpc/kernel/vmlinux.lds.S
> @@ -89,7 +89,7 @@ SECTIONS
> */
> .text BLOCK(0) : AT(ADDR(.text) - LOAD_OFFSET) {
> #ifdef CONFIG_LD_HEAD_STUB_CATCH
> - *(.linker_stub_catch);
> + KEEP(*(.linker_stub_catch));
> . = . ;
> #endif
>
> @@ -98,7 +98,7 @@ SECTIONS
> ALIGN_FUNCTION();
> #endif
> /* careful! __ftr_alt_* sections need to be close to .text */
> - *(.text.hot .text .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
> + *(.text.hot .text .text.[0-9a-zA-Z_]* .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
> SCHED_TEXT
> CPUIDLE_TEXT
> LOCK_TEXT
> @@ -170,10 +170,10 @@ SECTIONS
> .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
> INIT_DATA
> __vtop_table_begin = .;
> - *(.vtop_fixup);
> + KEEP(*(.vtop_fixup));
> __vtop_table_end = .;
> __ptov_table_begin = .;
> - *(.ptov_fixup);
> + KEEP(*(.ptov_fixup));
> __ptov_table_end = .;
> }
>
> @@ -194,26 +194,26 @@ SECTIONS
> . = ALIGN(8);
> __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) {
> __start___ftr_fixup = .;
> - *(__ftr_fixup)
> + KEEP(*(__ftr_fixup))
> __stop___ftr_fixup = .;
> }
> . = ALIGN(8);
> __mmu_ftr_fixup : AT(ADDR(__mmu_ftr_fixup) - LOAD_OFFSET) {
> __start___mmu_ftr_fixup = .;
> - *(__mmu_ftr_fixup)
> + KEEP(*(__mmu_ftr_fixup))
> __stop___mmu_ftr_fixup = .;
> }
> . = ALIGN(8);
> __lwsync_fixup : AT(ADDR(__lwsync_fixup) - LOAD_OFFSET) {
> __start___lwsync_fixup = .;
> - *(__lwsync_fixup)
> + KEEP(*(__lwsync_fixup))
> __stop___lwsync_fixup = .;
> }
> #ifdef CONFIG_PPC64
> . = ALIGN(8);
> __fw_ftr_fixup : AT(ADDR(__fw_ftr_fixup) - LOAD_OFFSET) {
> __start___fw_ftr_fixup = .;
> - *(__fw_ftr_fixup)
> + KEEP(*(__fw_ftr_fixup))
> __stop___fw_ftr_fixup = .;
> }
> #endif
> @@ -226,7 +226,7 @@ SECTIONS
> . = ALIGN(8);
> .machine.desc : AT(ADDR(.machine.desc) - LOAD_OFFSET) {
> __machine_desc_start = . ;
> - *(.machine.desc)
> + KEEP(*(.machine.desc))
> __machine_desc_end = . ;
> }
> #ifdef CONFIG_RELOCATABLE
> @@ -274,7 +274,7 @@ SECTIONS
> .data : AT(ADDR(.data) - LOAD_OFFSET) {
> DATA_DATA
> *(.data.rel*)
> - *(.sdata)
> + *(SDATA_MAIN)
> *(.sdata2)
> *(.got.plt) *(.got)
> *(.plt)
> @@ -289,7 +289,7 @@ SECTIONS
>
> .opd : AT(ADDR(.opd) - LOAD_OFFSET) {
> __start_opd = .;
> - *(.opd)
> + KEEP(*(.opd))
> __end_opd = .;
> }
>
> --
> 2.17.0
>
^ permalink raw reply
* Re: [PATCH 4/4] powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected
From: Christophe LEROY @ 2018-04-20 10:01 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev; +Cc: linux-arch, linux-kbuild, Nicolas Pitre
In-Reply-To: <20180420073414.23169-5-npiggin@gmail.com>
Le 20/04/2018 à 09:34, Nicholas Piggin a écrit :
> This requires further changes to linker script to KEEP some tables
> and wildcard compiler generated sections into the right place. This
> includes pp32 modifications from Christophe Leroy.
>
> When compiling powernv_defconfig with this option:
>
> text data bss dec filename
> 11827621 4810490 1341080 17979191 vmlinux
> 11752437 4598858 1338776 17690071 vmlinux.dcde
>
> Resulting kernel is almost 400kB smaller (and still boots).
>
> [ppc32 numbers here]
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/kernel/vmlinux.lds.S | 22 +++++++++++-----------
> 2 files changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index c32a181a7cbb..ee6dbe2efc8b 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -205,6 +205,7 @@ config PPC
> select HAVE_KPROBES
> select HAVE_KPROBES_ON_FTRACE
> select HAVE_KRETPROBES
> + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
> select HAVE_LIVEPATCH if HAVE_DYNAMIC_FTRACE_WITH_REGS
> select HAVE_MEMBLOCK
> select HAVE_MEMBLOCK_NODE_MAP
> diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
> index c8af90ff49f0..89381dc959ce 100644
> --- a/arch/powerpc/kernel/vmlinux.lds.S
> +++ b/arch/powerpc/kernel/vmlinux.lds.S
> @@ -89,7 +89,7 @@ SECTIONS
> */
> .text BLOCK(0) : AT(ADDR(.text) - LOAD_OFFSET) {
> #ifdef CONFIG_LD_HEAD_STUB_CATCH
> - *(.linker_stub_catch);
> + KEEP(*(.linker_stub_catch));
> . = . ;
> #endif
>
> @@ -98,7 +98,7 @@ SECTIONS
> ALIGN_FUNCTION();
> #endif
> /* careful! __ftr_alt_* sections need to be close to .text */
> - *(.text.hot .text .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
> + *(.text.hot .text .text.[0-9a-zA-Z_]* .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
Why not use TEXT_MAIN here instead of .text .text.[0-9a-zA-Z_]* ?
Christophe
> SCHED_TEXT
> CPUIDLE_TEXT
> LOCK_TEXT
> @@ -170,10 +170,10 @@ SECTIONS
> .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
> INIT_DATA
> __vtop_table_begin = .;
> - *(.vtop_fixup);
> + KEEP(*(.vtop_fixup));
> __vtop_table_end = .;
> __ptov_table_begin = .;
> - *(.ptov_fixup);
> + KEEP(*(.ptov_fixup));
> __ptov_table_end = .;
> }
>
> @@ -194,26 +194,26 @@ SECTIONS
> . = ALIGN(8);
> __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) {
> __start___ftr_fixup = .;
> - *(__ftr_fixup)
> + KEEP(*(__ftr_fixup))
> __stop___ftr_fixup = .;
> }
> . = ALIGN(8);
> __mmu_ftr_fixup : AT(ADDR(__mmu_ftr_fixup) - LOAD_OFFSET) {
> __start___mmu_ftr_fixup = .;
> - *(__mmu_ftr_fixup)
> + KEEP(*(__mmu_ftr_fixup))
> __stop___mmu_ftr_fixup = .;
> }
> . = ALIGN(8);
> __lwsync_fixup : AT(ADDR(__lwsync_fixup) - LOAD_OFFSET) {
> __start___lwsync_fixup = .;
> - *(__lwsync_fixup)
> + KEEP(*(__lwsync_fixup))
> __stop___lwsync_fixup = .;
> }
> #ifdef CONFIG_PPC64
> . = ALIGN(8);
> __fw_ftr_fixup : AT(ADDR(__fw_ftr_fixup) - LOAD_OFFSET) {
> __start___fw_ftr_fixup = .;
> - *(__fw_ftr_fixup)
> + KEEP(*(__fw_ftr_fixup))
> __stop___fw_ftr_fixup = .;
> }
> #endif
> @@ -226,7 +226,7 @@ SECTIONS
> . = ALIGN(8);
> .machine.desc : AT(ADDR(.machine.desc) - LOAD_OFFSET) {
> __machine_desc_start = . ;
> - *(.machine.desc)
> + KEEP(*(.machine.desc))
> __machine_desc_end = . ;
> }
> #ifdef CONFIG_RELOCATABLE
> @@ -274,7 +274,7 @@ SECTIONS
> .data : AT(ADDR(.data) - LOAD_OFFSET) {
> DATA_DATA
> *(.data.rel*)
> - *(.sdata)
> + *(SDATA_MAIN)
> *(.sdata2)
> *(.got.plt) *(.got)
> *(.plt)
> @@ -289,7 +289,7 @@ SECTIONS
>
> .opd : AT(ADDR(.opd) - LOAD_OFFSET) {
> __start_opd = .;
> - *(.opd)
> + KEEP(*(.opd))
> __end_opd = .;
> }
>
>
^ permalink raw reply
* Re: [PATCH 0/4] LD_DEAD_CODE_DATA_ELIMINATION fixes and enabling for powerpc
From: Christophe LEROY @ 2018-04-20 10:02 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev; +Cc: linux-arch, linux-kbuild, Nicolas Pitre
In-Reply-To: <20180420073414.23169-1-npiggin@gmail.com>
Le 20/04/2018 à 09:34, Nicholas Piggin a écrit :
> A few people have been interested in this again. And I promised
> if it remains dead code it should be removed, so I would like to
> have another try.
>
> I think I got snagged on the modules problem last time and did
> not take the time to work it out, this time I just turned off the
> compile options for modules (the linker option was never set anyway
> so no loss).
>
> This includes some linker script catches and ideas from others, I
> didn't documnt them all, but thanks for looking.
Thanks a lot.
It works well on both my 8xx and 83xx targets. I don't have
CONFIG_MODULE set.
Christophe
>
> I would be interested to help other archs get this working too, if
> anybody needs some help.
>
> Thanks,
> Nick
>
> Nicholas Piggin (4):
> kbuild: Fix asm-generic/vmlinux.lds.h for
> LD_DEAD_CODE_DATA_ELIMINATION
> kbuild: LD_DEAD_CODE_DATA_ELIMINATION no
> -ffunction-sections/-fdata-sections for module build
> kbuild: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selectable if
> enabled
> powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected
>
> Makefile | 4 +--
> arch/Kconfig | 15 ----------
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/kernel/vmlinux.lds.S | 22 +++++++-------
> include/asm-generic/vmlinux.lds.h | 49 ++++++++++++++++++-------------
> init/Kconfig | 27 +++++++++++++++++
> 6 files changed, 70 insertions(+), 48 deletions(-)
>
^ permalink raw reply
* Re: [PATCH 4/4] powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected
From: Nicholas Piggin @ 2018-04-20 10:36 UTC (permalink / raw)
To: Christophe LEROY; +Cc: linuxppc-dev, linux-arch, linux-kbuild, Nicolas Pitre
In-Reply-To: <5b495777-311b-ae81-6e07-6ae68f6da2b9@c-s.fr>
On Fri, 20 Apr 2018 12:01:34 +0200
Christophe LEROY <christophe.leroy@c-s.fr> wrote:
> Le 20/04/2018 à 09:34, Nicholas Piggin a écrit :
> > This requires further changes to linker script to KEEP some tables
> > and wildcard compiler generated sections into the right place. This
> > includes pp32 modifications from Christophe Leroy.
> >
> > When compiling powernv_defconfig with this option:
> >
> > text data bss dec filename
> > 11827621 4810490 1341080 17979191 vmlinux
> > 11752437 4598858 1338776 17690071 vmlinux.dcde
> >
> > Resulting kernel is almost 400kB smaller (and still boots).
> >
> > [ppc32 numbers here]
> >
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> > arch/powerpc/Kconfig | 1 +
> > arch/powerpc/kernel/vmlinux.lds.S | 22 +++++++++++-----------
> > 2 files changed, 12 insertions(+), 11 deletions(-)
> >
> > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > index c32a181a7cbb..ee6dbe2efc8b 100644
> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -205,6 +205,7 @@ config PPC
> > select HAVE_KPROBES
> > select HAVE_KPROBES_ON_FTRACE
> > select HAVE_KRETPROBES
> > + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
> > select HAVE_LIVEPATCH if HAVE_DYNAMIC_FTRACE_WITH_REGS
> > select HAVE_MEMBLOCK
> > select HAVE_MEMBLOCK_NODE_MAP
> > diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
> > index c8af90ff49f0..89381dc959ce 100644
> > --- a/arch/powerpc/kernel/vmlinux.lds.S
> > +++ b/arch/powerpc/kernel/vmlinux.lds.S
> > @@ -89,7 +89,7 @@ SECTIONS
> > */
> > .text BLOCK(0) : AT(ADDR(.text) - LOAD_OFFSET) {
> > #ifdef CONFIG_LD_HEAD_STUB_CATCH
> > - *(.linker_stub_catch);
> > + KEEP(*(.linker_stub_catch));
> > . = . ;
> > #endif
> >
> > @@ -98,7 +98,7 @@ SECTIONS
> > ALIGN_FUNCTION();
> > #endif
> > /* careful! __ftr_alt_* sections need to be close to .text */
> > - *(.text.hot .text .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
> > + *(.text.hot .text .text.[0-9a-zA-Z_]* .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
>
> Why not use TEXT_MAIN here instead of .text .text.[0-9a-zA-Z_]* ?
It's from my early patch before we added those in the generic linker
script. Yes your version looks nicer.
Thanks,
Nick
^ permalink raw reply
* Re: [PATCH 4/4] powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected
From: Christophe LEROY @ 2018-04-20 10:39 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev; +Cc: linux-arch, linux-kbuild, Nicolas Pitre
In-Reply-To: <20180420073414.23169-5-npiggin@gmail.com>
Le 20/04/2018 à 09:34, Nicholas Piggin a écrit :
> This requires further changes to linker script to KEEP some tables
> and wildcard compiler generated sections into the right place. This
> includes pp32 modifications from Christophe Leroy.
>
> When compiling powernv_defconfig with this option:
>
> text data bss dec filename
> 11827621 4810490 1341080 17979191 vmlinux
> 11752437 4598858 1338776 17690071 vmlinux.dcde
>
> Resulting kernel is almost 400kB smaller (and still boots).
>
> [ppc32 numbers here]
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Tested-by: Christophe Leroy <christophe.leroy@c-s.fr>
Tested on MPC885 and MPC8321E, CONFIG_MODULE unset.
Christophe
> ---
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/kernel/vmlinux.lds.S | 22 +++++++++++-----------
> 2 files changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index c32a181a7cbb..ee6dbe2efc8b 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -205,6 +205,7 @@ config PPC
> select HAVE_KPROBES
> select HAVE_KPROBES_ON_FTRACE
> select HAVE_KRETPROBES
> + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
> select HAVE_LIVEPATCH if HAVE_DYNAMIC_FTRACE_WITH_REGS
> select HAVE_MEMBLOCK
> select HAVE_MEMBLOCK_NODE_MAP
> diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
> index c8af90ff49f0..89381dc959ce 100644
> --- a/arch/powerpc/kernel/vmlinux.lds.S
> +++ b/arch/powerpc/kernel/vmlinux.lds.S
> @@ -89,7 +89,7 @@ SECTIONS
> */
> .text BLOCK(0) : AT(ADDR(.text) - LOAD_OFFSET) {
> #ifdef CONFIG_LD_HEAD_STUB_CATCH
> - *(.linker_stub_catch);
> + KEEP(*(.linker_stub_catch));
> . = . ;
> #endif
>
> @@ -98,7 +98,7 @@ SECTIONS
> ALIGN_FUNCTION();
> #endif
> /* careful! __ftr_alt_* sections need to be close to .text */
> - *(.text.hot .text .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
> + *(.text.hot .text .text.[0-9a-zA-Z_]* .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
> SCHED_TEXT
> CPUIDLE_TEXT
> LOCK_TEXT
> @@ -170,10 +170,10 @@ SECTIONS
> .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
> INIT_DATA
> __vtop_table_begin = .;
> - *(.vtop_fixup);
> + KEEP(*(.vtop_fixup));
> __vtop_table_end = .;
> __ptov_table_begin = .;
> - *(.ptov_fixup);
> + KEEP(*(.ptov_fixup));
> __ptov_table_end = .;
> }
>
> @@ -194,26 +194,26 @@ SECTIONS
> . = ALIGN(8);
> __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) {
> __start___ftr_fixup = .;
> - *(__ftr_fixup)
> + KEEP(*(__ftr_fixup))
> __stop___ftr_fixup = .;
> }
> . = ALIGN(8);
> __mmu_ftr_fixup : AT(ADDR(__mmu_ftr_fixup) - LOAD_OFFSET) {
> __start___mmu_ftr_fixup = .;
> - *(__mmu_ftr_fixup)
> + KEEP(*(__mmu_ftr_fixup))
> __stop___mmu_ftr_fixup = .;
> }
> . = ALIGN(8);
> __lwsync_fixup : AT(ADDR(__lwsync_fixup) - LOAD_OFFSET) {
> __start___lwsync_fixup = .;
> - *(__lwsync_fixup)
> + KEEP(*(__lwsync_fixup))
> __stop___lwsync_fixup = .;
> }
> #ifdef CONFIG_PPC64
> . = ALIGN(8);
> __fw_ftr_fixup : AT(ADDR(__fw_ftr_fixup) - LOAD_OFFSET) {
> __start___fw_ftr_fixup = .;
> - *(__fw_ftr_fixup)
> + KEEP(*(__fw_ftr_fixup))
> __stop___fw_ftr_fixup = .;
> }
> #endif
> @@ -226,7 +226,7 @@ SECTIONS
> . = ALIGN(8);
> .machine.desc : AT(ADDR(.machine.desc) - LOAD_OFFSET) {
> __machine_desc_start = . ;
> - *(.machine.desc)
> + KEEP(*(.machine.desc))
> __machine_desc_end = . ;
> }
> #ifdef CONFIG_RELOCATABLE
> @@ -274,7 +274,7 @@ SECTIONS
> .data : AT(ADDR(.data) - LOAD_OFFSET) {
> DATA_DATA
> *(.data.rel*)
> - *(.sdata)
> + *(SDATA_MAIN)
> *(.sdata2)
> *(.got.plt) *(.got)
> *(.plt)
> @@ -289,7 +289,7 @@ SECTIONS
>
> .opd : AT(ADDR(.opd) - LOAD_OFFSET) {
> __start_opd = .;
> - *(.opd)
> + KEEP(*(.opd))
> __end_opd = .;
> }
>
>
^ permalink raw reply
* Re: [PATCH 4/4] powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected
From: Nicholas Piggin @ 2018-04-20 10:41 UTC (permalink / raw)
To: Mathieu Malaterre; +Cc: linuxppc-dev, linux-arch, Nicolas Pitre, linux-kbuild
In-Reply-To: <CA+7wUswuyn+YgNe732rQAzVmgDBohTMEqwsd76nQ_CH5h7Y5WA@mail.gmail.com>
On Fri, 20 Apr 2018 12:00:49 +0200
Mathieu Malaterre <malat@debian.org> wrote:
> On Fri, Apr 20, 2018 at 9:34 AM, Nicholas Piggin <npiggin@gmail.com> wrote:
> > This requires further changes to linker script to KEEP some tables
> > and wildcard compiler generated sections into the right place. This
> > includes pp32 modifications from Christophe Leroy.
> >
> > When compiling powernv_defconfig with this option:
> >
> > text data bss dec filename
> > 11827621 4810490 1341080 17979191 vmlinux
> > 11752437 4598858 1338776 17690071 vmlinux.dcde
> >
> > Resulting kernel is almost 400kB smaller (and still boots).
> >
> > [ppc32 numbers here]
>
> ^^^
>
> Do you want somebody else to provide those numbers ?
If you have a booting kernel, yes some more numbers would be good.
Thanks,
Nick
^ permalink raw reply
* [PATCH] x86: ipc: fix x32 version of shmid64_ds and msqid64_ds
From: Arnd Bergmann @ 2018-04-20 13:03 UTC (permalink / raw)
To: x86, Thomas Gleixner, Ingo Molnar
Cc: ebiederm, y2038 Mailman List, linux-kernel, linux-api, linux-arch,
libc-alpha, Deepa Dinamani, Al Viro, Albert ARIBAUD, linux-s390,
schwidefsky, Catalin Marinas, will.deacon, linux-mips, jhogan,
Ralf Baechle, linuxppc-dev, sparclinux, Ben Hutchings,
Jeffrey Walton, Daniel Schepler, H . J . Lu, Adam Borowski, tg,
John Paul Adrian Glaubitz, Arnd Bergmann, stable, H. Peter Anvin
In-Reply-To: <CAK8P3a3qAoR1afmTTK1CAp1L81dzwtBL+SKj=QMqD=dBr_8oRQ@mail.gmail.com>
A bugfix broke the x32 shmid64_ds and msqid64_ds data structure layout
(as seen from user space) a few years ago: Originally, __BITS_PER_LONG
was defined as 64 on x32, so we did not have padding after the 64-bit
__kernel_time_t fields, After __BITS_PER_LONG got changed to 32,
applications would observe extra padding.
In other parts of the uapi headers we seem to have a mix of those
expecting either 32 or 64 on x32 applications, so we can't easily revert
the path that broke these two structures.
Instead, this patch decouples x32 from the other architectures and moves
it back into arch specific headers, partially reverting the even older
commit 73a2d096fdf2 ("x86: remove all now-duplicate header files").
It's not clear whether this ever made any difference, since at least
glibc carries its own (correct) copy of both of these header files,
so possibly no application has ever observed the definitions here.
There are other UAPI interfaces that depend on __BITS_PER_LONG and
that might suffer from the same problem on x32, but I have not tried to
analyse them in enough detail to be sure. If anyone still cares about x32,
that may be a useful thing to do.
Fixes: f4b4aae18288 ("x86/headers/uapi: Fix __BITS_PER_LONG value for x32 builds")
Cc: stable@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
This came out of the y2038 ipc syscall series but can be applied
and backported independently.
---
arch/x86/include/uapi/asm/msgbuf.h | 29 +++++++++++++++++++++++++++
arch/x86/include/uapi/asm/shmbuf.h | 40 ++++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+)
diff --git a/arch/x86/include/uapi/asm/msgbuf.h b/arch/x86/include/uapi/asm/msgbuf.h
index 809134c644a6..5f1604961e6d 100644
--- a/arch/x86/include/uapi/asm/msgbuf.h
+++ b/arch/x86/include/uapi/asm/msgbuf.h
@@ -1 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef __ASM_X64_MSGBUF_H
+#define __ASM_X64_MSGBUF_H
+
+#if !defined(__x86_64__) || !defined(__ilp32__)
#include <asm-generic/msgbuf.h>
+#else
+/*
+ * The msqid64_ds structure for x86 architecture with x32 ABI.
+ *
+ * On x86-32 and x86-64 we can just use the generic definition, but
+ * x32 uses the same binary layout as x86_64, which is differnet
+ * from other 32-bit architectures.
+ */
+
+struct msqid64_ds {
+ struct ipc64_perm msg_perm;
+ __kernel_time_t msg_stime; /* last msgsnd time */
+ __kernel_time_t msg_rtime; /* last msgrcv time */
+ __kernel_time_t msg_ctime; /* last change time */
+ __kernel_ulong_t msg_cbytes; /* current number of bytes on queue */
+ __kernel_ulong_t msg_qnum; /* number of messages in queue */
+ __kernel_ulong_t msg_qbytes; /* max number of bytes on queue */
+ __kernel_pid_t msg_lspid; /* pid of last msgsnd */
+ __kernel_pid_t msg_lrpid; /* last receive pid */
+ __kernel_ulong_t __unused4;
+ __kernel_ulong_t __unused5;
+};
+
+#endif /* __ASM_GENERIC_MSGBUF_H */
diff --git a/arch/x86/include/uapi/asm/shmbuf.h b/arch/x86/include/uapi/asm/shmbuf.h
index 83c05fc2de38..cdd7eec878fa 100644
--- a/arch/x86/include/uapi/asm/shmbuf.h
+++ b/arch/x86/include/uapi/asm/shmbuf.h
@@ -1 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef __ASM_X86_SHMBUF_H
+#define __ASM_X86_SHMBUF_H
+
+#if !defined(__x86_64__) || !defined(__ilp32__)
#include <asm-generic/shmbuf.h>
+#else
+/*
+ * The shmid64_ds structure for x86 architecture with x32 ABI.
+ *
+ * On x86-32 and x86-64 we can just use the generic definition, but
+ * x32 uses the same binary layout as x86_64, which is differnet
+ * from other 32-bit architectures.
+ */
+
+struct shmid64_ds {
+ struct ipc64_perm shm_perm; /* operation perms */
+ size_t shm_segsz; /* size of segment (bytes) */
+ __kernel_time_t shm_atime; /* last attach time */
+ __kernel_time_t shm_dtime; /* last detach time */
+ __kernel_time_t shm_ctime; /* last change time */
+ __kernel_pid_t shm_cpid; /* pid of creator */
+ __kernel_pid_t shm_lpid; /* pid of last operator */
+ __kernel_ulong_t shm_nattch; /* no. of current attaches */
+ __kernel_ulong_t __unused4;
+ __kernel_ulong_t __unused5;
+};
+
+struct shminfo64 {
+ __kernel_ulong_t shmmax;
+ __kernel_ulong_t shmmin;
+ __kernel_ulong_t shmmni;
+ __kernel_ulong_t shmseg;
+ __kernel_ulong_t shmall;
+ __kernel_ulong_t __unused1;
+ __kernel_ulong_t __unused2;
+ __kernel_ulong_t __unused3;
+ __kernel_ulong_t __unused4;
+};
+
+#endif /* __ASM_X86_SHMBUF_H */
--
2.9.0
^ permalink raw reply related
* Re: [PATCH 4/4] powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected
From: Christophe LEROY @ 2018-04-20 13:21 UTC (permalink / raw)
To: Nicholas Piggin; +Cc: linuxppc-dev, linux-arch, linux-kbuild, Nicolas Pitre
In-Reply-To: <20180420203658.73100c8b@roar.ozlabs.ibm.com>
Le 20/04/2018 à 12:36, Nicholas Piggin a écrit :
> On Fri, 20 Apr 2018 12:01:34 +0200
> Christophe LEROY <christophe.leroy@c-s.fr> wrote:
>
>> Le 20/04/2018 à 09:34, Nicholas Piggin a écrit :
>>> This requires further changes to linker script to KEEP some tables
>>> and wildcard compiler generated sections into the right place. This
>>> includes pp32 modifications from Christophe Leroy.
>>>
>>> When compiling powernv_defconfig with this option:
>>>
>>> text data bss dec filename
>>> 11827621 4810490 1341080 17979191 vmlinux
>>> 11752437 4598858 1338776 17690071 vmlinux.dcde
>>>
>>> Resulting kernel is almost 400kB smaller (and still boots).
>>>
>>> [ppc32 numbers here]
Here a few results, obtained with readelf -l vmlinux | grep LOAD
First val is filesz, second is memsz, for each config you get the size
before and after activation of LD_DCDE, and the difference between the two.
mpc83xx_defconfig:
Before: 0x5ecfe0 0x60b69c
After: 0x5d2fe0 0x5f04a4
Diff: 0x01a000 0x01b4c8
mpc83xx_defconfig without CONFIG_MODULE:
Before: 0x5c1040 0x5e0614
After: 0x55f040 0x57d314
Diff: 0x062000 0x063300
mpc885_ads_defconfig:
Before: 0x36eda4 0x38da04
After: 0x316da4 0x333764
Diff: 0x058000 0x05a2a0
Custom mpc885 config:
Before: 0x719948 0x78bc34
After: 0x6b9948 0x72a99c
Diff: 0x060000 0x061298
Custom mpc8321 config:
Before: 0x70f714 0x7d766c
After: 0x6af714 0x7763ec
Diff: 0x060000 0x061280
>>>
>>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>>> ---
>>> arch/powerpc/Kconfig | 1 +
>>> arch/powerpc/kernel/vmlinux.lds.S | 22 +++++++++++-----------
>>> 2 files changed, 12 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>>> index c32a181a7cbb..ee6dbe2efc8b 100644
>>> --- a/arch/powerpc/Kconfig
>>> +++ b/arch/powerpc/Kconfig
>>> @@ -205,6 +205,7 @@ config PPC
>>> select HAVE_KPROBES
>>> select HAVE_KPROBES_ON_FTRACE
>>> select HAVE_KRETPROBES
>>> + select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
>>> select HAVE_LIVEPATCH if HAVE_DYNAMIC_FTRACE_WITH_REGS
>>> select HAVE_MEMBLOCK
>>> select HAVE_MEMBLOCK_NODE_MAP
>>> diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
>>> index c8af90ff49f0..89381dc959ce 100644
>>> --- a/arch/powerpc/kernel/vmlinux.lds.S
>>> +++ b/arch/powerpc/kernel/vmlinux.lds.S
>>> @@ -89,7 +89,7 @@ SECTIONS
>>> */
>>> .text BLOCK(0) : AT(ADDR(.text) - LOAD_OFFSET) {
>>> #ifdef CONFIG_LD_HEAD_STUB_CATCH
>>> - *(.linker_stub_catch);
>>> + KEEP(*(.linker_stub_catch));
>>> . = . ;
>>> #endif
>>>
>>> @@ -98,7 +98,7 @@ SECTIONS
>>> ALIGN_FUNCTION();
>>> #endif
>>> /* careful! __ftr_alt_* sections need to be close to .text */
>>> - *(.text.hot .text .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
>>> + *(.text.hot .text .text.[0-9a-zA-Z_]* .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
>>
>> Why not use TEXT_MAIN here instead of .text .text.[0-9a-zA-Z_]* ?
>
> It's from my early patch before we added those in the generic linker
> script. Yes your version looks nicer.
>
> Thanks,
> Nick
>
^ permalink raw reply
* [GIT PULL] Please pull powerpc/linux.git powerpc-4.17-3 tag
From: Michael Ellerman @ 2018-04-20 13:28 UTC (permalink / raw)
To: Linus Torvalds; +Cc: benh, linux-kernel, linuxppc-dev, maddy, mikey, ruscur
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hi Linus,
Please pull some more powerpc fixes for 4.17:
The following changes since commit 60cc43fc888428bb2f18f08997432d426a243338:
Linux 4.17-rc1 (2018-04-15 18:24:20 -0700)
are available in the git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-4.17-3
for you to fetch changes up to 56376c5864f8ff4ba7c78a80ae857eee3b1d23d8:
powerpc/kvm: Fix lockups when running KVM guests on Power8 (2018-04-19 16:22:20 +1000)
- ----------------------------------------------------------------
powerpc fixes for 4.17 #3
Fix an off-by-one bug in our alternative asm patching which leads to incorrectly
patched code. This bug lay dormant for nearly 10 years but we finally hit it
due to a recent change.
Fix lockups when running KVM guests on Power8 due to a missing check when a
thread that's running KVM comes out of idle.
Fix an out-of-spec behaviour in the XIVE code (P9 interrupt controller).
Fix EEH handling of bridge MMIO windows.
Prevent crashes in our RFI fallback flush handler if firmware didn't tell us the
size of the L1 cache (only seen on simulators).
Thanks to:
Benjamin Herrenschmidt, Madhavan Srinivasan, Michael Neuling.
- ----------------------------------------------------------------
Benjamin Herrenschmidt (1):
powerpc/xive: Fix trying to "push" an already active pool VP
Madhavan Srinivasan (1):
powerpc/64s: Default l1d_size to 64K in RFI fallback flush
Michael Ellerman (2):
powerpc/lib: Fix off-by-one in alternate feature patching
powerpc/kvm: Fix lockups when running KVM guests on Power8
Michael Neuling (1):
powerpc/eeh: Fix enabling bridge MMIO windows
arch/powerpc/kernel/eeh_pe.c | 3 ++-
arch/powerpc/kernel/idle_book3s.S | 4 ++--
arch/powerpc/kernel/setup_64.c | 11 +++++++++++
arch/powerpc/lib/feature-fixups.c | 2 +-
arch/powerpc/sysdev/xive/native.c | 4 ++++
5 files changed, 20 insertions(+), 4 deletions(-)
-----BEGIN PGP SIGNATURE-----
iQIcBAEBCAAGBQJa2er8AAoJEFHr6jzI4aWAnc4P/2uaDmQ4NN9ETvsn11Ii6y9B
umuQ/TnFmS8piP9LrLyh5A0DNEheEizLf44qJDaXfgnJtV2+ZgKeW8kyzpdOYH1F
B6+Rq25gZ2ItBrKv8vrcfGyBFplVfSfg3KO/NC2tBoB/COCKA2lj6lxo1CvZ8BLq
Ov05mm2grmQ20XJgFQjAiK+GT6JKsra5Vc8WcpX3xj4DOP9yXvJpm5Ui+1RpqK0U
ZuKHocSKUQdIvQBuPcrqU6IVHN51lQLtvb//s3TUpMRS7sb7/y4VHBou93FsT8LZ
rjNKM4104u79ZN7SERRF17bqdY0fgmqHeAB1U8lxP8QvYo14z5ix99d9KjunDHt2
IRI25AhgHo4dfdcFr7sl3fg+85/Njwj4T7a2KPGw0FW4dIwPklodYzxnlVpbBQMB
92J8fKC6G0UsVza2KLySuGY1AO1FvAXw+84JfeqpBsShpH7op2QSa7GjxgF7YeXz
w0guFuUKBOlmiyuuTaq7HPGNVZBqmyAIpTaTKmv/L7pnaOY/fL14y4zPyKDav9VN
E6wLxqh0b1kOMaOzZelps8Isrd/5LCx9wmv6TnZCjGazoy6GtV0NTt4Nl8l0wjJW
uvDm8h6MOnwLG282OyKBJee79vBxKUey3cl41Y5DCkqJDmymnqTCCn/lF24zJ3nf
qpYttmW/n2nfdR/VSEZM
=UKi3
-----END PGP SIGNATURE-----
^ permalink raw reply
* Re: [PATCH] x86: ipc: fix x32 version of shmid64_ds and msqid64_ds
From: Jeffrey Walton @ 2018-04-20 13:53 UTC (permalink / raw)
To: Arnd Bergmann
Cc: x86, Thomas Gleixner, Ingo Molnar, ebiederm, y2038 Mailman List,
LKML, linux-api, linux-arch, libc-alpha, Deepa Dinamani, Al Viro,
Albert ARIBAUD, linux-s390, schwidefsky, Catalin Marinas,
Will Deacon, linux-mips, jhogan, Ralf Baechle, linuxppc-dev,
sparclinux, Ben Hutchings, Daniel Schepler, H . J . Lu,
Adam Borowski, tg, John Paul Adrian Glaubitz, stable,
H. Peter Anvin
In-Reply-To: <20180420130346.3178914-1-arnd@arndb.de>
Hi Arnd,
One comment here:
> +#if !defined(__x86_64__) || !defined(__ilp32__)
> #include <asm-generic/msgbuf.h>
> +#else
I understand there's some progress having Clang compile the kernel.
Clang treats __ILP32__ and friends differently than GCC. I believe
ILP32 shows up just about everywhere there are 32-bit ints, longs and
pointers. You might find it on Aarch64 or you might find it on MIPS64
when using Clang.
I think that means this may be a little suspicious:
> +#if !defined(__x86_64__) || !defined(__ilp32__)
I kind of felt LLVM was wandering away from the x32 ABI, but the LLVM
devs insisted they were within their purview. Also see
https://lists.llvm.org/pipermail/cfe-dev/2015-December/046300.html.
Sorry about the top-post. I just wanted to pick out that one piece.
Jeff
On Fri, Apr 20, 2018 at 9:03 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> A bugfix broke the x32 shmid64_ds and msqid64_ds data structure layout
> (as seen from user space) a few years ago: Originally, __BITS_PER_LONG
> was defined as 64 on x32, so we did not have padding after the 64-bit
> __kernel_time_t fields, After __BITS_PER_LONG got changed to 32,
> applications would observe extra padding.
>
> In other parts of the uapi headers we seem to have a mix of those
> expecting either 32 or 64 on x32 applications, so we can't easily revert
> the path that broke these two structures.
>
> Instead, this patch decouples x32 from the other architectures and moves
> it back into arch specific headers, partially reverting the even older
> commit 73a2d096fdf2 ("x86: remove all now-duplicate header files").
>
> It's not clear whether this ever made any difference, since at least
> glibc carries its own (correct) copy of both of these header files,
> so possibly no application has ever observed the definitions here.
>
> There are other UAPI interfaces that depend on __BITS_PER_LONG and
> that might suffer from the same problem on x32, but I have not tried to
> analyse them in enough detail to be sure. If anyone still cares about x32,
> that may be a useful thing to do.
>
> Fixes: f4b4aae18288 ("x86/headers/uapi: Fix __BITS_PER_LONG value for x32 builds")
> Cc: stable@vger.kernel.org
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> This came out of the y2038 ipc syscall series but can be applied
> and backported independently.
> ---
> arch/x86/include/uapi/asm/msgbuf.h | 29 +++++++++++++++++++++++++++
> arch/x86/include/uapi/asm/shmbuf.h | 40 ++++++++++++++++++++++++++++++++++++++
> 2 files changed, 69 insertions(+)
>
> diff --git a/arch/x86/include/uapi/asm/msgbuf.h b/arch/x86/include/uapi/asm/msgbuf.h
> index 809134c644a6..5f1604961e6d 100644
> --- a/arch/x86/include/uapi/asm/msgbuf.h
> +++ b/arch/x86/include/uapi/asm/msgbuf.h
> @@ -1 +1,30 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +#ifndef __ASM_X64_MSGBUF_H
> +#define __ASM_X64_MSGBUF_H
> +
> +#if !defined(__x86_64__) || !defined(__ilp32__)
> #include <asm-generic/msgbuf.h>
> +#else
> +/*
> + * The msqid64_ds structure for x86 architecture with x32 ABI.
> + *
> + * On x86-32 and x86-64 we can just use the generic definition, but
> + * x32 uses the same binary layout as x86_64, which is differnet
> + * from other 32-bit architectures.
> + */
> +
> +struct msqid64_ds {
> + struct ipc64_perm msg_perm;
> + __kernel_time_t msg_stime; /* last msgsnd time */
> + __kernel_time_t msg_rtime; /* last msgrcv time */
> + __kernel_time_t msg_ctime; /* last change time */
> + __kernel_ulong_t msg_cbytes; /* current number of bytes on queue */
> + __kernel_ulong_t msg_qnum; /* number of messages in queue */
> + __kernel_ulong_t msg_qbytes; /* max number of bytes on queue */
> + __kernel_pid_t msg_lspid; /* pid of last msgsnd */
> + __kernel_pid_t msg_lrpid; /* last receive pid */
> + __kernel_ulong_t __unused4;
> + __kernel_ulong_t __unused5;
> +};
> +
> +#endif /* __ASM_GENERIC_MSGBUF_H */
> diff --git a/arch/x86/include/uapi/asm/shmbuf.h b/arch/x86/include/uapi/asm/shmbuf.h
> index 83c05fc2de38..cdd7eec878fa 100644
> --- a/arch/x86/include/uapi/asm/shmbuf.h
> +++ b/arch/x86/include/uapi/asm/shmbuf.h
> @@ -1 +1,41 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +#ifndef __ASM_X86_SHMBUF_H
> +#define __ASM_X86_SHMBUF_H
> +
> +#if !defined(__x86_64__) || !defined(__ilp32__)
> #include <asm-generic/shmbuf.h>
> +#else
> +/*
> + * The shmid64_ds structure for x86 architecture with x32 ABI.
> + *
> + * On x86-32 and x86-64 we can just use the generic definition, but
> + * x32 uses the same binary layout as x86_64, which is differnet
> + * from other 32-bit architectures.
> + */
> +
> +struct shmid64_ds {
> + struct ipc64_perm shm_perm; /* operation perms */
> + size_t shm_segsz; /* size of segment (bytes) */
> + __kernel_time_t shm_atime; /* last attach time */
> + __kernel_time_t shm_dtime; /* last detach time */
> + __kernel_time_t shm_ctime; /* last change time */
> + __kernel_pid_t shm_cpid; /* pid of creator */
> + __kernel_pid_t shm_lpid; /* pid of last operator */
> + __kernel_ulong_t shm_nattch; /* no. of current attaches */
> + __kernel_ulong_t __unused4;
> + __kernel_ulong_t __unused5;
> +};
> +
> +struct shminfo64 {
> + __kernel_ulong_t shmmax;
> + __kernel_ulong_t shmmin;
> + __kernel_ulong_t shmmni;
> + __kernel_ulong_t shmseg;
> + __kernel_ulong_t shmall;
> + __kernel_ulong_t __unused1;
> + __kernel_ulong_t __unused2;
> + __kernel_ulong_t __unused3;
> + __kernel_ulong_t __unused4;
> +};
> +
> +#endif /* __ASM_X86_SHMBUF_H */
^ permalink raw reply
* Re: [PATCH] x86: ipc: fix x32 version of shmid64_ds and msqid64_ds
From: Arnd Bergmann @ 2018-04-20 14:38 UTC (permalink / raw)
To: Jeffrey Walton
Cc: the arch/x86 maintainers, Thomas Gleixner, Ingo Molnar,
Eric W . Biederman, y2038 Mailman List, LKML, Linux API,
linux-arch, GNU C Library, Deepa Dinamani, Al Viro,
Albert ARIBAUD, linux-s390, Martin Schwidefsky, Catalin Marinas,
Will Deacon, open list:RALINK MIPS ARCHITECTURE, James Hogan,
Ralf Baechle, linuxppc-dev, sparclinux, Ben Hutchings,
Daniel Schepler, H . J . Lu, Adam Borowski, tg,
John Paul Adrian Glaubitz, # 3.4.x, H. Peter Anvin
In-Reply-To: <CAH8yC8mnfNnG86kgjnfwiZJ0=qN+w=5PVcLcxddaJdDtYbSanA@mail.gmail.com>
On Fri, Apr 20, 2018 at 3:53 PM, Jeffrey Walton <noloader@gmail.com> wrote:
>> +#if !defined(__x86_64__) || !defined(__ilp32__)
>> #include <asm-generic/msgbuf.h>
>> +#else
>
> I understand there's some progress having Clang compile the kernel.
> Clang treats __ILP32__ and friends differently than GCC. I believe
> ILP32 shows up just about everywhere there are 32-bit ints, longs and
> pointers. You might find it on Aarch64 or you might find it on MIPS64
> when using Clang.
>
> I think that means this may be a little suspicious:
>
> > +#if !defined(__x86_64__) || !defined(__ilp32__)
>
> I kind of felt LLVM was wandering away from the x32 ABI, but the LLVM
> devs insisted they were within their purview. Also see
> https://lists.llvm.org/pipermail/cfe-dev/2015-December/046300.html.
>
> Sorry about the top-post. I just wanted to pick out that one piece.
It seems I made a typo and it needs to be __ILP32__ rather than
__ilp32__ (corrected that locally, will resend once we have resolved
this).
Aside from that, the #if check seems to be correct to me: this
is an x86-specific header, so it won't ever be seen on other
architectures. On x86-32, __x86_64__ isn't set, so we don't care
about whether __ilp32__ is set or not, and on x86-64 (lp64),
__ilp32__ is never set, so we still get the asm-generic header.
Arnd
^ permalink raw reply
* [PATCH v2] powerpc: platform: cell: spufs: Change return type to vm_fault_t
From: Souptick Joarder @ 2018-04-20 17:32 UTC (permalink / raw)
To: willy, jk, arnd, benh, paulus, mpe; +Cc: linuxppc-dev
Use new return type vm_fault_t for fault handler. For
now, this is just documenting that the function returns
a VM_FAULT value rather than an errno. Once all instances
are converted, vm_fault_t will become a distinct type.
Reference id -> 1c8f422059ae ("mm: change return type to
vm_fault_t")
We are fixing a minor bug, that the error from vm_insert_
pfn() was being ignored and the effect of this is likely
to be only felt in OOM situations.
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
---
arch/powerpc/platforms/cell/spufs/file.c | 33 +++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 469bdd0..43e7b93 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -232,12 +232,13 @@ static ssize_t spufs_attr_write(struct file *file, const char __user *buf,
return size;
}
-static int
+static vm_fault_t
spufs_mem_mmap_fault(struct vm_fault *vmf)
{
struct vm_area_struct *vma = vmf->vma;
struct spu_context *ctx = vma->vm_file->private_data;
unsigned long pfn, offset;
+ vm_fault_t ret;
offset = vmf->pgoff << PAGE_SHIFT;
if (offset >= LS_SIZE)
@@ -256,11 +257,11 @@ static ssize_t spufs_attr_write(struct file *file, const char __user *buf,
vma->vm_page_prot = pgprot_noncached_wc(vma->vm_page_prot);
pfn = (ctx->spu->local_store_phys + offset) >> PAGE_SHIFT;
}
- vm_insert_pfn(vma, vmf->address, pfn);
+ ret = vmf_insert_pfn(vma, vmf->address, pfn);
spu_release(ctx);
- return VM_FAULT_NOPAGE;
+ return ret;
}
static int spufs_mem_mmap_access(struct vm_area_struct *vma,
@@ -312,13 +313,14 @@ static int spufs_mem_mmap(struct file *file, struct vm_area_struct *vma)
.mmap = spufs_mem_mmap,
};
-static int spufs_ps_fault(struct vm_fault *vmf,
+static vm_fault_t spufs_ps_fault(struct vm_fault *vmf,
unsigned long ps_offs,
unsigned long ps_size)
{
struct spu_context *ctx = vmf->vma->vm_file->private_data;
unsigned long area, offset = vmf->pgoff << PAGE_SHIFT;
- int ret = 0;
+ int err = 0;
+ vm_fault_t ret = VM_FAULT_NOPAGE;
spu_context_nospu_trace(spufs_ps_fault__enter, ctx);
@@ -349,25 +351,26 @@ static int spufs_ps_fault(struct vm_fault *vmf,
if (ctx->state == SPU_STATE_SAVED) {
up_read(¤t->mm->mmap_sem);
spu_context_nospu_trace(spufs_ps_fault__sleep, ctx);
- ret = spufs_wait(ctx->run_wq, ctx->state == SPU_STATE_RUNNABLE);
+ err = spufs_wait(ctx->run_wq, ctx->state == SPU_STATE_RUNNABLE);
spu_context_trace(spufs_ps_fault__wake, ctx, ctx->spu);
down_read(¤t->mm->mmap_sem);
} else {
area = ctx->spu->problem_phys + ps_offs;
- vm_insert_pfn(vmf->vma, vmf->address, (area + offset) >> PAGE_SHIFT);
+ ret = vmf_insert_pfn(vmf->vma, vmf->address,
+ (area + offset) >> PAGE_SHIFT);
spu_context_trace(spufs_ps_fault__insert, ctx, ctx->spu);
}
- if (!ret)
+ if (!err)
spu_release(ctx);
refault:
put_spu_context(ctx);
- return VM_FAULT_NOPAGE;
+ return ret;
}
#if SPUFS_MMAP_4K
-static int spufs_cntl_mmap_fault(struct vm_fault *vmf)
+static vm_fault_t spufs_cntl_mmap_fault(struct vm_fault *vmf)
{
return spufs_ps_fault(vmf, 0x4000, SPUFS_CNTL_MAP_SIZE);
}
@@ -1040,7 +1043,7 @@ static ssize_t spufs_signal1_write(struct file *file, const char __user *buf,
return 4;
}
-static int
+static vm_fault_t
spufs_signal1_mmap_fault(struct vm_fault *vmf)
{
#if SPUFS_SIGNAL_MAP_SIZE == 0x1000
@@ -1178,7 +1181,7 @@ static ssize_t spufs_signal2_write(struct file *file, const char __user *buf,
}
#if SPUFS_MMAP_4K
-static int
+static vm_fault_t
spufs_signal2_mmap_fault(struct vm_fault *vmf)
{
#if SPUFS_SIGNAL_MAP_SIZE == 0x1000
@@ -1307,7 +1310,7 @@ static u64 spufs_signal2_type_get(struct spu_context *ctx)
spufs_signal2_type_set, "%llu\n", SPU_ATTR_ACQUIRE);
#if SPUFS_MMAP_4K
-static int
+static vm_fault_t
spufs_mss_mmap_fault(struct vm_fault *vmf)
{
return spufs_ps_fault(vmf, 0x0000, SPUFS_MSS_MAP_SIZE);
@@ -1369,7 +1372,7 @@ static int spufs_mss_open(struct inode *inode, struct file *file)
.llseek = no_llseek,
};
-static int
+static vm_fault_t
spufs_psmap_mmap_fault(struct vm_fault *vmf)
{
return spufs_ps_fault(vmf, 0x0000, SPUFS_PS_MAP_SIZE);
@@ -1429,7 +1432,7 @@ static int spufs_psmap_open(struct inode *inode, struct file *file)
#if SPUFS_MMAP_4K
-static int
+static vm_fault_t
spufs_mfc_mmap_fault(struct vm_fault *vmf)
{
return spufs_ps_fault(vmf, 0x3000, SPUFS_MFC_MAP_SIZE);
--
1.9.1
^ permalink raw reply related
* [PATCH net] ibmvnic: Clean actual number of RX or TX pools
From: Thomas Falcon @ 2018-04-20 19:25 UTC (permalink / raw)
To: netdev; +Cc: nfont, jallen, linuxppc-dev, Thomas Falcon
Avoid using value stored in the login response buffer when
cleaning TX and RX buffer pools since these could be inconsistent
depending on the device state. Instead use the field in the driver's
private data that tracks the number of active pools.
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 2df01ad..6e8d6a6 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1128,7 +1128,7 @@ static void clean_rx_pools(struct ibmvnic_adapter *adapter)
if (!adapter->rx_pool)
return;
- rx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_rxadd_subcrqs);
+ rx_scrqs = adapter->num_active_rx_pools;
rx_entries = adapter->req_rx_add_entries_per_subcrq;
/* Free any remaining skbs in the rx buffer pools */
@@ -1177,7 +1177,7 @@ static void clean_tx_pools(struct ibmvnic_adapter *adapter)
if (!adapter->tx_pool || !adapter->tso_pool)
return;
- tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs);
+ tx_scrqs = adapter->num_active_tx_pools;
/* Free any remaining skbs in the tx buffer pools */
for (i = 0; i < tx_scrqs; i++) {
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH 4/4] powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected
From: Mathieu Malaterre @ 2018-04-20 20:08 UTC (permalink / raw)
To: Nicholas Piggin; +Cc: linuxppc-dev, linux-arch, Nicolas Pitre, linux-kbuild
In-Reply-To: <20180420204104.6e22b136@roar.ozlabs.ibm.com>
On Fri, Apr 20, 2018 at 12:41 PM, Nicholas Piggin <npiggin@gmail.com> wrote:
> On Fri, 20 Apr 2018 12:00:49 +0200
> Mathieu Malaterre <malat@debian.org> wrote:
>
>> On Fri, Apr 20, 2018 at 9:34 AM, Nicholas Piggin <npiggin@gmail.com> wrote:
>> > This requires further changes to linker script to KEEP some tables
>> > and wildcard compiler generated sections into the right place. This
>> > includes pp32 modifications from Christophe Leroy.
>> >
>> > When compiling powernv_defconfig with this option:
>> >
>> > text data bss dec filename
>> > 11827621 4810490 1341080 17979191 vmlinux
>> > 11752437 4598858 1338776 17690071 vmlinux.dcde
>> >
>> > Resulting kernel is almost 400kB smaller (and still boots).
>> >
>> > [ppc32 numbers here]
>>
>> ^^^
>>
>> Do you want somebody else to provide those numbers ?
>
> If you have a booting kernel, yes some more numbers would be good.
I've used /boot/config-4.15.0-2-powerpc from my current debian
package. Rebuild master with and without option, boot ok, load/unload
module ok.
$ size nick/vmlinux.with*
text data bss dec hex filename
7386425 2364370 1425432 11176227 aa8923 nick/vmlinux.with
7461457 2475122 1428064 11364643 ad6923 nick/vmlinux.without
This is not clear why with option the size of kernel is slightly bigger:
$ du -sk nick/vmlinux.with*
124488 nick/vmlinux.with
124004 nick/vmlinux.without
> Thanks,
> Nick
^ permalink raw reply
* [PATCH] pseries/memory-hotplug: Only update DT once per memory DLPAR request
From: Nathan Fontenot @ 2018-04-20 20:29 UTC (permalink / raw)
To: linuxppc-dev; +Cc: jallen
The updates to powerpc numa and memory hotplug code now use the
in-kernel LMB array instead of the device tree. This change
allows the pseries memory DLPAR code to only update the device
tree once after successfully handling a DLPAR request.
Prior to the in-kernel LMB array, the numa code looked up the
affinity for memory being added in the device tree, the code
now looks this up in the LMB array. This change means the
memory hotplug code can just update the affinity for an LMB
in the LMB array instead of updating the device tree.
This also provides a savings in kernel memory. When updating the
device tree old properties are never free'ed since there is no
usecount on properties. This behavior leads to a new copy of the
property being allocated every time a LMB is added or removed
(i.e. a request to add 100 LMBs creates 100 new copies of the
property). With this update only a single new property is created
when a DLPAR request completes successfully.
Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/drmem.h | 5 ++
arch/powerpc/platforms/pseries/hotplug-memory.c | 55 +++++++----------------
2 files changed, 21 insertions(+), 39 deletions(-)
diff --git a/arch/powerpc/include/asm/drmem.h b/arch/powerpc/include/asm/drmem.h
index ce242b9ea8c6..7c1d8e74b25d 100644
--- a/arch/powerpc/include/asm/drmem.h
+++ b/arch/powerpc/include/asm/drmem.h
@@ -99,4 +99,9 @@ void __init walk_drmem_lmbs_early(unsigned long node,
void (*func)(struct drmem_lmb *, const __be32 **));
#endif
+static inline void invalidate_lmb_associativity_index(struct drmem_lmb *lmb)
+{
+ lmb->aa_index = 0xffffffff;
+}
+
#endif /* _ASM_POWERPC_LMB_H */
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index c1578f54c626..9a15d39995e5 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -163,7 +163,7 @@ static u32 find_aa_index(struct device_node *dr_node,
return aa_index;
}
-static u32 lookup_lmb_associativity_index(struct drmem_lmb *lmb)
+static int update_lmb_associativity_index(struct drmem_lmb *lmb)
{
struct device_node *parent, *lmb_node, *dr_node;
struct property *ala_prop;
@@ -203,43 +203,14 @@ static u32 lookup_lmb_associativity_index(struct drmem_lmb *lmb)
aa_index = find_aa_index(dr_node, ala_prop, lmb_assoc);
dlpar_free_cc_nodes(lmb_node);
- return aa_index;
-}
-
-static int dlpar_add_device_tree_lmb(struct drmem_lmb *lmb)
-{
- int rc, aa_index;
-
- lmb->flags |= DRCONF_MEM_ASSIGNED;
- aa_index = lookup_lmb_associativity_index(lmb);
if (aa_index < 0) {
- pr_err("Couldn't find associativity index for drc index %x\n",
- lmb->drc_index);
- return aa_index;
+ pr_err("Could not find LMB associativity\n");
+ return -1;
}
lmb->aa_index = aa_index;
-
- rtas_hp_event = true;
- rc = drmem_update_dt();
- rtas_hp_event = false;
-
- return rc;
-}
-
-static int dlpar_remove_device_tree_lmb(struct drmem_lmb *lmb)
-{
- int rc;
-
- lmb->flags &= ~DRCONF_MEM_ASSIGNED;
- lmb->aa_index = 0xffffffff;
-
- rtas_hp_event = true;
- rc = drmem_update_dt();
- rtas_hp_event = false;
-
- return rc;
+ return 0;
}
static struct memory_block *lmb_to_memblock(struct drmem_lmb *lmb)
@@ -428,7 +399,9 @@ static int dlpar_remove_lmb(struct drmem_lmb *lmb)
/* Update memory regions for memory remove */
memblock_remove(lmb->base_addr, block_sz);
- dlpar_remove_device_tree_lmb(lmb);
+ invalidate_lmb_associativity_index(lmb);
+ lmb->flags &= ~DRCONF_MEM_ASSIGNED;
+
return 0;
}
@@ -688,10 +661,8 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb)
if (lmb->flags & DRCONF_MEM_ASSIGNED)
return -EINVAL;
- rc = dlpar_add_device_tree_lmb(lmb);
+ rc = update_lmb_associativity_index(lmb);
if (rc) {
- pr_err("Couldn't update device tree for drc index %x\n",
- lmb->drc_index);
dlpar_release_drc(lmb->drc_index);
return rc;
}
@@ -704,14 +675,14 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb)
/* Add the memory */
rc = add_memory(nid, lmb->base_addr, block_sz);
if (rc) {
- dlpar_remove_device_tree_lmb(lmb);
+ invalidate_lmb_associativity_index(lmb);
return rc;
}
rc = dlpar_online_lmb(lmb);
if (rc) {
remove_memory(nid, lmb->base_addr, block_sz);
- dlpar_remove_device_tree_lmb(lmb);
+ invalidate_lmb_associativity_index(lmb);
} else {
lmb->flags |= DRCONF_MEM_ASSIGNED;
}
@@ -958,6 +929,12 @@ int dlpar_memory(struct pseries_hp_errorlog *hp_elog)
break;
}
+ if (!rc) {
+ rtas_hp_event = true;
+ rc = drmem_update_dt();
+ rtas_hp_event = false;
+ }
+
unlock_device_hotplug();
return rc;
}
^ permalink raw reply related
* Re: [PATCH v2] powerpc: platform: cell: spufs: Change return type to vm_fault_t
From: Matthew Wilcox @ 2018-04-20 21:34 UTC (permalink / raw)
To: Souptick Joarder; +Cc: jk, arnd, benh, paulus, mpe, linuxppc-dev
In-Reply-To: <20180420173239.GA24560@jordon-HP-15-Notebook-PC>
On Fri, Apr 20, 2018 at 11:02:39PM +0530, Souptick Joarder wrote:
> Use new return type vm_fault_t for fault handler. For
> now, this is just documenting that the function returns
> a VM_FAULT value rather than an errno. Once all instances
> are converted, vm_fault_t will become a distinct type.
>
> Reference id -> 1c8f422059ae ("mm: change return type to
> vm_fault_t")
>
> We are fixing a minor bug, that the error from vm_insert_
> pfn() was being ignored and the effect of this is likely
> to be only felt in OOM situations.
>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
^ permalink raw reply
* Re: [PATCH 4/4] powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected
From: Nicholas Piggin @ 2018-04-21 2:48 UTC (permalink / raw)
To: Mathieu Malaterre; +Cc: linuxppc-dev, linux-arch, Nicolas Pitre, linux-kbuild
In-Reply-To: <CA+7wUsyWu3eweWjwfFoS5FD5yb3OxjLV4-XyErcNA4fJGPCf8Q@mail.gmail.com>
On Fri, 20 Apr 2018 22:08:27 +0200
Mathieu Malaterre <malat@debian.org> wrote:
> On Fri, Apr 20, 2018 at 12:41 PM, Nicholas Piggin <npiggin@gmail.com> wrote:
> > On Fri, 20 Apr 2018 12:00:49 +0200
> > Mathieu Malaterre <malat@debian.org> wrote:
> >
> >> On Fri, Apr 20, 2018 at 9:34 AM, Nicholas Piggin <npiggin@gmail.com> wrote:
> >> > This requires further changes to linker script to KEEP some tables
> >> > and wildcard compiler generated sections into the right place. This
> >> > includes pp32 modifications from Christophe Leroy.
> >> >
> >> > When compiling powernv_defconfig with this option:
> >> >
> >> > text data bss dec filename
> >> > 11827621 4810490 1341080 17979191 vmlinux
> >> > 11752437 4598858 1338776 17690071 vmlinux.dcde
> >> >
> >> > Resulting kernel is almost 400kB smaller (and still boots).
> >> >
> >> > [ppc32 numbers here]
> >>
> >> ^^^
> >>
> >> Do you want somebody else to provide those numbers ?
> >
> > If you have a booting kernel, yes some more numbers would be good.
>
> I've used /boot/config-4.15.0-2-powerpc from my current debian
> package. Rebuild master with and without option, boot ok, load/unload
> module ok.
>
> $ size nick/vmlinux.with*
> text data bss dec hex filename
> 7386425 2364370 1425432 11176227 aa8923 nick/vmlinux.with
> 7461457 2475122 1428064 11364643 ad6923 nick/vmlinux.without
>
> This is not clear why with option the size of kernel is slightly bigger:
>
> $ du -sk nick/vmlinux.with*
> 124488 nick/vmlinux.with
> 124004 nick/vmlinux.without
Not sure. readelf -S vmlinux may show something.
To really get lots of detail, you can add to the top level Makefile:
LDFLAGS_vmlinux += -M
Then it will print the link map for you and other details. Actually
it will output several times because we link vmlinux 2-3 times, so
just take the last one. There is a lot of data there.
^ permalink raw reply
* Re: [PATCH 4/4] powerpc: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selected
From: christophe leroy @ 2018-04-21 7:16 UTC (permalink / raw)
To: Mathieu Malaterre, Nicholas Piggin
Cc: linux-arch, linux-kbuild, linuxppc-dev, Nicolas Pitre
In-Reply-To: <CA+7wUsyWu3eweWjwfFoS5FD5yb3OxjLV4-XyErcNA4fJGPCf8Q@mail.gmail.com>
Le 20/04/2018 à 22:08, Mathieu Malaterre a écrit :
> On Fri, Apr 20, 2018 at 12:41 PM, Nicholas Piggin <npiggin@gmail.com> wrote:
>> On Fri, 20 Apr 2018 12:00:49 +0200
>> Mathieu Malaterre <malat@debian.org> wrote:
>>
>>> On Fri, Apr 20, 2018 at 9:34 AM, Nicholas Piggin <npiggin@gmail.com> wrote:
>>>> This requires further changes to linker script to KEEP some tables
>>>> and wildcard compiler generated sections into the right place. This
>>>> includes pp32 modifications from Christophe Leroy.
>>>>
>>>> When compiling powernv_defconfig with this option:
>>>>
>>>> text data bss dec filename
>>>> 11827621 4810490 1341080 17979191 vmlinux
>>>> 11752437 4598858 1338776 17690071 vmlinux.dcde
>>>>
>>>> Resulting kernel is almost 400kB smaller (and still boots).
>>>>
>>>> [ppc32 numbers here]
>>>
>>> ^^^
>>>
>>> Do you want somebody else to provide those numbers ?
>>
>> If you have a booting kernel, yes some more numbers would be good.
>
> I've used /boot/config-4.15.0-2-powerpc from my current debian
> package. Rebuild master with and without option, boot ok, load/unload
> module ok.
>
> $ size nick/vmlinux.with*
> text data bss dec hex filename
> 7386425 2364370 1425432 11176227 aa8923 nick/vmlinux.with
> 7461457 2475122 1428064 11364643 ad6923 nick/vmlinux.without
>
> This is not clear why with option the size of kernel is slightly bigger:
The file contains also debug symbols, which might differ.
Only the LOAD part of the file is interesting, that's the part you get
when doing ppc-linux-objcopy vmlinux vmlinux.bin -O binary
You can see it with readelf -l vmlinux
Christophe
>
> $ du -sk nick/vmlinux.with*
> 124488 nick/vmlinux.with
> 124004 nick/vmlinux.without
>
>
>> Thanks,
>> Nick
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
^ permalink raw reply
* [PATCH] crypto/nx: Initialize 842 high and normal RxFIFO control registers
From: Haren Myneni @ 2018-04-21 11:19 UTC (permalink / raw)
To: mpe, herbert; +Cc: linuxppc-dev, linux-crypto
NX increments readOffset by FIFO size in receive FIFO control register
when CRB is read. But the index in RxFIFO has to match with the
corresponding entry in FIFO maintained by VAS in kernel. Otherwise NX
may be processing incorrect CRBs and can cause CRB timeout.
VAS FIFO offset is 0 when the receive window is opened during
initialization. When the module is reloaded, readOffset in FIFO control
register may not match with VAS entry. So nx_coproc_init OPAL call is
executed once for each NX instance. This call resets readOffset and
queued values in FIFO control register for both high and normal FIFOs.
Signed-off-by: Haren Myneni <haren@us.ibm.com>
diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h
index d886a5b..ff61e4b 100644
--- a/arch/powerpc/include/asm/opal-api.h
+++ b/arch/powerpc/include/asm/opal-api.h
@@ -206,7 +206,8 @@
#define OPAL_NPU_TL_SET 161
#define OPAL_PCI_GET_PBCQ_TUNNEL_BAR 164
#define OPAL_PCI_SET_PBCQ_TUNNEL_BAR 165
-#define OPAL_LAST 165
+#define OPAL_NX_COPROC_INIT 167
+#define OPAL_LAST 167
/* Device tree flags */
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 7159e1a..d79eb82 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -288,6 +288,7 @@ int64_t opal_imc_counters_init(uint32_t type, uint64_t address,
int opal_get_power_shift_ratio(u32 handle, int token, u32 *psr);
int opal_set_power_shift_ratio(u32 handle, int token, u32 psr);
int opal_sensor_group_clear(u32 group_hndl, int token);
+int opal_nx_coproc_init(uint32_t chip_id, uint32_t ct);
s64 opal_signal_system_reset(s32 cpu);
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index 3da30c2..c7541a9 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -325,3 +325,4 @@ OPAL_CALL(opal_npu_spa_clear_cache, OPAL_NPU_SPA_CLEAR_CACHE);
OPAL_CALL(opal_npu_tl_set, OPAL_NPU_TL_SET);
OPAL_CALL(opal_pci_get_pbcq_tunnel_bar, OPAL_PCI_GET_PBCQ_TUNNEL_BAR);
OPAL_CALL(opal_pci_set_pbcq_tunnel_bar, OPAL_PCI_SET_PBCQ_TUNNEL_BAR);
+OPAL_CALL(opal_nx_coproc_init, OPAL_NX_COPROC_INIT);
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 48fbb41..5e13908 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -1035,3 +1035,5 @@ void powernv_set_nmmu_ptcr(unsigned long ptcr)
EXPORT_SYMBOL_GPL(opal_int_set_mfrr);
EXPORT_SYMBOL_GPL(opal_int_eoi);
EXPORT_SYMBOL_GPL(opal_error_code);
+/* Export the below symbol for NX compression */
+EXPORT_SYMBOL(opal_nx_coproc_init);
diff --git a/drivers/crypto/nx/nx-842-powernv.c b/drivers/crypto/nx/nx-842-powernv.c
index 1e87637..6dffeb7 100644
--- a/drivers/crypto/nx/nx-842-powernv.c
+++ b/drivers/crypto/nx/nx-842-powernv.c
@@ -24,6 +24,8 @@
#include <asm/icswx.h>
#include <asm/vas.h>
#include <asm/reg.h>
+#include <asm/opal-api.h>
+#include <asm/opal.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Dan Streetman <ddstreet@ieee.org>");
@@ -803,9 +805,19 @@ static int __init vas_cfg_coproc_info(struct device_node *dn, int chip_id,
if (!coproc)
return -ENOMEM;
- if (!strcmp(priority, "High"))
+ if (!strcmp(priority, "High")) {
+ /*
+ * skiboot exports coproceeor type such as 842 or gzip in
+ * pid device tree property.
+ * Initialize each NX instance for both high and normal
+ * priority FIFOs.
+ */
+ ret = opal_nx_coproc_init(chip_id, pid);
+ if (ret)
+ goto err_out;
+
coproc->ct = VAS_COP_TYPE_842_HIPRI;
- else if (!strcmp(priority, "Normal"))
+ } else if (!strcmp(priority, "Normal"))
coproc->ct = VAS_COP_TYPE_842;
else {
pr_err("Invalid RxFIFO priority value\n");
^ permalink raw reply related
* Re: [PATCH v4 1/7] powerpc/fadump: Move the metadata region to start of the reserved area.
From: Nicholas Piggin @ 2018-04-22 1:58 UTC (permalink / raw)
To: Mahesh J Salgaonkar
Cc: linuxppc-dev, Ananth Narayan, kernelfans, Aneesh Kumar K.V,
Hari Bathini, Nathan Fontenot, Anshuman Khandual,
Srikar Dronamraju
In-Reply-To: <152420065839.31037.9373191008433546810.stgit@jupiter.in.ibm.com>
On Fri, 20 Apr 2018 10:34:18 +0530
Mahesh J Salgaonkar <mahesh@linux.vnet.ibm.com> wrote:
> From: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
>
> Currently the metadata region that holds crash info structure and ELF core
> header is placed towards the end of reserved memory area. This patch places
> it at the beginning of the reserved memory area. It also introduces
> additional dump section called metadata section to communicate location
> of metadata region to 2nd kernel. This patch also maintains the
> compatibility between production/capture kernels irrespective of their
> kernel versions. Both combination older/newer and newer/older works fine.
Trying to look at the patches it might help me if you document reasons
for why this change is made changelog, even if it may be obvious to
someone who knows the code better.
I thought you could include the documentation change in this patch as
well, but maybe that's a matter of preference.
Thanks,
Nick
^ 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