public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Cc: "Yu, Yu-cheng" <yu-cheng.yu@intel.com>,
	"riel@surriel.com" <riel@surriel.com>,
	"luto@kernel.org" <luto@kernel.org>,
	"Hellstrom, Thomas" <thomas.hellstrom@intel.com>,
	"Cui, Ling" <ling.cui@intel.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"bp@alien8.de" <bp@alien8.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"tglx@kernel.org" <tglx@kernel.org>
Subject: Re: [PATCH] x86/mm: Revert INVLPGB optimization for set_memory code
Date: Tue, 21 Apr 2026 18:42:53 +0000	[thread overview]
Message-ID: <6ba35878b09adfd0ad47dd6a4bdc55acbc683550.camel@intel.com> (raw)
In-Reply-To: <20260421151909.6B3281C6@davehans-spike.ostc.intel.com>

On Tue, 2026-04-21 at 08:19 -0700, Dave Hansen wrote:
> 86e6815b316e made the mistake of assuming that the virtual addresses
> in the cpa_data are always contiguous. It got things right when neither
> CPA_ARRAY/CPA_PAGES_ARRAY is used, but theoretically wrong when either
> of those is used.
> 
> In the i915 case, it probably failed to flush some WB TLB entries and
> install WC ones, leaving some data in the caches and not flushing it
> out to where the device could see it. That eventually caused graphics
> problems.

Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>

Makes sense. And I see the merit in just trying to revert the change. But I
think a change to fix the optimization is also temptingly small:

diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
index 40581a720fe82..2a7ee1848f7ed 100644
--- a/arch/x86/mm/pat/set_memory.c
+++ b/arch/x86/mm/pat/set_memory.c
@@ -2089,6 +2089,7 @@ static int change_page_attr_set_clr(unsigned long *addr,
int numpages,
        cpa.flags = in_flag;
        cpa.curpage = 0;
        cpa.force_split = force_split;
+       cpa.force_flush_all = in_flag & (CPA_PAGES_ARRAY | CPA_ARRAY);
 
        ret = __change_page_attr_set_clr(&cpa, 1);
 

Also, could add:
Fixes: 86e6815b316ec ("x86/mm: Change cpa_flush() to call flush_kernel_range()
directly")



  parent reply	other threads:[~2026-04-21 18:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 15:19 [PATCH] x86/mm: Revert INVLPGB optimization for set_memory code Dave Hansen
2026-04-21 15:20 ` Dave Hansen
2026-04-21 15:25 ` Hellstrom, Thomas
2026-04-21 18:42 ` Edgecombe, Rick P [this message]
2026-04-21 18:46   ` Dave Hansen
2026-04-22  7:59     ` Hellstrom, Thomas
2026-04-22 14:01       ` Dave Hansen
2026-04-22 19:15 ` [tip: x86/urgent] " tip-bot2 for Dave Hansen
2026-04-24 13:46 ` tip-bot2 for Dave Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ba35878b09adfd0ad47dd6a4bdc55acbc683550.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=ling.cui@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=tglx@kernel.org \
    --cc=thomas.hellstrom@intel.com \
    --cc=x86@kernel.org \
    --cc=yu-cheng.yu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox