From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADD6E606A31A for ; Wed, 2 Dec 2026 11:49:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=bii0NukP; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=HlK/iCFz DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=/mlRp0x4Nv/gTV4EnNeKr6RoKg1t/SDB6BDr6uhexdc=; b=bii0NukPHfS8Xo 60oiM5Z7sxxOop5LrYb/0TYTMHuwehfXlAs/EepMkY6slm2pE33czp8ryJiMP1TPzQkxt8tSliQBw ENrPOUtNX4jqAjJhfmGlWo1yzJh2pcirqsWGE5TtnCc7KTEuF0ji0s5kKdYUCDDn6SL4RK867ohv+ vPgHmuWqPPql6y1skbpWagUqtoaWs8Bf+dg/7Ga4FycwnUxxpxTr+67jns37HsrI0m7GNf3Rns8M3 pKs0sTjZsIDNiS9g2cegI6DivniOlV3aNwjHWjCuN/NGdQR7Rhyui5lV8Z7NxoEZvyclfsMpwpO2o yetvoOm8gh0rmsr0G0yg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYiqE-0000000BMEq-0ZlW; Wed, 02 Dec 2026 11:49:42 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYiqA-0000000BMDW-3JyQ for linux-arm-kernel@lists.infradead.org; Wed, 02 Dec 2026 11:49:39 +0000 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-Archived-By: 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261202_034938_884965_6D6E2445 X-CRM114-Status: GOOD ( 13.52 ) X-Spam-Score: -4.4 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-7.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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