Re: [PATCH v4 06/10] x86/alternative: use temporary mm for text poking

2018-11-11 Thread Nadav Amit
From: Peter Zijlstra Sent: November 11, 2018 at 2:59:36 PM GMT > To: Nadav Amit > Cc: Ingo Molnar , linux-kernel@vger.kernel.org, > x...@kernel.org, H. Peter Anvin , Thomas Gleixner > , Borislav Petkov , Dave Hansen > , Andy Lutomirski , Kees Cook > , Dave Hansen , M

Re: [PATCH v4 06/10] x86/alternative: use temporary mm for text poking

2018-11-11 Thread Nadav Amit
From: Damian Tometzki Sent: November 11, 2018 at 7:11:42 PM GMT > To: Nadav Amit > Cc: Ingo Molnar , linux-kernel@vger.kernel.org>, > x...@kernel.org>, H. Peter Anvin , Thomas Gleixner > , Borislav Petkov , Dave Hansen > , Andy Lutomirski , Kees Cook > , Pete

Re: [PATCH v4 05/10] x86/alternative: initializing temporary mm for patching

2018-11-11 Thread Nadav Amit
From: Peter Zijlstra Sent: November 11, 2018 at 2:43:27 PM GMT > To: Nadav Amit > Cc: Ingo Molnar , linux-kernel@vger.kernel.org, > x...@kernel.org, H. Peter Anvin , Thomas Gleixner > , Borislav Petkov , Dave Hansen > , Kees Cook , Dave Hansen > > Subject: Re:

Re: [PATCH v4 09/10] x86/jump-label: remove support for custom poker

2018-11-11 Thread Nadav Amit
From: Peter Zijlstra Sent: November 11, 2018 at 3:05:53 PM GMT > To: Nadav Amit > Cc: Ingo Molnar , linux-kernel@vger.kernel.org, > x...@kernel.org, H. Peter Anvin , Thomas Gleixner > , Borislav Petkov , Dave Hansen > , Andy Lutomirski , Kees Cook > , Dave Hansen , M

[PATCH v4 00/10] x86/alternative: text_poke() fixes

2018-11-10 Thread Nadav Amit
s of text_poke return value [masami] - Use __weak for poking_init instead of macros [masami] - Simplify error handling in poking_init [masami] Andy Lutomirski (1): x86/mm: temporary mm struct Nadav Amit (9): Fix "x86/alternatives: Lockdep-enforce text_mutex in text_poke*()" x86/

[PATCH v4 01/10] Fix "x86/alternatives: Lockdep-enforce text_mutex in text_poke*()"

2018-11-10 Thread Nadav Amit
Lockdep-enforce text_mutex in text_poke*()") Suggested-by: Peter Zijlstra Signed-off-by: Nadav Amit --- arch/x86/include/asm/text-patching.h | 3 +- arch/x86/kernel/alternative.c| 72 +--- arch/x86/kernel/kgdb.c | 15 -- 3 files changed,

[PATCH v4 02/10] x86/jump_label: Use text_poke_early() during early init

2018-11-10 Thread Nadav Amit
that would set a temporary mm for patching, which is initialized after some static-keys are enabled/disabled. Cc: Andy Lutomirski Cc: Kees Cook Cc: Dave Hansen Cc: Masami Hiramatsu Co-Developed-by: Peter Zijlstra Signed-off-by: Nadav Amit --- arch/x86/kernel/jump_label.c | 7 ++- 1 file ch

[PATCH v4 04/10] fork: provide a function for copying init_mm

2018-11-10 Thread Nadav Amit
Provide a function for copying init_mm. This function will be later used for setting a temporary mm. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Nadav Amit --- include/linux/sched/task.h | 1

[PATCH v4 07/10] x86/kgdb: avoid redundant comparison of code

2018-11-10 Thread Nadav Amit
text_poke() already ensures that the written value is the correct one and fails if that is not the case. There is no need for an additional comparison. Remove it. Signed-off-by: Nadav Amit --- arch/x86/kernel/kgdb.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/arch/x86/kernel

[PATCH v4 03/10] x86/mm: temporary mm struct

2018-11-10 Thread Nadav Amit
: Peter Zijlstra Cc: Dave Hansen Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/include/asm/mmu_context.h | 20 1 file changed, 20 insertions(+) diff --git a/arch/x86/include/asm

[PATCH v4 05/10] x86/alternative: initializing temporary mm for patching

2018-11-10 Thread Nadav Amit
Hiramatsu Tested-by: Masami Hiramatsu Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/include/asm/pgtable.h | 3 +++ arch/x86/include/asm/text-patching.h | 2 ++ arch/x86/kernel/alternative.c| 3 +++ arch/x86/mm/init_64.c| 39

[PATCH v4 08/10] x86: avoid W^X being broken during modules loading

2018-11-10 Thread Nadav Amit
Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Suggested-by: Thomas Gleixner Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/kernel/alternative.c | 28 +--- arch/x86/kernel/module.c | 2 +- include/linux/filter.h| 6 ++ kernel

[PATCH v4 06/10] x86/alternative: use temporary mm for text poking

2018-11-10 Thread Nadav Amit
conservative enough when mapping pages, as it always tries to map 2 pages, even when a single one is sufficient. So try to be more conservative, and do not map more than needed. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Signed-off-by: Nadav Amit

[PATCH v4 10/10] x86/alternative: remove the return value of text_poke_*()

