Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4018010ioo; Wed, 25 May 2022 12:59:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHjOv6KGkccrbwPOtOAnBT0dG/SUyjpRg3DCLwT5ViLXUQ9Xhe1G4NYixdObKvdkz3SVku X-Received: by 2002:aa7:888a:0:b0:518:a0b8:f5c1 with SMTP id z10-20020aa7888a000000b00518a0b8f5c1mr16542516pfe.46.1653508782392; Wed, 25 May 2022 12:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653508782; cv=none; d=google.com; s=arc-20160816; b=i0nDz8f9oWOl8WOZPiNBiYoor4WZtembpYhcow9L3tTag9in+jcDo+d60nkrGouz1d RmwehtxD0OXovA6e34RXXC4yMubVqTCs2uZsG6LP+RLyLnsbSxHGEnV9XKNyJdp9Vd/M AaOJ7B1cwtAwyLQGArrQmPyRgnJWUbbiBSjCQSJj164sFLiofe+ikl3P7tELuzB5HWkM jlgi7hladOy21KMt6OPwbb9uNBpuSFM+xJczHgcg8eXEx4pFkQwEBRNcH0/er2ENJagQ Nl93YeZwOsgFppCBtQ272ZQut7AUzgUj1neFyH+EYZxSzkPhUZHeq6AHpmsyDYXGjddH mItg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=EEsgi+27EFEI3maGbNXwrsJ/Fye7W0r30w8cc5+v1XA=; b=DUohIRs2/dTKA7zy/qoo+CixZmoQDystCGgs0W7Amg79yI2RY1bMj+1nGzy58P6GZO p+2QA6cCtAsYeCl2W/IW5plYbRA/XWvWpx/3xNkeisyqlwnLG2+gLYJO+6YsAMiTNNwW SR83gvHoQfJprkvFTUuDmIGGBkINtjfm4pqmHsLu2+dDjjBGDQX0qjkmktOzX5WKyerG 4/u+kobdbJLKmNZcj0/GwGaOCh5UXTTsvHc2TxccSLcKjLUjZImX72VTyuK6JPpzuNJ6 udrS3yE7Rif05I43IrYlqJdmBP3BUowexDynuEltX/XQzpMwTb69otfmEBA4ia3F5saD MsHQ== 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 p2-20020a634f42000000b00383f92e1f96si20143991pgl.79.2022.05.25.12.59.31; Wed, 25 May 2022 12:59:42 -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; 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 S237273AbiEYLJK (ORCPT + 99 others); Wed, 25 May 2022 07:09:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbiEYLJH (ORCPT ); Wed, 25 May 2022 07:09:07 -0400 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 557CF4B1CE; Wed, 25 May 2022 04:09:04 -0700 (PDT) Received: from mail-yb1-f169.google.com ([209.85.219.169]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MmlfS-1nRwNd1dw6-00jup3; Wed, 25 May 2022 13:03:59 +0200 Received: by mail-yb1-f169.google.com with SMTP id s14so8286681ybc.10; Wed, 25 May 2022 04:03:59 -0700 (PDT) X-Gm-Message-State: AOAM530rmeqk08WjlN/QYC+WZuXpvM7ioxV96Ps+P10BEN4XaNoCxpPg tzi129E65eoTjSXGI1o88lqPdydVXe/0hMUrZdg= X-Received: by 2002:a25:9b89:0:b0:655:8454:dc92 with SMTP id v9-20020a259b89000000b006558454dc92mr3917386ybo.550.1653476637990; Wed, 25 May 2022 04:03:57 -0700 (PDT) MIME-Version: 1.0 References: <20220419211658.11403-1-apais@linux.microsoft.com> <20220419211658.11403-2-apais@linux.microsoft.com> In-Reply-To: From: Arnd Bergmann Date: Wed, 25 May 2022 13:03:41 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue To: Linus Walleij Cc: Allen Pais , Vincent Guittot , Arnd Bergmann , olivier.dautricourt@orolia.com, Stefan Roese , Vinod Koul , 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 , =?UTF-8?Q?Andreas_F=C3=A4rber?= , 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 , =?UTF-8?Q?Jernej_=C5=A0krabec?= , Samuel Holland , dmaengine@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:f/6k2PCsIE8z9nVIcZyFl7FQM76NaSb/7sgHOxM2nu/nvieFW5T iWAJyvMLPoTlX5/UMfaYOUfCK3rlzw0wg3KHxasWD0dv00v0UVwJoiFG51yrVU5XSQhDLvH H/45U5SOj90pRYFmRgUXqlTYtUldRhVTOPzs75PlT6jhXCzj+i4ggaZ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F_NONE,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 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. 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. 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