From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796212178; b=JbncUl6BQTjltpGIYNTsZLRoXvI0i3AfsgohvoUl3edhlKxgbLZIKE29vXWN96UmY06Y fz71cR2LXgHB0eQfUHel0MG27pJxXuYJLe+lBXQ148R2e5EXIFDP+xOaHT7TIrIsb3THm g/65yfTrmSEvv00Up6cSNNg70kJMXTYsaUZ9jhYa+mRJQFQwRVZ+xyP7G4e351z4+Wwuf kgatSZKRgTlujNWx+NEh9I5napxVC1/BjOmtLCXvjZM/ZzHEXErnrx+r3tT7fzEd/JZgU qW3pcjS99sLJjue8qKAHkuisVtFvIrEsRH/6rNDEN8arbgbdbJx7RJwuBxDGGwKlorw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796212178; h=DMARC-Filter:Received:Received:DKIM-Signature:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:From: Content-Language:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=/mlRp0x4Nv/gTV4EnNeKr6RoKg1t/SDB6BDr6uhexdc=; b=BCxmSs5bhktQJd1h5NGNc089Kf//cZBygZadn+/yDCU/NsGWjlQeR7Rc8qpI+T48yMqH /8kfwANMvn1dF1afbbH80r7n8sZpVJzbNVS662pPnsB65fV45Xcodsv91957LEPr6JFM3 OEJAXJ9VHTNig1A4Xwgxs2vHqTW96XvfphiLFWWqiMOdBoxfOwCqEtKsB/hvI36HAbxfB RGoCo7bKmHMhA573o1WXipSOzlLTaIsT6F2V7kS7kivX8oAzBNjiuX0P2L2oojyrdJROR tczzjNlSKEwP47mzn9rwqim/dyVCBo8nuTuPSRap9cZ88fVqm66P4HsjLQY8g6cnKAg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b="HlK/iCFz"; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4ED8E606A323; Wed, 2 Dec 2026 11:49:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4ED8E606A323 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=HlK/iCFz Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0E6F81682; Wed, 2 Dec 2026 03:49:35 -0800 (PST) Received: from [10.57.53.204] (unknown [10.57.53.204]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7066A3F7D8; Wed, 2 Dec 2026 03:49:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796212177; bh=QpeYVi9fM/LoaZyBb6FhExLHVFrnrwvNt6pAHFrR/x8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=HlK/iCFzvJ+U3/7gTfTocL+/8wn5YkPoRxLbwcPIZAtghnUF+mTnFD8xpIR/MV5BM 9xsTe8Cd+5HOT7a4fey71+NsM0DWrTvTtmKbKAVWRsF03XK2qJNHN2b5s33cOuDrkB dz5HgJ1+X1vDyQbguCTpQ1ukUJsUjVwJ7AQkBDII= Message-ID: Date: Wed, 2 Dec 2026 11:49:29 +0000 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 07/11] KVM: arm64: CCA: Add Realm RTT mapping and invalidation helpers To: Suzuki K Poulose , kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni , Gavin Shan , Shanker Donthineni , Alper Gun , "Aneesh Kumar K . V" , Emi Kisanuki , Vishal Annapurve , WeiLin.Chang@arm.com, Lorenzo Pieralisi , Kohei Enju References: <20261130142534.219108-1-steven.price@arm.com> <20261130142534.219108-8-steven.price@arm.com> <54c43dbb-1f39-4bd9-986c-e4bfe71d118d@arm.com> From: Steven Price Content-Language: en-GB In-Reply-To: <54c43dbb-1f39-4bd9-986c-e4bfe71d118d@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 01/12/2026 23:15, Suzuki K Poulose wrote: > On 30/11/2026 14:25, Steven Price wrote: >> Add the RMI RTT creation and unmap helpers needed by CCA Realm stage-2 >> memory operations. REC exit handling and guest requested RIPAS changes >> follow in the vCPU series. >> [...] >> + >> +void kvm_realm_unmap_range_filter(struct kvm *kvm, unsigned long start, >> +                  unsigned long size, bool may_block, >> +                  enum kvm_gfn_range_filter attr_filter) >> +{ >> +    /* >> +     * MMU notifier callbacks only invalidate shared mappings, which can >> +     * fall back to unmapping a larger block if an atomic split fails. >> +     * Private invalidation uses a local cache instead of the eager >> split >> +     * cache protected by slots_lock. >> +     */ >> +    struct kvm_mmu_memory_cache cache = { .gfp_zero = __GFP_ZERO }; > > Is it better to keep a cache in struct realm that can be used here > instead of the local cache ? That could be reused for RMI_POPULATE > and even SET_RIPAS. The benefit of the local cache is it avoids locking issues. We drop mmu_lock to allocate pages so that doesn't help coordinate a shared cache, and holding it makes using another lock tricky without causing lock ordering issues. SET_RIPAS already makes use of the vCPU cache and RMI_POPULATE doesn't currently use a cache. So a local cache is certainly much easier to reason about and without evidence of it causing performance issues I'd be keen to keep it this way. Thanks, Steve