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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 9311DC433F5 for ; Wed, 4 May 2022 08:06:38 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.320424.541137 (Exim 4.92) (envelope-from ) id 1nmA1e-0000WB-Cf; Wed, 04 May 2022 08:06:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 320424.541137; Wed, 04 May 2022 08:06:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nmA1e-0000W4-7K; Wed, 04 May 2022 08:06:22 +0000 Received: by outflank-mailman (input) for mailman id 320424; Wed, 04 May 2022 08:06:20 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nmA1c-0000Vx-SM for xen-devel@lists.xenproject.org; Wed, 04 May 2022 08:06:20 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nmA1c-0008Bf-IZ; Wed, 04 May 2022 08:06:20 +0000 Received: from [54.239.6.185] (helo=[192.168.21.29]) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nmA1c-0000pX-Cc; Wed, 04 May 2022 08:06:20 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID; bh=fFRfu8WinN2af30yWVR7eQyalk7y8rMLkiOOZFNQqFw=; b=Mvuqq12UMZAEiZAQqgk5PjMOGK Wkx92OntMK5kOg9bwOGB+0h1GP6qlE52kGmrMA+Vsmtu4/WLMT7ukMMcfdC6eQHFUHXYNtx6dcmy9 fS/LfHEV9eI9BKefLHhX2lDR8ZrDfPgp9mWrM4lf7+FgkSHkfol0JC9r2EsovItSwqwE=; Message-ID: Date: Wed, 4 May 2022 09:06:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH 3/3] xen/arm: Add sb instruction support To: Bertrand Marquis Cc: "xen-devel@lists.xenproject.org" , Stefano Stabellini , Volodymyr Babchuk References: <24fd2364294345f103cb13bdab2ad0b706681071.1651570561.git.bertrand.marquis@arm.com> <6571ead7-ff94-acb5-1e55-53ae69944bf0@xen.org> From: Julien Grall In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 04/05/2022 08:24, Bertrand Marquis wrote: > Hi Julien, Hi Bertrand, > >> On 3 May 2022, at 19:47, Julien Grall wrote: >>> A new cpuerrata capability is introduced to enable the alternative >> >> 'sb' is definitely not an erratum. Errata are for stuff that are meant to be specific to one (or multiple) CPU and they are not part of the architecture. >> >> This is the first time we introduce a feature in Xen. So we need to add a new array in cpufeature.c that will cover 'SB' for now. In future we could add feature like pointer auth, LSE atomics... > > I am not quite sure why you would want to do that. > > Using the sb instruction is definitely something to do to solve erratas, if a CPU is not impacted by those erratas, why would you want to use this ? I agree that SB is used to solve errata but the instruction itself is not a workaround (it may be part of it though). Instead, this is a more efficient way to prevent speculation and will replace dsb/isb. Speculation is never going to disappear from processor. So, in the future, there might be valid reason for us to say "We don't want the processor to speculate". This would mean using SB. >>> + .inst 0xd50330ff >>> + nop >> >> Why do we need the NOP? > > Alternative requires both sides to have the same size hence the nop to have 2 instructions as in the if. A few years ago we backported a patch from Linux to automatically add nop. However, looking at the code, this would not handle this Cheers, -- Julien Grall