From: Kiryl Shutsemau <kas@kernel.org>
To: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
Cc: "peterz@infradead.org" <peterz@infradead.org>,
"luto@kernel.org" <luto@kernel.org>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"andrew+kernel@donnellan.id.au" <andrew+kernel@donnellan.id.au>,
"rppt@kernel.org" <rppt@kernel.org>,
"pasha.tatashin@soleen.com" <pasha.tatashin@soleen.com>,
"kernel-team@meta.com" <kernel-team@meta.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"david@kernel.org" <david@kernel.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"peterx@redhat.com" <peterx@redhat.com>,
"tj@kernel.org" <tj@kernel.org>,
"azpijr@gmail.com" <azpijr@gmail.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"hpa@zytor.com" <hpa@zytor.com>,
"baolin.wang@linux.alibaba.com" <baolin.wang@linux.alibaba.com>,
"tglx@kernel.org" <tglx@kernel.org>,
"rmclure@linux.ibm.com" <rmclure@linux.ibm.com>,
"bp@alien8.de" <bp@alien8.de>, "x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH] x86/mm: Define the zapped-entry checks only with CONFIG_DEBUG_VM
Date: Mon, 2 Nov 2026 17:32:56 +0000 [thread overview]
Message-ID: <aujIo3W5yVZdZaf7@thinkstation> (raw)
In-Reply-To: <f20b6d4f4e9368885e187e208453f21a9b0a2140.camel@intel.com>
On Mon, Nov 02, 2026 at 04:53:17PM +0000, Edgecombe, Rick P wrote:
> Do you happen to know if this performance impact is relevant at all in the non
> Safe RET case?
Yes, both sides of the comparison are the same kernel with Safe RET on,
with and without the patch.
Without Safe RET (spec_rstack_overflow=off, same two kernels) the call
and return predict fine: branch misses are the same with and without the
patch, and the gain is under 2%, within noise.
> > diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
> > index 4a105f283cfb..3352bc6904f3 100644
> > --- a/arch/x86/mm/pgtable.c
> > +++ b/arch/x86/mm/pgtable.c
> > @@ -798,6 +798,7 @@ pmd_t pmd_mkwrite(pmd_t pmd, struct vm_area_struct *vma)
> > return pmd_clear_saveddirty(pmd);
> > }
> >
> > +#ifdef CONFIG_DEBUG_VM
> > void arch_check_zapped_pte(struct vm_area_struct *vma, pte_t pte)
> > {
> > /*
> > @@ -823,3 +824,4 @@ void arch_check_zapped_pud(struct vm_area_struct *vma,
> > pud_t pud)
> > /* See note in arch_check_zapped_pte() */
> > VM_WARN_ON_ONCE(!(vma->vm_flags & VM_SHADOW_STACK) &&
> > pud_shstk(pud));
>
> I guess all of these don't need to be the "VM_WARN_" varieties if they are
> compiled out in the other case.
I can do either way. It is functionally equivalent.
--
Kiryl Shutsemau / Kirill A. Shutemov
next prev parent reply other threads:[~2026-11-02 17:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 14:39 Kiryl Shutsemau (Meta)
2026-11-02 16:09 ` Jose A. Perez de Azpillaga
2026-11-02 16:53 ` Edgecombe, Rick P
2026-11-02 17:32 ` Kiryl Shutsemau [this message]
2026-11-02 19:07 ` Edgecombe, Rick P
2026-11-02 21:12 ` 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=aujIo3W5yVZdZaf7@thinkstation \
--to=kas@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andrew+kernel@donnellan.id.au \
--cc=azpijr@gmail.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=hpa@zytor.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=pasha.tatashin@soleen.com \
--cc=peterx@redhat.com \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=rmclure@linux.ibm.com \
--cc=rppt@kernel.org \
--cc=tglx@kernel.org \
--cc=tj@kernel.org \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®