Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4972165rwb; Sun, 22 Jan 2023 00:23:03 -0800 (PST) X-Google-Smtp-Source: AMrXdXuhM9YQpvpbYolTBSXv8LZ/nk/PmaGAV8kwnxpnCVdW30+i3wEyaD++BKFxORFCG4HLAKqa X-Received: by 2002:a17:906:e0c5:b0:86d:67ee:d607 with SMTP id gl5-20020a170906e0c500b0086d67eed607mr31426524ejb.64.1674375783256; Sun, 22 Jan 2023 00:23:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674375783; cv=none; d=google.com; s=arc-20160816; b=gu/oL+MIm9Z3mohRHa3/ex4GP+mg4AbUekYzEjj1cVFtYQGNHizi+TeoDI0dXEDnvg cencV1h0RnbqDkCNoIK6pQmS6139xsVPJXVac2sOoNb9MSeOx2hUGDvMJ32giXBMt/JY 1ptXbPWLUxwzRRxlBQVWJB+QeHqatqOwWaPuMtrbIfbLdxGWNo6NprRBp1tHyzxysjTK soNuNRjU7HGmY4UVdVoI7k+JcP0VICHjvW6cZPOvEel4F0ru2rYMtloWOKsp1evI1FZk L95b8ScwHUzy/cPnTY9hgCKBR0cC56h1mBrCxjG2emirYZnUKq7wAUpa81C7fP7XR6dm buSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=PaoEB2SJ8hAJGHmTjh2jS2rB3P2ZU9CaxqgXn6PxLac=; b=N4DDp/usIXrPBmyZWd54/y5AoTAS0/8O7jsz8hamTwFGBZb7UQFs6xToqM+JH1aCjl U87vTyH9zwJytZwgwGar6xNIPpiCpt3gz2i6/LFWe1tQ7gfgYwq2YBRPa8hahOOCjR1H KjS5dk7LwS14TLGTtIIyicnd32/2oyGyP6iWObCqK5RgSE8ALrGyiSlbTubNLUxtS7Ws IXH24kY2tq0HVgIRYonZt8mdScVMpgEKyR9dQOPMJIy8H4VU/PrqLuOgTJoqqeF3+8Pd PjPejB5nLRUo9cN5WO6cJE/Hhyw/iYRsgsYc+yaqVTY7LJz2caU8YtHM4zZEM8PUhr1N Q3Sg== ARC-Authentication-Results: i=1; mx.google.com; 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 gn19-20020a1709070d1300b008776a7302d0si2490131ejc.905.2023.01.22.00.22.50; Sun, 22 Jan 2023 00:23:03 -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; 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 S229760AbjAVH2G (ORCPT + 52 others); Sun, 22 Jan 2023 02:28:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbjAVH2F (ORCPT ); Sun, 22 Jan 2023 02:28:05 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6508313530; Sat, 21 Jan 2023 23:28:04 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id 845BC68AA6; Sun, 22 Jan 2023 08:27:59 +0100 (CET) Date: Sun, 22 Jan 2023 08:27:59 +0100 From: Christoph Hellwig To: Arnd Bergmann Cc: Christoph Hellwig , Prabhakar , "Conor.Dooley" , Geert Uytterhoeven , Heiko =?iso-8859-1?Q?St=FCbner?= , guoren , Andrew Jones , Paul Walmsley , Palmer Dabbelt , Albert Ou , "open list:RISC-V ARCHITECTURE" , open list , devicetree@vger.kernel.org, Linux-Renesas , "Lad, Prabhakar" , Philipp Tomsich , Nathan Chancellor , Atish Patra , Anup Patel , Tsukasa OI , Jisheng Zhang , Mayuresh Chitale , Will Deacon Subject: Re: [RFC PATCH v6 1/6] riscv: mm: dma-noncoherent: Switch using function pointers for cache management Message-ID: <20230122072759.GA3703@lst.de> References: <9017adf0-acd4-4c43-8aea-3579b214b477@app.fastmail.com> <45d6eb0c-cbe3-4a83-aa12-3483638473ae@app.fastmail.com> <20230110070144.GG10289@lst.de> <02988e70-b099-46fd-b260-2d537c50543a@app.fastmail.com> <20230113054807.GA23179@lst.de> <20230121143733.GA7415@lst.de> <6a64b0b5-0ebc-43a5-a3d8-483a845a0b5e@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6a64b0b5-0ebc-43a5-a3d8-483a845a0b5e@app.fastmail.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE 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 Sat, Jan 21, 2023 at 08:30:23PM +0100, Arnd Bergmann wrote: > > That feels really odd, and might be worth a bug report to the > > PPC maintainers. > > Right, my first step would be to change all of the current > outliers to use the same set of operations where possible. Sounds good. > > I'd rather avoid multiple callbacks if we can. But maybe solve > > the simple problem first and just pass the paddr and then > > iterate from there. > > Ok, fair enough. This means we can't easily put the kmap_atomic() > into common code for highmem, though the per-page loop would > still work. Yes. Given how messy many of the ops are I think one step at a time is always good. > I was thinking of using STATIC_CALL() as an optimization here, which > I find easier to read and understand than alternatives. One advantage > here is that this allows the actual cache operations to be declared > locally in the architecture without letting drivers call them, > but still update the common code to work without indirect branches. > > The main downside is that this is currently only optimized on > powerpc and x86, both of which don't actually need CPU specific > callbacks. ARC, ARM, and MIPS on the other hand already > have indirect function pointers, RISC-V would likely benefit the > most from either alternatives or static_call, as it already > uses alternatives and has one implementation that is clearly > preferred over the others. For now I'd just keep doing direct calls into the arch code, just for the lower level invalidate, writeback, invalidate+writeback calls as that helps cementinc the logic of which of those to use in well documented core code. And I'm not really sure I'd like to go beyond that - making it too easy pluggable will make people feel more comfortable doing stupid things here. And yes, maybe that's personal because I've warned the RISC-V people years ago that they'll need architectural cache management instructions yesterday and the answer was that no one is going to use them on modern CPUs. *sigh*