Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5582662rwl; Tue, 4 Apr 2023 00:05:30 -0700 (PDT) X-Google-Smtp-Source: AKy350Z6IZ/TcLo9NoX24uOH/W+tgq3JnRhJZt3OjcJmGtx7egU5MPyujJb/Ao9+HAAwdrBcTDFy X-Received: by 2002:a17:90b:1c05:b0:23b:3641:cf16 with SMTP id oc5-20020a17090b1c0500b0023b3641cf16mr1632881pjb.11.1680591929927; Tue, 04 Apr 2023 00:05:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680591929; cv=none; d=google.com; s=arc-20160816; b=AdLNWo3pd3mpeMgx1siXvrzJEe6+wBAYi+bAv/uQfuNdowa60ePgU4UJeLPVUBAb0J fswZv0rRcoLA0bSF/RMyaZ8D0xCGs5IMx61ou5tC3AWELxaqzu+yFbXbvrk4rKJlOK2R wVuPxZUuHlDKkfvf1lbXUEkT7tXfAn1NyzEjVjqWHzcYawIJxHFFH755WpFtg3d27gdL p0XBDSKnpaAPmEsCRkXOH1LZYAZVjquvPZlnH0ehnEfbG5gGWeVEdEFOHHNwz/G0334B grskadrhDw/0oOzk6LtZYjVBUJvyY4sbR6aYjw8Q2pI7LEueyXwrLyMncu8lJRSEw1Fc yrmg== 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=v2dI6spERPfx16kbV0WCle0Vb2RxqTCiGpZk4D85fwE=; b=qDyDkKt2QaTl2Tv8b6T61meuX+SS306GENtBEnjQEGOufQ9V5ThXjM5rPOzR8NFZ4r z/e5eRyzs8sJjZnYbPNW6uCfNINPCl0iiJDl92GMZ3e+untRzObwXUR0gdcyu3SwwqsQ Y+ir/stRXQAYgBexIutcCdnQ3QmtxcJT6HQdqrUDlXgt/H11DzgBoHhCUT/CKiu5Qlmi txR1xkviDQ81FHlMghPa8+DPOTrS70yX5C/IsJb3VQtdRayYjyYiw8Bj5Bo5JpeFx3GX +HsZTh25whVpeDxbDoNNRN3VirqAHuWfDpQzZQuG4IxnhsuUWitrPSmCtfyFg9l/6pt8 2P8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=pQZrdfZq; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lj3-20020a17090b344300b0023d4a3bec5asi14058714pjb.87.2023.04.04.00.05.17; Tue, 04 Apr 2023 00:05:29 -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=@microchip.com header.s=mchp header.b=pQZrdfZq; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233699AbjDDHAM (ORCPT + 99 others); Tue, 4 Apr 2023 03:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbjDDHAK (ORCPT ); Tue, 4 Apr 2023 03:00:10 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E98E10CF; Tue, 4 Apr 2023 00:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1680591608; x=1712127608; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Ld2eaAkEDBJ1cLPyuEHukq8mrhlyAnJBQuxn65rZM0s=; b=pQZrdfZqv57+9W5Yui8+5aBifmY3RxuabM/uGmKn7SSvYHOY70VHjqWG miMi5EqKJvHooM9dAijbr8EMSWcy9S42/0I0sC8zWPFSU4nJmaKGmrh38 lF+bg9he40UHofJJfVMOSkjvCG2YvNzH35aVnTzwYWgVe81CO4dwyyJZR 7XKOLYLJ5fl1ExtJHxlfdNuz56mlJQAbAqQNfK+ijX6r4FIddKHCGjJb2 jYwjh/hYhnGLcORMW1/9qlHUH00RYvtnW7ejtuT2+JhBpuj2Hk44xD0w8 aJK8g/nFMV4OvhmP7gyJVr4P7YrknQcm+A9j2z8gWqcy3EfR+9k6MyYf1 g==; X-IronPort-AV: E=Sophos;i="5.98,317,1673938800"; d="asc'?scan'208";a="207617530" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Apr 2023 00:00:07 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 4 Apr 2023 00:00:06 -0700 Received: from wendy (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Tue, 4 Apr 2023 00:00:03 -0700 Date: Tue, 4 Apr 2023 07:59:49 +0100 From: Conor Dooley To: Arnd Bergmann CC: Christoph Hellwig , Prabhakar , Geert Uytterhoeven , Heiko =?iso-8859-1?Q?St=FCbner?= , guoren , Andrew Jones , Paul Walmsley , Palmer Dabbelt , Albert Ou , Samuel Holland , , Rob Herring , Krzysztof Kozlowski , , , Linux-Renesas , Biju Das , "Lad, Prabhakar" Subject: Re: [PATCH v7 1/6] riscv: mm: dma-noncoherent: Switch using function pointers for cache management Message-ID: <20230404-5cd527745ab99524c5dde42c@wendy> References: <20230330204217.47666-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20230330204217.47666-2-prabhakar.mahadev-lad.rj@bp.renesas.com> <377d2841-18b5-4f61-b675-3a7c2e0db3b2@app.fastmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ZREIQbKvtp6hD4WG" Content-Disposition: inline In-Reply-To: <377d2841-18b5-4f61-b675-3a7c2e0db3b2@app.fastmail.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 --ZREIQbKvtp6hD4WG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 04, 2023 at 08:50:16AM +0200, Arnd Bergmann wrote: > On Tue, Apr 4, 2023, at 07:29, Christoph Hellwig wrote: > > On Thu, Mar 30, 2023 at 09:42:12PM +0100, Prabhakar wrote: > >> From: Lad Prabhakar > >>=20 > >> Currently, selecting which CMOs to use on a given platform is done usi= ng > >> and ALTERNATIVE_X() macro. This was manageable when there were just two > >> CMO implementations, but now that there are more and more platforms co= ming > >> needing custom CMOs, the use of the ALTERNATIVE_X() macro is unmanagea= ble. > >>=20 > >> To avoid such issues this patch switches to use of function pointers > >> instead of ALTERNATIVE_X() macro for cache management (the only drawba= ck > >> being performance over the previous approach). > >>=20 > >> void (*clean_range)(unsigned long addr, unsigned long size); > >> void (*inv_range)(unsigned long addr, unsigned long size); > >> void (*flush_range)(unsigned long addr, unsigned long size); > >>=20 > > > > NAK. Function pointers for somthing high performance as cache > > maintainance is a complete no-go. >=20 > As we already discussed, this is now planned to use a direct > branch to the zicbom version when the function pointer is NULL, > which should be a fast predicted branch on all standard implementations > and only be slow on the nonstandard ones, which I think is a reasonable > compromise. >=20 > I'm also not sure I'd actually consider this a fast path, since > there is already a significant cost in accessing the invalidated > cache lines afterwards, which is likely going to be much higher than > the cost of an indirect branch. >=20 > I suppose an alternative would be to use the linux/static_call.h > infrastructure to avoid the overhead of indirect branches altogether. > Right now, this has no riscv specific implementation though, so > using it just turns into a regular indirect branch until someone > implements static_call. Someone actually posted an implementation for that the other day: https://patchwork.kernel.org/project/linux-riscv/patch/tencent_A8A256967B65= 4625AEE1DB222514B0613B07@qq.com/ I haven't looked at it at all, other than noticing the build issues outside of for !rv64 || !mmu, so I have no idea what state it is actually in. --ZREIQbKvtp6hD4WG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZCvK5QAKCRB4tDGHoIJi 0u41AQC5LlNjFCo7KuWt5ZFwh4+c+I5y0gSMhl//kBtKQMsMKgD+NN9jEGHmflZR INGsvjP7dlUKwSSpdNO7N3SeKqmFVwo= =rvG3 -----END PGP SIGNATURE----- --ZREIQbKvtp6hD4WG--