Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp249169ioo; Thu, 26 May 2022 02:50:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywQRH53DVYMl93y1qOl9WZwo8g/21jljeU1is50mnv207aZanED5Etfsw8BpLyHWb/9OCe X-Received: by 2002:a05:6402:35c8:b0:42b:3377:581 with SMTP id z8-20020a05640235c800b0042b33770581mr30677879edc.369.1653558624865; Thu, 26 May 2022 02:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653558624; cv=none; d=google.com; s=arc-20160816; b=wdzCrMUbM1izzDPU3pdW4kdGzdTHVJE53f0rqWquaOSMBl48sFXTWd1fVObzSgUnN+ fAFH92G50nlQV7zEPNyfOrsTlRiE07YNp5Lb21y9FRHjoYVbMwwVH8A/mvppJixduxwG fS02oCQDMU70fqfOGu3U9825QPxCSZ5MoiHGWYvB5rhnZo/arymjTCZ/MVZf9wDig5xL C0QhiCxE1F5XYHsSJo66JuCenzRHyDrmjrfXclrfovlKvodaFa6A+XeZdYq8iwR3swIP CyHlmvs5lu6QhxckA+YLQic2d0pZ3q1NgEN5LVdTgQZSRb+peQkUneVIyCQiNWEv9b+f ltGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:dkim-filter; bh=AIZAMiCEajIHhQ0xzFaRPG9svaWeXfFXVXfyfZDYgF8=; b=LFPGfUsHzViHMlIW72RhP0fGDFlciiCqNCF3A18bfMmwxa3peznQaQEfGHm4S4+wss vUsDL+Fpw6q5JYbSqseglinATUs54hLbabCcR8Ik0idC/2oNfUJ8pOLkuZqAqOQ/5OSg 9s3JNXKLly4tKsebGl9Vsl8kHfGYhEqSGwv+Wq6OLvrNxzC5XrnupaZ+Z8Z98qW6KbNC YRGGojElMBF1xCpO0buk0U2AJmmcwSWK3VjH3cV2dAfUNU7OZNoxTcJofZbFDRADdVN5 KU+fRlrMZMvL9clfnOiDi8usV/QXBuq9Pb7JRTYYs4hq7fPjFuGDI9hru7D+tKnIROSy XmNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=qkPq7ZxK; 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=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vw5-20020a170907058500b006fec9c64513si959122ejb.177.2022.05.26.02.49.57; Thu, 26 May 2022 02:50:24 -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=@linux.microsoft.com header.s=default header.b=qkPq7ZxK; 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=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343631AbiEYSES (ORCPT + 99 others); Wed, 25 May 2022 14:04:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343622AbiEYSEP (ORCPT ); Wed, 25 May 2022 14:04:15 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 33E279CF43; Wed, 25 May 2022 11:04:14 -0700 (PDT) Received: from smtpclient.apple (d66-183-91-182.bchsia.telus.net [66.183.91.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 676BE20B71D5; Wed, 25 May 2022 11:04:12 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 676BE20B71D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1653501853; bh=AIZAMiCEajIHhQ0xzFaRPG9svaWeXfFXVXfyfZDYgF8=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=qkPq7ZxKLUX+Js2XTpprB3QG78Q+FVPrOwQe4D4uDbsxi4xBnu1SohxxB30+ZmQYa vH5+kwVx+y32vqBI4OjdS/hhilI25YmpsA3nweMp+1Tl2JQcYd/mpLkjV/QuvUwFGz yBllJU5p5jUsgst9RiU/mkvW0F4DnJwkJyQrECg0= Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) Subject: Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue From: Allen Pais In-Reply-To: Date: Wed, 25 May 2022 11:04:11 -0700 Cc: David Laight , Linus Walleij , Vincent Guittot , "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-Transfer-Encoding: quoted-printable Message-Id: <45597969-0419-4CEE-B80C-4D2917943837@linux.microsoft.com> References: <20220419211658.11403-1-apais@linux.microsoft.com> <20220419211658.11403-2-apais@linux.microsoft.com> <9947cfa64667406996de191f07b9e8b9@AcuMS.aculab.com> <6E248F41-6687-4F2B-B847-DB5459BA1344@linux.microsoft.com> To: Arnd Bergmann X-Mailer: Apple Mail (2.3696.80.82.1.1) X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL 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 >>=20 >> Thank you Linus, Arnd, Vincent and David for the feedback. >>=20 >> This is a lot more than a just conversion of API=E2=80=99s. I am in = the process >> Of replacing tasklets with threaded irq=E2=80=99s and hopefully that = should be >> A better solution than using workqueues. >=20 > I don't think that is much better for the case of the DMA engine > callbacks than the work queue, the problem I pointed out here > is scheduling into task context, which may be too expensive > in some cases, but whether it is or not depends on the slave > driver, not the dmaengine driver. Fair point. Deferring all callbacks to task context is not the ideal Way forward. I will work on the approach you shared, >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. Thanks. >=20 > Even if all the slave drivers are better off using task context > (threaded irq or workqueue), you need to look at the slave > drivers first before you can convert the dmaengine drivers. >=20