From: Mark Rutland <mark.rutland@arm.com>
To: Tangnianyao <tangnianyao@huawei.com>
Cc: Marc Zyngier <maz@kernel.org>,
Wei-Lin Chang <weilin.chang@arm.com>,
oupton@kernel.org, joey.gouly@arm.com, seiden@linux.ibm.com,
suzuki.poulose@arm.com, yuzenghui@huawei.com,
catalin.marinas@arm.com, will@kernel.org,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
linux-kernel@vger.kernel.org, "guoyang (C)" <guoyang2@huawei.com>,
"huanglingyan (A)" <huanglingyan2@huawei.com>,
"Wangzhou (B)" <wangzhou1@hisilicon.com>
Subject: Re: Question about the "TLBs and I-cache are private to each vCPU" guarantee with VTTBR_EL2.CnP
Date: Mon, 6 Jul 2026 16:33:17 +0100 [thread overview]
Message-ID: <akvKvePWiu4pB47Q@J2N7QTR9R3.cambridge.arm.com> (raw)
In-Reply-To: <5685cdb9-95d8-9ead-4d24-d6ad06dd9547@huawei.com>
On Mon, Jul 06, 2026 at 10:15:04PM +0800, Tangnianyao wrote:
> Two SMT threads(PE0,PE1) on the same physical core share TLB.
Critially those are *NOT* allowed to share entries allocated with
CnP==0, and are only allowed to share entries where CnP was enabled at
stage 1 (and stage 2 if applicable).
Please see the ARM ARM:
https://developer.arm.com/documentation/ddi0487/mc/
Specifically, section D8.12.3.4 "Common not private translations":
https://developer.arm.com/documentation/ddi0487/mc/-Part-D-The-AArch64-System-Level-Architecture/-Chapter-D8-The-AArch64-Virtual-Memory-System-Architecture/-D8-16-Translation-Lookaside-Buffers/-D8-16-3-Use-of-ASIDs-and-VMIDs-to-reduce-TLB-maintenance-requirements
> VM0 has 2 vcpus, vcpu0 and vcpu1 that share all architectural context
> except the address translation context.
>
> Vcpu0 may observe TLB entries that are supposed to be private to vcpu1
> in the following case:
>
> PE0(core0,smt0) PE1(core0,smt1)
> vcpu0 load
> vcpu0 va->pa0
> vcpu0 put
> vcpu1 load
> vcpu1 flush local tlb
> vcpu1 modify desc to va->pa1
> vcpu0 load
> vcpu0 hit *va->pa1*
How is CnP managed in this example?
If *either* of the vCPUs don't set TTBRn_EL1.CnP, that is not permitted
to happen.
If *both* of the vCPUs set TTBRn_EL1.CnP, then surely that is
indistinguishable from physical CPUs:
PE0(core0,smt0) PE1(core0,smt1)
cpu0 va->pa0
cpu1 flush local tlb
cpu1 modify desc to va->pa1
cpu0 hit *va->pa1*
Mark.
next prev parent reply other threads:[~2026-07-06 15:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-04 7:45 Question about the "TLBs and I-cache are private to each vCPU" guarantee with VTTBR_EL2.CnP Tangnianyao
2026-07-05 17:28 ` Wei-Lin Chang
2026-07-06 3:30 ` Tangnianyao
2026-07-06 7:25 ` Marc Zyngier
2026-07-06 8:25 ` Tangnianyao
2026-07-06 8:44 ` Marc Zyngier
2026-07-06 14:15 ` Tangnianyao
2026-07-06 15:18 ` Will Deacon
2026-07-06 15:33 ` Mark Rutland [this message]
2026-07-07 2:41 ` Tangnianyao
2026-07-07 6:36 ` Oliver Upton
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=akvKvePWiu4pB47Q@J2N7QTR9R3.cambridge.arm.com \
--to=mark.rutland@arm.com \
--cc=catalin.marinas@arm.com \
--cc=guoyang2@huawei.com \
--cc=huanglingyan2@huawei.com \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=seiden@linux.ibm.com \
--cc=suzuki.poulose@arm.com \
--cc=tangnianyao@huawei.com \
--cc=wangzhou1@hisilicon.com \
--cc=weilin.chang@arm.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.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