Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp3858058rwb; Sun, 30 Jul 2023 18:21:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlG7iZgYdLDWJaLaaK6DXplRMH7oOama0lc9uisg66+JhEcri20FOntgFEUej/BAvpDPVoXc X-Received: by 2002:a05:6512:3150:b0:4fe:ca4:7cd3 with SMTP id s16-20020a056512315000b004fe0ca47cd3mr4292866lfi.23.1690766507728; Sun, 30 Jul 2023 18:21:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690766507; cv=none; d=google.com; s=arc-20160816; b=G/S+5yH7SDqYksxuMiCADQCHhR/Ai55tk4Z2F2WsGF9g3W06w/lYaeGkGMOvQQ11Us mN3lEcpbS9V0Ullhdmlhcy5gJdB/qgQGNgFuvKcz+VBqCOqHDU6hyyWc1iAF2cIcFHbI neSZGaw84iyacSSaWxRhuCl5dGdJCIyaJOKA3WiqEe5jLbjf01+gijlN27FXLlxdV9p6 DcFTffWDTXzs8wL92O2WwQVUHu1WL9GgAg6iFkDRkICU02VcxoMQy8v808x+XFwjNoDN SYDba5l5YabIP/3vmIQ3Y5bIypYCdEvwqJZKIjA36I/RvFFL/lZzD2+5MiFr8fnGapNC kerQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=7xwKDpp0ef7skXlyYq8xTWPcGH6MaBIz1zgO3HLKN9Q=; fh=5HPme0lsE1V9SeO1Nke+KFwyzZvF0OJ/iAVOhy3rwnA=; b=Huf3AufjD2GrFxGzkMdK4zXT2XVv9uUpHxxLnuDmYwxi9FwpCqjhQJ4ax4wh7rcBUc kLZRMXiT4IGxg8IsIVCCBpSIQO/IgoBJtKCta9Yu2VnVMIu2rJAf/V9NTIGMF+FO8yfg 2Yq0rdVfCKcBLzYw7ueJFydnjfNDysqddIiZhDKqO275LU/RlxfLoal/+eoHRBKdmzmG 3OP1DVoAPe/Lgl8cGIT60zE9faw8RkwYgXJ3nuiVqDaf2e2w9oMB8vtZJhNvOVutDcTk oDilI1gJ8DMKFx1Kk56jEutqx25Lo36SRzg9NfYcmbEv4W7P9EeDcLVuX0ukJkai57Br KlVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p+D7khP4; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i21-20020aa7c715000000b00522586f3b0asi5263120edq.85.2023.07.30.18.21.23; Sun, 30 Jul 2023 18:21:47 -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=@kernel.org header.s=k20201202 header.b=p+D7khP4; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229552AbjGaAtd (ORCPT + 99 others); Sun, 30 Jul 2023 20:49:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjGaAtc (ORCPT ); Sun, 30 Jul 2023 20:49:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F280E78; Sun, 30 Jul 2023 17:49:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3124760DF9; Mon, 31 Jul 2023 00:49:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9299CC43397; Mon, 31 Jul 2023 00:49:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690764570; bh=HSe9skEoxlUTuOZvdtNJpMW/Hkn8jkbcfx3F/K4PLVY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=p+D7khP4AiP7n5c2GyfpNG+VVGVttTyGWAQRc+NtLtBozyiyHmuvJg4wLhYTRPoU3 O9cBmMMFPhdKcNDf02eZ/qCyEXOQjoZH9sC1zubZ+OvUqczlj8iMOoR0ScKqGqPZfi /0GdSLc0GJj/ZdFSCR38HMGD1p2QSJoLhuRoaFnoe3zvSkoa/hOECqnC1pED6etxQL aAOrXh8KdMZOjVBCN7o49+4wVhsaZQL4Zt9iVou7PcJs2jzmzXV1+Lbq68FSLQU/sM UxduwZh/q3IBFeozIKt3xDmJ2r/x3wP2vzNIeAhaXc8QAvW3lwN3Br3OIZKpTpL6As tvqnrlzZf/H/w== Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-4fe1489ced6so6267536e87.0; Sun, 30 Jul 2023 17:49:30 -0700 (PDT) X-Gm-Message-State: ABy/qLZLCSqmX2Ds8EuQp9mJ8zu852jZc7fCThFSz0Z4VzJlnPyKMUIi 6mgisCRIi/8TQWIF0nVQ61UQygvcyN/0+b8kbV0= X-Received: by 2002:ac2:5047:0:b0:4fb:92df:a27b with SMTP id a7-20020ac25047000000b004fb92dfa27bmr4330470lfm.39.1690764568411; Sun, 30 Jul 2023 17:49:28 -0700 (PDT) MIME-Version: 1.0 References: <20230702203429.237615-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20230702203429.237615-4-prabhakar.mahadev-lad.rj@bp.renesas.com> <92c00ddb-e956-4861-af80-5f5558c9a8f5@app.fastmail.com> In-Reply-To: <92c00ddb-e956-4861-af80-5f5558c9a8f5@app.fastmail.com> From: Guo Ren Date: Mon, 31 Jul 2023 08:49:17 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v10 3/6] riscv: mm: dma-noncoherent: nonstandard cache operations support To: =?UTF-8?Q?Heiko_St=C3=BCbner?= , Arnd Bergmann Cc: Emil Renner Berthing , Jisheng Zhang , Prabhakar , "Conor.Dooley" , Geert Uytterhoeven , Andrew Jones , Paul Walmsley , Palmer Dabbelt , Albert Ou , Samuel Holland , linux-riscv@lists.infradead.org, Christoph Hellwig , Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Linux-Renesas , Biju Das , "Lad, Prabhakar" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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, Jul 31, 2023 at 4:36=E2=80=AFAM Arnd Bergmann wrote= : > > On Sun, Jul 30, 2023, at 17:42, Emil Renner Berthing wrote: > > On Sun, 30 Jul 2023 at 17:11, Jisheng Zhang wrote: > > >> > + > >> > static inline void arch_dma_cache_wback(phys_addr_t paddr, size_t s= ize) > >> > { > >> > void *vaddr =3D phys_to_virt(paddr); > >> > > >> > +#ifdef CONFIG_RISCV_NONSTANDARD_CACHE_OPS > >> > + if (unlikely(noncoherent_cache_ops.wback)) { > >> > >> I'm worried about the performance impact here. > >> For unified kernel Image reason, RISCV_NONSTANDARD_CACHE_OPS will be > >> enabled by default, so standard CMO and T-HEAD's CMO platform's > >> performance will be impacted, because even an unlikely is put > >> here, the check action still needs to be done. > > > > On IRC I asked why not use a static key so the overhead is just a > > single nop when the standard CMO ops are available, but the consensus > > seemed to be that the flushing would completely dominate this branch. > > And on platforms with the standard CMO ops the branch be correctly > > predicted anyway. > > Not just the flushing, but also loading back the invalidated > cache lines afterwards is just very expensive. I don't think > you would be able to measure a difference between the static > key and a correctly predicted branch on any relevant usecase here. Maybe we should move CMO & THEAD ops to the noncoherent_cache_ops, and only keep one of them. I prefer noncoherent_cache_ops, it's more maintance than ALTERNATIVE. Heiko, How do you think about this? > > Arnd --=20 Best Regards Guo Ren