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 EC63B606A332 for ; Thu, 3 Dec 2026 15:36:18 +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=NjIoqjgx; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=MHnTg+tm 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=JWwfqHIf/dG2me4KYl+FvdQpEzpO1AxoxOiGpvHsc9A=; b=NjIoqjgxO91OOL SCgW0dq4znkY5wtFhTjgnTQ7G7j8RjCaPemyPupfkQ0kR5PQIpRF0MYpWxvHTnwWlO15Bt3OeBUR9 A3/Xzo/qGCsggD9KFbZMfMD40gpYJ8Sv2sCMFsCpJcitYmy/EVOklVNxWRutHpsL500w83juFlawW 3R4nP9c0ECQNO9erbV/2P1L/BrZswM75fxBtQuYllAy7F2nyyax0md/VKR5ceOU50vzfYM14rDHx/ QqqKPLcy6RujaRyQ1jPRUOHPCOQC9ymN6VCJ1uSF1f8bAf2yN9FvPUyp1F7NlQBXe3EiwHQEpG0iO KijbFuSIuPV2uIbYi2bA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ8qv-0000000FA1k-3you; Thu, 03 Dec 2026 15:36:12 +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 1xZ8qt-0000000FA1K-1M42 for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2026 15:36:08 +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 6E6D7497; Thu, 3 Dec 2026 07:36:03 -0800 (PST) Received: from [10.0.154.42] (e121487-lin.cambridge.arm.com [10.0.154.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 243F23F7D8; Thu, 3 Dec 2026 07:36:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796312166; bh=/7J3ggOGnxeFsRZC5UeR+MBoAScVXhezmO1PH/c7RXI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=MHnTg+tm5rJO1/irVLGWMMkxkUS02/t0FtsnIkjAvk8/Axv7xpRzoL7EPP89KQnLO c7LlCNCXKwSzR4cjMxFuTSNMs6RS+G8yjk2XyOuHZCtns4PuFjQQwaT+HOuCZlXHVC D8A481iVvk0w0M+mb3XzhCDOq9+tDxZ649RfXZBE= Message-ID: <590fd07e-e1c0-4988-9171-83edf2b08e72@arm.com> Date: Thu, 3 Dec 2026 15:36:02 +0000 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 14/44] arm64: replace local_daif helpers To: Ashok Raj Cc: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, lpieralisi@kernel.org, ruanjinjie@huawei.com, liaochang1@huawei.com, maz@kernel.org, kas@kernel.org References: <20261130155506.118408-1-vladimir.murzin@arm.com> <20261130155506.118408-15-vladimir.murzin@arm.com> Content-Language: en-GB From: Vladimir Murzin In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261203_073607_404825_D32EAF72 X-CRM114-Status: GOOD ( 13.29 ) 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=-12.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 12/2/26 21:31, Ashok Raj wrote: >> int __kvm_vcpu_run(struct kvm_vcpu *vcpu) >> { >> + arm64_exc_hwstates_t hwstate; >> int ret; >> >> - local_daif_mask(); >> + hwstate = local_exceptions_save_mask(CRITICAL_CONTEXT); >> >> /* >> * Having IRQs masked via PMR when entering the guest means the GIC >> @@ -683,18 +685,18 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu) >> * only way to get out will be via guest exceptions. >> * Naturally, we want to avoid this. >> * >> - * local_daif_mask() already sets GIC_PRIO_PSR_I_SET, we just need a >> - * dsb to ensure the redistributor is forwards EL2 IRQs to the CPU. >> + * local_exceptions_save_mask(), via helpers, sets >> + * GIC_PRIO_IRQON along with pmr_sync(), so we can be sure >> + * that redistributor forwards EL2 IRQs to the CPU. >> */ >> - pmr_sync(); > The comment seems to imply that the helper always sets PMR is IRQON, rather > than implying that it always writes PMR and executes pmr_sync()? > > The comment seems to imply the helper is always setting PMR is IRQON > But local_exceptions_save_mask() seems to pass force=false when the current PMR > already matches the target; __arm64_update_exc_hwstate() and skips > the PMR write and pmr_sync(). ? > Perhaps whole comment block need to be taking into context: * "Having IRQs masked via PMR" implies PMR state is GIC_PRIO_IRQON * "Naturally, we want to avoid this" * "local_exceptions_save_mask(), via helpers, sets GIC_PRIO_IRQON" * that implies that force flag in local_exceptions_save_mask() is true * To make sure it propagates to distributor we need pmr_sync(), yet... * ... __arm64_update_exc_hwstate() would already do pmr_sync() since PMR is GIC_PRIO_IRQON and force is true * Thus we do not need explicit pmr_sync() * Note that local_daif_mask() even has comment saying that it doesn't do synchronisation, that's the reason old code has to do it explicitly. Does is make it clear? Anything I can do to improve comment? Thanks Vladimir > Cheers, > Ashok >