2018-11-10 Thread Nadav Amit
The return value of text_poke_early() and text_poke_bp() is useless. Remove it. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Signed-off-by: Nadav Amit --- arch/x86/include/asm/text-patching.h | 4 ++-- arch/x86/kernel/alternative.c| 11

[PATCH v4 09/10] x86/jump-label: remove support for custom poker

2018-11-10 Thread Nadav Amit
Signed-off-by: Nadav Amit --- arch/x86/kernel/jump_label.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c index ed5fe274a7d8..7947df599e58 100644 --- a/arch/x86/kernel/jump_label.c +++ b/arch/x86/kernel

Re: [PATCH v9 02/10] Makefile: Prepare for using macros for inline asm

2018-11-10 Thread Nadav Amit
From: Nadav Amit Sent: November 8, 2018 at 8:18:23 PM GMT > To: Logan Gunthorpe , h...@zytor.com , > Ingo Molnar > Cc: LKML , X86 ML , Sam > Ravnborg , Michal Marek , Thomas > Gleixner , Linux Kbuild mailing list > , Stephen Bates > Subject: Re: [PATCH v9 02/10] Makefi

Re: [PATCH v9 02/10] Makefile: Prepare for using macros for inline asm

2018-11-08 Thread Nadav Amit
From: Logan Gunthorpe Sent: November 8, 2018 at 8:00:33 PM GMT > To: Nadav Amit , h...@zytor.com , Ingo > Molnar > Cc: LKML , X86 ML , Sam > Ravnborg , Michal Marek , Thomas > Gleixner , Linux Kbuild mailing list > , Stephen Bates > Subject: Re: [PATCH v9 02/10] Makefi

Re: [PATCH v9 02/10] Makefile: Prepare for using macros for inline asm

2018-11-08 Thread Nadav Amit
From: Logan Gunthorpe Sent: November 8, 2018 at 5:14:58 PM GMT > To: Nadav Amit , h...@zytor.com , Ingo > Molnar > Cc: LKML , X86 ML , Sam > Ravnborg , Michal Marek , Thomas > Gleixner , Linux Kbuild mailing list > , Stephen Bates > Subject: Re: [PATCH v9 02/10] Makefi

Re: [PATCH v9 02/10] Makefile: Prepare for using macros for inline asm

2018-11-07 Thread Nadav Amit
From: h...@zytor.com Sent: November 7, 2018 at 9:50:28 PM GMT > To: Logan Gunthorpe , Nadav Amit , > Ingo Molnar > Cc: LKML , X86 ML , Sam > Ravnborg , Michal Marek , Thomas > Gleixner , Linux Kbuild mailing list > , Stephen Bates > Subject: Re: [PATCH v9 02/10] Makefi

Re: [PATCH v3 2/7] x86/jump_label: Use text_poke_early() during early_init

2018-11-07 Thread Nadav Amit
From: Peter Zijlstra Sent: November 5, 2018 at 2:09:25 PM GMT > To: Nadav Amit > Cc: Ingo Molnar , linux-kernel@vger.kernel.org, > x...@kernel.org, H. Peter Anvin , Thomas Gleixner > , Borislav Petkov , Dave Hansen > , Andy Lutomirski , Kees Cook > , Dave Hansen , M

Re: [PATCH v9 02/10] Makefile: Prepare for using macros for inline asm

2018-11-07 Thread Nadav Amit
From: Logan Gunthorpe Sent: November 7, 2018 at 6:53:02 PM GMT > Subject: Re: [PATCH v9 02/10] Makefile: Prepare for using macros for inline > asm > > > > > On 2018-11-07 11:01 a.m., Nadav Amit wrote: >> Ideas? Do people care about it? > > Just spit balling

Re: [PATCH v9 02/10] Makefile: Prepare for using macros for inline asm

2018-11-07 Thread Nadav Amit
From: Logan Gunthorpe Sent: November 6, 2018 at 8:01:31 PM GMT > To: Nadav Amit , Ingo Molnar > Cc: LKML , X86 ML , Sam > Ravnborg , Michal Marek , Thomas > Gleixner , H. Peter Anvin , Linux Kbuild > mailing list , Stephen Bates > > Subject: Re: [PATCH v9 02/10] Makefi

Re: [PATCH v9 02/10] Makefile: Prepare for using macros for inline asm

2018-11-06 Thread Nadav Amit
From: Logan Gunthorpe Sent: November 6, 2018 at 6:57:57 PM GMT > To: Nadav Amit , Ingo Molnar > Cc: linux-kernel@vger.kernel.org>, x...@kernel.org>, Sam Ravnborg > , Michal Marek , Thomas Gleixner > , H. Peter Anvin , > linux-kbu...@vger.kernel.org>, Stephen Bates >

Re: [PATCH v3 6/7] x86/alternatives: use temporary mm for text poking

2018-11-06 Thread Nadav Amit
From: Peter Zijlstra Sent: November 6, 2018 at 1:11:19 PM GMT > To: Nadav Amit > Cc: Ingo Molnar , LKML , X86 > ML , H. Peter Anvin , Thomas Gleixner > , Borislav Petkov , Dave Hansen > , Andy Lutomirski , Kees Cook > , Dave Hansen , Masami > Hiramatsu > Subject

Re: [PATCH v3 2/7] x86/jump_label: Use text_poke_early() during early_init

