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 7320BC4321E for ; Thu, 17 Nov 2022 10:37:44 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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-Owner; bh=y6/DtqcUj41Ofe8aIzIju/k2+qUHwbKPuClVBDt0rQA=; b=pMFAa35ucL3wsu AaQSocHsttwVisaDevzGCCKqEmejfa3UluQ5nYzg2T6Wr7iwL6EB4EtEkHrzSZe4iG2ErHwam5qd2 7txAlEAlfbKncVwyAzgLHnojSrbHlnjTsAYT4nWfioitwVaY/5/xxY5n/Mce73nkj+3+aN6QjqXF9 NMhKAULrgLMtu5NEZRKNVQqpnHW1UZtB+gubl0ycuyXgIJmGFutTP/91+//B8OnSLWRk2jrjd2o4c CS4+vgfvF8Rj9VaWx/HvgIkewqBFqhF1MM6bbDE4D4IOr+zsVf3NyO3P9hONDEgD0hMTEq1Aey3c9 woCbyviX0RRRU2cy9f+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovcFw-00CdfK-MA; Thu, 17 Nov 2022 10:36:29 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovc0A-00CUdk-UZ for linux-arm-kernel@lists.infradead.org; Thu, 17 Nov 2022 10:20:12 +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 08F7513D5; Thu, 17 Nov 2022 02:20:10 -0800 (PST) Received: from [10.162.42.95] (unknown [10.162.42.95]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 61EB63F73B; Thu, 17 Nov 2022 02:20:02 -0800 (PST) Message-ID: Date: Thu, 17 Nov 2022 15:49:59 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH 7/8] ARM: Add hwcap for Speculation Barrier(SB) Content-Language: en-US To: Linus Walleij Cc: Russell King , patches@armlinux.org.uk, linux-arm-kernel@lists.infradead.org References: <20221026055001.12986-1-amit.kachhap@arm.com> <20221026055001.12986-8-amit.kachhap@arm.com> From: Amit Daniel Kachhap In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_022011_092830_1C2A7076 X-CRM114-Status: GOOD ( 22.84 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 11/16/22 19:36, Linus Walleij wrote: > On Wed, Oct 26, 2022 at 7:53 AM Amit Daniel Kachhap > wrote: > >> Speculation Barrier(FEAT_SB) is a feature present in AArch32 state for >> Armv8 and is represented by ISAR6.SB identification register. >> >> This feature denotes the presence of SB instruction and hence adding a >> hwcap will enable the userspace to check it before trying to use this >> instruction. >> >> This commit adds the ID feature bit detection, and uses elf_hwcap2 >> accordingly. >> >> Signed-off-by: Amit Daniel Kachhap > > The patch is fine, the following is a question. > > I see that the aarch64 kernel is using this instruction in the kernel > for speculation barriers, and after this the aarch32 userspace can > use it too. > > Does it make sense to ask the question whether this could be > compiled into and used by a aarch32 kernel, provided it is > configured for a core known to support it? (This is assuming that > the compiler also knows about it.) I think you have a valid point to use sb in the kernel also. Besides the compiler support, aarch32 kernel might need feature based dynamic instruction patching framework like aarch64. So as you said it is too much to do here. Thanks, Amit Daniel > > I'm asking because speculation barriers is something we have a > lot of due to the constant security problems so it might be something > handy to have in the toolbox. > > It might be just adding too much complexity... I know. > > Yours, > Linus Walleij _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel