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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95EAFC77B60 for ; Tue, 4 Apr 2023 15:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235941AbjDDPmk (ORCPT ); Tue, 4 Apr 2023 11:42:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235404AbjDDPmi (ORCPT ); Tue, 4 Apr 2023 11:42:38 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5481D4687; Tue, 4 Apr 2023 08:42:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=booTjXEjDItMr83/eVTfoDxuM3Rup1He0ErLuQdXd0Q=; b=OzxbHVtyfERSnBcrsPOVWl5N74 Wwjt4FFnh4JL6wj151vcbY8Ho3YWAWJmTY6uBMrEgRtcKeCF8r/WsbIGbNJktlDNxLc7QgJvQzT7d slGICmuquA4zKFpITpkzSJJCRMA2AK86yE7PBeajq9NP2lbyykUECAdvP9xA8kf6EMBpu+234Rg01 ctn8sDyiKq4TvMXuzbc/GTSOoNwnnTC+sNQIoQKC6sDM9bLksyTEzubF/MQbdYx/bykf8T1zjKG9t d4rVicC0bmCCQjeyxb5B/JrlCbErkI74h4UdE9tb4p5kAT+STXHwmO2jG1Jfs74FkQi7chhw87d/H qWGoE7Hw==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pjinR-0022mB-2C; Tue, 04 Apr 2023 15:42:09 +0000 Date: Tue, 4 Apr 2023 08:42:09 -0700 From: Christoph Hellwig To: Biju Das Cc: Christoph Hellwig , Prabhakar , "devicetree@vger.kernel.org" , Albert Ou , Arnd Bergmann , Geert Uytterhoeven , Samuel Holland , Heiko Stuebner , "linux-kernel@vger.kernel.org" , Prabhakar Mahadev Lad , "linux-renesas-soc@vger.kernel.org" , Conor Dooley , Rob Herring , Guo Ren , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , "linux-riscv@lists.infradead.org" , Andrew Jones Subject: Re: [PATCH v7 1/6] riscv: mm: dma-noncoherent: Switch using function pointers for cache management Message-ID: References: <20230330204217.47666-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20230330204217.47666-2-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Tue, Apr 04, 2023 at 06:24:16AM +0000, Biju Das wrote: > Just a question, how does function pointer makes a performance difference compared to > ALTERNATIVE_X() macros? > > On both cases, we are pushing function parameters to stack, jumping to the actual routine > And then on return pop the variables from stack. Am I missing something here? Indirect calls have always been more expensive, and with the hard- and software mitigations for spectre-like attacks they are becoming even more expensive. But other other point is adding more cache flushing variants should not be easy. Everyone should be using the standardize version. If it's not implemented in hardware despite having ratified extensions you can fake it up in SBI. Yes, that's way more expensive than indirect calls, but that's what you get for taping out new hardware that ignores the actual architecture specification and just does their own made up shit.