2018-11-05 Thread Nadav Amit
From: Thomas Gleixner Sent: November 5, 2018 at 8:28:29 PM GMT > To: Andy Lutomirski > Cc: Nadav Amit , Linus Torvalds > , H. Peter Anvin , Peter > Zijlstra , Ingo Molnar , LKML > , X86 ML , Borislav Petkov > , Dave Hansen , Andrew > Lutomirski , Kees Cook , Dave Hansen

Re: [PATCH v3 2/7] x86/jump_label: Use text_poke_early() during early_init

2018-11-05 Thread Nadav Amit
From: Andy Lutomirski Sent: November 5, 2018 at 7:03:49 PM GMT > To: Nadav Amit > Cc: Peter Zijlstra , Ingo Molnar , > LKML , X86 ML , H. Peter Anvin > , Thomas Gleixner , Borislav Petkov > , Dave Hansen , Andy Lutomirski > , Kees Cook , Dave Hansen > , Masami Hir

Re: [PATCH v3 1/7] Fix "x86/alternatives: Lockdep-enforce text_mutex in text_poke*()"

2018-11-05 Thread Nadav Amit
From: Thomas Gleixner Sent: November 4, 2018 at 8:58:20 PM GMT > To: Nadav Amit > Cc: Ingo Molnar , linux-kernel@vger.kernel.org>, > x...@kernel.org>, H. Peter Anvin , Borislav Petkov > , Dave Hansen , Jiri Kosina > , Andy Lutomirski , Kees Cook > , Dave Hansen >

Re: [PATCH v3 6/7] x86/alternatives: use temporary mm for text poking

2018-11-05 Thread Nadav Amit
From: Peter Zijlstra Sent: November 5, 2018 at 1:30:41 PM GMT > To: Nadav Amit > Cc: Ingo Molnar , linux-kernel@vger.kernel.org, > x...@kernel.org, H. Peter Anvin , Thomas Gleixner > , Borislav Petkov , Dave Hansen > , Andy Lutomirski , Kees Cook > , Dave Hansen , M

Re: [PATCH v3 2/7] x86/jump_label: Use text_poke_early() during early_init

2018-11-05 Thread Nadav Amit
From: Andy Lutomirski Sent: November 5, 2018 at 5:22:32 PM GMT > To: Peter Zijlstra > Cc: Nadav Amit , Ingo Molnar , > linux-kernel@vger.kernel.org, x...@kernel.org, H. Peter Anvin > , Thomas Gleixner , Borislav Petkov > , Dave Hansen , Andy Lutomirski > , Kees Cook , Dave

[PATCH v3 0/7] x86/alternatives: text_poke() fixes

2018-11-02 Thread Nadav Amit
value [masami] - Use __weak for poking_init instead of macros [masami] - Simplify error handling in poking_init [masami] Cc: Jiri Kosina Cc: Andy Lutomirski Cc: Masami Hiramatsu Cc: Kees Cook Cc: Peter Zijlstra Andy Lutomirski (1): x86/mm: temporary mm struct Nadav Amit (6): Fix &qu

[PATCH v3 5/7] x86/alternatives: initializing temporary mm for patching

2018-11-02 Thread Nadav Amit
Hiramatsu Tested-by: Masami Hiramatsu Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/include/asm/pgtable.h | 3 +++ arch/x86/include/asm/text-patching.h | 2 ++ arch/x86/kernel/alternative.c| 3 +++ arch/x86/mm/init_64.c| 39

[PATCH v3 2/7] x86/jump_label: Use text_poke_early() during early_init

2018-11-02 Thread Nadav Amit
that would set a temporary mm for patching, which is initialized after some static-keys are enabled/disabled. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Signed-off-by: Nadav Amit --- arch/x86/kernel/jump_label.c | 8 +++- include/linux/ker

[PATCH v3 1/7] Fix "x86/alternatives: Lockdep-enforce text_mutex in text_poke*()"

2018-11-02 Thread Nadav Amit
ex in text_poke*()") Cc: Jiri Kosina Cc: Andy Lutomirski Cc: Kees Cook Cc: Dave Hansen Fixes: 9222f606506c ("x86/alternatives: Lockdep-enforce text_mutex in text_poke*()") Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Suggested-by: Peter Zijlstra Signed-off-by: Na

[PATCH v3 3/7] x86/mm: temporary mm struct

2018-11-02 Thread Nadav Amit
: Peter Zijlstra Cc: Dave Hansen Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/include/asm/mmu_context.h | 20 1 file changed, 20 insertions(+) diff --git a/arch/x86/include/asm

[PATCH v3 7/7] x86/alternatives: remove text_poke() return value

2018-11-02 Thread Nadav Amit
: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Nadav Amit --- arch/x86/include/asm/text-patching.h | 2 +- arch/x86/kernel/alternative.c| 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/text-patching.h b/arch/x86/include/asm/text

[PATCH v3 6/7] x86/alternatives: use temporary mm for text poking

2018-11-02 Thread Nadav Amit
conservative, and do not map more than needed. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Signed-off-by: Nadav Amit --- arch/x86/include/asm/fixmap.h | 2 - arch/x86/kernel/alternative.c | 112 +++--- 2 files changed, 91

[PATCH v3 4/7] fork: provide a function for copying init_mm

2018-11-02 Thread Nadav Amit
Provide a function for copying init_mm. This function will be later used for setting a temporary mm. Cc: Andy Lutomirski Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Nadav Amit --- include/linux/sched/task.h | 1

Re: [v3 07/12] x86/fsgsbase/64: Introduce the new FIND_PERCPU_BASE macro

2018-10-25 Thread Nadav Amit
From: Andy Lutomirski Sent: October 26, 2018 at 12:25:17 AM GMT > To: Bae, Chang Seok , Nadav Amit > Cc: Ingo Molnar , Thomas Gleixner , > Andrew Lutomirski , H. Peter Anvin , Andi > Kleen , Dave Hansen , > Metzger, Markus T , Ravi V. Shankar > , LKML > Subject: Re: [v

Re: [PATCH] x86: Remove -pipe from KBUILD_CFLAGS

2018-10-23 Thread Nadav Amit
From: Nathan Chancellor Sent: October 23, 2018 at 11:11:25 PM GMT > To: Thomas Gleixner; Ingo Molnar; Borislav Petkov > Cc: H. Peter Anvin; x...@kernel.org, linux-kernel@vger.kernel.org, Nadav > Amit; Kees Cook; Masahiro Yamada; Nick Desaulniers; Nathan Chancellor > Subject: [PATCH]

Re: [RFC PATCH 0/5] x86: dynamic indirect call promotion

2018-10-23 Thread Nadav Amit
at 11:36 AM, Dave Hansen wrote: > On 10/17/18 5:54 PM, Nadav Amit wrote: >> base relpoline >> - >> nginx22898 25178 (+10%) >> redis-ycsb 24523 25486 (+4%) >> dbench 2144

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Nadav Amit
at 9:29 PM, Andy Lutomirski wrote: >> On Oct 18, 2018, at 6:08 PM, Nadav Amit wrote: >> >> at 10:00 AM, Andy Lutomirski wrote: >> >>>> On Oct 18, 2018, at 9:47 AM, Nadav Amit wrote: >>>> >>>> at 8:51 PM, Andy Lutomirski wrote: &g

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Nadav Amit
at 10:00 AM, Andy Lutomirski wrote: > > >> On Oct 18, 2018, at 9:47 AM, Nadav Amit wrote: >> >> at 8:51 PM, Andy Lutomirski wrote: >> >>>> On Wed, Oct 17, 2018 at 8:12 PM Nadav Amit wrote: >>>> at 6:22 PM, Andy Lutomirski wrote: >&

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Nadav Amit
at 12:54 AM, Peter Zijlstra wrote: > On Wed, Oct 17, 2018 at 06:22:48PM -0700, Andy Lutomirski wrote: >>> On Oct 17, 2018, at 5:54 PM, Nadav Amit wrote: >>> >>> It is sometimes beneficial to prevent preemption for very few >>> instructions, or preven

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Nadav Amit
at 10:29 AM, Andy Lutomirski wrote: > On Thu, Oct 18, 2018 at 10:25 AM Nadav Amit wrote: >> at 10:00 AM, Andy Lutomirski wrote: >> >>>> On Oct 18, 2018, at 9:47 AM, Nadav Amit wrote: >>>> >>>> at 8:51 PM, Andy Lutomirski wrote: >>>

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Nadav Amit
at 10:00 AM, Andy Lutomirski wrote: > > >> On Oct 18, 2018, at 9:47 AM, Nadav Amit wrote: >> >> at 8:51 PM, Andy Lutomirski wrote: >> >>>> On Wed, Oct 17, 2018 at 8:12 PM Nadav Amit wrote: >>>> at 6:22 PM, Andy Lutomirski wrote: >&

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-18 Thread Nadav Amit
at 8:51 PM, Andy Lutomirski wrote: > On Wed, Oct 17, 2018 at 8:12 PM Nadav Amit wrote: >> at 6:22 PM, Andy Lutomirski wrote: >> >>>> On Oct 17, 2018, at 5:54 PM, Nadav Amit wrote: >>>> >>>> It is sometimes beneficial to prevent pr

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-17 Thread Nadav Amit
at 8:11 PM, Nadav Amit wrote: > at 6:22 PM, Andy Lutomirski wrote: > >>> On Oct 17, 2018, at 5:54 PM, Nadav Amit wrote: >>> >>> It is sometimes beneficial to prevent preemption for very few >>> instructions, or prevent preemption for some instructi

Re: [RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-17 Thread Nadav Amit
at 6:22 PM, Andy Lutomirski wrote: > >> On Oct 17, 2018, at 5:54 PM, Nadav Amit wrote: >> >> It is sometimes beneficial to prevent preemption for very few >> instructions, or prevent preemption for some instructions that precede >> a branch (this latter ca

[RFC PATCH 0/5] x86: dynamic indirect call promotion

2018-10-17 Thread Nadav Amit
that some of the approaches I took would challenge the new code-of-conduct, so I though of getting some feedback before putting more effort into it. Nadav Amit (5): x86: introduce preemption disable prefix x86: patch indirect branch promotion x86: interface for accessing indirect branch

[RFC PATCH 1/5] x86: introduce preemption disable prefix

2018-10-17 Thread Nadav Amit
indication that preemption is disabled for the following instruction. It is expected that this opcode is not in common use. Signed-off-by: Nadav Amit --- arch/x86/entry/entry_64.S| 10 ++ arch/x86/include/asm/nospec-branch.h | 12 2 files changed, 22 insertions(+) diff

[RFC PATCH 2/5] x86: patch indirect branch promotion

2018-10-17 Thread Nadav Amit
thunks and patch them to hold the code that is needed for indirect branch promotion. The build-system is slightly broken with this patch, as changes to nospec-branch.h should trigger a full kernel rebuild, which currently it does not. Signed-off-by: Nadav Amit --- arch/x86/include/asm/nospec

[RFC PATCH 3/5] x86: interface for accessing indirect branch locations

2018-10-17 Thread Nadav Amit
Adding a C interface to access the locations of indirect branches. To be used for dynamic patching. Signed-off-by: Nadav Amit --- arch/x86/include/asm/nospec-branch.h | 1 - arch/x86/include/asm/sections.h | 2 ++ include/linux/module.h | 5 + kernel/module.c

[RFC PATCH 4/5] x86: learning and patching indirect branch targets

2018-10-17 Thread Nadav Amit
branches are set back into learning mode to see whether the targets have changed. The current policy might be too aggressive. Signed-off-by: Nadav Amit --- arch/x86/include/asm/nospec-branch.h | 3 + arch/x86/kernel/nospec-branch.c | 894 +++ 2 files changed, 897

[RFC PATCH 5/5] x86: relpoline: disabling interface

2018-10-17 Thread Nadav Amit
In certain cases it is beneficial not to use indirect branch promotion. One such case is seccomp, which may hold multiple filters and different ones for different processes. The interface indicates to the macro not to add a relpoline to the the indirect branch. Signed-off-by: Nadav Amit

Re: [PATCH v9 04/10] x86: refcount: prevent gcc distortions

2018-10-07 Thread Nadav Amit
at 2:31 AM, Ingo Molnar wrote: > > * Nadav Amit wrote: > >>> Are you using defconfig or a reasonable distro-config for your tests? >> >> I think it is best to take the kernel and run localyesconfig for testing. > > Ok, agreed - and this makes the number

[tip:x86/build] x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs

2018-10-06 Thread tip-bot for Nadav Amit
Commit-ID: 5bdcd510c2ac9efaf55c4cbd8d46421d8e2320cd Gitweb: https://git.kernel.org/tip/5bdcd510c2ac9efaf55c4cbd8d46421d8e2320cd Author: Nadav Amit AuthorDate: Fri, 5 Oct 2018 13:27:18 -0700 Committer: Ingo Molnar CommitDate: Sat, 6 Oct 2018 15:52:17 +0200 x86/jump-labels: Macrofy

[tip:x86/build] x86/cpufeature: Macrofy inline assembly code to work around GCC inlining bugs

2018-10-06 Thread tip-bot for Nadav Amit
Commit-ID: d5a581d84ae6b8a4a740464b80d8d9cf1e7947b2 Gitweb: https://git.kernel.org/tip/d5a581d84ae6b8a4a740464b80d8d9cf1e7947b2 Author: Nadav Amit AuthorDate: Fri, 5 Oct 2018 13:27:17 -0700 Committer: Ingo Molnar CommitDate: Sat, 6 Oct 2018 15:52:16 +0200 x86/cpufeature: Macrofy

[tip:x86/build] x86/extable: Macrofy inline assembly code to work around GCC inlining bugs

2018-10-06 Thread tip-bot for Nadav Amit
Commit-ID: 0474d5d9d2f7f3b11262f7bf87d0e7314ead9200 Gitweb: https://git.kernel.org/tip/0474d5d9d2f7f3b11262f7bf87d0e7314ead9200 Author: Nadav Amit AuthorDate: Fri, 5 Oct 2018 13:27:16 -0700 Committer: Ingo Molnar CommitDate: Sat, 6 Oct 2018 15:52:15 +0200 x86/extable: Macrofy inline

Re: [RFC] x86/cpu_entry_area: move part of it back to fixmap

2018-10-05 Thread Nadav Amit
at 3:10 PM, Andy Lutomirski wrote: > On Fri, Oct 5, 2018 at 3:08 PM Nadav Amit wrote: >> at 10:02 AM, Andy Lutomirski wrote: >> >>> On Thu, Oct 4, 2018 at 9:31 AM Nadav Amit wrote: >>>> at 7:11 AM, Andy Lutomirski wrote: >>>> >

[PATCH 1/3] x86/extable: Macrofy inline assembly code to work around GCC inlining bugs

2018-10-05 Thread Nadav Amit
0226256 2957312 31346447 1de4f0f ./vmlinux after (+292) But this allows the inlining of functions such as nested_vmx_exit_reflected(), set_segment_reg(), __copy_xstate_to_user() which is a net benefit. Tested-by: Kees Cook Signed-off-by: Nadav Amit Acked-by: Peter Zijlstra (Intel) Cc: Andy

[PATCH 0/3] Macrofying inline asm rebased

2018-10-05 Thread Nadav Amit
03561ac3fd71410 Nadav Amit (3): x86/extable: Macrofy inline assembly code to work around GCC inlining bugs x86/cpufeature: Macrofy inline assembly code to work around GCC inlining bugs x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs arch/x86/

[PATCH 2/3] x86/cpufeature: Macrofy inline assembly code to work around GCC inlining bugs

2018-10-05 Thread Nadav Amit
hex filename 18162879 10226256 2957312 31346447 1de4f0f ./vmlinux before 18163528 10226300 2957312 31347140 1de51c4 ./vmlinux after (+693) And enables the inlining of function such as free_ldt_pgtables(). Tested-by: Kees Cook Signed-off-by: Nadav Amit Acked-by: Peter Zijlstra (Intel) Cc: Andy

[PATCH 3/3] x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs

2018-10-05 Thread Nadav Amit
0226300 2957312 31347140 1de51c4 ./vmlinux before 18163608 10227348 2957312 31348268 1de562c ./vmlinux after (+1128) And functions such as intel_pstate_adjust_policy_max(), kvm_cpu_accept_dm_intr(), kvm_register_readl() are inlined. Tested-by: Kees Cook Signed-off-by: Nadav Amit Acked-by: Peter Zijls

Re: [RFC] x86/cpu_entry_area: move part of it back to fixmap

2018-10-05 Thread Nadav Amit
at 10:02 AM, Andy Lutomirski wrote: > On Thu, Oct 4, 2018 at 9:31 AM Nadav Amit wrote: >> at 7:11 AM, Andy Lutomirski wrote: >> >>> On Oct 3, 2018, at 9:59 PM, Nadav Amit wrote: >>> >>>> This RFC proposes to return part of the entry-area b

Re: [PATCH v9 04/10] x86: refcount: prevent gcc distortions

2018-10-04 Thread Nadav Amit
at 12:33 PM, H. Peter Anvin wrote: > On 10/04/18 02:16, Ingo Molnar wrote: >> * h...@zytor.com wrote: >> >>> Ingo: I wasn't talking necessarily about the specifics of each bit, but >>> rather the general >>> concept about being able to use macros in inlines... >> >> Ok, agreed about that par

Re: [RFC] x86/cpu_entry_area: move part of it back to fixmap

2018-10-04 Thread Nadav Amit
at 7:11 AM, Andy Lutomirski wrote: > > > On Oct 3, 2018, at 9:59 PM, Nadav Amit wrote: > >> This RFC proposes to return part of the entry-area back to the fixmap to >> improve system-call performance. Currently, since the entry-area is >> mapped far (more than

Re: [PATCH v9 04/10] x86: refcount: prevent gcc distortions

2018-10-04 Thread Nadav Amit
at 2:45 AM, Ingo Molnar wrote: > > * Nadav Amit wrote: > >>> Another, separate question I wanted to ask: how do we ensure that the >>> kernel stays fixed? >>> I.e. is there some tooling we can use to actually measure whether there's >>> bad

[tip:x86/build] x86/paravirt: Work around GCC inlining bugs when compiling paravirt ops

2018-10-04 Thread tip-bot for Nadav Amit
Commit-ID: 494b5168f2de009eb80f198f668da374295098dd Gitweb: https://git.kernel.org/tip/494b5168f2de009eb80f198f668da374295098dd Author: Nadav Amit AuthorDate: Wed, 3 Oct 2018 14:30:57 -0700 Committer: Ingo Molnar CommitDate: Thu, 4 Oct 2018 11:25:00 +0200 x86/paravirt: Work around GCC

[tip:x86/build] x86/bug: Macrofy the BUG table section handling, to work around GCC inlining bugs

2018-10-04 Thread tip-bot for Nadav Amit
Commit-ID: f81f8ad56fd1c7b99b2ed1c314527f7d9ac447c6 Gitweb: https://git.kernel.org/tip/f81f8ad56fd1c7b99b2ed1c314527f7d9ac447c6 Author: Nadav Amit AuthorDate: Wed, 3 Oct 2018 14:30:56 -0700 Committer: Ingo Molnar CommitDate: Thu, 4 Oct 2018 11:25:00 +0200 x86/bug: Macrofy the BUG

[tip:x86/build] x86/alternatives: Macrofy lock prefixes to work around GCC inlining bugs

2018-10-04 Thread tip-bot for Nadav Amit
Commit-ID: 77f48ec28e4ccff94d2e5f4260a83ac27a7f3099 Gitweb: https://git.kernel.org/tip/77f48ec28e4ccff94d2e5f4260a83ac27a7f3099 Author: Nadav Amit AuthorDate: Wed, 3 Oct 2018 14:30:55 -0700 Committer: Ingo Molnar CommitDate: Thu, 4 Oct 2018 11:24:59 +0200 x86/alternatives: Macrofy

[tip:x86/build] kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related GCC inlining bugs

2018-10-04 Thread tip-bot for Nadav Amit
Commit-ID: 77b0bf55bc675233d22cd5df97605d516d64525e Gitweb: https://git.kernel.org/tip/77b0bf55bc675233d22cd5df97605d516d64525e Author: Nadav Amit AuthorDate: Wed, 3 Oct 2018 14:30:52 -0700 Committer: Ingo Molnar CommitDate: Thu, 4 Oct 2018 10:57:09 +0200 kbuild/Makefile: Prepare for

[tip:x86/build] x86/refcount: Work around GCC inlining bug

2018-10-04 Thread tip-bot for Nadav Amit
Commit-ID: 9e1725b410594911cc5981b6c7b4cea4ec054ca8 Gitweb: https://git.kernel.org/tip/9e1725b410594911cc5981b6c7b4cea4ec054ca8 Author: Nadav Amit AuthorDate: Wed, 3 Oct 2018 14:30:54 -0700 Committer: Ingo Molnar CommitDate: Thu, 4 Oct 2018 11:24:59 +0200 x86/refcount: Work around GCC

[tip:x86/build] x86/objtool: Use asm macros to work around GCC inlining bugs

2018-10-04 Thread tip-bot for Nadav Amit
Commit-ID: c06c4d8090513f2974dfdbed2ac98634357ac475 Gitweb: https://git.kernel.org/tip/c06c4d8090513f2974dfdbed2ac98634357ac475 Author: Nadav Amit AuthorDate: Wed, 3 Oct 2018 14:30:53 -0700 Committer: Ingo Molnar CommitDate: Thu, 4 Oct 2018 11:24:58 +0200 x86/objtool: Use asm macros

[tip:x86/build] kbuild/arch/xtensa: Define LINKER_SCRIPT for the linker script

2018-10-04 Thread tip-bot for Nadav Amit
Commit-ID: 35e76b99ddf20405a6196bb7c9eb152675c93106 Gitweb: https://git.kernel.org/tip/35e76b99ddf20405a6196bb7c9eb152675c93106 Author: Nadav Amit AuthorDate: Wed, 3 Oct 2018 14:30:51 -0700 Committer: Ingo Molnar CommitDate: Thu, 4 Oct 2018 10:05:38 +0200 kbuild/arch/xtensa: Define

Re: [RFC] x86/cpu_entry_area: move part of it back to fixmap

2018-10-04 Thread Nadav Amit
at 12:37 AM, Peter Zijlstra wrote: > On Wed, Oct 03, 2018 at 09:59:48PM -0700, Nadav Amit wrote: >> This patch proposes to do something different: break >> it into two. One part holds code+data that is needed for the entry >> (trampoline code, entry stack and TSS), which is

Re: [PATCH v9 04/10] x86: refcount: prevent gcc distortions

2018-10-04 Thread Nadav Amit
at 2:12 AM, Ingo Molnar wrote: > > * Nadav Amit wrote: > >> I can run some tests. (@hpa: I thought you asked about the -pipe overhead; >> perhaps I misunderstood). > > Well, tests are unlikely to show the overhead of extra lines of this > magnitude, unless done

Re: [PATCH v9 04/10] x86: refcount: prevent gcc distortions

2018-10-04 Thread Nadav Amit
at 1:40 AM, h...@zytor.com wrote: > On October 4, 2018 1:33:33 AM PDT, Ingo Molnar wrote: >> * Ingo Molnar wrote: >> >>> I'm also somewhat annoyed at the fact that this series carries a >> boatload >>> of reviewed-by's and acked-by's, yet none of those reviewers found it >>> important to point

Re: [PATCH v9 04/10] x86: refcount: prevent gcc distortions

2018-10-04 Thread Nadav Amit
at 12:57 AM, Ingo Molnar wrote: > > * Nadav Amit wrote: > >> GCC considers the number of statements in inlined assembly blocks, >> according to new-lines and semicolons, as an indication to the cost of >> the block in time and space. This data is distorted by the

[RFC] x86/cpu_entry_area: move part of it back to fixmap

2018-10-03 Thread Nadav Amit
ms reasonable to ask first for comments before putting an effort into shaping it up. Cc: David Woodhouse Cc: Peter Zijlstra Cc: Andy Lutomirski Cc: Thomas Gleixner Signed-off-by: Nadav Amit --- arch/x86/entry/entry_64.S | 34 +-- arch/x86/events/intel/ds.c |

[PATCH v9 08/10] x86: extable: use macros instead of inline assembly

2018-10-03 Thread Nadav Amit
: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x...@kernel.org Cc: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) Tested-by: Kees Cook Signed-off-by: Nadav Amit --- arch/x86/include/asm/asm.h | 61 +- arch/x86/kernel/macros.S | 1

[PATCH v9 05/10] x86: alternatives: macrofy locks for better inlining

2018-10-03 Thread Nadav Amit
nel.org Cc: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) Tested-by: Kees Cook Signed-off-by: Nadav Amit --- arch/x86/include/asm/alternative-asm.h | 20 ++-- arch/x86/include/asm/alternative.h | 11 ++- arch/x86/kernel/macros.S | 1 + 3 files c

[PATCH v9 04/10] x86: refcount: prevent gcc distortions

2018-10-03 Thread Nadav Amit
) Functions such as kref_get(), free_user(), fuse_file_get() now get inlined. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x...@kernel.org Cc: Jan Beulich Cc: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) Tested-by: Kees Cook Signed-off-by: Nadav Amit --- arch/x86/i

[PATCH v9 01/10] xtensa: defining LINKER_SCRIPT for the linker script

2018-10-03 Thread Nadav Amit
Defining the LINKER_SCRIPT when building the linker script as being done in other architectures. This is required for the next Makefile changes would otherwise break things. Cc: Chris Zankel Cc: linux-xte...@linux-xtensa.org Acked-by: Max Filippov Signed-off-by: Nadav Amit --- arch/xtensa

[PATCH v9 03/10] x86: objtool: use asm macro for better compiler decisions

2018-10-03 Thread Nadav Amit
: 40302 (-19) Cc: Christopher Li Cc: linux-spa...@vger.kernel.org Acked-by: Peter Zijlstra (Intel) Reviewed-by: Josh Poimboeuf Tested-by: Kees Cook Signed-off-by: Nadav Amit --- arch/x86/kernel/macros.S | 2 ++ include/linux/compiler.h | 56 ++-- 2 files

[PATCH v9 02/10] Makefile: Prepare for using macros for inline asm

2018-10-03 Thread Nadav Amit
Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x...@kernel.org Cc: linux-kbu...@vger.kernel.org Acked-by: Masahiro Yamada Acked-by: Peter Zijlstra (Intel) Tested-by: Kees Cook Signed-off-by: Nadav Amit --- Makefile | 9 +++-- arch/x86/Makefile| 7 +++

[PATCH v9 06/10] x86: bug: prevent gcc distortions

2018-10-03 Thread Nadav Amit
(-165) Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x...@kernel.org Cc: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) Tested-by: Kees Cook Signed-off-by: Nadav Amit --- arch/x86/include/asm/bug.h | 98 ++ arch/x86/kerne

[PATCH v9 09/10] x86: cpufeature: use macros instead of inline assembly

2018-10-03 Thread Nadav Amit
Peter Anvin" Cc: x...@kernel.org Acked-by: Peter Zijlstra (Intel) Tested-by: Kees Cook Signed-off-by: Nadav Amit --- arch/x86/include/asm/cpufeature.h | 82 ++- arch/x86/kernel/macros.S | 1 + 2 files changed, 48 insertions(+), 35 deletions(-) diff --

[PATCH v9 07/10] x86: prevent inline distortion by paravirt ops

2018-10-03 Thread Nadav Amit
Cc: "H. Peter Anvin" Cc: x...@kernel.org Cc: virtualizat...@lists.linux-foundation.org Acked-by: Peter Zijlstra (Intel) Reviewed-by: Juergen Gross Tested-by: Kees Cook Signed-off-by: Nadav Amit --- arch/x86/include/asm/paravirt_types.h | 56 +-- arch/

[PATCH v9 10/10] x86: jump-labels: use macros instead of inline assembly

2018-10-03 Thread Nadav Amit
: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x...@kernel.org Cc: Greg Kroah-Hartman Cc: Kate Stewart Cc: Philippe Ombredanne Acked-by: Peter Zijlstra (Intel) Tested-by: Kees Cook Signed-off-by: Nadav Amit --- arch/x86/entry/calling.h | 2 +- arch/x86/i

Re: [PATCH v8 02/10] Makefile: Prepare for using macros for inline asm

2018-10-03 Thread Nadav Amit
at 12:43 PM, h...@zytor.com wrote: > > Does -pipe actually win anything these days? Sorry, I don’t have the time to check it right now. Anyhow, I presume it is best that such a change will be in a separate patch.

Re: [PATCH v8 02/10] Makefile: Prepare for using macros for inline asm

2018-10-03 Thread Nadav Amit
at 3:01 PM, Masahiro Yamada wrote: > Hi. Thanks for your reply. Your advices are always valuable! > > > > 2018年9月27日(木) 2:57 Nadav Amit : >> at 1:58 AM, Rasmus Villemoes wrote: >> >>> On 2018-09-18 23:28, Nadav Amit wrote: >>> >>&g

[PATCH v3 04/20] vmw_balloon: simplifying batch access

2018-09-26 Thread Nadav Amit
The use of accessors for batch entries complicates the code and makes it less readable. Remove it an instead use bit-fields. Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 81 ++ 1 file changed, 30 insertions(+), 51

[PATCH v3 03/20] vmw_balloon: merge send_lock and send_unlock path

2018-09-26 Thread Nadav Amit
The lock and unlock code paths are very similar, so avoid the duplicate code by merging them together. Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 62 +- 1 file changed, 21 insertions(+), 41 deletions(-) diff

[PATCH v3 02/20] vmw_balloon: unify commands tracing and stats

2018-09-26 Thread Nadav Amit
Now that we have a single point, unify the tracing and collecting the statistics for commands and their failure. While it might somewhat reduce the control over debugging, it cleans the code a lot. Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 116

[PATCH v3 07/20] vmw_balloon: treat all refused pages equally

2018-09-26 Thread Nadav Amit
refused list. Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 52 +- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 96dde120bbd5

[PATCH v3 09/20] vmw_balloon: refactor change size from vmballoon_work

2018-09-26 Thread Nadav Amit
The required change in the balloon size is currently computed in vmballoon_work(), vmballoon_inflate() and vmballoon_deflate(). Refactor it to simplify the next patches. Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 75

[PATCH v3 06/20] vmw_balloon: change batch/single lock abstractions

2018-09-26 Thread Nadav Amit
consistent in the return type and avoid potential coding errors. Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 358 + 1 file changed, 165 insertions(+), 193 deletions(-) diff --git a/drivers/misc/vmw_balloon.c b/drivers

[PATCH v3 01/20] vmw_balloon: handle commands in a single function.

2018-09-26 Thread Nadav Amit
selectively). Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 223 +++-- 1 file changed, 116 insertions(+), 107 deletions(-) diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 2543ef1ece17..0a4d5501f805

[PATCH v3 08/20] vmw_balloon: rename VMW_BALLOON_2M_SHIFT to VMW_BALLOON_2M_ORDER

2018-09-26 Thread Nadav Amit
hange. Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 4e067d269706..626abe65eddb 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_ball

[PATCH v3 19/20] vmw_balloon: memory shrinker

2018-09-26 Thread Nadav Amit
-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 124 - 1 file changed, 122 insertions(+), 2 deletions(-) diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 4c9c171325c3..8d60c7e65242 100644 --- a/drivers

<    3   4   5   6   7   8   9   10   11   12   >