Re: [PATCH v7 2/2] ThunderX2, perf : Add Cavium ThunderX2 SoC UNCORE PMU driver

2018-11-19 Thread Ganapatrao Kulkarni
Hi Suzuki, Thanks for the comments, will update next version with your comments. On Fri, Nov 16, 2018 at 4:14 AM Suzuki K Poulose wrote: > > Hi, > > On 10/25/2018 06:59 AM, Kulkarni, Ganapatrao wrote: > > This patch adds a perf driver for the PMU UNCORE devices DDR4 Memory > > Controller(DMC) an

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Leon Romanovsky
On Tue, Nov 20, 2018 at 11:07:02AM +0800, Kenneth Lee wrote: > On Mon, Nov 19, 2018 at 11:49:54AM -0700, Jason Gunthorpe wrote: > > Date: Mon, 19 Nov 2018 11:49:54 -0700 > > From: Jason Gunthorpe > > To: Kenneth Lee > > CC: Leon Romanovsky , Kenneth Lee , > > Tim Sell , linux-doc@vger.kernel.org

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jason Gunthorpe
On Tue, Nov 20, 2018 at 11:07:02AM +0800, Kenneth Lee wrote: > On Mon, Nov 19, 2018 at 11:49:54AM -0700, Jason Gunthorpe wrote: > > Date: Mon, 19 Nov 2018 11:49:54 -0700 > > From: Jason Gunthorpe > > To: Kenneth Lee > > CC: Leon Romanovsky , Kenneth Lee , > > Tim Sell , linux-doc@vger.kernel.org

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Kenneth Lee
On Mon, Nov 19, 2018 at 11:49:54AM -0700, Jason Gunthorpe wrote: > Date: Mon, 19 Nov 2018 11:49:54 -0700 > From: Jason Gunthorpe > To: Kenneth Lee > CC: Leon Romanovsky , Kenneth Lee , > Tim Sell , linux-doc@vger.kernel.org, Alexander > Shishkin , Zaibo Xu > , zhangfei@foxmail.com, linux..

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Kenneth Lee
On Mon, Nov 19, 2018 at 12:48:01PM +0200, Leon Romanovsky wrote: > Date: Mon, 19 Nov 2018 12:48:01 +0200 > From: Leon Romanovsky > To: Kenneth Lee > CC: Tim Sell , linux-doc@vger.kernel.org, > Alexander Shishkin , Zaibo Xu > , zhangfei@foxmail.com, linux...@huawei.com, > haojian.zhu...@lin

RE: [PATCH v7 00/13] arch/x86: AMD QoS support

2018-11-19 Thread Yu, Fenghua
> From: Pavel Machek [mailto:pa...@ucw.cz] > > rename Documentation/x86/{intel_rdt_ui.txt => resctrl_ui.txt} (99%) > > Rest of files in that directory use - as a separator; and maybe qos.txt would > be a better name then this? Actually a few other files in the directory use "_" as a separator (e

Re: [PATCH v7 00/13] arch/x86: AMD QoS support

2018-11-19 Thread Pavel Machek
Hi! > rename Documentation/x86/{intel_rdt_ui.txt => resctrl_ui.txt} (99%) Rest of files in that directory use - as a separator; and maybe qos.txt would be a better name then this? Thanks, Pavel -- (english) http://www.liv

Re: [RFC PATCH v6 08/11] x86: Insert endbr32/endbr64 to vDSO

2018-11-19 Thread Yu-cheng Yu
On Mon, 2018-11-19 at 14:17 -0800, Andy Lutomirski wrote: > On Mon, Nov 19, 2018 at 1:55 PM Yu-cheng Yu wrote: > > > > From: "H.J. Lu" > > > > When Intel indirect branch tracking is enabled, functions in vDSO which > > may be called indirectly must have endbr32 or endbr64 as the first > > instr

Re: [RFC PATCH v6 09/11] x86/vsyscall/32: Add ENDBR32 to vsyscall entry point

2018-11-19 Thread Yu-cheng Yu
On Mon, 2018-11-19 at 14:23 -0800, Andy Lutomirski wrote: > On Mon, Nov 19, 2018 at 1:55 PM Yu-cheng Yu wrote: > > > > From: "H.J. Lu" > > > > Add ENDBR32 to vsyscall entry point. > > $SUBJECT should be "x86/vdso/32: Add ENDBR32 to __kernel_vsyscall entry > point". I will fix it. Yu-cheng

Re: [RFC PATCH v6 09/11] x86/vsyscall/32: Add ENDBR32 to vsyscall entry point

2018-11-19 Thread Andy Lutomirski
On Mon, Nov 19, 2018 at 1:55 PM Yu-cheng Yu wrote: > > From: "H.J. Lu" > > Add ENDBR32 to vsyscall entry point. $SUBJECT should be "x86/vdso/32: Add ENDBR32 to __kernel_vsyscall entry point". --Andy

Re: [RFC PATCH v6 10/11] x86/vsyscall/64: Add ENDBR64 to vsyscall entry points

2018-11-19 Thread Andy Lutomirski
On Mon, Nov 19, 2018 at 1:55 PM Yu-cheng Yu wrote: > > From: "H.J. Lu" > > Add ENDBR64 to vsyscall entry points. > > Signed-off-by: H.J. Lu Acked-by: Andy Lutomirski although the scenarios where this matters will be extremely rare, given that this code is mapped NX :) Tools like 'pin' may ca

Re: [PATCH] hwmon (ina3221) Add single-shot mode support

2018-11-19 Thread Nicolin Chen
On Mon, Nov 19, 2018 at 09:45:59AM -0800, Guenter Roeck wrote: > > In short, other than exposing it via a generic ABI to the user > > space, how about defining some policy to maintaining it within > > the driver? > I think that would be a bad idea. It changes timing for everyone > curently using t

Re: [RFC PATCH v6 08/11] x86: Insert endbr32/endbr64 to vDSO

2018-11-19 Thread Andy Lutomirski
On Mon, Nov 19, 2018 at 1:55 PM Yu-cheng Yu wrote: > > From: "H.J. Lu" > > When Intel indirect branch tracking is enabled, functions in vDSO which > may be called indirectly must have endbr32 or endbr64 as the first > instruction. Compiler must support -fcf-protection=branch so that it > can be

[RFC PATCH v6 01/26] Documentation/x86: Add CET description

2018-11-19 Thread Yu-cheng Yu
Explain how CET works and the no_cet_shstk/no_cet_ibt kernel parameters. Signed-off-by: Yu-cheng Yu --- .../admin-guide/kernel-parameters.txt | 6 + Documentation/index.rst | 1 + Documentation/x86/index.rst | 13 + Documentation/x86/intel_cet

[RFC PATCH v6 03/26] x86/fpu/xstate: Change names to separate XSAVES system and user states

2018-11-19 Thread Yu-cheng Yu
Control-flow Enforcement (CET) MSR contents are XSAVES system states. To support CET, introduce XSAVES system states first. XSAVES is a "supervisor" instruction and, comparing to XSAVE, saves additional "supervisor" states that can be modified only from CPL 0. However, these states are per-task an

[RFC PATCH v6 00/26] Control-flow Enforcement: Shadow Stack

2018-11-19 Thread Yu-cheng Yu
The previous version of CET Shadow Stack patches is at the following link: https://lkml.org/lkml/2018/10/11/642 Summary of changes from v5: To support more threads, change compat-mode thread shadow stack to a fixed size from RLIMIT_STACK to RLIMIT_STACK / 4. This change applies only to

[RFC PATCH v6 08/26] mm: Introduce VM_SHSTK for shadow stack memory

2018-11-19 Thread Yu-cheng Yu
VM_SHSTK indicates a shadow stack memory area. The shadow stack is implemented only for the 64-bit kernel. Signed-off-by: Yu-cheng Yu --- fs/proc/task_mmu.c | 3 +++ include/linux/mm.h | 8 2 files changed, 11 insertions(+) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 47c

[RFC PATCH v6 05/26] x86/fpu/xstate: Add XSAVES system states for shadow stack

2018-11-19 Thread Yu-cheng Yu
Intel Control-flow Enforcement Technology (CET) introduces the following MSRs. MSR_IA32_U_CET (user-mode CET settings), MSR_IA32_PL3_SSP (user-mode shadow stack), MSR_IA32_PL0_SSP (kernel-mode shadow stack), MSR_IA32_PL1_SSP (Privilege Level 1 shadow stack), MSR_IA32_PL2_SSP (P

[RFC PATCH v6 12/26] drm/i915/gvt: Update _PAGE_DIRTY to _PAGE_DIRTY_BITS

2018-11-19 Thread Yu-cheng Yu
Update _PAGE_DIRTY to _PAGE_DIRTY_BITS in split_2MB_gtt_entry(). In order to support Control-flow Enforcement (CET), _PAGE_DIRTY is now _PAGE_DIRTY_HW or _PAGE_DIRTY_SW. Signed-off-by: Yu-cheng Yu --- drivers/gpu/drm/i915/gvt/gtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --g

[RFC PATCH v6 13/26] x86/mm: Modify ptep_set_wrprotect and pmdp_set_wrprotect for _PAGE_DIRTY_SW

2018-11-19 Thread Yu-cheng Yu
When Shadow Stack is enabled, the [R/O + PAGE_DIRTY_HW] setting is reserved only for the Shadow Stack. Non-Shadow Stack R/O PTEs use [R/O + PAGE_DIRTY_SW]. When a PTE goes from [R/W + PAGE_DIRTY_HW] to [R/O + PAGE_DIRTY_SW], it could become a transient Shadow Stack PTE in two cases. The first ca

[RFC PATCH v6 10/26] x86/mm: Change _PAGE_DIRTY to _PAGE_DIRTY_HW

2018-11-19 Thread Yu-cheng Yu
Before introducing _PAGE_DIRTY_SW for non-hardware, memory management purposes in the next patch, rename _PAGE_DIRTY to _PAGE_DIRTY_HW and _PAGE_BIT_DIRTY to _PAGE_BIT_DIRTY_HW to make these PTE dirty bits more clear. There are no functional changes in this patch. Signed-off-by: Yu-cheng Yu ---

[RFC PATCH v6 07/26] x86/cet/shstk: Add Kconfig option for user-mode shadow stack

2018-11-19 Thread Yu-cheng Yu
Introduce Kconfig option X86_INTEL_SHADOW_STACK_USER. An application has shadow stack protection when all the following are true: (1) The kernel has X86_INTEL_SHADOW_STACK_USER enabled, (2) The running processor supports the shadow stack, (3) The application is built with shadow stack enabl

[RFC PATCH v6 06/26] x86/cet: Add control protection exception handler

2018-11-19 Thread Yu-cheng Yu
A control protection exception is triggered when a control flow transfer attempt violated shadow stack or indirect branch tracking constraints. For example, the return address for a RET instruction differs from the safe copy on the shadow stack; or a JMP instruction arrives at a non- ENDBR instruct

[RFC PATCH v6 02/26] x86/cpufeatures: Add CET CPU feature flags for Control-flow Enforcement Technology (CET)

2018-11-19 Thread Yu-cheng Yu
Add CPU feature flags for Control-flow Enforcement Technology (CET). CPUID.(EAX=7,ECX=0):ECX[bit 7] Shadow stack CPUID.(EAX=7,ECX=0):EDX[bit 20] Indirect branch tracking Signed-off-by: Yu-cheng Yu Reviewed-by: Borislav Petkov --- arch/x86/include/asm/cpufeatures.h | 2 ++ 1 file changed, 2 ins

[RFC PATCH v6 11/26] x86/mm: Introduce _PAGE_DIRTY_SW

2018-11-19 Thread Yu-cheng Yu
A RO and dirty PTE exists in the following cases: (a) A page is modified and then shared with a fork()'ed child; (b) A R/O page that has been COW'ed; (c) A SHSTK page. The processor does not read the dirty bit for (a) and (b), but checks the dirty bit for (c). To prevent the use of non-SHSTK mem

[RFC PATCH v6 14/26] x86/mm: Shadow stack page fault error checking

2018-11-19 Thread Yu-cheng Yu
If a page fault is triggered by a shadow stack access (e.g. call/ret) or shadow stack management instructions (e.g. wrussq), then bit[6] of the page fault error code is set. In access_error(), verify a shadow stack page fault is within a shadow stack memory area. It is always an error otherwise.

[RFC PATCH v6 04/26] x86/fpu/xstate: Introduce XSAVES system states

2018-11-19 Thread Yu-cheng Yu
Control-flow Enforcement (CET) MSR contents are XSAVES system states. To support CET, introduce XSAVES system states first. Signed-off-by: Yu-cheng Yu --- arch/x86/include/asm/fpu/internal.h | 3 +- arch/x86/include/asm/fpu/xstate.h | 4 +- arch/x86/kernel/fpu/core.c | 6 +- arch/x

[RFC PATCH v6 15/26] mm: Handle shadow stack page fault

2018-11-19 Thread Yu-cheng Yu
When a task does fork(), its shadow stack (SHSTK) must be duplicated for the child. This patch implements a flow similar to copy-on-write of an anonymous page, but for SHSTK. A SHSTK PTE must be RO and dirty. This dirty bit requirement is used to effect the copying. In copy_one_pte(), clear the

[RFC PATCH v6 16/26] mm: Handle THP/HugeTLB shadow stack page fault

2018-11-19 Thread Yu-cheng Yu
This patch implements THP shadow stack (SHSTK) copying in the same way as in the previous patch for regular PTE. In copy_huge_pmd(), clear the dirty bit from the PMD to cause a page fault upon the next SHSTK access to the PMD. At that time, fix the PMD and copy/re-use the page. Signed-off-by: Yu

[RFC PATCH v6 02/11] x86/cet/ibt: User-mode indirect branch tracking support

2018-11-19 Thread Yu-cheng Yu
Add user-mode indirect branch tracking enabling/disabling and supporting routines. Signed-off-by: H.J. Lu Signed-off-by: Yu-cheng Yu --- arch/x86/include/asm/cet.h| 7 + arch/x86/include/asm/disabled-features.h | 8 - arch/x86/kernel/cet.c

[RFC PATCH v6 19/26] x86/cet/shstk: User-mode shadow stack support

2018-11-19 Thread Yu-cheng Yu
This patch adds basic shadow stack enabling/disabling routines. A task's shadow stack is allocated from memory with VM_SHSTK flag set and read-only protection. It has a fixed size of RLIMIT_STACK. Signed-off-by: Yu-cheng Yu --- arch/x86/include/asm/cet.h| 34 ++ arch/x8

[RFC PATCH v6 23/26] x86/cet/shstk: Handle thread shadow stack

2018-11-19 Thread Yu-cheng Yu
The shadow stack for clone/fork is handled as the following: (1) If ((clone_flags & (CLONE_VFORK | CLONE_VM)) == CLONE_VM), the kernel allocates (and frees on thread exit) a new SHSTK for the child. It is possible for the kernel to complete the clone syscall and set the child's SH

[RFC PATCH v6 20/26] x86/cet/shstk: Introduce WRUSS instruction

2018-11-19 Thread Yu-cheng Yu
WRUSS is a new kernel-mode instruction but writes directly to user shadow stack memory. This is used to construct a return address on the shadow stack for the signal handler. This instruction can fault if the user shadow stack is invalid shadow stack memory. In that case, the kernel does a fixup

[RFC PATCH v6 03/11] x86/cet/ibt: Add IBT legacy code bitmap setup function

2018-11-19 Thread Yu-cheng Yu
Indirect Branch Tracking (IBT) provides an optional legacy code bitmap that allows execution of legacy, non-IBT compatible library by an IBT-enabled application. When set, each bit in the bitmap indicates one page of legacy code. The bitmap is allocated and setup from the application. Signed-off

[RFC PATCH v6 18/26] mm: Introduce do_mmap_locked()

2018-11-19 Thread Yu-cheng Yu
There are a few places that need do_mmap() with mm->mmap_sem held. Create an in-line function for that. Signed-off-by: Yu-cheng Yu --- include/linux/mm.h | 18 ++ 1 file changed, 18 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 7873ac3635a7..36f72c4441

[RFC PATCH v6 00/11] Control-flow Enforcement: Branch Tracking, PTRACE

2018-11-19 Thread Yu-cheng Yu
The previous version of CET Branch Tracking/PTRACE patches is at the following link: https://lkml.org/lkml/2018/10/11/662 Summary of changes from v5: Remove the legacy code bitmap allocation from kernel. Now GLIBC allocates the bitmap and passes it to the kernel. Some small fixes. H.J

[RFC PATCH v6 17/26] mm: Update can_follow_write_pte/pmd for shadow stack

2018-11-19 Thread Yu-cheng Yu
can_follow_write_pte/pmd look for the (RO & DIRTY) PTE/PMD to verify an exclusive RO page still exists after a broken COW. A shadow stack PTE is RO & PAGE_DIRTY_SW when it is shared, otherwise RO & PAGE_DIRTY_HW. Introduce pte_exclusive() and pmd_exclusive() to also verify a shadow stack PTE is e

[RFC PATCH v6 04/11] mm/mmap: Add IBT bitmap size to address space limit check

2018-11-19 Thread Yu-cheng Yu
The indirect branch tracking legacy bitmap takes a large address space. This causes may_expand_vm() failure on the address limit check. For a IBT-enabled task, add the bitmap size to the address limit. Signed-off-by: Yu-cheng Yu --- arch/x86/include/asm/mmu_context.h | 10 ++ mm/mmap.c

[RFC PATCH v6 21/26] x86/cet/shstk: Signal handling for shadow stack

2018-11-19 Thread Yu-cheng Yu
When setting up a signal, the kernel creates a shadow stack restore token at the current SHSTK address and then stores the token's address in the signal frame, right after the FPU state. Before restoring a signal, the kernel verifies and then uses the restore token to set the SHSTK pointer. Signe

[RFC PATCH v6 22/26] x86/cet/shstk: ELF header parsing of Shadow Stack

2018-11-19 Thread Yu-cheng Yu
Look in .note.gnu.property of an ELF file and check if Shadow Stack needs to be enabled for the task. Signed-off-by: H.J. Lu Signed-off-by: Yu-cheng Yu --- arch/x86/Kconfig | 4 + arch/x86/include/asm/elf.h | 5 + arch/x86/include/uapi/asm/elf_property.

[RFC PATCH v6 01/11] x86/cet/ibt: Add Kconfig option for user-mode Indirect Branch Tracking

2018-11-19 Thread Yu-cheng Yu
The user-mode indirect branch tracking support is done mostly by GCC to insert ENDBR64/ENDBR32 instructions at branch targets. The kernel provides CPUID enumeration and feature setup. Signed-off-by: Yu-cheng Yu --- arch/x86/Kconfig | 16 arch/x86/Makefile | 7 +++ 2 files

[RFC PATCH v6 06/11] x86/cet/ibt: Add arch_prctl functions for IBT

2018-11-19 Thread Yu-cheng Yu
Update ARCH_X86_CET_STATUS and ARCH_X86_CET_DISABLE to include Indirect Branch Tracking features. Introduce: arch_prctl(ARCH_X86_CET_SET_LEGACY_BITMAP, unsigned long *addr) Enable the Indirect Branch Tracking legacy code bitmap. The parameter 'addr' is a pointer to a user buffer that has

[RFC PATCH v6 09/11] x86/vsyscall/32: Add ENDBR32 to vsyscall entry point

2018-11-19 Thread Yu-cheng Yu
From: "H.J. Lu" Add ENDBR32 to vsyscall entry point. Signed-off-by: H.J. Lu --- arch/x86/entry/vdso/vdso32/system_call.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/entry/vdso/vdso32/system_call.S b/arch/x86/entry/vdso/vdso32/system_call.S index 263d7433dea8..2fc8141fff4e

[RFC PATCH v6 08/11] x86: Insert endbr32/endbr64 to vDSO

2018-11-19 Thread Yu-cheng Yu
From: "H.J. Lu" When Intel indirect branch tracking is enabled, functions in vDSO which may be called indirectly must have endbr32 or endbr64 as the first instruction. Compiler must support -fcf-protection=branch so that it can be used to compile vDSO. Signed-off-by: H.J. Lu --- arch/x86/entr

[RFC PATCH v6 11/11] x86/cet: Add PTRACE interface for CET

2018-11-19 Thread Yu-cheng Yu
Add REGSET_CET64/REGSET_CET32 to get/set CET MSRs: IA32_U_CET (user-mode CET settings) and IA32_PL3_SSP (user-mode shadow stack) Signed-off-by: Yu-cheng Yu --- arch/x86/include/asm/fpu/regset.h | 7 +++--- arch/x86/kernel/fpu/regset.c | 41 +++ arch/x86

[RFC PATCH v6 10/11] x86/vsyscall/64: Add ENDBR64 to vsyscall entry points

2018-11-19 Thread Yu-cheng Yu
From: "H.J. Lu" Add ENDBR64 to vsyscall entry points. Signed-off-by: H.J. Lu --- arch/x86/entry/vsyscall/vsyscall_emu_64.S | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/x86/entry/vsyscall/vsyscall_emu_64.S b/arch/x86/entry/vsyscall/vsyscall_emu_64.S index c9596a9af159..085

[RFC PATCH v6 05/11] x86/cet/ibt: ELF header parsing for IBT

2018-11-19 Thread Yu-cheng Yu
Look in .note.gnu.property of an ELF file and check if Indirect Branch Tracking needs to be enabled for the task. Signed-off-by: H.J. Lu Signed-off-by: Yu-cheng Yu --- arch/x86/include/uapi/asm/elf_property.h | 1 + arch/x86/kernel/elf.c| 5 + 2 files changed, 6 insertio

[RFC PATCH v6 07/11] x86/cet/ibt: Add ENDBR to op-code-map

2018-11-19 Thread Yu-cheng Yu
Add control transfer terminating instructions: ENDBR64/ENDBR32: Mark a valid 64/32-bit control transfer endpoint. Signed-off-by: Yu-cheng Yu --- arch/x86/lib/x86-opcode-map.txt | 13 +++-- tools/objtool/arch/x86/lib/x86-opcode-map.txt | 13 +++-- 2 files change

[RFC PATCH v6 24/26] mm/mmap: Add Shadow stack pages to memory accounting

2018-11-19 Thread Yu-cheng Yu
Add shadow stack pages to memory accounting. Signed-off-by: Yu-cheng Yu --- mm/mmap.c | 5 + 1 file changed, 5 insertions(+) diff --git a/mm/mmap.c b/mm/mmap.c index 30836512ca79..9560d69fa08c 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1701,6 +1701,9 @@ static inline int accountable_mapping

[RFC PATCH v6 25/26] x86/cet/shstk: Add arch_prctl functions for Shadow Stack

2018-11-19 Thread Yu-cheng Yu
arch_prctl(ARCH_X86_CET_STATUS, unsigned long *addr) Return CET feature status. The parameter 'addr' is a pointer to a user buffer. On returning to the caller, the kernel fills the following information: *addr = SHSTK/IBT status *(addr + 1) = SHSTK base address *(addr

[RFC PATCH v6 09/26] mm/mmap: Prevent Shadow Stack VMA merges

2018-11-19 Thread Yu-cheng Yu
To prevent function call/return spills into the next shadow stack area, do not merge shadow stack areas. Signed-off-by: Yu-cheng Yu --- mm/mmap.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/mm/mmap.c b/mm/mmap.c index 6c04292e16a7..30836512ca79 100644 --- a/mm/mmap.c +++ b/mm/mmap.

[RFC PATCH v6 26/26] x86/cet/shstk: Add Shadow Stack instructions to opcode map

2018-11-19 Thread Yu-cheng Yu
Add the following shadow stack management instructions. INCSSP: Increment shadow stack pointer by the steps specified. RDSSP: Read SSP register into a GPR. SAVEPREVSSP: Use "prev ssp" token at top of current shadow stack to create a "restore token" on previous shadow stack. RSTO

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jason Gunthorpe
On Mon, Nov 19, 2018 at 04:33:20PM -0500, Jerome Glisse wrote: > On Mon, Nov 19, 2018 at 02:26:38PM -0700, Jason Gunthorpe wrote: > > On Mon, Nov 19, 2018 at 03:26:15PM -0500, Jerome Glisse wrote: > > > On Mon, Nov 19, 2018 at 01:11:56PM -0700, Jason Gunthorpe wrote: > > > > On Mon, Nov 19, 2018 at

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jerome Glisse
On Mon, Nov 19, 2018 at 02:26:38PM -0700, Jason Gunthorpe wrote: > On Mon, Nov 19, 2018 at 03:26:15PM -0500, Jerome Glisse wrote: > > On Mon, Nov 19, 2018 at 01:11:56PM -0700, Jason Gunthorpe wrote: > > > On Mon, Nov 19, 2018 at 02:46:32PM -0500, Jerome Glisse wrote: > > > > > > > > ?? How can O_D

Re: [PATCH v9 00/24] ILP32 for ARM64

2018-11-19 Thread Yury Norov
Hi all, On Wed, May 16, 2018 at 11:18:45AM +0300, Yury Norov wrote: > This series enables AARCH64 with ILP32 mode. > > As supporting work, it introduces ARCH_32BIT_OFF_T configuration > option that is enabled for existing 32-bit architectures but disabled > for new arches (so 64-bit off_t userspa

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jason Gunthorpe
On Mon, Nov 19, 2018 at 03:26:15PM -0500, Jerome Glisse wrote: > On Mon, Nov 19, 2018 at 01:11:56PM -0700, Jason Gunthorpe wrote: > > On Mon, Nov 19, 2018 at 02:46:32PM -0500, Jerome Glisse wrote: > > > > > > ?? How can O_DIRECT be fine but RDMA not? They use exactly the same > > > > get_user_page

[PATCH] Documentation: hwmon: Add descriptions for ina2xx sysfs entries

2018-11-19 Thread Nicolin Chen
There are a few sysfs entries being exposed to user space by the ina2xx hwmon driver while not getting explicitly documented. So this patch just adds a description section for them. Signed-off-by: Nicolin Chen --- Documentation/hwmon/ina2xx | 15 +++ 1 file changed, 15 insertions(+)

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jerome Glisse
On Mon, Nov 19, 2018 at 01:11:56PM -0700, Jason Gunthorpe wrote: > On Mon, Nov 19, 2018 at 02:46:32PM -0500, Jerome Glisse wrote: > > > > ?? How can O_DIRECT be fine but RDMA not? They use exactly the same > > > get_user_pages flow, right? Can we do what O_DIRECT does in RDMA and > > > be fine too

Re: [PATCH v8 01/13] arch/resctrl: Start renaming the rdt files to more generic names

2018-11-19 Thread Moger, Babu
On 11/19/18 2:22 PM, Borislav Petkov wrote: > On Mon, Nov 19, 2018 at 08:11:36PM +, Moger, Babu wrote: >> Changed core.c and internel.h to res.c and res.h respectively. Both of >> these files are about resource definitions and initialization. > > I guess but the core.c thing we do a lot in t

Re: [PATCH v8 01/13] arch/resctrl: Start renaming the rdt files to more generic names

2018-11-19 Thread Borislav Petkov
On Mon, Nov 19, 2018 at 08:11:36PM +, Moger, Babu wrote: > Changed core.c and internel.h to res.c and res.h respectively. Both of > these files are about resource definitions and initialization. I guess but the core.c thing we do a lot in the kernel: $ git ls-files | grep -E "/core\.c" | wc -

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jason Gunthorpe
On Mon, Nov 19, 2018 at 02:46:32PM -0500, Jerome Glisse wrote: > > ?? How can O_DIRECT be fine but RDMA not? They use exactly the same > > get_user_pages flow, right? Can we do what O_DIRECT does in RDMA and > > be fine too? > > > > AFAIK the only difference is the length of the race window. You'

RE: [PATCH v8 01/13] arch/resctrl: Start renaming the rdt files to more generic names

2018-11-19 Thread Moger, Babu
Boris/Thomas, > -Original Message- > From: Thomas Gleixner > Sent: Monday, November 19, 2018 1:14 PM > To: Borislav Petkov > Cc: Moger, Babu ; mi...@redhat.com; > cor...@lwn.net; fenghua...@intel.com; reinette.cha...@intel.com; > pet...@infradead.org; gre...@linuxfoundation.org; > da...@

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jerome Glisse
On Mon, Nov 19, 2018 at 12:27:02PM -0700, Jason Gunthorpe wrote: > On Mon, Nov 19, 2018 at 02:17:21PM -0500, Jerome Glisse wrote: > > On Mon, Nov 19, 2018 at 11:53:33AM -0700, Jason Gunthorpe wrote: > > > On Mon, Nov 19, 2018 at 01:42:16PM -0500, Jerome Glisse wrote: > > > > On Mon, Nov 19, 2018 at

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jason Gunthorpe
On Mon, Nov 19, 2018 at 02:17:21PM -0500, Jerome Glisse wrote: > On Mon, Nov 19, 2018 at 11:53:33AM -0700, Jason Gunthorpe wrote: > > On Mon, Nov 19, 2018 at 01:42:16PM -0500, Jerome Glisse wrote: > > > On Mon, Nov 19, 2018 at 11:27:52AM -0700, Jason Gunthorpe wrote: > > > > On Mon, Nov 19, 2018 at

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jerome Glisse
On Mon, Nov 19, 2018 at 07:19:04PM +, Christopher Lameter wrote: > On Mon, 19 Nov 2018, Jerome Glisse wrote: > > > > IIRC this is solved in IB by automatically calling > > > madvise(MADV_DONTFORK) before creating the MR. > > > > > > MADV_DONTFORK > > > .. This is useful to prevent copy-on-wr

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Christopher Lameter
On Mon, 19 Nov 2018, Jerome Glisse wrote: > > IIRC this is solved in IB by automatically calling > > madvise(MADV_DONTFORK) before creating the MR. > > > > MADV_DONTFORK > > .. This is useful to prevent copy-on-write semantics from changing the > > physical location of a page if the parent wri

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jerome Glisse
On Mon, Nov 19, 2018 at 11:53:33AM -0700, Jason Gunthorpe wrote: > On Mon, Nov 19, 2018 at 01:42:16PM -0500, Jerome Glisse wrote: > > On Mon, Nov 19, 2018 at 11:27:52AM -0700, Jason Gunthorpe wrote: > > > On Mon, Nov 19, 2018 at 11:48:54AM -0500, Jerome Glisse wrote: > > > > > > > Just to comment

Re: [PATCH v8 01/13] arch/resctrl: Start renaming the rdt files to more generic names

2018-11-19 Thread Thomas Gleixner
On Sun, 18 Nov 2018, Borislav Petkov wrote: > > Now, it looks to me like the whole resctrl thing begs for its own dir: > > arch/x86/kernel/cpu/resctrl/core.c > arch/x86/kernel/cpu/resctrl/ctrlmondata.c > arch/x86/kernel/cpu/resctrl/internal.h > arch/x86/kernel/cpu/resctrl/monitor.c > arch/x8

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Leon Romanovsky
On Mon, Nov 19, 2018 at 01:42:16PM -0500, Jerome Glisse wrote: > On Mon, Nov 19, 2018 at 11:27:52AM -0700, Jason Gunthorpe wrote: > > On Mon, Nov 19, 2018 at 11:48:54AM -0500, Jerome Glisse wrote: > > > > > Just to comment on this, any infiniband driver which use umem and do > > > not have ODP (her

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jason Gunthorpe
On Mon, Nov 19, 2018 at 01:42:16PM -0500, Jerome Glisse wrote: > On Mon, Nov 19, 2018 at 11:27:52AM -0700, Jason Gunthorpe wrote: > > On Mon, Nov 19, 2018 at 11:48:54AM -0500, Jerome Glisse wrote: > > > > > Just to comment on this, any infiniband driver which use umem and do > > > not have ODP (he

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jason Gunthorpe
On Mon, Nov 19, 2018 at 05:14:05PM +0800, Kenneth Lee wrote: > If the hardware cannot share page table with the CPU, we then need to have > some way to change the device page table. This is what happen in ODP. It > invalidates the page table in device upon mmu_notifier call back. But this > cann

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jerome Glisse
On Mon, Nov 19, 2018 at 11:27:52AM -0700, Jason Gunthorpe wrote: > On Mon, Nov 19, 2018 at 11:48:54AM -0500, Jerome Glisse wrote: > > > Just to comment on this, any infiniband driver which use umem and do > > not have ODP (here ODP for me means listening to mmu notifier so all > > infiniband drive

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jason Gunthorpe
On Mon, Nov 19, 2018 at 11:48:54AM -0500, Jerome Glisse wrote: > Just to comment on this, any infiniband driver which use umem and do > not have ODP (here ODP for me means listening to mmu notifier so all > infiniband driver except mlx5) will be affected by same issue AFAICT. > > AFAICT there is

Re: [PATCH] hwmon (ina3221) Add single-shot mode support

2018-11-19 Thread Guenter Roeck
On Fri, Nov 16, 2018 at 05:51:34PM -0800, Nicolin Chen wrote: > Hello Guenter, > > On Wed, Nov 14, 2018 at 09:23:30AM -0800, Guenter Roeck wrote: > > > An alternative way (without the sysfs node), after looking at > > > other hwmon code, could be to have a timed polling thread and > > > read data

Re: [PATCH v3 7/7] cgroup: document cgroup v2 freezer interface

2018-11-19 Thread Roman Gushchin
On Sat, Nov 17, 2018 at 12:02:28AM -0800, Mike Rapoport wrote: > Hi, > > On Fri, Nov 16, 2018 at 04:38:30PM -0800, Roman Gushchin wrote: > > Describe cgroup v2 freezer interface in the cgroup v2 admin guide. > > > > Signed-off-by: Roman Gushchin > > Cc: Tejun Heo > > Cc: linux-doc@vger.kernel.o

Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce

2018-11-19 Thread Jerome Glisse
On Mon, Nov 19, 2018 at 12:48:01PM +0200, Leon Romanovsky wrote: > On Mon, Nov 19, 2018 at 05:19:10PM +0800, Kenneth Lee wrote: > > On Mon, Nov 19, 2018 at 05:14:05PM +0800, Kenneth Lee wrote: > > > On Thu, Nov 15, 2018 at 04:54:55PM +0200, Leon Romanovsky wrote: > > > > On Thu, Nov 15, 2018 at 04:

Re: PLEASE REVERT URGENTLY: Re: [PATCH v5 2/3] x86/boot: add acpi rsdp address to setup_header

2018-11-19 Thread Konrad Rzeszutek Wilk
On Sun, Nov 11, 2018 at 10:49:39AM -0800, H. Peter Anvin wrote: > On 11/10/18 1:03 AM, Juergen Gross wrote: > > > > How would that help? The garabge data written could have the correct > > terminal sentinel value by chance. > > > > That's why I re-used an existing field in setup_header (the versi

Re: [PATCH v11 00/24] kasan: add software tag-based mode for arm64

2018-11-19 Thread Mark Rutland
On Mon, Nov 19, 2018 at 06:28:57PM +0100, Andrey Konovalov wrote: > On Mon, Nov 19, 2018 at 6:26 PM, Andrey Konovalov > wrote: > > Changes in v11: > > - Rebased onto 9ff01193 (4.20-rc3). > > - Moved KASAN_SHADOW_SCALE_SHIFT definition to arch/arm64/Makefile. > > - Added and used CC_HAS_KASAN_GENE

[PATCH v11 02/24] kasan, slub: handle pointer tags in early_kmem_cache_node_alloc

2018-11-19 Thread Andrey Konovalov
The previous patch updated KASAN hooks signatures and their usage in SLAB and SLUB code, except for the early_kmem_cache_node_alloc function. This patch handles that function separately, as it requires to reorder some of the initialization code to correctly propagate a tagged pointer in case a tag

[PATCH v11 01/24] kasan, mm: change hooks signatures

2018-11-19 Thread Andrey Konovalov
Tag-based KASAN changes the value of the top byte of pointers returned from the kernel allocation functions (such as kmalloc). This patch updates KASAN hooks signatures and their usage in SLAB and SLUB code to reflect that. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: A

[PATCH v11 00/24] kasan: add software tag-based mode for arm64

2018-11-19 Thread Andrey Konovalov
This patchset adds a new software tag-based mode to KASAN [1]. (Initially this mode was called KHWASAN, but it got renamed, see the naming rationale at the end of this section). The plan is to implement HWASan [2] for the kernel with the incentive, that it's going to have comparable to KASAN perf

[PATCH v11 04/24] kasan: rename source files to reflect the new naming scheme

2018-11-19 Thread Andrey Konovalov
We now have two KASAN modes: generic KASAN and tag-based KASAN. Rename kasan.c to generic.c to reflect that. Also rename kasan_init.c to init.c as it contains initialization code for both KASAN modes. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- m

[PATCH v11 03/24] kasan: move common generic and tag-based code to common.c

2018-11-19 Thread Andrey Konovalov
Tag-based KASAN reuses a significant part of the generic KASAN code, so move the common parts to common.c without any functional changes. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- mm/kasan/Makefile | 5 +- mm/kasan/common.c | 603

[PATCH v11 05/24] kasan: add CONFIG_KASAN_GENERIC and CONFIG_KASAN_SW_TAGS

2018-11-19 Thread Andrey Konovalov
This commit splits the current CONFIG_KASAN config option into two: 1. CONFIG_KASAN_GENERIC, that enables the generic KASAN mode (the one that exists now); 2. CONFIG_KASAN_SW_TAGS, that enables the software tag-based KASAN mode. The name CONFIG_KASAN_SW_TAGS is chosen as in the future we will h

[PATCH v11 11/24] kasan, arm64: untag address in _virt_addr_is_linear

2018-11-19 Thread Andrey Konovalov
virt_addr_is_linear (which is used by virt_addr_valid) assumes that the top byte of the address is 0xff, which isn't always the case with tag-based KASAN. This patch resets the tag in this macro. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- arch/

[PATCH v11 09/24] arm64: move untagged_addr macro from uaccess.h to memory.h

2018-11-19 Thread Andrey Konovalov
Move the untagged_addr() macro from arch/arm64/include/asm/uaccess.h to arch/arm64/include/asm/memory.h to be later reused by KASAN. Also make the untagged_addr() macro accept all kinds of address types (void *, unsigned long, etc.). This allows not to specify type casts in each place where the ma

[PATCH v11 12/24] kasan: preassign tags to objects with ctors or SLAB_TYPESAFE_BY_RCU

2018-11-19 Thread Andrey Konovalov
An object constructor can initialize pointers within this objects based on the address of the object. Since the object address might be tagged, we need to assign a tag before calling constructor. The implemented approach is to assign tags to objects with constructors when a slab is allocated and c

Re: [PATCH v11 00/24] kasan: add software tag-based mode for arm64

2018-11-19 Thread Andrey Konovalov
On Mon, Nov 19, 2018 at 6:26 PM, Andrey Konovalov wrote: > This patchset adds a new software tag-based mode to KASAN [1]. > (Initially this mode was called KHWASAN, but it got renamed, > see the naming rationale at the end of this section). > > The plan is to implement HWASan [2] for the kernel w

[PATCH v11 13/24] kasan, arm64: fix up fault handling logic

2018-11-19 Thread Andrey Konovalov
Right now arm64 fault handling code removes pointer tags from addresses covered by TTBR0 in faults taken from both EL0 and EL1, but doesn't do that for pointers covered by TTBR1. This patch adds two helper functions is_ttbr0_addr() and is_ttbr1_addr(), where the latter one accounts for the fact th

[PATCH v11 17/24] kasan: add bug reporting routines for tag-based mode

2018-11-19 Thread Andrey Konovalov
This commit adds rountines, that print tag-based KASAN error reports. Those are quite similar to generic KASAN, the difference is: 1. The way tag-based KASAN finds the first bad shadow cell (with a mismatching tag). Tag-based KASAN compares memory tags from the shadow memory to the pointer t

[PATCH v11 20/24] kasan, arm64: add brk handler for inline instrumentation

2018-11-19 Thread Andrey Konovalov
Tag-based KASAN inline instrumentation mode (which embeds checks of shadow memory into the generated code, instead of inserting a callback) generates a brk instruction when a tag mismatch is detected. This commit adds a tag-based KASAN specific brk handler, that decodes the immediate value passed

[PATCH v11 22/24] kasan: add __must_check annotations to kasan hooks

2018-11-19 Thread Andrey Konovalov
This patch adds __must_check annotations to kasan hooks that return a pointer to make sure that a tagged pointer always gets propagated. Suggested-by: Andrey Ryabinin Signed-off-by: Andrey Konovalov --- include/linux/kasan.h | 16 ++-- mm/kasan/common.c | 14 -- 2 fi

[PATCH v11 15/24] kasan, mm: perform untagged pointers comparison in krealloc

2018-11-19 Thread Andrey Konovalov
The krealloc function checks where the same buffer was reused or a new one allocated by comparing kernel pointers. Tag-based KASAN changes memory tag on the krealloc'ed chunk of memory and therefore also changes the pointer tag of the returned pointer. Therefore we need to perform comparison on unt

[PATCH v11 16/24] kasan: split out generic_report.c from report.c

2018-11-19 Thread Andrey Konovalov
This patch moves generic KASAN specific error reporting routines to generic_report.c without any functional changes, leaving common error reporting code in report.c to be later reused by tag-based KASAN. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov ---

[PATCH v11 21/24] kasan, mm, arm64: tag non slab memory allocated via pagealloc

2018-11-19 Thread Andrey Konovalov
Tag-based KASAN doesn't check memory accesses through pointers tagged with 0xff. When page_address is used to get pointer to memory that corresponds to some page, the tag of the resulting pointer gets set to 0xff, even though the allocated memory might have been tagged differently. For slab pages

[PATCH v11 23/24] kasan: update documentation

2018-11-19 Thread Andrey Konovalov
This patch updates KASAN documentation to reflect the addition of the new tag-based mode. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- Documentation/dev-tools/kasan.rst | 232 ++ 1 file changed, 138 insertions(+), 94 de

[PATCH v11 24/24] kasan: add SPDX-License-Identifier mark to source files

2018-11-19 Thread Andrey Konovalov
This patch adds a "SPDX-License-Identifier: GPL-2.0" mark to all source files under mm/kasan. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- mm/kasan/common.c | 1 + mm/kasan/generic.c| 1 + mm/kasan/generic_report.c | 1 + mm/kasan/

[PATCH v11 19/24] kasan: add hooks implementation for tag-based mode

2018-11-19 Thread Andrey Konovalov
This commit adds tag-based KASAN specific hooks implementation and adjusts common generic and tag-based KASAN ones. 1. When a new slab cache is created, tag-based KASAN rounds up the size of the objects in this cache to KASAN_SHADOW_SCALE_SIZE (== 16). 2. On each kmalloc tag-based KASAN genera

[PATCH v11 18/24] mm: move obj_to_index to include/linux/slab_def.h

2018-11-19 Thread Andrey Konovalov
While with SLUB we can actually preassign tags for caches with contructors and store them in pointers in the freelist, SLAB doesn't allow that since the freelist is stored as an array of indexes, so there are no pointers to store the tags. Instead we compute the tag twice, once when a slab is crea

[PATCH v11 14/24] kasan, arm64: enable top byte ignore for the kernel

2018-11-19 Thread Andrey Konovalov
Tag-based KASAN uses the Top Byte Ignore feature of arm64 CPUs to store a pointer tag in the top byte of each pointer. This commit enables the TCR_TBI1 bit, which enables Top Byte Ignore for the kernel, when tag-based KASAN is used. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-

  1   2   >