Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10736430rwl; Thu, 12 Jan 2023 01:43:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXsXPQSBg+F1/dhqR/Slucl58eBF7JG0bExZeVKvqFuYDOOn/+2CYJKQceCClo3yA4gc7Se7 X-Received: by 2002:a17:90b:19d2:b0:225:cc25:3947 with SMTP id nm18-20020a17090b19d200b00225cc253947mr6222209pjb.13.1673516609764; Thu, 12 Jan 2023 01:43:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673516609; cv=none; d=google.com; s=arc-20160816; b=PxLp9fha85umhEJH1NPCF3M6E5wZAqs6CFSAg/Ka3BLESdj2rBKYoJMRFNuY9AueLG w4X9OOqbhGKttigs/v8LQ1bNStERninmNmIPeKJ3ClaCoy0tuS+AXC54nJc/f/kk4SSI HNHro+IH113c0zY48/WgkfZwiDpuJxeeajnVD4BSgMiLcORP17lGc5aFg8azTj0Mgzv+ JZAfVQWPqgktM18s4BTriZlnNEsDWdPEFX/S3Nu3h1Cpg9aBtkqsuZ3Qce2CtVzu0pps JI1+2U9XjzV047x/0lVq+9Tt/ZuRmLvK98mS1QAcv3I7SwK/V0vVDFzxxceMWossJ3Ng QTTA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kqb6Iris8XWiiMxft3j9JHa7v06d0Pz4gSRMhwJTQx0=; b=jmBcfllt6P/+61Vc1VtqXMugE40K11j9/i6Z2MYYVqWar48bwlpeEYXjFKPWkpgiTE UZqLiZc5SSB+vHQboli+rpgc+llISnW+UwwnERCS7twyd4aSqc0JgF2hYnMLLZUEaeqU mwCy3t4ZZpRfaKnbtm6me83Ud7j7a6zKo02YWgXXj8Vo/Ee1IRo//XOu+RP338t6OQZc WgW8Xe/RYQzsD/pLbqQ0USUyvrlVrlmQMxln4jqLrvlD3IaDn7aZG7vGKjzEknAd9vOF y08AYLUvCychC91BWwWy6Um8n7P3Y18kOIKdJ0V4edWr3m2rYEZTiKwb2luH+vbGdGLx tsJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="n/F6PNUG"; 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 e5-20020a17090a9a8500b00229125d3a6asi2356pjp.83.2023.01.12.01.43.23; Thu, 12 Jan 2023 01:43:29 -0800 (PST) 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="n/F6PNUG"; 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 S240163AbjALJ3V (ORCPT + 50 others); Thu, 12 Jan 2023 04:29:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239659AbjALJ2t (ORCPT ); Thu, 12 Jan 2023 04:28:49 -0500 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E85654D72F for ; Thu, 12 Jan 2023 01:21:44 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id ss4so35937512ejb.11 for ; Thu, 12 Jan 2023 01:21:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=kqb6Iris8XWiiMxft3j9JHa7v06d0Pz4gSRMhwJTQx0=; b=n/F6PNUGVNPoZrDebVKmVpiZJ+hGLnh9tTOom2GkMxmVqhiyluaHAS2mBeZ+cssrXK bLQjy0nWfHpIxez+jYZWgkjA6OiUnTKL9YEYoI+7cP76G0AvRrsmQ6wjpXoccCUStBP4 0csRTNp5wI1csOg0vSp1k0usXDWeatgNKt9JkZu3PIUlq14P4jCWeYU5bG9GnOsazUu4 QVEtXP5nka4fCPL3IId1dI4rA43UPGnDlpgPPN+StdxX1bn1GEK7MMAof+79Yt3iU1zM jcokevDrio0CVEdvkfLF9M8n9gAW8KKaXiQTLBNrINIAJ4SDfUoH5IwDkpkGi1+jcQP8 ee3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding: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=kqb6Iris8XWiiMxft3j9JHa7v06d0Pz4gSRMhwJTQx0=; b=gBQIS2ASdfV0iE3xyE3HwL66/POOyyYPk6DHiXXpE47LAN2r2rSxWFczoiKaG4Uix4 A2ZdLMgGFOmYhKp7+H7u3HEa/PuQTDhvKRRVsewoyt8dNylEGZvf6Co4Sn6B+Ulb1b0o s8JncHUL40rFxdXdmkUADZswkipl94mImnKuZFqjTIaPptl9BgWg6V9zxC2gXbIBuf+p w8OekWMdsXBZUSuhzf23AxGVtvUyBzQFdQBa9iOgYdLk9aMdy9KX7Y6d2NPnYdPUebyx W+0cc2XAEKwhm8zIPXyqzE3VrpnHNvDauXOU/ZaN8hbWB1YPNoP+MpgOaohNNu4vumzo OXww== X-Gm-Message-State: AFqh2kqemQU6DQjJ8+ureawpV7QfXPkllSmjX8iOvgjfFC5iL5JVec1t Hm7oNW+JFywIs36ySENP8Rv2wA== X-Received: by 2002:a17:906:34db:b0:842:3920:df75 with SMTP id h27-20020a17090634db00b008423920df75mr66807232ejb.33.1673515303467; Thu, 12 Jan 2023 01:21:43 -0800 (PST) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id y16-20020a1709063a9000b0084ce5d5d21bsm7189751ejd.22.2023.01.12.01.21.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 01:21:43 -0800 (PST) Date: Thu, 12 Jan 2023 10:21:36 +0100 From: Andrew Jones To: Heiko =?utf-8?Q?St=C3=BCbner?= Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Atish Patra , Jisheng Zhang , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org Subject: Re: [PATCH v3 05/13] riscv: cpufeature: extend riscv_cpufeature_patch_func to all ISA extensions Message-ID: <20230112092136.f2g43hrhmrqouy4y@orel> References: <20230111171027.2392-1-jszhang@kernel.org> <20230111171027.2392-6-jszhang@kernel.org> <2398293.3Lj2Plt8kZ@diego> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2398293.3Lj2Plt8kZ@diego> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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 Thu, Jan 12, 2023 at 12:29:57AM +0100, Heiko St?bner wrote: > Hi Jisheng. > > Am Mittwoch, 11. Januar 2023, 18:10:19 CET schrieb Jisheng Zhang: > > riscv_cpufeature_patch_func() currently only scans a limited set of > > cpufeatures, explicitly defined with macros. Extend it to probe for all > > ISA extensions. > > > > Signed-off-by: Jisheng Zhang > > Reviewed-by: Andrew Jones > > Reviewed-by: Heiko Stuebner > > --- > > arch/riscv/include/asm/errata_list.h | 9 ++-- > > arch/riscv/kernel/cpufeature.c | 63 ++++------------------------ > > 2 files changed, 11 insertions(+), 61 deletions(-) > > hmmm ... I do see a somewhat big caveat for this. > and would like to take back my Reviewed-by for now > > > With this change we would limit the patchable cpufeatures to actual > riscv extensions. But cpufeatures can also be soft features like > how performant the core handles unaligned accesses. I agree that this needs to be addressed and Jisheng also raised this yesterday here [*]. It seems we need the concept of cpufeatures, which may be extensions or non-extensions. [*] https://lore.kernel.org/all/Y77xyNPNqnFQUqAx@xhacker/ > > See Palmer's series [0]. > > > Also this essentially codifies that each ALTERNATIVE can only ever > be attached to exactly one extension. > > But contrary to vendor-errata, it is very likely that we will need > combinations of different extensions for some alternatives in the future. One possible approach may be to combine extensions/non-extensions at boot time into pseudo-cpufeatures. Then, alternatives can continue attaching to a single "feature". (I'm not saying that's a better approach than the bitmap, I'm just suggesting it as something else to consider.) Thanks, drew > > In my optimization quest, I found that it's actually pretty neat to > convert the errata-id for cpufeatures to a bitfield [1], because then it's > possible to just combine extensions into said bitfield [2]: > > ALTERNATIVE_2("nop", > "j strcmp_zbb_unaligned", 0, CPUFEATURE_ZBB | CPUFEATURE_FAST_UNALIGNED, 0, CONFIG_RISCV_ISA_ZBB, > "j variant_zbb", 0, CPUFEATURE_ZBB, CPUFEATURE_FAST_UNALIGNED, CONFIG_RISCV_ISA_ZBB) > > [the additional field there models a "not" component] > > So I really feel this would limit us quite a bit. > > > Heiko > > > > [0] https://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git/commit/?h=riscv-hwprobe-v1&id=510c491cb9d87dcbdc91c63558dc704968723240 > [1] https://github.com/mmind/linux-riscv/commit/f57a896122ee7e666692079320fc35829434cf96 > [2] https://github.com/mmind/linux-riscv/commit/8cef615dab0c00ad68af2651ee5b93d06be17f27#diff-194cb8a86f9fb9b03683295f21c8f46b456a9f94737f01726ddbcbb9e3aace2cR12 > >