From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 26BA5C433F5 for ; Tue, 21 Dec 2021 11:32:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qXeTjp/d8Xhi+hycGU2E6JZo01ozdlmbn7CRnrieGi8=; b=hG4YCg/cDz86H1 8WQzueHVnYT0nTU3qJxVhPxqd3KY4lguTslN5aWT31rzh8hvMclzumKmnMcvoEaKQ+rteOMmlW9PB L1AaBhIPBtRhW/uXzR86GCbOX4hAsR02dB0T6qjAl7fDDy8iEbZDTKwf8sqZ5voJdv01v8mk5apaM wtCFkyz5YIAAQ4yu7QD2LekZ2Dv5bgUSWwTUhssrgz5w7LvfkU0VD6LqUlUWIM3DUHUsmFkAXTWLC CpvXl9h6VHS4H1vlmrkoJXsENIORFMJTr4IUsY5JJItfRstdjxRc/VAIOw3LM1GqCsBdOoB9O9v3C bi0/LoRB1n+Y3FLqML6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzdM9-006b3e-Rd; Tue, 21 Dec 2021 11:30:57 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzdM6-006b3D-Ra for linux-arm-kernel@lists.infradead.org; Tue, 21 Dec 2021 11:30:56 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8BF3261532; Tue, 21 Dec 2021 11:30:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2EBDC36AE8; Tue, 21 Dec 2021 11:30:50 +0000 (UTC) Date: Tue, 21 Dec 2021 11:30:47 +0000 From: Catalin Marinas To: D Scott Phillips Cc: linux-arm-kernel@lists.infradead.org, Marc Zyngier , Will Deacon , Darren Hart , patches@amperecomputing.com Subject: Re: [PATCH v5] arm64: errata: Fix exec handling in erratum 1418040 workaround Message-ID: References: <20211220234114.3926-1-scott@os.amperecomputing.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211220234114.3926-1-scott@os.amperecomputing.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211221_033054_979425_BF7567E1 X-CRM114-Status: GOOD ( 16.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Dec 20, 2021 at 03:41:14PM -0800, D Scott Phillips wrote: > The erratum 1418040 workaround enables CNTVCT_EL1 access trapping in EL0 > when executing compat threads. The workaround is applied when switching > between tasks, but the need for the workaround could also change at an > exec(), when a non-compat task execs a compat binary or vice versa. Apply > the workaround in arch_setup_new_exec(). > > This leaves a small window of time between SET_PERSONALITY and > arch_setup_new_exec where preemption could occur and confuse the old > workaround logic that compares TIF_32BIT between prev and next. Instead, we > can just read cntkctl to make sure it's in the state that the next task > needs. I measured cntkctl read time to be about the same as a mov from a > general-purpose register on N1. Update the workaround logic to examine the > current value of cntkctl instead of the previous task's compat state. The patch looks fine to me but I was wondering what the cost of writing CNTKCTL_EL1 is, compared to a read. If it turns out to be negligible, we can simplify this patch further ;). -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel