Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2405693ioo; Sat, 28 May 2022 12:36:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUDKhJBzDJcQRau37UQ6UgnOt9qVzC58BRCWGaYKavGky7WMp18hUuLST9WhE+JDfBXgdO X-Received: by 2002:a17:902:f789:b0:14e:ebbc:264b with SMTP id q9-20020a170902f78900b0014eebbc264bmr47644331pln.169.1653766562788; Sat, 28 May 2022 12:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653766562; cv=none; d=google.com; s=arc-20160816; b=bRwoi1+AoeI7K8L4c4kzzZWT/+mqJMElttZrpC1Ai4waPhhMkznph7mq6GuZeFInYM isNBIJ7oltVqWT/Aua+u9+9L4MXF9K0XLbjSrGNRo2ZvEn0xy+CjKmMI5ok9h/zH4o1L zCzSj3115EqXVEDp4So2lVpEEWVuUdBotXrHiAQB9eF0Zt5W6U56SYUciQBzpILT5oVX RdFAbDdWqO2ZqrlXoGuGVgshUWEiKJLEosoDNlja1/9HTqjSEwXnUzRLWcSMhQx1C0b3 ZC/R0tg2VM7ED+jztIv8k7e6nDjWzWFYhC+zOfeMvHjOnHg0f4oV2p1xkYplvhhzoO6+ lysw== 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=Jv0/UDp5TMUt1tgDIICOCXUjMh4J6JxpjHjLaRAHU0E=; b=KK53ciZfmMKM69hQdfiSCvoLu7DzQJP6Vngvaqq6t97j5kVNwWj7IhIXGLHavj5jD7 9vMQhJfIULHqf+ogB8zffl43WnCpXqFOulh51sE0FMpX47uyiapIT7PctTgYHsmOFRR1 tP6IkH9Teuk8a36ANtXyV1Xp0gikXGPWUtmVfhRDHSpa7xUXxgdzL35C6cStUrKSlspb Q1MdUOb/SvFgiZ77Q8t7XgOZdkykH5hKgO7TfvzaHamcBAOLo063fl7ValsLL/jbG+Bf Ci3PzqDZuOWvG+5reGQ/kjNs5mrhSGoyi/y4b1NhIsCmu4mwUrnVftk3xMpKPH3d66Ib Xd8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="QnUb/Iot"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id y30-20020a056a001c9e00b00518fc8adc58si8029887pfw.380.2022.05.28.12.36.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 12:36:02 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="QnUb/Iot"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 846172C641; Sat, 28 May 2022 12:01:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349637AbiE0IHN (ORCPT + 99 others); Fri, 27 May 2022 04:07:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349627AbiE0IGi (ORCPT ); Fri, 27 May 2022 04:06:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EBC8AF315; Fri, 27 May 2022 01:06:23 -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 8786A61C01; Fri, 27 May 2022 08:06:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 998CAC34119; Fri, 27 May 2022 08:06:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653638780; bh=bExDxURONoYyEyd2zIv+DcSXNxKTDMG5tYNYaUYxBJc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QnUb/Iotj6TLwlrFaZEv5Mj1e2uWOatVHI1xeiSd6YPEBYzPq1CPU6lowYeMJ66Xa ED3/aVsH5VNu3w1153cjLlkDukyW2Esl4jKOPSJqIK9236GmTJveEIeOPDbjmsFrt6 AronjEdLvrWRBdHmFJIerwC2Kz9GaftGPDDqNQ006N23oST9E4Wl9TJu+/YInV20JL r2Uf2Z9gKCYnKNIIVlSv/FwGFN4Q0ALDwXrRaWJHrImdAcrzKQgqpAxx3PzjBIekbK BQtbM4vc4MQJ+7uF/PUaKHkszShaU/wvTxSwoFHc1b5vJR0P7Yr816NWTr7EeyNcdP mDN1TcO4tL21g== Date: Fri, 27 May 2022 13:36:16 +0530 From: Vinod Koul To: Arnd Bergmann Cc: Linus Walleij , Allen Pais , Vincent Guittot , olivier.dautricourt@orolia.com, Stefan Roese , Kees Cook , linux-hardening@vger.kernel.org, Ludovic Desroches , Tudor Ambarus , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list , Nicolas Saenz Julienne , Paul Cercueil , Eugeniy.Paltsev@synopsys.com, Gustavo Pimentel , Viresh Kumar , Andy Shevchenko , Leo Li , zw@zh-kernel.org, Zhou Wang , Shawn Guo , Sascha Hauer , Sean Wang , Matthias Brugger , Andreas =?iso-8859-1?Q?F=E4rber?= , Manivannan Sadhasivam , Logan Gunthorpe , Sanjay R Mehta , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Andy Gross , Bjorn Andersson , Krzysztof Kozlowski , green.wan@sifive.com, Orson Zhai , Baolin Wang , Lyra Zhang , Patrice CHOTARD , Chen-Yu Tsai , Jernej =?utf-8?Q?=C5=A0krabec?= , Samuel Holland , dmaengine@vger.kernel.org, Linux Kernel Mailing List Subject: Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue Message-ID: References: <20220419211658.11403-1-apais@linux.microsoft.com> <20220419211658.11403-2-apais@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3.1 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 25-05-22, 13:03, Arnd Bergmann wrote: > On Wed, May 25, 2022 at 11:24 AM Linus Walleij wrote: > > On Tue, Apr 19, 2022 at 11:17 PM Allen Pais wrote: > > > > > The tasklet is an old API which will be deprecated, workqueue API > > > cab be used instead of them. > > > > > > This patch replaces the tasklet usage in drivers/dma/* with a > > > simple work. > > > > > > Github: https://github.com/KSPP/linux/issues/94 > > > > > > Signed-off-by: Allen Pais > > > > Paging Vincent Guittot and Arnd Bergmann on the following question > > on this patch set: > > > > - Will replacing tasklets with workque like this negatively impact the > > performance on DMA engine bottom halves? > > I think it will in some cases but not others. The problem I see is that > the short patch description makes it sound like a trivial conversion of a > single subsystem, but in reality this interacts with all the drivers using > DMA engines, including tty/serial, sound, mmc and spi. > > In many cases, the change is an improvement, but I can see a number > of ways this might go wrong: > > - for audio, waiting to schedule the workqueue task may add enough > latency to lead to audible skips > > - for serial, transferring a few characters through DMA is probably > more expensive now than using MMIO, which might mean that > there may no longer be a point in using DMA in the first place. > > - Some drivers such as dw_mmc schedule another tasklet from the > callback. If the tasklet is turned into a workqueue, this becomes > a bit pointless unless we change the called drivers first. Yes and there are assumptions in the peripheral drivers about the context of callback which right now is tasklet, that needs to be updated as well.. > What might work better in the case of the dmaengine API would > be an approach like: > > 1. add helper functions to call the callback functions from a > tasklet locally defined in drivers/dma/dmaengine.c to allow > deferring it from hardirq context > > 2. Change all tasklets that are not part of the callback > mechanism to work queue functions, I only see > xilinx_dpdma_chan_err_task in the patch, but there > may be more > > 3. change all drivers to move their custom tasklets back into > hardirq context and instead call the new helper for deferring > the callback. > > 4. Extend the dmaengine callback API to let slave drivers > pick hardirq, tasklet or task context for the callback. > task context can mean either a workqueue, or a threaded > IRQ here, with the default remaining the tasklet version. That does sound a good idea, but I dont know who will use the workqueue or a threaded context here, it might be that most would default to hardirq or tasklet context for obvious reasons... > > 5. Change slave drivers to pick either hardirq or task context > depending on their requirements > > 6. Remove the tasklet version. > > This is of course a lot more complicated than Allen's > approach, but I think the end result would be much better. > > Arnd -- ~Vinod