Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp966514rwl; Fri, 24 Mar 2023 04:38:53 -0700 (PDT) X-Google-Smtp-Source: AKy350YO+xND5V0xo9wy7Ji2vOhVA6+ZmGVmK3Z9dMcmTIm40St8iqbl2CBg7tZQAfw5EH0D8K12 X-Received: by 2002:a17:906:39d3:b0:931:86cf:9556 with SMTP id i19-20020a17090639d300b0093186cf9556mr3471186eje.23.1679657933599; Fri, 24 Mar 2023 04:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679657933; cv=none; d=google.com; s=arc-20160816; b=Q92hXpiSBjG5NQcMmO10dOnfpQe3bOtlIcV5X+n4pZZp3otQgdJCIBoJrVDuHYnqeO FcNogS6zNjOH2h2dH+8NdppFW+wohmI3/TLiM57Ni0zoseQLGBWbr9D+Xz7rPs/WJqFJ CdFB7EC9bd12J9TVYrGqk2wbcLz/gsxJR1ZcXRGEyDxENLrwbVotUrkPGNijywkxyvos xKXKq5j2vfjb3KA0Fc19pfwPsDbMBSqA/YqIxH7q+F2o/tMZYm8tXC4w5OHVloWjOkbM KcpjVXajGPqvB4WNXJOwW8FVhb5TwtiEn0gMFOMQkJ3bU/+kckrw0jcqzD/MrUpeuEn3 Bj7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3f6o0AI12RH51u4tiMa8ok8ddso/WpX9mlrkI0ZUu0w=; b=wlPDSw7JodbmaCksiOjnqtLAE4X4uWfJ99PK6t2q0sJD/sIglFytSYtii2YWX0Q5C2 F3n7LkVBDtmBjT2gwxXEKzVLJYqx/HYh2cW4mGDQBGiFxn/TAyymD4G1oWYiOnakSNW0 U2Kc29j31HsnjPDqaSPBP/nYS+HjMjZyfT9xEoYWu0f7fOUP4rdd6fP8WJTKzjiW5qZi oRDMc7oAplrmw8IyWNjj719Z6oRaY6Zl6yM5y71ceY2yj/jPC+JW9Q21gCrGbv7FQlqt 4sd6ilJA9mt247gJWcptlZEsoeP3Z9EnMwvWCZj6AE87HBCTbhapvcF+SPjrHLQ3q218 pVTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="P7MGoAM/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x4-20020a170906710400b009217e23a19esi22174525ejj.599.2023.03.24.04.38.28; Fri, 24 Mar 2023 04:38:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="P7MGoAM/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231436AbjCXLbm (ORCPT + 99 others); Fri, 24 Mar 2023 07:31:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230418AbjCXLbk (ORCPT ); Fri, 24 Mar 2023 07:31:40 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB0411C7CF for ; Fri, 24 Mar 2023 04:31:13 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id o32so963061wms.1 for ; Fri, 24 Mar 2023 04:31:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1679657468; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3f6o0AI12RH51u4tiMa8ok8ddso/WpX9mlrkI0ZUu0w=; b=P7MGoAM/2B0An/hP4AHitapxcPDSq7vRUPNE7aa6gf7AlO5KgYVw+iE5cDl0nuxNSo bIuB51BQrVxtU2a4mNCgfg83mSVWjTaQ77YrAXbp0XAxUVYmw13/gTqJHrXjeLULyhMr VwkkvDVEuOIwU8zDdX3oArtR1Y2DbHZgol4F7jxOWDpZ7OPqVO1qoJendXyLuRuZWo7B c/tmZmE9sTFrpqbKUaHIFHI/mLLV9MrDxdKglqmSJ/rOXAzucYQ1hNN/PqsGiweulo9T DZcTdkjbBdLZHmRePmljMUiN9NBi3KjAKSx9YJr2TuQqFKCqhTK/ZZV30YBYJJDEj7DU /QiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679657468; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3f6o0AI12RH51u4tiMa8ok8ddso/WpX9mlrkI0ZUu0w=; b=IESD/Xo90k3vk02ZcGUTRV+OXXHHxZYI6TrWAEqzMtMIjXADCaRVPm0yeX+1PMVtsM 8Y0oQwAtpSOnUjZj3WXKpWTNv/ZDWuvp9C52oSILd3BIbKbLCTX6GT/JwU7l7wbwhwXk Lmm9c5Fp/H12iKT8BbJofuDAIl8wQ/zutAWyrE32UaOeXDZmpv8/7c5Yi66dspL6W6eF jdPNHHNo/vu+7HCZR8M7d0bg/tzBqKFjXQP2iAe5sMNaOaw7OwqJ92shGz43DtDh16uX sIPxZNAkcm4c7PWAr3H5J7Vi6XlD+E+q3TVGKDXPMa7VLi47aBY9n9C1KR9pm6M6muxX biXA== X-Gm-Message-State: AO0yUKXrx5cPTs8/W74RWrx3erORNtC6cofnbfjc06FNf1XrVMEaDwNn Ui6FojPRjBqdSYS//s5qUGPWkw== X-Received: by 2002:a7b:cb90:0:b0:3dc:4b87:a570 with SMTP id m16-20020a7bcb90000000b003dc4b87a570mr2381902wmi.35.1679657468483; Fri, 24 Mar 2023 04:31:08 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id f24-20020a7bc8d8000000b003eb596cbc54sm4724396wml.0.2023.03.24.04.31.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 04:31:08 -0700 (PDT) Date: Fri, 24 Mar 2023 12:31:07 +0100 From: Andrew Jones To: Conor Dooley Cc: palmer@dabbelt.com, conor@kernel.org, Paul Walmsley , Heiko Stuebner , Anup Patel , Jisheng Zhang , "Jason A . Donenfeld" , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency Message-ID: <20230324113107.djp4ejnlpzn3qzrb@orel> References: <20230324100538.3514663-1-conor.dooley@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230324100538.3514663-1-conor.dooley@microchip.com> X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 24, 2023 at 10:05:37AM +0000, Conor Dooley wrote: > Here's my attempt at fixing both the use of an FPU on XIP kernels and > the issue that Jason ran into where CONFIG_FPU, which needs the > alternatives frame work for has_fpu() checks, could be enabled without > the alternatives actually being present. > > For the former, a "slow" fallback that does not use alternatives is > added to riscv_has_extension_[un]likely() that can be used with XIP. > Obviously, we want to make use of Jisheng's alternatives based approach > where possible, so any users of riscv_has_extension_[un]likely() will > want to make sure that they select RISCV_ALTERNATIVE. > If they don't however, they'll hit the fallback path which (should, > sparing a silly mistake from me!) behave in the same way, thus > succeeding silently. Sounds like a > > To prevent "depends on !XIP_KERNEL; select RISCV_ALTERNATIVE" spreading > like the plague through the various places that want to check for the > presence of extensions, and sidestep the potential silent "success" > mentioned above, all users RISCV_ALTERNATIVE are converted from selects > to dependencies, with the option being selected for all !XIP_KERNEL > builds. > > I know that the VDSO was a key place that Jisheng wanted to use the new > helper rather than static branches, and I think the fallback path > should not cause issues there. > > See the thread at [1] for the prior discussion. > > Cheers, > Conor. > > 1 - https://lore.kernel.org/linux-riscv/20230128172856.3814-1-jszhang@kernel.org/T/#m21390d570997145d31dd8bb95002fd61f99c6573 > > CC: Paul Walmsley > CC: Palmer Dabbelt > CC: Conor Dooley > CC: Heiko Stuebner > CC: Andrew Jones > CC: Anup Patel > CC: Jisheng Zhang > CC: Andrew Jones > CC: Jason A. Donenfeld > CC: linux-riscv@lists.infradead.org > CC: linux-kernel@vger.kernel.org > > Conor Dooley (2): > RISC-V: add non-alternative fallback for > riscv_has_extension_[un]likely() > RISC-V: always select RISCV_ALTERNATIVE for non-xip kernels > > arch/riscv/Kconfig | 12 ++++---- > arch/riscv/Kconfig.erratas | 6 ++-- > arch/riscv/include/asm/hwcap.h | 50 ++++++++++++++++++++-------------- > 3 files changed, 38 insertions(+), 30 deletions(-) > > -- > 2.39.2 > LGTM, but if it was based on for-next then it could also immediately be applied to zicboz. For the series, Reviewed-by: Andrew Jones Thanks, drew