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 1B569E8FDC3 for ; Thu, 5 Oct 2023 09:40:14 +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=g6mgGYpNxD549AhCE98cRFlAsz6qdG2F3H0FIObUfwc=; b=R1Ar0NxFj5+fPa nxsL9r+ug6pMldoGZKgfMtCgoRksBXPMo6JnIyAEhDrO541CJziuQScj4rwMXZ/pkJDHsnu9/bqlk Oifds+xUdNGL3PbT9EM/8uXpnjtjhqyHELCaQbL2uiAVkYZxVnrS3mDvowfhyZtx+hAN1vAYPITVV uryx1PSLIbpjqbF+OrUzT+XrRqfTnBIlpdqUh1anvaxsnMKx8vy73vcRDH2WRykM9NwP6b/3AAO6i WzPzj2T+j1V/XdpLpx33R/xiAuBpXBlDzUjLUAOqhHvvsAGSHm3mPY2Lh5reXthEXskdh3LMnEYAn bbKzxQC3PFC9Sg50gx6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qoKpY-001mcj-3B; Thu, 05 Oct 2023 09:39:40 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qoKpU-001mcG-1p for linux-arm-kernel@lists.infradead.org; Thu, 05 Oct 2023 09:39:40 +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 49C80152B; Thu, 5 Oct 2023 02:40:09 -0700 (PDT) Received: from [10.57.2.226] (unknown [10.57.2.226]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 830493F5A1; Thu, 5 Oct 2023 02:39:28 -0700 (PDT) Message-ID: <5f9f772e-b4a6-31ae-d24a-c0f1869af631@arm.com> Date: Thu, 5 Oct 2023 10:39:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH 05/37] arm64: Add cpus_have_final_boot_cap() To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, ardb@kernel.org, bertrand.marquis@arm.com, boris.ostrovsky@oracle.com, broonie@kernel.org, catalin.marinas@arm.com, daniel.lezcano@linaro.org, james.morse@arm.com, jgross@suse.com, maz@kernel.org, oliver.upton@linux.dev, pcc@google.com, sstabellini@kernel.org, tglx@linutronix.de, vladimir.murzin@arm.com, will@kernel.org References: <20230919092850.1940729-1-mark.rutland@arm.com> <20230919092850.1940729-6-mark.rutland@arm.com> <55c9f428-b715-a2ae-5b89-d125a0104ea3@arm.com> From: Suzuki K Poulose In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231005_023938_372359_317ED349 X-CRM114-Status: GOOD ( 18.17 ) 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 05/10/2023 10:23, Mark Rutland wrote: > On Fri, Sep 22, 2023 at 11:26:21AM +0100, Suzuki K Poulose wrote: >> On 21/09/2023 17:36, Mark Rutland wrote: >>> On Thu, Sep 21, 2023 at 10:13:31AM +0100, Suzuki K Poulose wrote: >>>> On 19/09/2023 10:28, Mark Rutland wrote: > >>>>> /* >>>>> * Test for a capability without a runtime check. >>>>> * >>>>> - * Before capabilities are finalized, this will BUG(). >>>>> - * After capabilities are finalized, this is patched to avoid a runtime check. >>>>> + * Before boot capabilities are finalized, this will BUG(). >>>>> + * After boot capabilities are finalized, this is patched to avoid a runtime >>>>> + * check. >>>>> + * >>>>> + * @num must be a compile-time constant. >>>>> + */ >>>>> +static __always_inline bool cpus_have_final_boot_cap(int num) >>>>> +{ >>>>> + if (boot_capabilities_finalized()) >>>> >>>> Does this need to make sure the cap is really a "BOOT" cap ? It is a bit of >>>> an overkill, but prevents users from incorrectly assuming the cap is >>>> finalised ? >>> >>> Do you have an idea in mind for how to do that? >>> >>> I had also wanted that, but we don't have the information available when >>> compiling the callsites today since that's determined by the >>> arm64_cpu_capabilities::type flags. >> >>> We could us an alternative callback for boot_capabilities_finalized() that >>> goes and checks the arm64_cpu_capabilities::type flags, but that doesn't seem >>> very nice. >>> >> Thats what I had initially in mind, and is why I called it an >> overkill. >> >> But may be another option is to have a different alternative construct >> for all capabilities, which defaults to BUG() and then patched to >> "false" or "true" based on the real status ? This may be more >> complicated. >> >>> Otherwise, given this only has a few users, I could have those directly use: >>> >>> BUG_ON(!boot_capabilities_finalized()); >>> >>> ... and remove cpus_have_final_boot_cap() for now? >> >> I don't think that is necessary. We could keep your patch >> as is, if we can't verify the boot capability easily. > > I had a go at reworking this to automatically do the right thing, and it needs > a more substantial rework of the way we handle the cpucap bitmaps and walk over > the capability structures. > > Given that, I'd like to leave this as-is for now, and follow up with the rework > for that. Sure, I understand and this is fine by me. Suzuki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel