Re: [PATCH RFC V2 13/17] kmap: Add stray write protection for device pages
From: Ira Weiny
Date: Tue Jul 21 2020 - 12:31:54 EST
On Mon, Jul 20, 2020 at 11:17:40AM +0200, Peter Zijlstra wrote:
> On Sat, Jul 18, 2020 at 09:13:19PM -0700, Ira Weiny wrote:
> > On Fri, Jul 17, 2020 at 11:21:39AM +0200, Peter Zijlstra wrote:
> > > On Fri, Jul 17, 2020 at 12:20:52AM -0700, ira.weiny@xxxxxxxxx wrote:
> > > > @@ -31,6 +32,20 @@ static inline void invalidate_kernel_vmap_range(void *vaddr, int size)
> > > >
> > > > #include <asm/kmap_types.h>
> > > >
> > > > +static inline void enable_access(struct page *page)
> > > > +{
> > > > + if (!page_is_access_protected(page))
> > > > + return;
> > > > + dev_access_enable();
> > > > +}
> > > > +
> > > > +static inline void disable_access(struct page *page)
> > > > +{
> > > > + if (!page_is_access_protected(page))
> > > > + return;
> > > > + dev_access_disable();
> > > > +}
> > >
> > > These are some very generic names, do we want them to be a little more
> > > specific?
> >
> > I had them named kmap_* but Dave (I think it was Dave) thought they did not
> > really apply strictly to kmap_*.
> >
> > They are static to this file which I thought may be sufficient to 'uniqify'
> > them?
>
> They're static to a .h, which means they're all over the place ;-)
I've thought about it a bit. I think I agree with both you and Dave.
How about:
dev_page_{en,dis}able_access()
??
I've made that change for now.
Thanks,
Ira