From: Rik van Riel <riel@surriel.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com
Subject: Re: [PATCH] x86/mm: resize user_pcid_flush_mask for PTI / broadcast TLB flush combination
Date: Sat, 17 May 2025 17:29:06 -0400 [thread overview]
Message-ID: <0cd34b6c8d8009fd6f626f3287ce36e55374b140.camel@surriel.com> (raw)
In-Reply-To: <aChB9ORFxaL8VfyD@gmail.com>
On Sat, 2025-05-17 at 09:59 +0200, Ingo Molnar wrote:
>
> CONFIG_X86_TLB_BROADCAST_TLB_FLUSH doesn't actually exist, the name
> is
> CONFIG_BROADCAST_TLB_FLUSH.
>
Argh, cut'n'pasted from the wrong tree :(
>
> we could make this a more obvious:
>
> And we can drop the ugly & fragile type cast in
> invalidate_user_asid():
>
> - __set_bit(kern_pcid(asid),
> - (unsigned long
> *)this_cpu_ptr(&cpu_tlbstate.user_pcid_flush_mask));
>
> + __set_bit(kern_pcid(asid),
> this_cpu_ptr(cpu_tlbstate.user_pcid_flush_mask));
>
That is a really nice improvement, and it almost
works, too ;)
In file included from ./arch/x86/include/asm/bitops.h:430,
from ./include/linux/bitops.h:68:
./include/asm-generic/bitops/instrumented-non-atomic.h:26:54: note:
expected ‘volatile long unsigned int *’ but argument is of type ‘long
unsigned int (*)[32]’
26 | ___set_bit(unsigned long nr, volatile unsigned long *addr)
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
I ended up settling for this:
__set_bit(kern_pcid(asid),
this_cpu_ptr(&cpu_tlbstate.user_pcid_flush_mask[0]));
> 3)
>
> If we are going to grow user_pcid_flush_mask from 2 bytes to 256
> bytes
> then please reorder 'struct tlb_state' for cache efficiency: at
> minimum
> the ::cr4 shadow should move to before ::user_pcid_flush_mask. But I
> think we should probably move user_pcid_flush_mask to the end of the
> structure, where it does the least damage to cache layout.
Done. V2 to follow in another email.
Thank you!
--
All Rights Reversed.
next prev parent reply other threads:[~2025-05-17 21:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-16 16:33 Rik van Riel
2025-05-17 7:59 ` Ingo Molnar
2025-05-17 21:29 ` Rik van Riel [this message]
2025-05-18 0:12 ` [PATCH v2] " Rik van Riel
2025-05-18 6:25 ` Ingo Molnar
2025-05-18 16:22 ` Rik van Riel
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=0cd34b6c8d8009fd6f626f3287ce36e55374b140.camel@surriel.com \
--to=riel@surriel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.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®