Re: [PATCH v3] powerpc/papr_scm: Reduce error severity if nvdimm stats inaccessible

2021-05-08 Thread Ira Weiny
rror is returned back. > > In case of H_UNSUPPORTED error we return a EOPNOTSUPP error back from > drc_pmem_query_stats() indicating that performance stats-query > operation is not supported on this nvdimm. > > Fixes: 2d02bf835e57('powerpc/papr_scm: Fetch nvdimm p

Re: [PATCH v2] powerpc/papr_scm: Reduce error severity if nvdimm stats inaccessible

2021-05-05 Thread Ira Weiny
On Thu, May 06, 2021 at 12:46:06AM +0530, Vaibhav Jain wrote: > Currently drc_pmem_qeury_stats() generates a dev_err in case > "Enable Performance Information Collection" feature is disabled from > HMC or performance stats are not available for an nvdimm. The error is > of the form below: > >

Re: [PATCH v3 1/3] fsdax: Factor helpers to simplify dax fault code

2021-04-27 Thread Ira Weiny
On Tue, Apr 27, 2021 at 02:44:33AM +, ruansy.f...@fujitsu.com wrote: > > -Original Message- > > From: Ira Weiny > > Sent: Tuesday, April 27, 2021 7:38 AM > > Subject: Re: [PATCH v3 1/3] fsdax: Factor helpers to simplify dax fault code > > > > On T

Re: [PATCH v3 1/3] fsdax: Factor helpers to simplify dax fault code

2021-04-26 Thread Ira Weiny
On Thu, Apr 22, 2021 at 09:44:59PM +0800, Shiyang Ruan wrote: > The dax page fault code is too long and a bit difficult to read. And it > is hard to understand when we trying to add new features. Some of the > PTE/PMD codes have similar logic. So, factor them as helper functions to > simplify the

Re: [PATCH v2 1/3] fsdax: Factor helpers to simplify dax fault code

2021-04-26 Thread Ira Weiny
On Wed, Apr 07, 2021 at 09:38:21PM +0800, Shiyang Ruan wrote: > The dax page fault code is too long and a bit difficult to read. And it > is hard to understand when we trying to add new features. Some of the > PTE/PMD codes have similar logic. So, factor them as helper functions to > simplify the

Re: [PATCH] libnvdimm.h: Remove duplicate struct declaration

2021-04-19 Thread Ira Weiny
On Mon, Apr 19, 2021 at 07:27:25PM +0800, Wan Jiabing wrote: > struct device is declared at 133rd line. > The declaration here is unnecessary. Remove it. > > Signed-off-by: Wan Jiabing > --- > include/linux/libnvdimm.h | 1 - > 1 file changed, 1 deletion(-) > > diff --git

Re: [PATCH] powerpc/papr_scm: Reduce error severity if nvdimm stats inaccessible

2021-04-14 Thread Ira Weiny
On Wed, Apr 14, 2021 at 09:51:40PM +0530, Vaibhav Jain wrote: > Thanks for looking into this patch Ira, > > Ira Weiny writes: > > > On Wed, Apr 14, 2021 at 06:10:26PM +0530, Vaibhav Jain wrote: > >> Currently drc_pmem_qeury_stats() generates a dev_err in ca

Re: [PATCH] powerpc/papr_scm: Reduce error severity if nvdimm stats inaccessible

2021-04-14 Thread Ira Weiny
On Wed, Apr 14, 2021 at 06:10:26PM +0530, Vaibhav Jain wrote: > Currently drc_pmem_qeury_stats() generates a dev_err in case > "Enable Performance Information Collection" feature is disabled from > HMC. The error is of the form below: > > papr_scm ibm,persistent-memory:ibm,pmemory@44104001:

Re: [PATCH v1] libnvdimm, dax: Fix a missing check in nd_dax_probe()

2021-04-09 Thread Ira Weiny
On Thu, Apr 08, 2021 at 06:58:26PM -0700, wangyingji...@126.com wrote: > From: Yingjie Wang > > In nd_dax_probe(), 'nd_dax' is allocated by nd_dax_alloc(). > nd_dax_alloc() may fail and return NULL, so we should better check Avoid the use of 'we'. > it's return value to avoid a NULL pointer

Re: [PATCH] ndtest: Remove redundant NULL check

2021-03-22 Thread Ira Weiny
On Mon, Mar 22, 2021 at 06:00:40PM +0800, Jiapeng Chong wrote: > Fix the following coccicheck warnings: > > ./tools/testing/nvdimm/test/ndtest.c:491:2-7: WARNING: NULL check before > some freeing functions is not needed. I don't think there is anything wrong with this patch specifically but why

Re: [PATCH] libnvdimm/pmem: remove unused header.

2021-01-04 Thread Ira Weiny
On Mon, Jan 04, 2021 at 02:32:06PM -0800, Dan Williams wrote: > On Mon, Jan 4, 2021 at 2:19 PM Ira Weiny wrote: > > > > On Mon, Jan 04, 2021 at 01:16:32PM -0800, Dan Williams wrote: > > > On Mon, Dec 28, 2020 at 9:18 AM Ira Weiny wrote: > > > > > > &g

Re: [PATCH] libnvdimm/pmem: remove unused header.

2021-01-04 Thread Ira Weiny
On Mon, Jan 04, 2021 at 01:16:32PM -0800, Dan Williams wrote: > On Mon, Dec 28, 2020 at 9:18 AM Ira Weiny wrote: > > > > On Fri, Dec 25, 2020 at 09:35:46AM +0800, Jianpeng Ma wrote: > > > 'commit a8b456d01cd6 ("bdi: remove BDI_CAP_SYNCHRONOUS_IO")' forgot >

Re: [PATCH v2] fs/dax: include to fix build error on ARC

2021-01-04 Thread Ira Weiny
; Reported-by: kernel test robot > Signed-off-by: Randy Dunlap Looks reasonable Reviewed-by: Ira Weiny > Cc: Vineet Gupta > Cc: linux-snps-...@lists.infradead.org > Cc: Dan Williams > Acked-by: Vineet Gupta > Cc: Andrew Morton > Cc: Matthew Wilcox > Cc: Jan Kar

Re: [PATCH] nvdimm: Switch to using the new API kobj_to_dev()

2020-12-28 Thread Ira Weiny
nce container_of(kobj, typeof(*dev), kobj) and > container_of(kobj, struct device, kobj) are the same, so also > replace container_of(kobj, typeof(*dev), kobj) with the new kobj_to_dev. > > Signed-off-by: Tian Tao Reviewed-by: Ira Weiny > --- > drivers/nvdimm/bus.c

Re: [PATCH] libnvdimm/pmem: remove unused header.

2020-12-28 Thread Ira Weiny
On Fri, Dec 25, 2020 at 09:35:46AM +0800, Jianpeng Ma wrote: > 'commit a8b456d01cd6 ("bdi: remove BDI_CAP_SYNCHRONOUS_IO")' forgot This information should be part of a fixes tag. Other than that looks ok. Reviewed-by: Ira Weiny > remove the related header file. > > Sign

Re: [PATCH V3 04/10] x86/pks: Preserve the PKRS MSR on context switch

2020-12-18 Thread Ira Weiny
On Fri, Dec 18, 2020 at 02:57:51PM +0100, Thomas Gleixner wrote: > On Thu, Dec 17 2020 at 23:43, Thomas Gleixner wrote: > > The only use case for this in your tree is: kmap() and the possible > > usage of that mapping outside of the thread context which sets it up. > > > > The only hint for doing

Re: [NEEDS-REVIEW] [PATCH V3 04/10] x86/pks: Preserve the PKRS MSR on context switch

2020-12-17 Thread Ira Weiny
On Thu, Dec 17, 2020 at 12:41:50PM -0800, Dave Hansen wrote: > On 11/6/20 3:29 PM, ira.we...@intel.com wrote: > > void disable_TSC(void) > > @@ -644,6 +668,8 @@ void __switch_to_xtra(struct task_struct *prev_p, > > struct task_struct *next_p) > > > > if ((tifp ^ tifn) & _TIF_SLD) > >

Re: [PATCH V3 04/10] x86/pks: Preserve the PKRS MSR on context switch

2020-12-17 Thread Ira Weiny
On Thu, Dec 17, 2020 at 03:50:55PM +0100, Thomas Gleixner wrote: > On Fri, Nov 06 2020 at 15:29, ira weiny wrote: > > --- a/arch/x86/kernel/process.c > > +++ b/arch/x86/kernel/process.c > > @@ -43,6 +43,7 @@ > > #include > > #include > > #include > &

Re: [PATCH V3 10/10] x86/pks: Add PKS test code

2020-12-17 Thread Ira Weiny
On Thu, Dec 17, 2020 at 12:55:39PM -0800, Dave Hansen wrote: > On 11/6/20 3:29 PM, ira.we...@intel.com wrote: > > + /* Arm for context switch test */ > > + write(fd, "1", 1); > > + > > + /* Context switch out... */ > > + sleep(4); > > + > > + /*

Re: [PATCH V3.1] entry: Pass irqentry_state_t by reference

2020-12-16 Thread Ira Weiny
On Tue, Dec 15, 2020 at 06:09:02PM -0800, Andy Lutomirski wrote: > On Tue, Dec 15, 2020 at 5:32 PM Ira Weiny wrote: > > > > On Fri, Dec 11, 2020 at 02:14:28PM -0800, Andy Lutomirski wrote: > > > On Mon, Nov 23, 2020 at 10:10 PM wrote: > > > > IOW we have:

Re: [PATCH V3.1] entry: Pass irqentry_state_t by reference

2020-12-15 Thread Ira Weiny
On Fri, Dec 11, 2020 at 02:14:28PM -0800, Andy Lutomirski wrote: > On Mon, Nov 23, 2020 at 10:10 PM wrote: > > > > From: Ira Weiny > > > > Currently struct irqentry_state_t only contains a single bool value > > which makes passing it by value is reasonable.

Re: [PATCH] mm/up: combine put_compound_head() and unpin_user_page()

2020-12-09 Thread Ira Weiny
user_pages (FOLL_PIN) > reporting") > Signed-off-by: Jason Gunthorpe Reviewed-by: Ira Weiny > --- > mm/gup.c | 103 +-- > 1 file changed, 23 insertions(+), 80 deletions(-) > > With Matt's folio idea I'd next to go to make a

Re: [PATCH V3 00/10] PKS: Add Protection Keys Supervisor (PKS) support V3

2020-12-08 Thread Ira Weiny
On Tue, Dec 08, 2020 at 04:55:54PM +0100, Thomas Gleixner wrote: > Ira, > > On Mon, Dec 07 2020 at 14:14, Ira Weiny wrote: > > Is there any chance of this landing before the kmap stuff gets sorted out? > > I have marked this as needs an update because the change log o

Re: [PATCH V3 00/10] PKS: Add Protection Keys Supervisor (PKS) support V3

2020-12-07 Thread Ira Weiny
Thomas, Is there any chance of this landing before the kmap stuff gets sorted out? It would be nice to have this in 5.11 to build off of. Ira On Fri, Nov 06, 2020 at 03:28:58PM -0800, 'Ira Weiny' wrote: > From: Ira Weiny > > Changes from V2 [4] > Rebased on tip-tre

[PATCH V3.1] entry: Pass irqentry_state_t by reference

2020-11-23 Thread ira . weiny
From: Ira Weiny Currently struct irqentry_state_t only contains a single bool value which makes passing it by value is reasonable. However, future patches add information to this struct. This includes the PKRS thread state, included in this series, as well as information to store kmap

Re: [ndctl PATCH v2] Rework license identification

2020-11-20 Thread Ira Weiny
On Thu, Nov 19, 2020 at 06:34:01PM -0800, Dan Williams wrote: > Convert to the LICENSES/ directory format for COPYING from the Linux > kernel, and switch all remaining files over to SPDX annotations. > > Cc: Ira Weiny LGTM Reviewed-by: Ira Weiny > Reported-by: Christoph Hellwi

Re: [PATCH V3 05/10] x86/entry: Pass irqentry_state_t by reference

2020-11-16 Thread Ira Weiny
On Sun, Nov 15, 2020 at 07:58:52PM +0100, Thomas Gleixner wrote: > Ira, > > On Fri, Nov 06 2020 at 15:29, ira weiny wrote: > > Subject prefix wants to 'entry:'. This changes generic code and the x86 > part is just required to fix the generic code change. Sorry, yes that was c

Re: [PATCH RFC PKS/PMEM 05/58] kmap: Introduce k[un]map_thread

2020-11-09 Thread Ira Weiny
On Tue, Nov 10, 2020 at 02:13:56AM +0100, Thomas Gleixner wrote: > Ira, > > On Fri, Oct 09 2020 at 12:49, ira weiny wrote: > > From: Ira Weiny > > > > To correctly support the semantics of kmap() with Kernel protection keys > > (PKS), kmap() may be required t

[PATCH V3 09/10] x86/pks: Enable Protection Keys Supervisor (PKS)

2020-11-06 Thread ira . weiny
using a supervisor specific MSR. Kernel users can thus defines 'domains' of page mappings which have an extra level of protection beyond those specified in the supervisor page table entries. Enable PKS on supported CPUS. Co-developed-by: Ira Weiny Signed-off-by: Ira Weiny Signed-off-by: Fenghua Yu

[PATCH V3 07/10] x86/fault: Report the PKRS state on fault

2020-11-06 Thread ira . weiny
From: Ira Weiny When only user space pkeys are enabled faulting within the kernel was an unexpected condition which should never happen. Therefore a WARN_ON in the kernel fault handler would detect if it ever did. Now this is no longer the case if PKS is enabled and supported. Report a Pkey

[PATCH V3 05/10] x86/entry: Pass irqentry_state_t by reference

2020-11-06 Thread ira . weiny
From: Ira Weiny Currently struct irqentry_state_t only contains a single bool value which makes passing it by value is reasonable. However, future patches propose to add information to this struct, for example the PKRS register/thread state. Adding information to irqentry_state_t makes passing

[PATCH V3 02/10] x86/fpu: Refactor arch_set_user_pkey_access() for PKS support

2020-11-06 Thread ira . weiny
From: Ira Weiny Define a helper, update_pkey_val(), which will be used to support both Protection Key User (PKU) and the new Protection Key for Supervisor (PKS) in subsequent patches. Co-developed-by: Peter Zijlstra Signed-off-by: Peter Zijlstra Signed-off-by: Ira Weiny --- Changes from RFC

[PATCH V3 03/10] x86/pks: Add PKS defines and Kconfig options

2020-11-06 Thread ira . weiny
From: Ira Weiny Protection Keys for Supervisor pages (PKS) enables fast, hardware thread specific, manipulation of permission restrictions on supervisor page mappings. It uses the same mechanism of Protection Keys as those on User mappings but applies that mechanism to supervisor mappings using

[PATCH V3 06/10] x86/entry: Preserve PKRS MSR across exceptions

2020-11-06 Thread ira . weiny
From: Ira Weiny The PKRS MSR is not managed by XSAVE. It is preserved through a context switch but this support leaves exception handling code open to memory accesses during exceptions. 2 possible places for preserving this state were considered, irqentry_state_t or pt_regs.[1] pt_regs

[PATCH V3 10/10] x86/pks: Add PKS test code

2020-11-06 Thread ira . weiny
From: Ira Weiny The core PKS functionality provides an interface for kernel users to reserve keys to their domains set up the page tables with those keys and control access to those domains when needed. Define test code which exercises the core functionality of PKS via a debugfs entry. Basic

[PATCH V3 08/10] x86/pks: Add PKS kernel API

2020-11-06 Thread ira . weiny
(), pks_mkrdwr(), and pks_key_free(). Add 2 new macros; PAGE_KERNEL_PKEY(key) and _PAGE_PKEY(pkey). Update the protection key documentation to cover pkeys on supervisor pages. Co-developed-by: Ira Weiny Signed-off-by: Ira Weiny Signed-off-by: Fenghua Yu --- Changes from V2 From Greg

[PATCH V3 00/10] PKS: Add Protection Keys Supervisor (PKS) support V3

2020-11-06 Thread ira . weiny
From: Ira Weiny Changes from V2 [4] Rebased on tip-tree/core/entry From Thomas Gleixner Address bisectability Drop Patch: x86/entry: Move nmi entry/exit into common code From Greg KH Remove WARN_ON's

[PATCH V3 01/10] x86/pkeys: Create pkeys_common.h

2020-11-06 Thread ira . weiny
From: Ira Weiny Protection Keys User (PKU) and Protection Keys Supervisor (PKS) work in similar fashions and can share common defines. Specifically PKS and PKU each have: 1. A single control register 2. The same number of keys 3. The same number of bits in the register

[PATCH V3 04/10] x86/pks: Preserve the PKRS MSR on context switch

2020-11-06 Thread ira . weiny
From: Ira Weiny The PKRS MSR is defined as a per-logical-processor register. This isolates memory access by logical CPU. Unfortunately, the MSR is not managed by XSAVE. Therefore, tasks must save/restore the MSR value on context switch. Define a saved PKRS value in the task struct, as well

Re: [PATCH V2 00/10] PKS: Add Protection Keys Supervisor (PKS) support

2020-11-04 Thread Ira Weiny
On Wed, Nov 04, 2020 at 02:45:54PM -0800, 'Ira Weiny' wrote: > On Wed, Nov 04, 2020 at 11:00:04PM +0100, Thomas Gleixner wrote: > > On Wed, Nov 04 2020 at 09:46, Ira Weiny wrote: > > > On Tue, Nov 03, 2020 at 12:36:16AM +0100, Thomas Gleixner wrote: > > >> This

Re: [PATCH V2 00/10] PKS: Add Protection Keys Supervisor (PKS) support

2020-11-04 Thread Ira Weiny
On Wed, Nov 04, 2020 at 11:00:04PM +0100, Thomas Gleixner wrote: > On Wed, Nov 04 2020 at 09:46, Ira Weiny wrote: > > On Tue, Nov 03, 2020 at 12:36:16AM +0100, Thomas Gleixner wrote: > >> This is the wrong ordering, really. > >> > >> x86/entry:

Re: [PATCH V2 00/10] PKS: Add Protection Keys Supervisor (PKS) support

2020-11-04 Thread Ira Weiny
On Tue, Nov 03, 2020 at 12:36:16AM +0100, Thomas Gleixner wrote: > On Mon, Nov 02 2020 at 12:53, ira weiny wrote: > > Fenghua Yu (2): > > x86/pks: Enable Protection Keys Supervisor (PKS) > > x86/pks: Add PKS kernel API > > > > Ira Weiny (7): > > x86/pke

Re: [PATCH V2 05/10] x86/pks: Add PKS kernel API

2020-11-03 Thread Ira Weiny
On Tue, Nov 03, 2020 at 07:14:07PM +0100, Greg KH wrote: > On Tue, Nov 03, 2020 at 09:53:36AM -0800, Ira Weiny wrote: > > On Tue, Nov 03, 2020 at 07:50:24AM +0100, Greg KH wrote: > > > On Mon, Nov 02, 2020 at 12:53:15PM -0800, ira.we...@intel.com wrote: > &

Re: [PATCH V2 05/10] x86/pks: Add PKS kernel API

2020-11-03 Thread Ira Weiny
On Tue, Nov 03, 2020 at 07:50:24AM +0100, Greg KH wrote: > On Mon, Nov 02, 2020 at 12:53:15PM -0800, ira.we...@intel.com wrote: > > From: Fenghua Yu > > [snip] > > diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h > > index 2955ba976048..0959a4c0ca64 100644 > > ---

[PATCH V2 10/10] x86/pks: Add PKS test code

2020-11-02 Thread ira . weiny
From: Ira Weiny The core PKS functionality provides an interface for kernel users to reserve keys to their domains set up the page tables with those keys and control access to those domains when needed. Define test code which exercises the core functionality of PKS via a debugfs entry. Basic

[PATCH V2 09/10] x86/fault: Report the PKRS state on fault

2020-11-02 Thread ira . weiny
From: Ira Weiny When only user space pkeys are enabled faulting within the kernel was an unexpected condition which should never happen. Therefore a WARN_ON in the kernel fault handler would detect if it ever did. Now this is no longer the case if PKS is enabled and supported. Report a Pkey

[PATCH V2 07/10] x86/entry: Pass irqentry_state_t by reference

2020-11-02 Thread ira . weiny
From: Ira Weiny Currently struct irqentry_state_t only contains a single bool value which makes passing it by value is reasonable. However, future patches propose to add information to this struct, for example the PKRS register/thread state. Adding information to irqentry_state_t makes passing

[PATCH V2 08/10] x86/entry: Preserve PKRS MSR across exceptions

2020-11-02 Thread ira . weiny
From: Ira Weiny The PKRS MSR is not managed by XSAVE. It is preserved through a context switch but this support leaves exception handling code open to memory accesses during exceptions. 2 possible places for preserving this state were considered, irqentry_state_t or pt_regs.[1] pt_regs

[PATCH V2 05/10] x86/pks: Add PKS kernel API

2020-11-02 Thread ira . weiny
(), pks_mkrdwr(), and pks_key_free(). Add 2 new macros; PAGE_KERNEL_PKEY(key) and _PAGE_PKEY(pkey). Update the protection key documentation to cover pkeys on supervisor pages. Co-developed-by: Ira Weiny Signed-off-by: Ira Weiny Signed-off-by: Fenghua Yu --- Changes from V1 Per Dave

[PATCH V2 06/10] x86/entry: Move nmi entry/exit into common code

2020-11-02 Thread ira . weiny
irqentry_state_t to carry lockdep state. Ira: Make exit_rcu and lockdep a union as they are mutually exclusive between the IRQ and NMI exceptions, and add kernel documentation for struct irqentry_state_t Signed-off-by: Thomas Gleixner Signed-off-by: Ira Weiny --- Changes from V1 Update commit

[PATCH V2 04/10] x86/pks: Preserve the PKRS MSR on context switch

2020-11-02 Thread ira . weiny
From: Ira Weiny The PKRS MSR is defined as a per-logical-processor register. This isolates memory access by logical CPU. Unfortunately, the MSR is not managed by XSAVE. Therefore, tasks must save/restore the MSR value on context switch. Define a saved PKRS value in the task struct, as well

[PATCH V2 01/10] x86/pkeys: Create pkeys_common.h

2020-11-02 Thread ira . weiny
From: Ira Weiny Protection Keys User (PKU) and Protection Keys Supervisor (PKS) work in similar fashions and can share common defines. Specifically PKS and PKU each have: 1. A single control register 2. The same number of keys 3. The same number of bits in the register

[PATCH V2 00/10] PKS: Add Protection Keys Supervisor (PKS) support

2020-11-02 Thread ira . weiny
From: Ira Weiny Changes from V1 Rebase to TIP master; resolve conflicts and test Clean up some kernel docs updates missed in V1 Add irqentry_state_t kernel doc for PKRS field Removed redundant irq_state->pkrs This is only needed when we

[PATCH V2 03/10] x86/pks: Enable Protection Keys Supervisor (PKS)

2020-11-02 Thread ira . weiny
and then enable PKS when configured and indicated by the CPU instance. While not strictly necessary in this patch, ARCH_HAS_SUPERVISOR_PKEYS separates this functionality through the patch series so it is introduced here. Co-developed-by: Ira Weiny Signed-off-by: Ira Weiny Signed-off-by: Fenghua Yu

[PATCH V2 02/10] x86/fpu: Refactor arch_set_user_pkey_access() for PKS support

2020-11-02 Thread ira . weiny
From: Ira Weiny Define a helper, update_pkey_val(), which will be used to support both Protection Key User (PKU) and the new Protection Key for Supervisor (PKS) in subsequent patches. Co-developed-by: Peter Zijlstra Signed-off-by: Peter Zijlstra Signed-off-by: Ira Weiny --- Changes from RFC

Re: [PATCH 07/10] x86/entry: Pass irqentry_state_t by reference

2020-10-27 Thread Ira Weiny
On Fri, Oct 23, 2020 at 11:56:33PM +0200, Thomas Gleixner wrote: > On Thu, Oct 22 2020 at 15:26, ira weiny wrote: > > From: Ira Weiny > > > > In preparation for adding PKS information to struct irqentry_state_t > > change all call sites and usages to pass the stru

Re: [PATCH 06/10] x86/entry: Move nmi entry/exit into common code

2020-10-27 Thread Ira Weiny
On Fri, Oct 23, 2020 at 11:50:11PM +0200, Thomas Gleixner wrote: > On Thu, Oct 22 2020 at 15:26, ira weiny wrote: > > > From: Thomas Gleixner > > > > Lockdep state handling on NMI enter and exit is nothing specific to X86. > > It's > > not any different on

[PATCH 09/10] x86/fault: Report the PKRS state on fault

2020-10-22 Thread ira . weiny
From: Ira Weiny When only user space pkeys are enabled faulting within the kernel was an unexpected condition which should never happen. Therefore a WARN_ON in the kernel fault handler would detect if it ever did. Now this is no longer the case if PKS is enabled and supported. Report a Pkey

[PATCH 04/10] x86/pks: Preserve the PKRS MSR on context switch

2020-10-22 Thread ira . weiny
From: Ira Weiny The PKRS MSR is defined as a per-logical-processor register. This isolates memory access by logical CPU. Unfortunately, the MSR is not managed by XSAVE. Therefore, tasks must save/restore the MSR value on context switch. Define a saved PKRS value in the task struct, as well

[PATCH 05/10] x86/pks: Add PKS kernel API

2020-10-22 Thread ira . weiny
(), pks_mkrdwr(), and pks_key_free(). Add 2 new macros; PAGE_KERNEL_PKEY(key) and _PAGE_PKEY(pkey). Update the protection key documentation to cover pkeys on supervisor pages. Co-developed-by: Ira Weiny Signed-off-by: Ira Weiny Signed-off-by: Fenghua Yu --- Changes from RFC V3 Per

[PATCH 02/10] x86/fpu: Refactor arch_set_user_pkey_access() for PKS support

2020-10-22 Thread ira . weiny
From: Ira Weiny Define a helper, update_pkey_val(), which will be used to support both Protection Key User (PKU) and the new Protection Key for Supervisor (PKS) in subsequent patches. Co-developed-by: Peter Zijlstra Signed-off-by: Peter Zijlstra Signed-off-by: Ira Weiny --- Changes from RFC

[PATCH 06/10] x86/entry: Move nmi entry/exit into common code

2020-10-22 Thread ira . weiny
irqentry_state_t to carry lockdep state. Signed-off-by: Thomas Gleixner Signed-off-by: Ira Weiny --- arch/x86/entry/common.c | 34 --- arch/x86/include/asm/idtentry.h | 3 --- arch/x86/kernel/cpu/mce/core.c | 6 +++--- arch/x86/kernel/nmi.c | 6 +++--- arch

[PATCH 10/10] x86/pks: Add PKS test code

2020-10-22 Thread ira . weiny
From: Ira Weiny The core PKS functionality provides an interface for kernel users to reserve keys to their domains set up the page tables with those keys and control access to those domains when needed. Define test code which exercises the core functionality of PKS via a debugfs entry. Basic

[PATCH 08/10] x86/entry: Preserve PKRS MSR across exceptions

2020-10-22 Thread ira . weiny
From: Ira Weiny The PKRS MSR is not managed by XSAVE. It is preserved through a context switch but this support leaves exception handling code open to memory accesses during exceptions. 2 possible places for preserving this state were considered, irqentry_state_t or pt_regs.[1] pt_regs

[PATCH 03/10] x86/pks: Enable Protection Keys Supervisor (PKS)

2020-10-22 Thread ira . weiny
and then enable PKS when configured and indicated by the CPU instance. While not strictly necessary in this patch, ARCH_HAS_SUPERVISOR_PKEYS separates this functionality through the patch series so it is introduced here. Co-developed-by: Ira Weiny Signed-off-by: Ira Weiny Signed-off-by: Fenghua Yu

[PATCH 01/10] x86/pkeys: Create pkeys_common.h

2020-10-22 Thread ira . weiny
From: Ira Weiny Protection Keys User (PKU) and Protection Keys Supervisor (PKS) work in similar fashions and can share common defines. Specifically PKS and PKU each have: 1. A single control register 2. The same number of keys 3. The same number of bits in the register

[PATCH 07/10] x86/entry: Pass irqentry_state_t by reference

2020-10-22 Thread ira . weiny
From: Ira Weiny In preparation for adding PKS information to struct irqentry_state_t change all call sites and usages to pass the struct by reference instead of by value. While we are editing the call sites it is a good time to standardize on the name 'irq_state'. Signed-off-by: Ira Weiny

[PATCH 00/10] PKS: Add Protection Keys Supervisor (PKS) support

2020-10-22 Thread ira . weiny
From: Ira Weiny Changes from RFC V3[3] Rebase to TIP master Update test error output Standardize on 'irq_state' for state variables From Dave Hansen Update commit messages Add/clean up comments Add X86_FEATURE_PKS

Re: [PATCH] mm/mremap_pages: Fix static key devmap_managed_key updates

2020-10-22 Thread Ira Weiny
On Thu, Oct 22, 2020 at 11:19:43AM -0700, Ralph Campbell wrote: > > On 10/22/20 8:41 AM, Ira Weiny wrote: > > On Thu, Oct 22, 2020 at 11:37:53AM +0530, Aneesh Kumar K.V wrote: > > > commit 6f42193fd86e ("memremap: don't use a separate devm action for > > >

Re: [PATCH] mm/mremap_pages: Fix static key devmap_managed_key updates

2020-10-22 Thread Ira Weiny
c1fd80] [c003a430] system_call_exception+0x120/0x270 > [c00025c1fe20] [c000c540] system_call_common+0xf0/0x27c > > Cc: Christoph Hellwig > Cc: Dan Williams > Cc: Sachin Sant > Cc: linux-nvdimm@lists.01.org > Cc: Ira Weiny > Cc: Jason Gunthorpe > Sig

Re: [ndctl PATCH] Rework license identification

2020-10-21 Thread Ira Weiny
On Tue, Oct 20, 2020 at 10:53:20AM -0700, Dan Williams wrote: > Convert to the LICENSES/ directory format for COPYING from the Linux > kernel, and switch all remaining files over to SPDX annotations. > > Reported-by: Christoph Hellwig > Signed-off-by: Dan Williams > --- [snip] > diff --git

Re: [PATCH RFC V3 6/9] x86/entry: Pass irqentry_state_t by reference

2020-10-20 Thread Ira Weiny
On Mon, Oct 19, 2020 at 11:12:44PM +0200, Thomas Gleixner wrote: > On Mon, Oct 19 2020 at 13:26, Ira Weiny wrote: > > On Mon, Oct 19, 2020 at 11:32:50AM +0200, Thomas Gleixner wrote: > > Sorry, let me clarify. After this patch we have. > > > > typedef union ir

Re: [PATCH RFC V3 6/9] x86/entry: Pass irqentry_state_t by reference

2020-10-19 Thread Ira Weiny
On Mon, Oct 19, 2020 at 11:32:50AM +0200, Thomas Gleixner wrote: > On Sun, Oct 18 2020 at 22:37, Ira Weiny wrote: > > On Fri, Oct 16, 2020 at 02:55:21PM +0200, Thomas Gleixner wrote: > >> Subject: x86/entry: Move nmi entry/exit into common code > >> From: Thomas Gleix

Re: [PATCH RFC V3 4/9] x86/pks: Preserve the PKRS MSR on context switch

2020-10-19 Thread Ira Weiny
On Mon, Oct 19, 2020 at 11:37:14AM +0200, Peter Zijlstra wrote: > On Fri, Oct 16, 2020 at 10:14:10PM -0700, Ira Weiny wrote: > > > so it either needs to > > > explicitly do so, or have an assertion that preemption is indeed > > > disabled. > > > > H

Re: [PATCH RFC V3 6/9] x86/entry: Pass irqentry_state_t by reference

2020-10-18 Thread Ira Weiny
On Fri, Oct 16, 2020 at 02:55:21PM +0200, Thomas Gleixner wrote: > On Fri, Oct 16 2020 at 13:45, Peter Zijlstra wrote: > > On Fri, Oct 09, 2020 at 12:42:55PM -0700, ira.we...@intel.com wrote: > >> @@ -238,7 +236,7 @@ noinstr void idtentry_exit_nmi(struct pt_regs *regs, > >> bool restore) > >> >

Re: [PATCH RFC V3 5/9] x86/pks: Add PKS kernel API

2020-10-16 Thread Ira Weiny
On Fri, Oct 16, 2020 at 01:07:47PM +0200, Peter Zijlstra wrote: > On Fri, Oct 09, 2020 at 12:42:54PM -0700, ira.we...@intel.com wrote: > > +static inline void pks_update_protection(int pkey, unsigned long > > protection) > > +{ > > + current->thread.saved_pkrs =

Re: [PATCH RFC V3 4/9] x86/pks: Preserve the PKRS MSR on context switch

2020-10-16 Thread Ira Weiny
On Fri, Oct 16, 2020 at 01:06:36PM +0200, Peter Zijlstra wrote: > On Fri, Oct 09, 2020 at 12:42:53PM -0700, ira.we...@intel.com wrote: > > > @@ -644,6 +663,8 @@ void __switch_to_xtra(struct task_struct *prev_p, > > struct task_struct *next_p) > > > > if ((tifp ^ tifn) & _TIF_SLD) > >

Re: [PATCH RFC V3 4/9] x86/pks: Preserve the PKRS MSR on context switch

2020-10-16 Thread Ira Weiny
On Fri, Oct 16, 2020 at 01:12:26PM +0200, Peter Zijlstra wrote: > On Tue, Oct 13, 2020 at 11:31:45AM -0700, Dave Hansen wrote: > > > +/** > > > + * It should also be noted that the underlying WRMSR(MSR_IA32_PKRS) is > > > not > > > + * serializing but still maintains ordering properties similar

Re: [PATCH RFC V3 2/9] x86/fpu: Refactor arch_set_user_pkey_access() for PKS support

2020-10-16 Thread Ira Weiny
and the new Protection Key for Supervisor > > (PKS) in subsequent patches. > > > > Co-developed-by: Ira Weiny > > Signed-off-by: Ira Weiny > > Signed-off-by: Fenghua Yu > > --- > > arch/x86/include/asm/pkeys.h | 2 ++ > > arch/x86/kernel/fpu/

Re: [PATCH RFC V3 9/9] x86/pks: Add PKS test code

2020-10-14 Thread Ira Weiny
On Tue, Oct 13, 2020 at 12:02:07PM -0700, Dave Hansen wrote: > On 10/9/20 12:42 PM, ira.we...@intel.com wrote: > > #ifdef CONFIG_X86_32 > > /* > > * We can fault-in kernel-space virtual memory on-demand. The > > diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h > > index

Re: [PATCH RFC V3 7/9] x86/entry: Preserve PKRS MSR across exceptions

2020-10-14 Thread Ira Weiny
On Wed, Oct 14, 2020 at 09:06:44PM -0700, Dave Hansen wrote: > On 10/14/20 8:46 PM, Ira Weiny wrote: > > On Tue, Oct 13, 2020 at 11:52:32AM -0700, Dave Hansen wrote: > >> On 10/9/20 12:42 PM, ira.we...@intel.com wrote: > >>> @@ -341,6 +341,9 @@ noinstr void irqen

Re: [PATCH RFC V3 8/9] x86/fault: Report the PKRS state on fault

2020-10-14 Thread Ira Weiny
On Tue, Oct 13, 2020 at 11:56:53AM -0700, Dave Hansen wrote: > > @@ -548,6 +549,11 @@ show_fault_oops(struct pt_regs *regs, unsigned long > > error_code, unsigned long ad > > (error_code & X86_PF_PK)? "protection keys violation" : > >

Re: [PATCH RFC V3 7/9] x86/entry: Preserve PKRS MSR across exceptions

2020-10-14 Thread Ira Weiny
On Tue, Oct 13, 2020 at 11:52:32AM -0700, Dave Hansen wrote: > On 10/9/20 12:42 PM, ira.we...@intel.com wrote: > > @@ -341,6 +341,9 @@ noinstr void irqentry_enter(struct pt_regs *regs, > > irqentry_state_t *state) > > /* Use the combo lockdep/tracing function */ > > trace_hardirqs_off();

Re: [PATCH RFC V3 5/9] x86/pks: Add PKS kernel API

2020-10-14 Thread Ira Weiny
On Tue, Oct 13, 2020 at 11:43:57AM -0700, Dave Hansen wrote: > > +static inline void pks_update_protection(int pkey, unsigned long > > protection) > > +{ > > + current->thread.saved_pkrs = update_pkey_val(current->thread.saved_pkrs, > > +pkey,

Re: [PATCH RFC V3 4/9] x86/pks: Preserve the PKRS MSR on context switch

2020-10-14 Thread Ira Weiny
On Tue, Oct 13, 2020 at 11:31:45AM -0700, Dave Hansen wrote: > On 10/9/20 12:42 PM, ira.we...@intel.com wrote: > > From: Ira Weiny > > > > The PKRS MSR is defined as a per-logical-processor register. This > > isolates memory access by logical CPU. Unfortunately,

Re: [PATCH RFC V3 3/9] x86/pks: Enable Protection Keys Supervisor (PKS)

2020-10-13 Thread Ira Weiny
On Tue, Oct 13, 2020 at 11:23:08AM -0700, Dave Hansen wrote: > On 10/9/20 12:42 PM, ira.we...@intel.com wrote: > > +/* > > + * PKS is independent of PKU and either or both may be supported on a CPU. > > + * Configure PKS if the cpu supports the feature. > > + */ > > Let's at least be consistent

Re: [PATCH RFC V3 2/9] x86/fpu: Refactor arch_set_user_pkey_access() for PKS support

2020-10-13 Thread Ira Weiny
On Tue, Oct 13, 2020 at 10:50:05AM -0700, Dave Hansen wrote: > On 10/9/20 12:42 PM, ira.we...@intel.com wrote: > > +/* > > + * Update the pk_reg value and return it. > > How about: > > Replace disable bits for @pkey with values from @flags. Done. > > > + * Kernel users use the same

Re: [PATCH RFC PKS/PMEM 24/58] fs/freevxfs: Utilize new kmap_thread()

2020-10-13 Thread Ira Weiny
On Tue, Oct 13, 2020 at 12:25:44PM +0100, Christoph Hellwig wrote: > > - kaddr = kmap(pp); > > + kaddr = kmap_thread(pp); > > memcpy(kaddr, vip->vii_immed.vi_immed + offset, PAGE_SIZE); > > - kunmap(pp); > > + kunmap_thread(pp); > > You only Cced me on this particular patch, which

Re: [PATCH RFC PKS/PMEM 33/58] fs/cramfs: Utilize new kmap_thread()

2020-10-13 Thread Ira Weiny
On Tue, Oct 13, 2020 at 09:01:49PM +0100, Al Viro wrote: > On Tue, Oct 13, 2020 at 08:36:43PM +0100, Matthew Wilcox wrote: > > > static inline void copy_to_highpage(struct page *to, void *vfrom, unsigned > > int size) > > { > > char *vto = kmap_atomic(to); > > > > memcpy(vto, vfrom,

Re: [PATCH RFC PKS/PMEM 33/58] fs/cramfs: Utilize new kmap_thread()

2020-10-13 Thread Ira Weiny
On Tue, Oct 13, 2020 at 08:36:43PM +0100, Matthew Wilcox wrote: > On Tue, Oct 13, 2020 at 11:44:29AM -0700, Dan Williams wrote: > > On Fri, Oct 9, 2020 at 12:52 PM wrote: > > > > > > From: Ira Weiny > > > > > > The kmap() calls in this F

Re: [PATCH RFC V3 1/9] x86/pkeys: Create pkeys_common.h

2020-10-13 Thread Ira Weiny
On Tue, Oct 13, 2020 at 10:46:16AM -0700, Dave Hansen wrote: > On 10/9/20 12:42 PM, ira.we...@intel.com wrote: > > Protection Keys User (PKU) and Protection Keys Supervisor (PKS) work > > in similar fashions and can share common defines. > > Could we be a bit less abstract? PKS and PKU each

Re: [PATCH RFC PKS/PMEM 22/58] fs/f2fs: Utilize new kmap_thread()

2020-10-12 Thread Ira Weiny
On Mon, Oct 12, 2020 at 09:02:54PM +0100, Matthew Wilcox wrote: > On Mon, Oct 12, 2020 at 12:53:54PM -0700, Ira Weiny wrote: > > On Mon, Oct 12, 2020 at 05:44:38PM +0100, Matthew Wilcox wrote: > > > On Mon, Oct 12, 2020 at 09:28:29AM -0700, Dave Hansen wrote: > > >

Re: [PATCH RFC PKS/PMEM 22/58] fs/f2fs: Utilize new kmap_thread()

2020-10-12 Thread Ira Weiny
On Mon, Oct 12, 2020 at 05:44:38PM +0100, Matthew Wilcox wrote: > On Mon, Oct 12, 2020 at 09:28:29AM -0700, Dave Hansen wrote: > > kmap_atomic() is always preferred over kmap()/kmap_thread(). > > kmap_atomic() is _much_ more lightweight since its TLB invalidation is > > always CPU-local and never

Re: [PATCH RFC PKS/PMEM 22/58] fs/f2fs: Utilize new kmap_thread()

2020-10-12 Thread Ira Weiny
On Fri, Oct 09, 2020 at 06:30:36PM -0700, Eric Biggers wrote: > On Sat, Oct 10, 2020 at 01:39:54AM +0100, Matthew Wilcox wrote: > > On Fri, Oct 09, 2020 at 02:34:34PM -0700, Eric Biggers wrote: > > > On Fri, Oct 09, 2020 at 12:49:57PM -0700, ira.we...@intel.com wrote: > > > > The kmap() calls in

Re: [PATCH RFC PKS/PMEM 57/58] nvdimm/pmem: Stray access protection for pmem->virt_addr

2020-10-11 Thread Ira Weiny
On Fri, Oct 09, 2020 at 07:53:07PM -0700, John Hubbard wrote: > On 10/9/20 12:50 PM, ira.we...@intel.com wrote: > > From: Ira Weiny > > > > The pmem driver uses a cached virtual address to access its memory > > directly. Because the nvdimm driver is well aware of

Re: [PATCH RFC PKS/PMEM 48/58] drivers/md: Utilize new kmap_thread()

2020-10-11 Thread Ira Weiny
On Sat, Oct 10, 2020 at 10:20:34AM +0800, Coly Li wrote: > On 2020/10/10 03:50, ira.we...@intel.com wrote: > > From: Ira Weiny > > > > These kmap() calls are localized to a single thread. To avoid the over > > head of global PKRS updates use the new kmap_thre

Re: [PATCH RFC PKS/PMEM 10/58] drivers/rdma: Utilize new kmap_thread()

2020-10-11 Thread Ira Weiny
On Sat, Oct 10, 2020 at 11:36:49AM +, Bernard Metzler wrote: > -ira.we...@intel.com wrote: - > [snip] > >@@ -505,7 +505,7 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, > >struct socket *s) > > page_array[seg] = p; > > > >

Re: [PATCH RFC PKS/PMEM 09/58] drivers/gpu: Utilize new kmap_thread()

2020-10-10 Thread Ira Weiny
On Sat, Oct 10, 2020 at 12:03:49AM +0200, Daniel Vetter wrote: > On Fri, Oct 09, 2020 at 12:49:44PM -0700, ira.we...@intel.com wrote: > > From: Ira Weiny > > > > These kmap() calls in the gpu stack are localized to a single thread. > > To avoid the over head of glob

Re: [PATCH RFC V3 0/9] PKS: Add Protection Keys Supervisor (PKS) support RFC v3

2020-10-09 Thread Ira Weiny
On Fri, Oct 09, 2020 at 12:42:49PM -0700, 'Ira Weiny' wrote: > From: Ira Weiny > > This RFC series has been reviewed by Dave Hansen. > > Introduce a new page protection mechanism for supervisor pages, Protection Key > Supervisor (PKS). > > 2 use cases for PKS are being

[PATCH RFC PKS/PMEM 55/58] samples: Utilize new kmap_thread()

2020-10-09 Thread ira . weiny
From: Ira Weiny These kmap() calls are localized to a single thread. To avoid the over head of global PKRS updates use the new kmap_thread() call. Cc: Kirti Wankhede Signed-off-by: Ira Weiny --- samples/vfio-mdev/mbochs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

  1   2   3   4   5   >