Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5046338iob; Mon, 9 May 2022 07:35:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbrmrDuv2MvZIuL0Bbi3YQFIl69T3MUkWqd+olV1JBrBQHFtxDuJKQvguloLUEXgI+3G4O X-Received: by 2002:a65:4007:0:b0:3c6:c6e2:1ccc with SMTP id f7-20020a654007000000b003c6c6e21cccmr3661199pgp.500.1652106918921; Mon, 09 May 2022 07:35:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652106918; cv=none; d=google.com; s=arc-20160816; b=hJgxPRjLW31oa4+/J8ZaHquQbr8PKK8GQTnh8ZsSUgzPOvmzA7Fn8qgBRpA8zW62un cyIYiry2SQYMyTBjahL5P2aEBk72wN/7vT/JRQW8Ck4etI94CvLx9iZ6OOi8CI3ULR8g jPV9HCTgWHHZxEAS+kBvoJPLgbSah7RE4G5I6Yn5wbTxPysixlGnNdoGb6MnwSNXoHfb rwqQeR7AqWgDYqUIFgNJZee9wwZZmHDMO/5aIdgsmZOdGe8e1IyBLq7CIAwvLmVdI0Gq kfaocR1V1Y8w70ksLbRTh2KAFdKC37J9pmU6LgdvXeI5MDMXvHdvETgJRIitV4d5WC8u EF9A== 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=JxWO5ZAfWG1b9Ir0Kan5l8e1N7bA7LtKXbJugSvIxVE=; b=BP45W9K2OlWb6eBFmtS6ovbb/n32xv746o1MrcTbbhCT0UXkT/5e5S3TCWPhiDz3o2 MofFrWecH0BAfaw//7cu+HwRgUFXedwKJTkfASWSV36BFlIVNyFDOlQshzrwqaMDZugi v0uvo7HhVfrJV9wnTkT54PqasaCGYpN0dWsCSos4tJjO+RrJXY7rXpo/9TpBUCINq+EH BeLydUkRieTdC80/JjhbGhJkl2GnEoIB3Oan3uhf3EmuIoJlx8CSiuVi/ZHWqk+8icFI 9UfDdtRe5qWciut4HDy+xbHYhlAeEgF126mQEhw95Cm+E5qeaIf7CYYXI60wfnpUGAT+ nwwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uQMwhwbU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 31-20020a63145f000000b003ab19fb15f1si15948724pgu.382.2022.05.09.07.35.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 07:35:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uQMwhwbU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 302FC2A974F; Mon, 9 May 2022 07:35:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237278AbiEIOiy (ORCPT + 99 others); Mon, 9 May 2022 10:38:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237061AbiEIOix (ORCPT ); Mon, 9 May 2022 10:38:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 186CF2A76B5 for ; Mon, 9 May 2022 07:35:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B3C6F615FA for ; Mon, 9 May 2022 14:34:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43AC8C385AF; Mon, 9 May 2022 14:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652106899; bh=vfDKNwLVPbOGrvBsC/bFHFyH9ByxjZk7Ny2bY3inWbM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uQMwhwbUUnAYDeU++/wgIqkeNZBLHJbf4vMQP3gzxkpB844FBoWNBm7/rABZXhYbb y80q28vwC0lHQsVKNbnuRokPCXjavY1s3HiZRWGfLa9iqs17PEVV4J8svIomw/wlm+ Sq0ef9UE3VvBex/8y+iXuEkyOlM7ebQRcemtcw9krX5jZV11zF8a5T0S/dM2RyAgK4 0ruHLnRwU5TYL7hKuRvGeQkBQmaHSFj+4rNF+RNQh45T4GAOuD8nnKrelvJXHdrLuU MuntnYMOO70yE1B9QhQTsn75W0OfuIC4nsU461yplhBtOmr4MZ64PkiY4oxbrvFiVD Jd10kMiGCcfZA== Date: Mon, 9 May 2022 22:26:20 +0800 From: Jisheng Zhang To: Anup Patel Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Alexandre Ghiti , linux-riscv , "linux-kernel@vger.kernel.org List" , kasan-dev@googlegroups.com Subject: Re: [PATCH v2 0/4] unified way to use static key and optimize pgtable_l4_enabled Message-ID: References: <20220508160749.984-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 Mon, May 09, 2022 at 10:07:16AM +0530, Anup Patel wrote: > On Sun, May 8, 2022 at 9:46 PM Jisheng Zhang wrote: > > > > Currently, riscv has several features which may not be supported on all > > riscv platforms, for example, FPU, SV48, SV57 and so on. To support > > unified kernel Image style, we need to check whether the feature is > > suportted or not. If the check sits at hot code path, then performance > > will be impacted a lot. static key can be used to solve the issue. In > > the past, FPU support has been converted to use static key mechanism. > > I believe we will have similar cases in the future. For example, the > > SV48 support can take advantage of static key[1]. > > > > patch1 is a simple W=1 warning fix. > > patch2 introduces an unified mechanism to use static key for riscv cpu > > features. > > patch3 converts has_cpu() to use the mechanism. > > patch4 uses the mechanism to optimize pgtable_l4|[l5]_enabled. > > > > [1] http://lists.infradead.org/pipermail/linux-riscv/2021-December/011164.html > > Overall, using a script to generate CPU capabilities seems a bit > over-engineered to me. We already have RISC-V ISA extension Not all riscv features are *ISA* extensions. For example, SV48 and SV57 are not ISA extensions. IIRC, I asked this question before, here are Atish's comments: https://lore.kernel.org/linux-riscv/CAHBxVyF65jC_wvxcD6bueqpCY8-Kbahu1yxsSoBmO1s15dGkSQ@mail.gmail.com/ > parsing infrastructure which can be easily extended to support > static key arrays. >