Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83E2FC43381 for ; Thu, 28 Mar 2019 11:33:34 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 50D502075E for ; Thu, 28 Mar 2019 11:33:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UgHWYFaE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 50D502075E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject: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=QEHdXn8pxu22QGgD8O4Cb7wTbCtEypDIglAugcULlo8=; b=UgHWYFaEhIbI/E knsjQzKvV1+cy8s2jRrTbjw6IuINHprHQ4Zc6NQENOIm60TOGIPUa1/yO/z78K/OYmeTWdA1/6V7S LZPy7vkJxEApbm2/xHQHkNr4Q0g2vEAintB/9Wwc5HW1B69qNDiAgLUdk7V5iGMg70X1kl5UCzkfQ vgIwfSaFwZchx9GoRUJP6GKUQtRJopMzrIavsYf8dEuHKz64cYDuYUwkojnKOomQu+P60PqQapVwk q4FdyeUvakGC2N94/LEqo94sv6W50ZgnE/Ll/3rNWPDSQKXjvG1p+eFb587SPj1VEaZMPFTaiYGtA Hc0zctHFdkMegRqYtlEA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9THl-000711-Vl; Thu, 28 Mar 2019 11:33:29 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9TGi-0005wy-S4 for linux-arm-kernel@lists.infradead.org; Thu, 28 Mar 2019 11:32:31 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A1A6380D; Thu, 28 Mar 2019 04:32:24 -0700 (PDT) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8F1B83F59C; Thu, 28 Mar 2019 04:32:23 -0700 (PDT) Date: Thu, 28 Mar 2019 11:32:21 +0000 From: Dave Martin To: Andrew Murray Subject: Re: [PATCH v2 3/6] arm64: HWCAP: encapsulate elf_hwcap Message-ID: <20190328113220.GA3567@e103592.cambridge.arm.com> References: <1550751657-30252-1-git-send-email-andrew.murray@arm.com> <1550751657-30252-4-git-send-email-andrew.murray@arm.com> <20190221184506.GP16031@e103592.cambridge.arm.com> <20190327140311.GC43527@e119886-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190327140311.GC43527@e119886-lin.cambridge.arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190328_043225_102090_0BF9A7B2 X-CRM114-Status: GOOD ( 25.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Szabolcs Nagy , Catalin Marinas , Will Deacon , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Mar 27, 2019 at 02:03:11PM +0000, Andrew Murray wrote: > On Thu, Feb 21, 2019 at 06:45:08PM +0000, Dave P Martin wrote: > > On Thu, Feb 21, 2019 at 12:20:54PM +0000, Andrew Murray wrote: > > > The introduction of AT_HWCAP2 introduced accessors which ensure that > > > hwcap features are set and tested appropriately. > > > > > > Let's now mandate access to elf_hwcap via these accessors by making > > > elf_hwcap static within cpufeature.c. > > > > Since elf_hwcap now survives and retains a compatible encoding for > > HWCAP_foo, I'm wondering whether it would be simpler to drop this patch. > > > > Although this will help push people to use the new helpers, the need to > > do that seems reduced now. > > > > People falling off the end of the hwcaps will discover that there is no > > HWCAP_foo for the feature they want, only HWCAP2_foo (but no elf_hwcap2 > > to look for it in), or KERNEL_HWCAP_foo (which should get them > > thinking). > > > > What do you think? > > You're right that people will find the appropiate functions to set the > relevant hwcaps. But I think my motivation for this comes from the > perspective of code maintainability... > > There is absolutely no functional benefit to exposing the elf_hwcap > variable to the rest of the kernel - yet doing so will result in users > using elf_hwcap instead of the helpers. If we later change the type of > elf_hwcap, or split the bits into multiple variables (e.g. elf_hwcap2) or > even change the mapping from UAPI to kernel, then modifications need to be > made at each call site. Whereas if we reduce the visibility of elf_hwcap > then we encapsulate all the bit fiddling in one place. > > Also, taking this approach forces us into this ugly suitation... > > +#ifdef CONFIG_ARM64 > + if (cpu_have_feature_name(EVTSTRM)) > +#else > if (elf_hwcap & HWCAP_EVTSTRM) > +#endif > > It's not nice, but it's a lot less fragile than expecting cross-platform > agreement on the bit value of particular hwcaps. > > Is this a good enough reason to keep it? Yes, I'm happy for us to go forward with your approach here. Although it makes a bit more diff noise now, I agree it's the cleaner option for the future. Cheers ---Dave _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel