Re: [RFC PATCH 11/15] memremap: Add zone device access protection

2020-07-14 Thread Peter Zijlstra
On Tue, Jul 14, 2020 at 12:10:47PM -0700, Ira Weiny wrote: > On Tue, Jul 14, 2020 at 10:40:57AM +0200, Peter Zijlstra wrote: > > That's an anti-pattern vs static_keys, I'm thinking you actually want > > static_key_slow_{inc,dec}() instead of {enable,disable}(). > > Thanks. I'll go read the doc f

Re: [RFC PATCH 11/15] memremap: Add zone device access protection

2020-07-14 Thread Ira Weiny
On Tue, Jul 14, 2020 at 10:40:57AM +0200, Peter Zijlstra wrote: > On Tue, Jul 14, 2020 at 12:02:16AM -0700, ira.we...@intel.com wrote: > > > +static pgprot_t dev_protection_enable_get(struct dev_pagemap *pgmap, > > pgprot_t prot) > > +{ > > + if (pgmap->flags & PGMAP_PROT_ENABLED && dev_page_pk

Re: [RFC PATCH 11/15] memremap: Add zone device access protection

2020-07-14 Thread Peter Zijlstra
On Tue, Jul 14, 2020 at 12:02:16AM -0700, ira.we...@intel.com wrote: > +static pgprot_t dev_protection_enable_get(struct dev_pagemap *pgmap, > pgprot_t prot) > +{ > + if (pgmap->flags & PGMAP_PROT_ENABLED && dev_page_pkey != PKEY_INVALID) > { > + pgprotval_t val = pgprot_val(prot

[RFC PATCH 11/15] memremap: Add zone device access protection

2020-07-14 Thread ira . weiny
From: Ira Weiny Device managed memory exposes itself to the kernel direct map which allows stray pointers to access these device memories. Stray pointers to normal memory may result in a crash or other undesirable behavior which, while unfortunate, are usually recoverable with a reboot. Stray w