From: Song Liu <songliubraving@fb.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux MM <linux-mm@kvack.org>, Kernel Team <Kernel-team@fb.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
Joerg Roedel <jroedel@suse.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] x86/mm/pti: in pti_clone_pgtable() don't increase addr by PUD_SIZE
Date: Tue, 20 Aug 2019 13:17:02 +0000 [thread overview]
Message-ID: <6A23C1AE-B447-4273-A451-38D458085C02@fb.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1908201106260.2223@nanos.tec.linutronix.de>
> On Aug 20, 2019, at 2:12 AM, Thomas Gleixner <tglx@linutronix.de> wrote:
>
> On Tue, 20 Aug 2019, Song Liu wrote:
>
>> pti_clone_pgtable() increases addr by PUD_SIZE for pud_none(*pud) case.
>> This is not accurate because addr may not be PUD_SIZE aligned.
>
> You fail to explain how this happened. The code before the 32bit support
> did always increase by PMD_SIZE. The 32bit support broke that.
Will fix.
>
>> In our x86_64 kernel, pti_clone_pgtable() fails to clone 7 PMDs because
>> of this issuse, including PMD for the irq entry table. For a memcache
>> like workload, this introduces about 4.5x more iTLB-load and about 2.5x
>> more iTLB-load-misses on a Skylake CPU.
>
> This information is largely irrelevant. What matters is the fact that this
> got broken and incorrectly forwards the address by PUD_SIZE which is wrong
> if address is not PUD_SIZE aligned.
We started looking into this because we cannot explain the regression in
iTLB miss rate. I guess the patch itself explains it pretty well, so the
original issue doesn't matter that much?
I will remove this part.
>
>> This patch fixes this issue by adding PMD_SIZE to addr for pud_none()
>> case.
>
> git grep 'This patch' Documentation/process/submitting-patches.rst
Will fix.
>> Cc: stable@vger.kernel.org # v4.19+
>> Fixes: 16a3fe634f6a ("x86/mm/pti: Clone kernel-image on PTE level for 32 bit")
>> Signed-off-by: Song Liu <songliubraving@fb.com>
>> Cc: Joerg Roedel <jroedel@suse.de>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Dave Hansen <dave.hansen@linux.intel.com>
>> Cc: Andy Lutomirski <luto@kernel.org>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> ---
>> arch/x86/mm/pti.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
>> index b196524759ec..5a67c3015f59 100644
>> --- a/arch/x86/mm/pti.c
>> +++ b/arch/x86/mm/pti.c
>> @@ -330,7 +330,7 @@ pti_clone_pgtable(unsigned long start, unsigned long end,
>>
>> pud = pud_offset(p4d, addr);
>> if (pud_none(*pud)) {
>> - addr += PUD_SIZE;
>> + addr += PMD_SIZE;
>
> The right fix is to skip forward to the next PUD boundary instead of doing
> this in a loop with PMD_SIZE increments.
Agreed.
Thanks,
Song
next prev parent reply other threads:[~2019-08-20 13:17 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 7:51 Song Liu
2019-08-20 9:12 ` Thomas Gleixner
2019-08-20 13:17 ` Song Liu [this message]
2019-08-20 10:00 ` Peter Zijlstra
2019-08-20 11:16 ` Thomas Gleixner
2019-08-20 13:21 ` Song Liu
2019-08-20 13:39 ` Thomas Gleixner
2019-08-20 13:55 ` Rik van Riel
2019-08-20 14:00 ` Song Liu
2019-08-20 16:56 ` [PATCH v2] " Rik van Riel
2019-08-20 13:21 ` [PATCH] " Rik van Riel
2019-08-20 13:19 ` Song Liu
2019-08-20 13:57 ` Dave Hansen
2019-08-20 14:14 ` Song Liu
2019-08-20 14:18 ` Dave Hansen
2019-08-20 16:05 ` Song Liu
2019-08-20 16:38 ` Song Liu
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=6A23C1AE-B447-4273-A451-38D458085C02@fb.com \
--to=songliubraving@fb.com \
--cc=Kernel-team@fb.com \
--cc=dave.hansen@linux.intel.com \
--cc=jroedel@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
/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