* Re: [PATCH RFC 3/5] powerpc/speculation: Add support for 'cpu_spec_mitigations=' cmdline options
From: Timothy Pearson @ 2019-04-04 20:01 UTC (permalink / raw)
To: Jiri Kosina
Cc: Peter Zijlstra, Catalin Marinas, Will Deacon, Paul Mackerras,
H . Peter Anvin, Ingo Molnar, Andrea Arcangeli, linux-s390, x86,
Jon Masters, Waiman Long, linux-arch, Heiko Carstens,
linuxppc-dev, Borislav Petkov, Andy Lutomirski, Josh Poimboeuf,
Thomas Gleixner, linux-arm-kernel, Greg Kroah-Hartman,
linux-kernel, Tyler Hicks, Martin Schwidefsky, Linus Torvalds
In-Reply-To: <nycvar.YFH.7.76.1904042145590.9803@cbobk.fhfr.pm>
Will be joining in ~ 5 mins. Getting Chromium set up here.
----- Original Message -----
> From: "Jiri Kosina" <jikos@kernel.org>
> To: "Josh Poimboeuf" <jpoimboe@redhat.com>
> Cc: "Peter Zijlstra" <peterz@infradead.org>, "Heiko Carstens" <heiko.carstens@de.ibm.com>, "Paul Mackerras"
> <paulus@samba.org>, "H . Peter Anvin" <hpa@zytor.com>, "Ingo Molnar" <mingo@kernel.org>, "Andrea Arcangeli"
> <aarcange@redhat.com>, linux-s390@vger.kernel.org, x86@kernel.org, "Will Deacon" <will.deacon@arm.com>, "Linus
> Torvalds" <torvalds@linux-foundation.org>, "Catalin Marinas" <catalin.marinas@arm.com>, "Waiman Long"
> <longman@redhat.com>, linux-arch@vger.kernel.org, "Jon Masters" <jcm@redhat.com>, "Borislav Petkov" <bp@alien8.de>,
> "Andy Lutomirski" <luto@kernel.org>, "Thomas Gleixner" <tglx@linutronix.de>, linux-arm-kernel@lists.infradead.org,
> "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, "Tyler Hicks" <tyhicks@canonical.com>,
> "Martin Schwidefsky" <schwidefsky@de.ibm.com>, linuxppc-dev@lists.ozlabs.org
> Sent: Thursday, April 4, 2019 2:49:05 PM
> Subject: Re: [PATCH RFC 3/5] powerpc/speculation: Add support for 'cpu_spec_mitigations=' cmdline options
> On Thu, 4 Apr 2019, Josh Poimboeuf wrote:
>
>> Configure powerpc CPU runtime speculation bug mitigations in accordance
>> with the 'cpu_spec_mitigations=' cmdline options. This affects
>> Meltdown, Spectre v1, Spectre v2, and Speculative Store Bypass.
> [ ... snip ... ]
>> - if (!no_nospec)
>> + if (!no_nospec && cpu_spec_mitigations != CPU_SPEC_MITIGATIONS_OFF)
>
> '!no_nospec' is something that I am sure will come back to hunt me in my
> bad dreams.
>
> But that's been there already, and fixing it is out of scope of this
> patch. Other than that, as discussed previously -- I really like this new
> global option. Feel free to add
>
> Reviewed-by: Jiri Kosina <jkosina@suse.cz>
>
> for the whole set.
>
> Thanks,
>
> --
> Jiri Kosina
> SUSE Labs
^ permalink raw reply
* Re: [PATCH RFC 3/5] powerpc/speculation: Add support for 'cpu_spec_mitigations=' cmdline options
From: Jiri Kosina @ 2019-04-04 19:49 UTC (permalink / raw)
To: Josh Poimboeuf
Cc: Peter Zijlstra, Heiko Carstens, Paul Mackerras, H . Peter Anvin,
Ingo Molnar, Andrea Arcangeli, linux-s390, x86, Will Deacon,
Linus Torvalds, Catalin Marinas, Waiman Long, linux-arch,
Jon Masters, Borislav Petkov, Andy Lutomirski, Thomas Gleixner,
linux-arm-kernel, Greg Kroah-Hartman, linux-kernel, Tyler Hicks,
Martin Schwidefsky, linuxppc-dev
In-Reply-To: <91b92d8182d2f114d92c95689fcd4bb1a8dda1b0.1554396090.git.jpoimboe@redhat.com>
On Thu, 4 Apr 2019, Josh Poimboeuf wrote:
> Configure powerpc CPU runtime speculation bug mitigations in accordance
> with the 'cpu_spec_mitigations=' cmdline options. This affects
> Meltdown, Spectre v1, Spectre v2, and Speculative Store Bypass.
[ ... snip ... ]
> - if (!no_nospec)
> + if (!no_nospec && cpu_spec_mitigations != CPU_SPEC_MITIGATIONS_OFF)
'!no_nospec' is something that I am sure will come back to hunt me in my
bad dreams.
But that's been there already, and fixing it is out of scope of this
patch. Other than that, as discussed previously -- I really like this new
global option. Feel free to add
Reviewed-by: Jiri Kosina <jkosina@suse.cz>
for the whole set.
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH 5/6 v3] syscalls: Remove start and number from syscall_get_arguments() args
From: Max Filippov @ 2019-04-04 18:56 UTC (permalink / raw)
To: Steven Rostedt
Cc: open list:IA64 (Itanium) PL..., Gustavo A. R. Silva,
Peter Zijlstra, Palmer Dabbelt, Dominik Brodowski, Oleg Nesterov,
H. Peter Anvin, open list:SPARC + UltraSPAR..., linux-riscv,
Ingo Molnar, Linux-Arch, linux-s390, linux-c6x-dev,
open list:SUPERH, open list:QUALCOMM HEXAGON...,
maintainer:X86 ARCHITECTURE..., Ingo Molnar, linux-snps-arc,
Dave Martin, moderated list:H8/300 ARCHITECTURE, linux-xtensa,
Kees Cook, Roland McGrath, linux-um, linux-mips, openrisc,
Borislav Petkov, Andy Lutomirski, Thomas Gleixner,
Dmitry V. Levin, linux-arm-kernel, open list:PARISC ARCHITECTURE,
linuxppc-dev, LKML, Andy Lutomirski, Eric W. Biederman, nios2-dev,
Andrew Morton, Linus Torvalds
In-Reply-To: <20190401134421.278590567@goodmis.org>
On Mon, Apr 1, 2019 at 6:45 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
>
> At Linux Plumbers, Andy Lutomirski approached me and pointed out that the
> function call syscall_get_arguments() implemented in x86 was horribly
> written and not optimized for the standard case of passing in 0 and 6 for
> the starting index and the number of system calls to get. When looking at
> all the users of this function, I discovered that all instances pass in only
> 0 and 6 for these arguments. Instead of having this function handle
> different cases that are never used, simply rewrite it to return the first 6
> arguments of a system call.
>
> This should help out the performance of tracing system calls by ptrace,
> ftrace and perf.
[...]
> arch/xtensa/include/asm/syscall.h | 16 ++----
For xtensa changes:
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
--
Thanks.
-- Max
^ permalink raw reply
* Re: [PATCH 6/6 v3] syscalls: Remove start and number from syscall_set_arguments() args
From: Max Filippov @ 2019-04-04 18:55 UTC (permalink / raw)
To: Steven Rostedt
Cc: open list:IA64 (Itanium) PL..., Gustavo A. R. Silva,
Peter Zijlstra, Palmer Dabbelt, Dominik Brodowski, Oleg Nesterov,
H. Peter Anvin, open list:SPARC + UltraSPAR..., linux-riscv,
Ingo Molnar, Linux-Arch, linux-s390, linux-c6x-dev,
open list:SUPERH, open list:QUALCOMM HEXAGON...,
maintainer:X86 ARCHITECTURE..., Ingo Molnar, linux-snps-arc,
Dave Martin, moderated list:H8/300 ARCHITECTURE, linux-xtensa,
Kees Cook, Roland McGrath, linux-um, linux-mips, openrisc,
Borislav Petkov, Andy Lutomirski, Thomas Gleixner,
Dmitry V. Levin, linux-arm-kernel, open list:PARISC ARCHITECTURE,
linuxppc-dev, LKML, Andy Lutomirski, Eric W. Biederman, nios2-dev,
Andrew Morton, Linus Torvalds
In-Reply-To: <20190401134421.442323029@goodmis.org>
On Mon, Apr 1, 2019 at 6:45 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>
> After removing the start and count arguments of syscall_get_arguments() it
> seems reasonable to remove them from syscall_set_arguments(). Note, as of
> today, there are no users of syscall_set_arguments(). But we are told that
> there will be soon. But for now, at least make it consistent with
> syscall_get_arguments().
[...]
> arch/xtensa/include/asm/syscall.h | 17 ++-----
For xtensa changes:
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
--
Thanks.
-- Max
^ permalink raw reply
* Re: [PATCH 6/6 v3] syscalls: Remove start and number from syscall_set_arguments() args
From: Dmitry V. Levin @ 2019-04-04 18:18 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-ia64, Gustavo A. R. Silva, Peter Zijlstra, Palmer Dabbelt,
Dominik Brodowski, Oleg Nesterov, H. Peter Anvin, sparclinux,
linux-riscv, Ingo Molnar, linux-arch, linux-s390, linux-c6x-dev,
linux-sh, linux-hexagon, x86, Ingo Molnar, linux-snps-arc,
Dave Martin, uclinux-h8-devel, linux-xtensa, Kees Cook,
Roland McGrath, linux-um, linux-mips, openrisc, Borislav Petkov,
Andy Lutomirski, Thomas Gleixner, linux-arm-kernel, linux-parisc,
linuxppc-dev, linux-kernel, Andy Lutomirski, Eric W. Biederman,
nios2-dev, Andrew Morton, Linus Torvalds
In-Reply-To: <20190401134421.442323029@goodmis.org>
[-- Attachment #1: Type: text/plain, Size: 3659 bytes --]
On Mon, Apr 01, 2019 at 09:41:10AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>
> After removing the start and count arguments of syscall_get_arguments() it
> seems reasonable to remove them from syscall_set_arguments(). Note, as of
> today, there are no users of syscall_set_arguments(). But we are told that
> there will be soon. But for now, at least make it consistent with
> syscall_get_arguments().
>
> Link: http://lkml.kernel.org/r/20190327222014.GA32540@altlinux.org
FWIW, you can add
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
There are two places listed below where I'd prefer to see more readable
equivalents, but feel free to leave it to respective arch maintainers.
> diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
> index 89a6ec8731d8..671ebd357496 100644
> --- a/arch/nds32/include/asm/syscall.h
> +++ b/arch/nds32/include/asm/syscall.h
> @@ -129,39 +129,20 @@ void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
> * syscall_set_arguments - change system call parameter value
> * @task: task of interest, must be in system call entry tracing
> * @regs: task_pt_regs() of @task
> - * @i: argument index [0,5]
> - * @n: number of arguments; n+i must be [1,6].
> * @args: array of argument values to store
> *
> - * Changes @n arguments to the system call starting with the @i'th argument.
> - * Argument @i gets value @args[0], and so on.
> - * An arch inline version is probably optimal when @i and @n are constants.
> + * Changes 6 arguments to the system call. The first argument gets value
> + * @args[0], and so on.
> *
> * It's only valid to call this when @task is stopped for tracing on
> * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
> - * It's invalid to call this with @i + @n > 6; we only support system calls
> - * taking up to 6 arguments.
> */
> void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
> - unsigned int i, unsigned int n,
> const unsigned long *args)
> {
> - if (n == 0)
> - return;
> -
> - if (i + n > SYSCALL_MAX_ARGS) {
> - pr_warn("%s called with max args %d, handling only %d\n",
> - __func__, i + n, SYSCALL_MAX_ARGS);
> - n = SYSCALL_MAX_ARGS - i;
> - }
> -
> - if (i == 0) {
> - regs->orig_r0 = args[0];
> - args++;
> - i++;
> - n--;
> - }
> + regs->orig_r0 = args[0];
> + args++;
>
> - memcpy(®s->uregs[0] + i, args, n * sizeof(args[0]));
> + memcpy(®s->uregs[0] + 1, args, 5 * sizeof(args[0]));
> }
A shorter and slightly more readable equivalent of the last memcpy is
memcpy(®s->uregs[1], args, 5 * sizeof(args[0]));
> diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
> index ee0b1f6aa36d..59c3e91f2cdb 100644
> --- a/arch/s390/include/asm/syscall.h
> +++ b/arch/s390/include/asm/syscall.h
> @@ -74,15 +74,14 @@ static inline void syscall_get_arguments(struct task_struct *task,
>
> static inline void syscall_set_arguments(struct task_struct *task,
> struct pt_regs *regs,
> - unsigned int i, unsigned int n,
> const unsigned long *args)
> {
> - BUG_ON(i + n > 6);
> + unsigned int n = 6;
> +
> while (n-- > 0)
> - if (i + n > 0)
> - regs->gprs[2 + i + n] = args[n];
> - if (i == 0)
> - regs->orig_gpr2 = args[0];
> + if (n > 0)
> + regs->gprs[2 + n] = args[n];
> + regs->orig_gpr2 = args[0];
> }
A shorter and slightly more readable equivalent of the loop is
while (--n > 0)
regs->gprs[2 + n] = args[n];
--
ldv
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: [PATCH 5/6 v3] syscalls: Remove start and number from syscall_get_arguments() args
From: Dmitry V. Levin @ 2019-04-04 18:17 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-ia64, Gustavo A. R. Silva, Peter Zijlstra, Palmer Dabbelt,
Dominik Brodowski, Oleg Nesterov, H. Peter Anvin, sparclinux,
linux-riscv, Ingo Molnar, linux-arch, linux-s390, linux-c6x-dev,
linux-sh, linux-hexagon, x86, Ingo Molnar, linux-snps-arc,
Dave Martin, uclinux-h8-devel, linux-xtensa, Kees Cook,
Roland McGrath, linux-um, linux-mips, openrisc, Borislav Petkov,
Andy Lutomirski, Thomas Gleixner, linux-arm-kernel, linux-parisc,
linuxppc-dev, linux-kernel, Andy Lutomirski, Eric W. Biederman,
nios2-dev, Andrew Morton, Linus Torvalds
In-Reply-To: <20190401134421.278590567@goodmis.org>
[-- Attachment #1: Type: text/plain, Size: 6351 bytes --]
On Mon, Apr 01, 2019 at 09:41:09AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
>
> At Linux Plumbers, Andy Lutomirski approached me and pointed out that the
> function call syscall_get_arguments() implemented in x86 was horribly
> written and not optimized for the standard case of passing in 0 and 6 for
> the starting index and the number of system calls to get. When looking at
> all the users of this function, I discovered that all instances pass in only
> 0 and 6 for these arguments. Instead of having this function handle
> different cases that are never used, simply rewrite it to return the first 6
> arguments of a system call.
>
> This should help out the performance of tracing system calls by ptrace,
> ftrace and perf.
>
> Link: http://lkml.kernel.org/r/20161107213233.754809394@goodmis.org
FWIW, you can add
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
There are several places listed below where I'd prefer to see more readable
equivalents, but feel free to leave it to respective arch maintainers.
> diff --git a/arch/hexagon/include/asm/syscall.h b/arch/hexagon/include/asm/syscall.h
> index 4af9c7b6f13a..ae3a1e24fabd 100644
> --- a/arch/hexagon/include/asm/syscall.h
> +++ b/arch/hexagon/include/asm/syscall.h
> @@ -37,10 +37,8 @@ static inline long syscall_get_nr(struct task_struct *task,
>
> static inline void syscall_get_arguments(struct task_struct *task,
> struct pt_regs *regs,
> - unsigned int i, unsigned int n,
> unsigned long *args)
> {
> - BUG_ON(i + n > 6);
> - memcpy(args, &(®s->r00)[i], n * sizeof(args[0]));
> + memcpy(args, &(®s->r00)[0], 6 * sizeof(args[0]));
A shorter and slightly more readable equivalent is
memcpy(args, ®s->r00, 6 * sizeof(args[0]));
> diff --git a/arch/nds32/include/asm/syscall.h b/arch/nds32/include/asm/syscall.h
> index f7e5e86765fe..89a6ec8731d8 100644
> --- a/arch/nds32/include/asm/syscall.h
> +++ b/arch/nds32/include/asm/syscall.h
> @@ -108,42 +108,21 @@ void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
> * syscall_get_arguments - extract system call parameter values
> * @task: task of interest, must be blocked
> * @regs: task_pt_regs() of @task
> - * @i: argument index [0,5]
> - * @n: number of arguments; n+i must be [1,6].
> * @args: array filled with argument values
> *
> - * Fetches @n arguments to the system call starting with the @i'th argument
> - * (from 0 through 5). Argument @i is stored in @args[0], and so on.
> - * An arch inline version is probably optimal when @i and @n are constants.
> + * Fetches 6 arguments to the system call (from 0 through 5). The first
> + * argument is stored in @args[0], and so on.
> *
> * It's only valid to call this when @task is stopped for tracing on
> * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
> - * It's invalid to call this with @i + @n > 6; we only support system calls
> - * taking up to 6 arguments.
> */
> #define SYSCALL_MAX_ARGS 6
> void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
> - unsigned int i, unsigned int n, unsigned long *args)
> + unsigned long *args)
> {
> - if (n == 0)
> - return;
> - if (i + n > SYSCALL_MAX_ARGS) {
> - unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;
> - unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;
> - pr_warning("%s called with max args %d, handling only %d\n",
> - __func__, i + n, SYSCALL_MAX_ARGS);
> - memset(args_bad, 0, n_bad * sizeof(args[0]));
> - memset(args_bad, 0, n_bad * sizeof(args[0]));
> - }
> -
> - if (i == 0) {
> - args[0] = regs->orig_r0;
> - args++;
> - i++;
> - n--;
> - }
> -
> - memcpy(args, ®s->uregs[0] + i, n * sizeof(args[0]));
> + args[0] = regs->orig_r0;
> + args++;
> + memcpy(args, ®s->uregs[0] + 1, 5 * sizeof(args[0]));
> }
A shorter and slightly more readable equivalent of the last memcpy is
memcpy(args, ®s->uregs[1], 5 * sizeof(args[0]));
> diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
> index 1a0e7a8b1c81..5c9b9dc82b7e 100644
> --- a/arch/powerpc/include/asm/syscall.h
> +++ b/arch/powerpc/include/asm/syscall.h
> @@ -65,22 +65,20 @@ static inline void syscall_set_return_value(struct task_struct *task,
>
> static inline void syscall_get_arguments(struct task_struct *task,
> struct pt_regs *regs,
> - unsigned int i, unsigned int n,
> unsigned long *args)
> {
> unsigned long val, mask = -1UL;
> -
> - BUG_ON(i + n > 6);
> + unsigned int n = 6;
>
> #ifdef CONFIG_COMPAT
> if (test_tsk_thread_flag(task, TIF_32BIT))
> mask = 0xffffffff;
> #endif
> while (n--) {
> - if (n == 0 && i == 0)
> + if (n == 0)
> val = regs->orig_gpr3;
> else
> - val = regs->gpr[3 + i + n];
> + val = regs->gpr[3 + n];
>
> args[n] = val & mask;
> }
A shorter and slightly more readable equivalent of the loop is
while (--n)
args[n] = regs->gpr[3 + n] & mask;
args[0] = regs->orig_gpr3 & mask;
> diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
> index 96f9a9151fde..ee0b1f6aa36d 100644
> --- a/arch/s390/include/asm/syscall.h
> +++ b/arch/s390/include/asm/syscall.h
> @@ -56,27 +56,20 @@ static inline void syscall_set_return_value(struct task_struct *task,
>
> static inline void syscall_get_arguments(struct task_struct *task,
> struct pt_regs *regs,
> - unsigned int i, unsigned int n,
> unsigned long *args)
> {
> unsigned long mask = -1UL;
> + unsigned int n = 6;
>
> - /*
> - * No arguments for this syscall, there's nothing to do.
> - */
> - if (!n)
> - return;
> -
> - BUG_ON(i + n > 6);
> #ifdef CONFIG_COMPAT
> if (test_tsk_thread_flag(task, TIF_31BIT))
> mask = 0xffffffff;
> #endif
> while (n-- > 0)
> - if (i + n > 0)
> - args[n] = regs->gprs[2 + i + n] & mask;
> - if (i == 0)
> - args[0] = regs->orig_gpr2 & mask;
> + if (n > 0)
> + args[n] = regs->gprs[2 + n] & mask;
> +
> + args[0] = regs->orig_gpr2 & mask;
A shorter and slightly more readable equivalent of the loop is
while (--n > 0)
args[n] = regs->gprs[2 + n] & mask;
--
ldv
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: [RFC PATCH] powerpc/mm: Reduce memory usage for mm_context_t for radix
From: Christophe Leroy @ 2019-04-04 16:55 UTC (permalink / raw)
To: Nicholas Piggin, Aneesh Kumar K.V, benh, mpe, paulus; +Cc: linuxppc-dev
In-Reply-To: <1554393943.3joom3btwy.astroid@bobo.none>
Le 04/04/2019 à 18:13, Nicholas Piggin a écrit :
> Christophe Leroy's on April 3, 2019 4:31 am:
>>
>>
>> Le 02/04/2019 à 16:34, Aneesh Kumar K.V a écrit :
>>> Currently, our mm_context_t on book3s64 include all hash specific
>>> context details like slice mask, subpage protection details. We
>>> can skip allocating those on radix. This will help us to save
>>> 8K per mm_context with radix translation.
>>>
>>> With the patch applied we have
>>>
>>> sizeof(mm_context_t) = 136
>>> sizeof(struct hash_mm_context) = 8288
>>>
>>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>>> ---
>>> NOTE:
>>>
>>> If we want to do this, I am still trying to figure out how best we can do this
>>> without all the #ifdef and other overhead for 8xx book3e
>>>
>>>
>>> arch/powerpc/include/asm/book3s/64/mmu-hash.h | 2 +-
>>> arch/powerpc/include/asm/book3s/64/mmu.h | 48 +++++++++++--------
>>> arch/powerpc/include/asm/book3s/64/slice.h | 6 +--
>>> arch/powerpc/kernel/paca.c | 9 ++--
>>> arch/powerpc/kernel/setup-common.c | 7 ++-
>>> arch/powerpc/mm/hash_utils_64.c | 10 ++--
>>> arch/powerpc/mm/mmu_context_book3s64.c | 16 ++++++-
>>> arch/powerpc/mm/slb.c | 2 +-
>>> arch/powerpc/mm/slice.c | 48 +++++++++----------
>>> arch/powerpc/mm/subpage-prot.c | 8 ++--
>>> 10 files changed, 91 insertions(+), 65 deletions(-)
>>>
>>> diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
>>> index a28a28079edb..d801be977623 100644
>>> --- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
>>> +++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
>>> @@ -657,7 +657,7 @@ extern void slb_set_size(u16 size);
>>>
>>> /* 4 bits per slice and we have one slice per 1TB */
>>> #define SLICE_ARRAY_SIZE (H_PGTABLE_RANGE >> 41)
>>> -#define TASK_SLICE_ARRAY_SZ(x) ((x)->context.slb_addr_limit >> 41)
>>> +#define TASK_SLICE_ARRAY_SZ(x) ((x)->context.hash_context->slb_addr_limit >> 41)
>>>
>>> #ifndef __ASSEMBLY__
>>>
>>> diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h b/arch/powerpc/include/asm/book3s/64/mmu.h
>>> index a809bdd77322..07e76e304a3b 100644
>>> --- a/arch/powerpc/include/asm/book3s/64/mmu.h
>>> +++ b/arch/powerpc/include/asm/book3s/64/mmu.h
>>> @@ -114,6 +114,33 @@ struct slice_mask {
>>> DECLARE_BITMAP(high_slices, SLICE_NUM_HIGH);
>>> };
>>>
>>> +struct hash_mm_context {
>>> +
>>> + u16 user_psize; /* page size index */
>>
>> Could we keep that in mm_context_t ?
>
> Why do you want it there?
It was just to avoid so many changes and also the pointer complexity for
just saving 2 bytes. But your suggestion below seems good.
>
>
>>> @@ -155,15 +155,15 @@ static struct slice_mask *slice_mask_for_size(struct mm_struct *mm, int psize)
>>> {
>>> #ifdef CONFIG_PPC_64K_PAGES
>>> if (psize == MMU_PAGE_64K)
>>> - return &mm->context.mask_64k;
>>> + return &mm->context.hash_context->mask_64k;
>>
>> You should take the two patches below, that would help:
>> https://patchwork.ozlabs.org/patch/1059056/
>> https://patchwork.ozlabs.org/patch/1059058/
>
> Above patches seem good I think. What I think Aneesh should have is
> is a macro or inline that gives a pointer to the hash_mm_context from
> an mm_context pointer.
Good idea. But please call it something else, as it has nothing to do
with hash outside of book3s64 (ie the 8xx is a nohash32).
Christophe
>
> Architectures which always want it should just put the hash struct
> in their mm_context struct and that avoids the pointer overhead
> completely.
>
> Thanks,
> Nick
>
^ permalink raw reply
* Re: [PATCH RFC 0/5] cpu/speculation: Add 'cpu_spec_mitigations=' cmdline options
From: Waiman Long @ 2019-04-04 16:50 UTC (permalink / raw)
To: Josh Poimboeuf, linux-kernel
Cc: Peter Zijlstra, Heiko Carstens, Paul Mackerras, H . Peter Anvin,
Ingo Molnar, Andrea Arcangeli, linux-s390, x86, Will Deacon,
Linus Torvalds, Catalin Marinas, linux-arch, Jon Masters,
Jiri Kosina, Borislav Petkov, Andy Lutomirski, Thomas Gleixner,
linux-arm-kernel, Greg Kroah-Hartman, Tyler Hicks,
Martin Schwidefsky, linuxppc-dev
In-Reply-To: <cover.1554396090.git.jpoimboe@redhat.com>
On 04/04/2019 12:44 PM, Josh Poimboeuf wrote:
> Keeping track of the number of mitigations for all the CPU speculation
> bugs has become overwhelming for many users. It's getting more and more
> complicated to decide which mitigations are needed for a given
> architecture. Complicating matters is the fact that each arch tends to
> it own custom way to mitigate the same vulnerability.
... tends to "have its" own ... ?
-Longman
^ permalink raw reply
* Re: [PATCH RFC 1/5] cpu/speculation: Add 'cpu_spec_mitigations=' cmdline options
From: Josh Poimboeuf @ 2019-04-04 16:49 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Heiko Carstens, Paul Mackerras, H . Peter Anvin,
Ingo Molnar, Andrea Arcangeli, linux-s390, x86, Will Deacon,
Linus Torvalds, Catalin Marinas, Waiman Long, linux-arch,
Jon Masters, Jiri Kosina, Borislav Petkov, Andy Lutomirski,
Thomas Gleixner, linux-arm-kernel, Greg Kroah-Hartman,
Tyler Hicks, Martin Schwidefsky, linuxppc-dev
In-Reply-To: <f0bd17358ab478eaca52f3b1da8305c150911b40.1554396090.git.jpoimboe@redhat.com>
On Thu, Apr 04, 2019 at 11:44:11AM -0500, Josh Poimboeuf wrote:
> Keeping track of the number of mitigations for all the CPU speculation
> bugs has become overwhelming for many users. It's getting more and more
> complicated to decide which mitigations are needed for a given
> architecture. Complicating matters is the fact that each arch tends to
> their own custom way to mitigate the same vulnerability.
... tends to _have_ its own custom way ...
--
Josh
^ permalink raw reply
* [PATCH RFC 5/5] arm64/speculation: Add support for 'cpu_spec_mitigations=' cmdline options
From: Josh Poimboeuf @ 2019-04-04 16:44 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Heiko Carstens, Paul Mackerras, H . Peter Anvin,
Ingo Molnar, Andrea Arcangeli, linux-s390, x86, Will Deacon,
Linus Torvalds, Catalin Marinas, Waiman Long, linux-arch,
Jon Masters, Jiri Kosina, Borislav Petkov, Andy Lutomirski,
Thomas Gleixner, linux-arm-kernel, Greg Kroah-Hartman,
Tyler Hicks, Martin Schwidefsky, linuxppc-dev
In-Reply-To: <cover.1554396090.git.jpoimboe@redhat.com>
Configure arm64 runtime CPU speculation bug mitigations in accordance
with the 'cpu_spec_mitigations=' cmdline options. This affects
Meltdown and Speculative Store Bypass.
The default behavior is unchanged.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
Documentation/admin-guide/kernel-parameters.txt | 2 ++
arch/arm64/kernel/cpu_errata.c | 4 ++++
arch/arm64/kernel/cpufeature.c | 6 ++++++
3 files changed, 12 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index e838af96daa4..0b54385ee7a8 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2553,11 +2553,13 @@
off
Disable all speculative CPU mitigations.
Equivalent to: nopti [x86, powerpc]
+ kpti=0 [arm64]
nospectre_v1 [powerpc]
nospectre_v2 [x86, powerpc, s390]
spectre_v2_user=off [x86]
nobp=0 [s390]
spec_store_bypass_disable=off [x86, powerpc]
+ ssbd=force-off [arm64]
l1tf=off [x86]
auto (default)
diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
index 9950bb0cbd52..db8d27e3fb1c 100644
--- a/arch/arm64/kernel/cpu_errata.c
+++ b/arch/arm64/kernel/cpu_errata.c
@@ -19,6 +19,7 @@
#include <linux/arm-smccc.h>
#include <linux/psci.h>
#include <linux/types.h>
+#include <linux/cpu.h>
#include <asm/cpu.h>
#include <asm/cputype.h>
#include <asm/cpufeature.h>
@@ -385,6 +386,9 @@ static bool has_ssbd_mitigation(const struct arm64_cpu_capabilities *entry,
return false;
}
+ if (cpu_spec_mitigations == CPU_SPEC_MITIGATIONS_OFF)
+ ssbd_state = ARM64_SSBD_FORCE_DISABLE;
+
switch (psci_ops.conduit) {
case PSCI_CONDUIT_HVC:
arm_smccc_1_1_hvc(ARM_SMCCC_ARCH_FEATURES_FUNC_ID,
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 4061de10cea6..4512b582d50f 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -25,6 +25,7 @@
#include <linux/stop_machine.h>
#include <linux/types.h>
#include <linux/mm.h>
+#include <linux/cpu.h>
#include <asm/cpu.h>
#include <asm/cpufeature.h>
#include <asm/cpu_ops.h>
@@ -978,6 +979,11 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
__kpti_forced = -1;
}
+ if (cpu_spec_mitigations == CPU_SPEC_MITIGATIONS_OFF) {
+ str = "cpu_spec_mitigations=off";
+ __kpti_forced = -1;
+ }
+
/* Forced? */
if (__kpti_forced) {
pr_info_once("kernel page table isolation forced %s by %s\n",
--
2.17.2
^ permalink raw reply related
* [PATCH RFC 4/5] s390/speculation: Add support for 'cpu_spec_mitigations=' cmdline options
From: Josh Poimboeuf @ 2019-04-04 16:44 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Heiko Carstens, Paul Mackerras, H . Peter Anvin,
Ingo Molnar, Andrea Arcangeli, linux-s390, x86, Will Deacon,
Linus Torvalds, Catalin Marinas, Waiman Long, linux-arch,
Jon Masters, Jiri Kosina, Borislav Petkov, Andy Lutomirski,
Thomas Gleixner, linux-arm-kernel, Greg Kroah-Hartman,
Tyler Hicks, Martin Schwidefsky, linuxppc-dev
In-Reply-To: <cover.1554396090.git.jpoimboe@redhat.com>
Configure s390 runtime CPU speculation bug mitigations in accordance
with the 'cpu_spec_mitigations=' cmdline options. This affects Spectre
v1 and Spectre v2.
The default behavior is unchanged.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
Documentation/admin-guide/kernel-parameters.txt | 7 ++++---
arch/s390/kernel/nospec-branch.c | 4 +++-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 0e8eae1e8a25..e838af96daa4 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2554,8 +2554,9 @@
Disable all speculative CPU mitigations.
Equivalent to: nopti [x86, powerpc]
nospectre_v1 [powerpc]
- nospectre_v2 [x86]
+ nospectre_v2 [x86, powerpc, s390]
spectre_v2_user=off [x86]
+ nobp=0 [s390]
spec_store_bypass_disable=off [x86, powerpc]
l1tf=off [x86]
@@ -2567,7 +2568,7 @@
upgrades, or who have other ways of avoiding
SMT-based attacks.
Equivalent to: pti=auto [x86]
- spectre_v2=auto [x86]
+ spectre_v2=auto [x86, s390]
spectre_v2_user=auto [x86]
spec_store_bypass_disable=auto [x86, powerpc]
l1tf=flush [x86]
@@ -2578,7 +2579,7 @@
always want to be fully mitigated, even if it
means losing SMT.
Equivalent to: pti=auto [x86]
- spectre_v2=auto [x86]
+ spectre_v2=auto [x86, s390]
spectre_v2_user=auto [x86]
spec_store_bypass_disable=auto [x86, powerpc]
l1tf=flush,nosmt [x86]
diff --git a/arch/s390/kernel/nospec-branch.c b/arch/s390/kernel/nospec-branch.c
index bdddaae96559..c40eb672b43a 100644
--- a/arch/s390/kernel/nospec-branch.c
+++ b/arch/s390/kernel/nospec-branch.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/cpu.h>
#include <asm/nospec-branch.h>
static int __init nobp_setup_early(char *str)
@@ -58,7 +59,8 @@ early_param("nospectre_v2", nospectre_v2_setup_early);
void __init nospec_auto_detect(void)
{
- if (test_facility(156)) {
+ if (test_facility(156) ||
+ cpu_spec_mitigations == CPU_SPEC_MITIGATIONS_OFF) {
/*
* The machine supports etokens.
* Disable expolines and disable nobp.
--
2.17.2
^ permalink raw reply related
* [PATCH RFC 3/5] powerpc/speculation: Add support for 'cpu_spec_mitigations=' cmdline options
From: Josh Poimboeuf @ 2019-04-04 16:44 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Heiko Carstens, Paul Mackerras, H . Peter Anvin,
Ingo Molnar, Andrea Arcangeli, linux-s390, x86, Will Deacon,
Linus Torvalds, Catalin Marinas, Waiman Long, linux-arch,
Jon Masters, Jiri Kosina, Borislav Petkov, Andy Lutomirski,
Thomas Gleixner, linux-arm-kernel, Greg Kroah-Hartman,
Tyler Hicks, Martin Schwidefsky, linuxppc-dev
In-Reply-To: <cover.1554396090.git.jpoimboe@redhat.com>
Configure powerpc CPU runtime speculation bug mitigations in accordance
with the 'cpu_spec_mitigations=' cmdline options. This affects
Meltdown, Spectre v1, Spectre v2, and Speculative Store Bypass.
The default behavior is unchanged.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
Documentation/admin-guide/kernel-parameters.txt | 9 +++++----
arch/powerpc/kernel/security.c | 6 +++---
arch/powerpc/kernel/setup_64.c | 2 +-
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 29dc03971630..0e8eae1e8a25 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2552,10 +2552,11 @@
off
Disable all speculative CPU mitigations.
- Equivalent to: nopti [x86]
+ Equivalent to: nopti [x86, powerpc]
+ nospectre_v1 [powerpc]
nospectre_v2 [x86]
spectre_v2_user=off [x86]
- spec_store_bypass_disable=off [x86]
+ spec_store_bypass_disable=off [x86, powerpc]
l1tf=off [x86]
auto (default)
@@ -2568,7 +2569,7 @@
Equivalent to: pti=auto [x86]
spectre_v2=auto [x86]
spectre_v2_user=auto [x86]
- spec_store_bypass_disable=auto [x86]
+ spec_store_bypass_disable=auto [x86, powerpc]
l1tf=flush [x86]
auto,nosmt
@@ -2579,7 +2580,7 @@
Equivalent to: pti=auto [x86]
spectre_v2=auto [x86]
spectre_v2_user=auto [x86]
- spec_store_bypass_disable=auto [x86]
+ spec_store_bypass_disable=auto [x86, powerpc]
l1tf=flush,nosmt [x86]
mminit_loglevel=
diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c
index b33bafb8fcea..5aed4ad729ba 100644
--- a/arch/powerpc/kernel/security.c
+++ b/arch/powerpc/kernel/security.c
@@ -57,7 +57,7 @@ void setup_barrier_nospec(void)
enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) &&
security_ftr_enabled(SEC_FTR_BNDS_CHK_SPEC_BAR);
- if (!no_nospec)
+ if (!no_nospec && cpu_spec_mitigations != CPU_SPEC_MITIGATIONS_OFF)
enable_barrier_nospec(enable);
}
@@ -116,7 +116,7 @@ static int __init handle_nospectre_v2(char *p)
early_param("nospectre_v2", handle_nospectre_v2);
void setup_spectre_v2(void)
{
- if (no_spectrev2)
+ if (no_spectrev2 || cpu_spec_mitigations == CPU_SPEC_MITIGATIONS_OFF)
do_btb_flush_fixups();
else
btb_flush_enabled = true;
@@ -300,7 +300,7 @@ void setup_stf_barrier(void)
stf_enabled_flush_types = type;
- if (!no_stf_barrier)
+ if (!no_stf_barrier && cpu_spec_mitigations != CPU_SPEC_MITIGATIONS_OFF)
stf_barrier_enable(enable);
}
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index ba404dd9ce1d..d9d796a66a79 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -932,7 +932,7 @@ void setup_rfi_flush(enum l1d_flush_type types, bool enable)
enabled_flush_types = types;
- if (!no_rfi_flush)
+ if (!no_rfi_flush || cpu_spec_mitigations != CPU_SPEC_MITIGATIONS_OFF)
rfi_flush_enable(enable);
}
--
2.17.2
^ permalink raw reply related
* [PATCH RFC 1/5] cpu/speculation: Add 'cpu_spec_mitigations=' cmdline options
From: Josh Poimboeuf @ 2019-04-04 16:44 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Heiko Carstens, Paul Mackerras, H . Peter Anvin,
Ingo Molnar, Andrea Arcangeli, linux-s390, x86, Will Deacon,
Linus Torvalds, Catalin Marinas, Waiman Long, linux-arch,
Jon Masters, Jiri Kosina, Borislav Petkov, Andy Lutomirski,
Thomas Gleixner, linux-arm-kernel, Greg Kroah-Hartman,
Tyler Hicks, Martin Schwidefsky, linuxppc-dev
In-Reply-To: <cover.1554396090.git.jpoimboe@redhat.com>
Keeping track of the number of mitigations for all the CPU speculation
bugs has become overwhelming for many users. It's getting more and more
complicated to decide which mitigations are needed for a given
architecture. Complicating matters is the fact that each arch tends to
their own custom way to mitigate the same vulnerability.
Most users fall into a few basic categories:
a) they want all mitigations off;
b) they want all reasonable mitigations on, with SMT enabled even if
it's vulnerable; or
c) they want all reasonable mitigations on, with SMT disabled if
vulnerable.
Define a set of curated, arch-independent options, each of which is an
aggregation of existing options:
- cpu_spec_mitigations=off: Disable all mitigations.
- cpu_spec_mitigations=auto: [default] Enable all the default
mitigations, but leave SMT enabled, even if it's vulnerable.
- cpu_spec_mitigations=auto,nosmt: Enable all the default mitigations,
disabling SMT if needed by a mitigation.
Currently, these options are placeholders which don't actually do
anything. They will be fleshed out in upcoming patches.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
.../admin-guide/kernel-parameters.txt | 23 +++++++++++++++++++
include/linux/cpu.h | 8 +++++++
kernel/cpu.c | 15 ++++++++++++
3 files changed, 46 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index c4d830003b21..ac42e510bd6e 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2544,6 +2544,29 @@
in the "bleeding edge" mini2440 support kernel at
http://repo.or.cz/w/linux-2.6/mini2440.git
+ cpu_spec_mitigations=
+ [KNL] Control mitigations for CPU speculation
+ vulnerabilities on affected CPUs. This is a set of
+ curated, arch-independent options, each of which is an
+ aggregation of existing options.
+
+ off
+ Disable all speculative CPU mitigations.
+
+ auto (default)
+ Mitigate all speculative CPU vulnerabilities,
+ but leave SMT enabled, even if it's vulnerable.
+ This is useful for users who don't want to be
+ surprised by SMT getting disabled across kernel
+ upgrades, or who have other ways of avoiding
+ SMT-based attacks.
+
+ auto,nosmt
+ Mitigate all speculative CPU vulnerabilities,
+ disabling SMT if needed. This is for users who
+ always want to be fully mitigated, even if it
+ means losing SMT.
+
mminit_loglevel=
[KNL] When CONFIG_DEBUG_MEMORY_INIT is set, this
parameter allows control of the logging verbosity for
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 5041357d0297..3a1740fda2e2 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -187,4 +187,12 @@ static inline void cpu_smt_disable(bool force) { }
static inline void cpu_smt_check_topology(void) { }
#endif
+enum cpu_spec_mitigations {
+ CPU_SPEC_MITIGATIONS_OFF,
+ CPU_SPEC_MITIGATIONS_AUTO,
+ CPU_SPEC_MITIGATIONS_AUTO_NOSMT,
+};
+
+extern enum cpu_spec_mitigations cpu_spec_mitigations;
+
#endif /* _LINUX_CPU_H_ */
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 6c959aea0f9e..0a9d66b90a00 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -2306,3 +2306,18 @@ void __init boot_cpu_hotplug_init(void)
#endif
this_cpu_write(cpuhp_state.state, CPUHP_ONLINE);
}
+
+enum cpu_spec_mitigations cpu_spec_mitigations __ro_after_init = CPU_SPEC_MITIGATIONS_AUTO;
+
+static int __init cpu_spec_mitigations_setup(char *arg)
+{
+ if (!strcmp(arg, "off"))
+ cpu_spec_mitigations = CPU_SPEC_MITIGATIONS_OFF;
+ else if (!strcmp(arg, "auto"))
+ cpu_spec_mitigations = CPU_SPEC_MITIGATIONS_AUTO;
+ else if (!strcmp(arg, "auto,nosmt"))
+ cpu_spec_mitigations = CPU_SPEC_MITIGATIONS_AUTO_NOSMT;
+
+ return 0;
+}
+early_param("cpu_spec_mitigations", cpu_spec_mitigations_setup);
--
2.17.2
^ permalink raw reply related
* [PATCH RFC 2/5] x86/speculation: Add support for 'cpu_spec_mitigations=' cmdline options
From: Josh Poimboeuf @ 2019-04-04 16:44 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Heiko Carstens, Paul Mackerras, H . Peter Anvin,
Ingo Molnar, Andrea Arcangeli, linux-s390, x86, Will Deacon,
Linus Torvalds, Catalin Marinas, Waiman Long, linux-arch,
Jon Masters, Jiri Kosina, Borislav Petkov, Andy Lutomirski,
Thomas Gleixner, linux-arm-kernel, Greg Kroah-Hartman,
Tyler Hicks, Martin Schwidefsky, linuxppc-dev
In-Reply-To: <cover.1554396090.git.jpoimboe@redhat.com>
Configure x86 runtime CPU speculation bug mitigations in accordance with
the 'cpu_spec_mitigations=' cmdline options. This affects Meltdown,
Spectre v2, Speculative Store Bypass, and L1TF.
The default behavior is unchanged.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
.../admin-guide/kernel-parameters.txt | 15 +++++++++
arch/x86/include/asm/processor.h | 1 +
arch/x86/kernel/cpu/bugs.c | 32 ++++++++++++++++---
arch/x86/kvm/vmx/vmx.c | 2 ++
arch/x86/mm/pti.c | 4 ++-
5 files changed, 49 insertions(+), 5 deletions(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index ac42e510bd6e..29dc03971630 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2552,6 +2552,11 @@
off
Disable all speculative CPU mitigations.
+ Equivalent to: nopti [x86]
+ nospectre_v2 [x86]
+ spectre_v2_user=off [x86]
+ spec_store_bypass_disable=off [x86]
+ l1tf=off [x86]
auto (default)
Mitigate all speculative CPU vulnerabilities,
@@ -2560,12 +2565,22 @@
surprised by SMT getting disabled across kernel
upgrades, or who have other ways of avoiding
SMT-based attacks.
+ Equivalent to: pti=auto [x86]
+ spectre_v2=auto [x86]
+ spectre_v2_user=auto [x86]
+ spec_store_bypass_disable=auto [x86]
+ l1tf=flush [x86]
auto,nosmt
Mitigate all speculative CPU vulnerabilities,
disabling SMT if needed. This is for users who
always want to be fully mitigated, even if it
means losing SMT.
+ Equivalent to: pti=auto [x86]
+ spectre_v2=auto [x86]
+ spectre_v2_user=auto [x86]
+ spec_store_bypass_disable=auto [x86]
+ l1tf=flush,nosmt [x86]
mminit_loglevel=
[KNL] When CONFIG_DEBUG_MEMORY_INIT is set, this
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 2bb3a648fc12..7e95b310f869 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -982,6 +982,7 @@ void microcode_check(void);
enum l1tf_mitigations {
L1TF_MITIGATION_OFF,
+ L1TF_MITIGATION_DEFAULT,
L1TF_MITIGATION_FLUSH_NOWARN,
L1TF_MITIGATION_FLUSH,
L1TF_MITIGATION_FLUSH_NOSMT,
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 2da82eff0eb4..65b95fb95ba5 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -308,8 +308,11 @@ spectre_v2_parse_user_cmdline(enum spectre_v2_mitigation_cmd v2_cmd)
ret = cmdline_find_option(boot_command_line, "spectre_v2_user",
arg, sizeof(arg));
- if (ret < 0)
+ if (ret < 0) {
+ if (cpu_spec_mitigations == CPU_SPEC_MITIGATIONS_OFF)
+ return SPECTRE_V2_USER_CMD_NONE;
return SPECTRE_V2_USER_CMD_AUTO;
+ }
for (i = 0; i < ARRAY_SIZE(v2_user_options); i++) {
if (match_option(arg, ret, v2_user_options[i].option)) {
@@ -444,8 +447,11 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
return SPECTRE_V2_CMD_NONE;
ret = cmdline_find_option(boot_command_line, "spectre_v2", arg, sizeof(arg));
- if (ret < 0)
+ if (ret < 0) {
+ if (cpu_spec_mitigations == CPU_SPEC_MITIGATIONS_OFF)
+ return SPECTRE_V2_CMD_NONE;
return SPECTRE_V2_CMD_AUTO;
+ }
for (i = 0; i < ARRAY_SIZE(mitigation_options); i++) {
if (!match_option(arg, ret, mitigation_options[i].option))
@@ -677,8 +683,11 @@ static enum ssb_mitigation_cmd __init ssb_parse_cmdline(void)
} else {
ret = cmdline_find_option(boot_command_line, "spec_store_bypass_disable",
arg, sizeof(arg));
- if (ret < 0)
+ if (ret < 0) {
+ if (cpu_spec_mitigations == CPU_SPEC_MITIGATIONS_OFF)
+ return SPEC_STORE_BYPASS_CMD_NONE;
return SPEC_STORE_BYPASS_CMD_AUTO;
+ }
for (i = 0; i < ARRAY_SIZE(ssb_mitigation_options); i++) {
if (!match_option(arg, ret, ssb_mitigation_options[i].option))
@@ -955,7 +964,7 @@ void x86_spec_ctrl_setup_ap(void)
#define pr_fmt(fmt) "L1TF: " fmt
/* Default mitigation for L1TF-affected CPUs */
-enum l1tf_mitigations l1tf_mitigation __ro_after_init = L1TF_MITIGATION_FLUSH;
+enum l1tf_mitigations l1tf_mitigation __ro_after_init = L1TF_MITIGATION_DEFAULT;
#if IS_ENABLED(CONFIG_KVM_INTEL)
EXPORT_SYMBOL_GPL(l1tf_mitigation);
#endif
@@ -1010,8 +1019,23 @@ static void __init l1tf_select_mitigation(void)
override_cache_bits(&boot_cpu_data);
+ if (l1tf_mitigation == L1TF_MITIGATION_DEFAULT) {
+ switch (cpu_spec_mitigations) {
+ case CPU_SPEC_MITIGATIONS_OFF:
+ l1tf_mitigation = L1TF_MITIGATION_OFF;
+ break;
+ case CPU_SPEC_MITIGATIONS_AUTO:
+ l1tf_mitigation = L1TF_MITIGATION_FLUSH;
+ break;
+ case CPU_SPEC_MITIGATIONS_AUTO_NOSMT:
+ l1tf_mitigation = L1TF_MITIGATION_FLUSH_NOSMT;
+ break;
+ }
+ }
+
switch (l1tf_mitigation) {
case L1TF_MITIGATION_OFF:
+ case L1TF_MITIGATION_DEFAULT:
case L1TF_MITIGATION_FLUSH_NOWARN:
case L1TF_MITIGATION_FLUSH:
break;
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index ab432a930ae8..83b5bdc3c777 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -233,6 +233,7 @@ static int vmx_setup_l1d_flush(enum vmx_l1d_flush_state l1tf)
case L1TF_MITIGATION_FLUSH_NOWARN:
case L1TF_MITIGATION_FLUSH:
case L1TF_MITIGATION_FLUSH_NOSMT:
+ case L1TF_MITIGATION_DEFAULT:
l1tf = VMENTER_L1D_FLUSH_COND;
break;
case L1TF_MITIGATION_FULL:
@@ -6686,6 +6687,7 @@ static int vmx_vm_init(struct kvm *kvm)
case L1TF_MITIGATION_FLUSH:
case L1TF_MITIGATION_FLUSH_NOSMT:
case L1TF_MITIGATION_FULL:
+ case L1TF_MITIGATION_DEFAULT:
/*
* Warn upon starting the first VM in a potentially
* insecure environment.
diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
index 139b28a01ce4..6d3bf680bf95 100644
--- a/arch/x86/mm/pti.c
+++ b/arch/x86/mm/pti.c
@@ -35,6 +35,7 @@
#include <linux/spinlock.h>
#include <linux/mm.h>
#include <linux/uaccess.h>
+#include <linux/cpu.h>
#include <asm/cpufeature.h>
#include <asm/hypervisor.h>
@@ -115,7 +116,8 @@ void __init pti_check_boottime_disable(void)
}
}
- if (cmdline_find_option_bool(boot_command_line, "nopti")) {
+ if (cmdline_find_option_bool(boot_command_line, "nopti") ||
+ cpu_spec_mitigations == CPU_SPEC_MITIGATIONS_OFF) {
pti_mode = PTI_FORCE_OFF;
pti_print_if_insecure("disabled on command line.");
return;
--
2.17.2
^ permalink raw reply related
* [PATCH RFC 0/5] cpu/speculation: Add 'cpu_spec_mitigations=' cmdline options
From: Josh Poimboeuf @ 2019-04-04 16:44 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Heiko Carstens, Paul Mackerras, H . Peter Anvin,
Ingo Molnar, Andrea Arcangeli, linux-s390, x86, Will Deacon,
Linus Torvalds, Catalin Marinas, Waiman Long, linux-arch,
Jon Masters, Jiri Kosina, Borislav Petkov, Andy Lutomirski,
Thomas Gleixner, linux-arm-kernel, Greg Kroah-Hartman,
Tyler Hicks, Martin Schwidefsky, linuxppc-dev
Keeping track of the number of mitigations for all the CPU speculation
bugs has become overwhelming for many users. It's getting more and more
complicated to decide which mitigations are needed for a given
architecture. Complicating matters is the fact that each arch tends to
it own custom way to mitigate the same vulnerability.
Most users fall into a few basic categories:
a) they want all CPU speculation mitigations off;
b) they want all reasonable mitigations on, with SMT enabled even if
it's vulnerable; or
c) they want all reasonable mitigations on, with SMT disabled if
vulnerable.
Define a set of curated, arch-independent options, each of which is an
aggregation of existing options:
- cpu_spec_mitigations=off: Disable all mitigations.
- cpu_spec_mitigations=auto: [default] Enable all the default
mitigations, but leave SMT enabled, even if it's vulnerable.
- cpu_spec_mitigations=auto,nosmt: Enable all the default mitigations,
disabling SMT if needed by a mitigation.
Josh Poimboeuf (5):
cpu/speculation: Add 'cpu_spec_mitigations=' cmdline options
x86/speculation: Add support for 'cpu_spec_mitigations=' cmdline
options
powerpc/speculation: Add support for 'cpu_spec_mitigations=' cmdline
options
s390/speculation: Add support for 'cpu_spec_mitigations=' cmdline
options
arm64/speculation: Add support for 'cpu_spec_mitigations=' cmdline
options
.../admin-guide/kernel-parameters.txt | 42 +++++++++++++++++++
arch/arm64/kernel/cpu_errata.c | 4 ++
arch/arm64/kernel/cpufeature.c | 6 +++
arch/powerpc/kernel/security.c | 6 +--
arch/powerpc/kernel/setup_64.c | 2 +-
arch/s390/kernel/nospec-branch.c | 4 +-
arch/x86/include/asm/processor.h | 1 +
arch/x86/kernel/cpu/bugs.c | 32 ++++++++++++--
arch/x86/kvm/vmx/vmx.c | 2 +
arch/x86/mm/pti.c | 4 +-
include/linux/cpu.h | 8 ++++
kernel/cpu.c | 15 +++++++
12 files changed, 116 insertions(+), 10 deletions(-)
--
2.17.2
^ permalink raw reply
* Re: [Qemu-ppc] pseries on qemu-system-ppc64le crashes in doorbell_core_ipi()
From: Nicholas Piggin @ 2019-04-04 16:25 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Sebastian Andrzej Siewior, Steven Rostedt, Paul Mackerras,
Cédric Le Goater, Suraj Jitindar Singh, Frederic Weisbecker,
qemu-ppc, tglx, linuxppc-dev, David? Gibson
In-Reply-To: <20190401083827.GE11158@hirez.programming.kicks-ass.net>
Peter Zijlstra's on April 1, 2019 6:38 pm:
>
> + fweisbec, who did the remote bits
>
> On Sat, Mar 30, 2019 at 01:10:28PM +1000, Nicholas Piggin wrote:
>> Something like this?
>>
>> kernel/irq_work: Do not raise an IPI when queueing work on the local CPU
>>
>> The QEMU powerpc/pseries machine model was not expecting a self-IPI,
>> and it may be a bit surprising thing to do, so have irq_work_queue_on
>> do local queueing when target is current CPU.
>
> This seems OK to me.
>
>> Suggested-by: Steven Rostedt <rostedt@goodmis.org>
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>
> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Thanks for taking a look.
Sebastian, are you able to test if this patch solves your problem?
Thanks,
Nick
^ permalink raw reply
* Re: [RFC PATCH] powerpc/mm: Reduce memory usage for mm_context_t for radix
From: Nicholas Piggin @ 2019-04-04 16:13 UTC (permalink / raw)
To: Aneesh Kumar K.V, benh, Christophe Leroy, mpe, paulus; +Cc: linuxppc-dev
In-Reply-To: <88b8b995-87d3-e264-e0d6-a99c3e8e098b@c-s.fr>
Christophe Leroy's on April 3, 2019 4:31 am:
>
>
> Le 02/04/2019 à 16:34, Aneesh Kumar K.V a écrit :
>> Currently, our mm_context_t on book3s64 include all hash specific
>> context details like slice mask, subpage protection details. We
>> can skip allocating those on radix. This will help us to save
>> 8K per mm_context with radix translation.
>>
>> With the patch applied we have
>>
>> sizeof(mm_context_t) = 136
>> sizeof(struct hash_mm_context) = 8288
>>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> ---
>> NOTE:
>>
>> If we want to do this, I am still trying to figure out how best we can do this
>> without all the #ifdef and other overhead for 8xx book3e
>>
>>
>> arch/powerpc/include/asm/book3s/64/mmu-hash.h | 2 +-
>> arch/powerpc/include/asm/book3s/64/mmu.h | 48 +++++++++++--------
>> arch/powerpc/include/asm/book3s/64/slice.h | 6 +--
>> arch/powerpc/kernel/paca.c | 9 ++--
>> arch/powerpc/kernel/setup-common.c | 7 ++-
>> arch/powerpc/mm/hash_utils_64.c | 10 ++--
>> arch/powerpc/mm/mmu_context_book3s64.c | 16 ++++++-
>> arch/powerpc/mm/slb.c | 2 +-
>> arch/powerpc/mm/slice.c | 48 +++++++++----------
>> arch/powerpc/mm/subpage-prot.c | 8 ++--
>> 10 files changed, 91 insertions(+), 65 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
>> index a28a28079edb..d801be977623 100644
>> --- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h
>> +++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h
>> @@ -657,7 +657,7 @@ extern void slb_set_size(u16 size);
>>
>> /* 4 bits per slice and we have one slice per 1TB */
>> #define SLICE_ARRAY_SIZE (H_PGTABLE_RANGE >> 41)
>> -#define TASK_SLICE_ARRAY_SZ(x) ((x)->context.slb_addr_limit >> 41)
>> +#define TASK_SLICE_ARRAY_SZ(x) ((x)->context.hash_context->slb_addr_limit >> 41)
>>
>> #ifndef __ASSEMBLY__
>>
>> diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h b/arch/powerpc/include/asm/book3s/64/mmu.h
>> index a809bdd77322..07e76e304a3b 100644
>> --- a/arch/powerpc/include/asm/book3s/64/mmu.h
>> +++ b/arch/powerpc/include/asm/book3s/64/mmu.h
>> @@ -114,6 +114,33 @@ struct slice_mask {
>> DECLARE_BITMAP(high_slices, SLICE_NUM_HIGH);
>> };
>>
>> +struct hash_mm_context {
>> +
>> + u16 user_psize; /* page size index */
>
> Could we keep that in mm_context_t ?
Why do you want it there?
>> @@ -155,15 +155,15 @@ static struct slice_mask *slice_mask_for_size(struct mm_struct *mm, int psize)
>> {
>> #ifdef CONFIG_PPC_64K_PAGES
>> if (psize == MMU_PAGE_64K)
>> - return &mm->context.mask_64k;
>> + return &mm->context.hash_context->mask_64k;
>
> You should take the two patches below, that would help:
> https://patchwork.ozlabs.org/patch/1059056/
> https://patchwork.ozlabs.org/patch/1059058/
Above patches seem good I think. What I think Aneesh should have is
is a macro or inline that gives a pointer to the hash_mm_context from
an mm_context pointer.
Architectures which always want it should just put the hash struct
in their mm_context struct and that avoids the pointer overhead
completely.
Thanks,
Nick
^ permalink raw reply
* Re: [PATCH] powerpc/watchdog: Use hrtimers for per-CPU heartbeat
From: Nicholas Piggin @ 2019-04-04 16:03 UTC (permalink / raw)
To: ego; +Cc: Ravikumar Bangoria, linuxppc-dev
In-Reply-To: <CAHZ_5WzckrKg=D+joA_JJU0riObA4bb7oQj-bfBNna5y22wQ+Q@mail.gmail.com>
Gautham R Shenoy's on April 4, 2019 9:19 pm:
> Hello Nicholas,
>
> On Tue, Apr 2, 2019 at 4:57 PM Nicholas Piggin <npiggin@gmail.com> wrote:
>>
>> Using a jiffies timer creates a dependency on the tick_do_timer_cpu
>> incrementing jiffies. If that CPU has locked up and jiffies is not
>> incrementing, the watchdog heartbeat timer for all CPUs stops and
>> creates false positives and confusing warnings on local CPUs, and
>> also causes the SMP detector to stop, so the root cause is never
>> detected.
>>
>> Fix this by using hrtimer based timers for the watchdog heartbeat,
>> like the generic kernel hardlockup detector.
>>
>> Reported-by: Ravikumar Bangoria <ravi.bangoria@in.ibm.com>
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>
> [..snip..]
>
>> @@ -325,19 +325,21 @@ EXPORT_SYMBOL(arch_touch_nmi_watchdog);
>>
>> static void start_watchdog_timer_on(unsigned int cpu)
>> {
>> - struct timer_list *t = per_cpu_ptr(&wd_timer, cpu);
>> + struct hrtimer *hrtimer = this_cpu_ptr(&wd_hrtimer);
>
> This function can be called during the initialization via
>
> watchdog_nmi_start -->
> for_each_online_cpu(cpu)
> start_wd_on_cpu(cpu) -->
> start_watchdog_timer_on(cpu)
>
> Thus, it is not guarateed that we are always calling
> start_watchdog_timer_on() from the CPU where
> we want to start the watchdog timer.
>
> Thus, should we be calling this function from start_wd_on_cpu() via an
> smp_call_function_single() ?
Good catch, yes I think we need that change (like kernel/watchdog.c).
I'll resend.
Thanks,
Nick
^ permalink raw reply
* Re: [PATCH v2] powerpc/vmlinux.lds: Drop binutils < 2.18 workarounds
From: Christophe Leroy @ 2019-04-04 14:58 UTC (permalink / raw)
To: Segher Boessenkool, Joel Stanley; +Cc: linuxppc-dev
In-Reply-To: <20190404145333.GC8599@gate.crashing.org>
Le 04/04/2019 à 16:53, Segher Boessenkool a écrit :
> Hi Joel,
>
> On Thu, Apr 04, 2019 at 12:17:40PM +0000, Joel Stanley wrote:
>> On Fri, 29 Mar 2019 at 09:53, Segher Boessenkool
>> <segher@kernel.crashing.org> wrote:
>>> On Fri, Mar 29, 2019 at 05:14:53PM +1030, Joel Stanley wrote:
>>>> - NOTES :kernel :notes
>>>> + NOTES
>>>
>>> I think this still need to be
>>>
>>> NOTES :kernel
>>>
>>> or the linker will complain. Did you try to build ppc64_defconfig?
>>
>> Yeah, I did build (and boot, in qemu) the ppc64_defconfig. I tried
>> leaving in/removing the :kernel annotation in a bunch of places and as
>> long as I had it in the first spot, the kernel linked.
>>
>> Shall I respin with this added?
>
> Yes please, if only so we are testing the exact same thing :-)
>
> There may be a binutils version difference here.
>
>>> (And I do not know if there are any tools that expect the notes in a phdr,
>>> or even specifically the second phdr).
>
> ^^^ This question remains?
A few days ago while I was investigating
https://github.com/linuxppc/issues/issues/208 , I had the feeling that
QEMU expects some sort of NOTES section.
I didn't investigate further though.
Christophe
^ permalink raw reply
* Re: [PATCH v2] powerpc/vmlinux.lds: Drop binutils < 2.18 workarounds
From: Segher Boessenkool @ 2019-04-04 14:53 UTC (permalink / raw)
To: Joel Stanley; +Cc: linuxppc-dev
In-Reply-To: <CACPK8Xes6+j+bjCbqwBLJpvP-Hi_WzbtEwfUSzJjeAW9jwFRKA@mail.gmail.com>
Hi Joel,
On Thu, Apr 04, 2019 at 12:17:40PM +0000, Joel Stanley wrote:
> On Fri, 29 Mar 2019 at 09:53, Segher Boessenkool
> <segher@kernel.crashing.org> wrote:
> > On Fri, Mar 29, 2019 at 05:14:53PM +1030, Joel Stanley wrote:
> > > - NOTES :kernel :notes
> > > + NOTES
> >
> > I think this still need to be
> >
> > NOTES :kernel
> >
> > or the linker will complain. Did you try to build ppc64_defconfig?
>
> Yeah, I did build (and boot, in qemu) the ppc64_defconfig. I tried
> leaving in/removing the :kernel annotation in a bunch of places and as
> long as I had it in the first spot, the kernel linked.
>
> Shall I respin with this added?
Yes please, if only so we are testing the exact same thing :-)
There may be a binutils version difference here.
> > (And I do not know if there are any tools that expect the notes in a phdr,
> > or even specifically the second phdr).
^^^ This question remains?
Segher
^ permalink raw reply
* VLC doesn't play videos anymore since the PowerPC fixes 5.1-3
From: Christian Zigotzky @ 2019-04-04 12:48 UTC (permalink / raw)
To: Christophe Leroy, linuxppc-dev, Michael Ellerman
In-Reply-To: <0617ec18-e5a9-c430-3c66-9f1c95a1ef8e@xenosoft.de>
On 04 April 2019 at 1:23PM, Christian Zigotzky wrote:
> On 04 April 2019 at 11:07AM, Christophe Leroy wrote:
>>
>>
>> On 04/04/2019 08:44 AM, Christian Zigotzky wrote:
>>> On 04 April 2019 at 06:00AM, Christophe Leroy wrote:
>>>>
>>>>
>>>> Le 04/04/2019 à 02:58, Christian Zigotzky a écrit :
>>>>> On 03 April 2019 at 07:05AM, Christophe Leroy wrote:
>>>>>> Le 03/04/2019 à 05:52, Christian Zigotzky a écrit :
>>>>>>> Please test VLC with the RC3 of kernel 5.1.
>>>>>>>
>>>>>>> The removing of the PowerPC fixes 5.1-3 has solved the VLC
>>>>>>> issue. Another user has already confirmed that [1]. This isn’t
>>>>>>> an April Fool‘s. ;-)
>>>>>>
>>>>>> Could you bisect to identify the guilty commit ?
>>>>>>
>>>>>> Thanks
>>>>>> Christophe
>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> [1]
>>>>>>> http://forum.hyperion-entertainment.com/viewtopic.php?f=58&t=4256&start=20#p47561
>>>>>>>
>>>>>>>
>>>>>>
>>>>> Hello Christophe,
>>>>>
>>>>> I have found the problematic patch. The following patch from the
>>>>> PowerPC fixes 5.1-3 is responsible for the VLC issue.
>>>>
>>>> That change is part of the following commit:
>>>>
>>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.1-rc2&id=b5b4453e7912f056da1ca7572574cada32ecb60c
>>>>
>>>>
>>>> Just changing back the type of wtom_clock_sec to 32 bits without
>>>> changing back the loading instruction is likely to give unexpected
>>>> results on PPC64.
>>>>
>>>> Are you using 32 bits or 64 bits powerpc ?
>>>>
>>>> Christophe
>>> 64-bit kernel + 32-bit userland for example:
>>>
>>> - ubuntu MATE 16.04.6 LTS 32-bit PowerPC with a 64-bit kernel
>>> - Fienix (Debian Sid) 32-bit PowerPC with a 64-bit kernel
>>> - MATE PowerPC Remix (ubuntu MATE 17.04) 32-bit PowerPC with a
>>> 64-bit kernel
>>
>> Ok, thanks. Can you please try below change:
>>
>> diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S
>> b/arch/powerpc/kernel/vdso32/gettimeofday.S
>> index 1e0bc5955a40..afd516b572f8 100644
>> --- a/arch/powerpc/kernel/vdso32/gettimeofday.S
>> +++ b/arch/powerpc/kernel/vdso32/gettimeofday.S
>> @@ -98,7 +98,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
>> * can be used, r7 contains NSEC_PER_SEC.
>> */
>>
>> - lwz r5,WTOM_CLOCK_SEC(r9)
>> + lwz r5,(WTOM_CLOCK_SEC+LOPART)(r9)
>> lwz r6,WTOM_CLOCK_NSEC(r9)
>>
>> /* We now have our offset in r5,r6. We create a fake dependency
>>
>>
>> Christophe
>>
> Hello Christophe,
>
> Your patch works! VLC plays videos without any problems! Thank you!
>
> Cheers,
> Christian
Christophe,
I also successfully tested the VLC with the RC3 of kernel 5.1 with your
patch on openSUSE Tumbleweed PPC64 (64-bit kernel + 64-bit userland)
today. VLC works without any problems!
Screenshot:
https://i.pinimg.com/originals/5e/d4/4b/5ed44b324a7ea2fc541185880e21c165.png
Many thanks for your help! :-)
Cheers,
Christian
^ permalink raw reply
* [PATCH] ASoC: imx-pcm: Switch to SPDX identifier
From: Andra Danciu @ 2019-04-04 12:07 UTC (permalink / raw)
To: timur, nicoleotsuka, Xiubo.Lee, festevam, lgirdwood, broonie,
perex, tiwai, shawnguo, s.hauer, kernel, linux-imx, alsa-devel,
linuxppc-dev, linux-arm-kernel, linux-kernel
Cc: Andra Danciu, daniel.baluta
Adopt the SPDX license identifier headers to ease license compliance
management.
Signed-off-by: Andra Danciu <andradanciu1997@gmail.com>
---
sound/soc/fsl/imx-pcm.h | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/sound/soc/fsl/imx-pcm.h b/sound/soc/fsl/imx-pcm.h
index 133c4470acad..3ce2f437e645 100644
--- a/sound/soc/fsl/imx-pcm.h
+++ b/sound/soc/fsl/imx-pcm.h
@@ -1,13 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de>
*
* This code is based on code copyrighted by Freescale,
* Liam Girdwood, Javier Martin and probably others.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
*/
#ifndef _IMX_PCM_H
--
2.11.0
^ permalink raw reply related
* [PATCH] ASoC: imx-pcm-dma: Switch to SPDX identifier
From: Andra Danciu @ 2019-04-04 11:52 UTC (permalink / raw)
To: timur, nicoleotsuka, Xiubo.Lee, festevam, lgirdwood, broonie,
perex, tiwai, shawnguo, s.hauer, kernel, linux-imx, alsa-devel,
linuxppc-dev, linux-arm-kernel, linux-kernel
Cc: Andra Danciu
Adopt the SPDX license identifier headers to ease license compliance
management.
Signed-off-by: Andra Danciu <andradanciu1997@gmail.com>
---
sound/soc/fsl/imx-pcm-dma.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
index 314814ddd2b0..6c495761f33c 100644
--- a/sound/soc/fsl/imx-pcm-dma.c
+++ b/sound/soc/fsl/imx-pcm-dma.c
@@ -1,16 +1,12 @@
-/*
- * imx-pcm-dma-mx2.c -- ALSA Soc Audio Layer
- *
- * Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de>
- *
- * This code is based on code copyrighted by Freescale,
- * Liam Girdwood, Javier Martin and probably others.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- */
+// SPDX-License-Identifier: GPL-2.0+
+//
+// imx-pcm-dma-mx2.c -- ALSA Soc Audio Layer
+//
+// Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de>
+//
+// This code is based on code copyrighted by Freescale,
+// Liam Girdwood, Javier Martin and probably others.
+
#include <linux/platform_device.h>
#include <linux/dmaengine.h>
#include <linux/types.h>
--
2.11.0
^ permalink raw reply related
* [PATCH] powerpc/vdso32: fix CLOCK_MONOTONIC on PPC64
From: Christophe Leroy @ 2019-04-04 12:20 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Christian Zigotzky
Cc: linuxppc-dev, linux-kernel
Commit b5b4453e7912 ("powerpc/vdso64: Fix CLOCK_MONOTONIC
inconsistencies across Y2038") changed the type of wtom_clock_sec
to s64 on PPC64. Therefore, VDSO32 needs to read it with a 4 bytes
shift in order to retrieve the lower part of it.
Fixes: b5b4453e7912 ("powerpc/vdso64: Fix CLOCK_MONOTONIC inconsistencies across Y2038")
Reported-by: Christian Zigotzky <chzigotzky@xenosoft.de>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
arch/powerpc/kernel/vdso32/gettimeofday.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S
index 1e0bc5955a40..afd516b572f8 100644
--- a/arch/powerpc/kernel/vdso32/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso32/gettimeofday.S
@@ -98,7 +98,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
* can be used, r7 contains NSEC_PER_SEC.
*/
- lwz r5,WTOM_CLOCK_SEC(r9)
+ lwz r5,(WTOM_CLOCK_SEC+LOPART)(r9)
lwz r6,WTOM_CLOCK_NSEC(r9)
/* We now have our offset in r5,r6. We create a fake dependency
--
2.13.3
^ permalink raw reply related
* Re: [PATCH v2] powerpc/vmlinux.lds: Drop binutils < 2.18 workarounds
From: Joel Stanley @ 2019-04-04 12:17 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev
In-Reply-To: <20190329095318.GJ3969@gate.crashing.org>
On Fri, 29 Mar 2019 at 09:53, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> Hi!
>
> On Fri, Mar 29, 2019 at 05:14:53PM +1030, Joel Stanley wrote:
> > - NOTES :kernel :notes
> > + NOTES
>
> I think this still need to be
>
> NOTES :kernel
>
> or the linker will complain. Did you try to build ppc64_defconfig?
Yeah, I did build (and boot, in qemu) the ppc64_defconfig. I tried
leaving in/removing the :kernel annotation in a bunch of places and as
long as I had it in the first spot, the kernel linked.
Shall I respin with this added?
> (And I do not know if there are any tools that expect the notes in a phdr,
> or even specifically the second phdr).
>
>
> Segher
^ 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