Re: [RFC PATCH, x86]: Disable CPA cache flush for selfsnoop targets

From: Andy Lutomirski
Date: Mon Jul 15 2019 - 18:12:30 EST


On Mon, Jul 15, 2019 at 12:38 PM Andi Kleen <ak@xxxxxxxxxxxxxxx> wrote:
>
> >
> > That does not answer the question whether it's worthwhile to do that.
>
> It's likely worthwhile for (Intel integrated) graphics.
>
> There was also a recent issue with 3dxp/dax, which uses ioremap in some
> cases.
>


FWIW, I applied this simpler patch:

diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 6a9a77a403c9..a933f99b176a 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -1729,6 +1729,7 @@ static int change_page_attr_set_clr(unsigned
long *addr, int numpages,
* attributes:
*/
cache = !!pgprot2cachemode(mask_set);
+ WARN_ON(cache);

/*
* On error; flush everything to be sure.

and booted a VM, including loading a module. The warning did not
fire. For the most part, we use PAT for things like ioremap_wc(), but
there's no flush, since there's no preexisting mapping at all.

I haven't tested on a real kernel with i915. Does i915 really hit
this code path? Does it happen more than once or twice at boot?

The only case I can think of where this would really matter is DAX, if
anyone uses WT for DAX.