linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/1] refactor all tasklet users into other APIs
@ 2022-04-19 21:16 Allen Pais
       [not found] ` <20220419211658.11403-2-apais@linux.microsoft.com>
  0 siblings, 1 reply; 27+ messages in thread
From: Allen Pais @ 2022-04-19 21:16 UTC (permalink / raw)
  To: olivier.dautricourt, sr, vkoul
  Cc: keescook, linux-hardening, ludovic.desroches, tudor.ambarus,
	f.fainelli, rjui, sbranden, bcm-kernel-feedback-list, nsaenz,
	paul, Eugeniy.Paltsev, gustavo.pimentel, vireshk,
	andriy.shevchenko, leoyang.li, zw, wangzhou1, shawnguo, s.hauer,
	sean.wang, matthias.bgg, afaerber, mani, logang, sanju.mehta,
	daniel, haojian.zhuang, robert.jarzmik, agross, bjorn.andersson,
	krzysztof.kozlowski, green.wan, orsonzhai, baolin.wang7,
	zhang.lyra, patrice.chotard, linus.walleij, wens, jernej.skrabec,
	samuel, dmaengine, linux-kernel

 Tasklet is an old API that will be eventually deprecated.
During the modernization of the tasklets API, there was a
request to entirely remove the API from the kernel. 
This series converts tasklets to simple work.

 Feedback on the series would be of great help as we are in the
process of dropping the usage of tasklets from the rest of the sub-systems.

 This is part of KSPP effort which is tracked at:
https://github.com/KSPP/linux/issues/94

This series replaces tasklets in drivers/dma/* with simple
workqueue. 

Allen Pais (1):
  drivers/dma/*: replace tasklets with workqueue

 drivers/dma/altera-msgdma.c                   | 15 ++++----
 drivers/dma/at_hdmac.c                        | 16 ++++-----
 drivers/dma/at_hdmac_regs.h                   |  6 ++--
 drivers/dma/at_xdmac.c                        | 14 ++++----
 drivers/dma/bcm2835-dma.c                     |  2 +-
 drivers/dma/dma-axi-dmac.c                    |  2 +-
 drivers/dma/dma-jz4780.c                      |  2 +-
 .../dma/dw-axi-dmac/dw-axi-dmac-platform.c    |  2 +-
 drivers/dma/dw-edma/dw-edma-core.c            |  4 +--
 drivers/dma/dw/core.c                         | 13 +++----
 drivers/dma/dw/regs.h                         |  2 +-
 drivers/dma/ep93xx_dma.c                      | 15 ++++----
 drivers/dma/fsl-edma-common.c                 |  2 +-
 drivers/dma/fsl-qdma.c                        |  2 +-
 drivers/dma/fsl_raid.c                        | 12 ++++---
 drivers/dma/fsl_raid.h                        |  2 +-
 drivers/dma/fsldma.c                          | 15 ++++----
 drivers/dma/fsldma.h                          |  2 +-
 drivers/dma/hisi_dma.c                        |  2 +-
 drivers/dma/hsu/hsu.c                         |  2 +-
 drivers/dma/idma64.c                          |  4 +--
 drivers/dma/img-mdc-dma.c                     |  2 +-
 drivers/dma/imx-dma.c                         | 27 +++++++-------
 drivers/dma/imx-sdma.c                        |  6 ++--
 drivers/dma/ioat/dma.c                        | 19 +++++-----
 drivers/dma/ioat/dma.h                        |  4 +--
 drivers/dma/ioat/init.c                       |  2 +-
 drivers/dma/iop-adma.c                        | 12 +++----
 drivers/dma/ipu/ipu_idmac.c                   | 22 ++++--------
 drivers/dma/ipu/ipu_intern.h                  |  2 +-
 drivers/dma/k3dma.c                           | 19 +++++-----
 drivers/dma/mediatek/mtk-cqdma.c              | 35 ++++++++++---------
 drivers/dma/mediatek/mtk-hsdma.c              |  4 +--
 drivers/dma/mediatek/mtk-uart-apdma.c         |  4 +--
 drivers/dma/mmp_pdma.c                        | 13 +++----
 drivers/dma/mmp_tdma.c                        | 11 +++---
 drivers/dma/mpc512x_dma.c                     | 17 ++++-----
 drivers/dma/mv_xor.c                          | 13 +++----
 drivers/dma/mv_xor.h                          |  4 +--
 drivers/dma/mv_xor_v2.c                       | 23 ++++++------
 drivers/dma/mxs-dma.c                         | 13 +++----
 drivers/dma/nbpfaxi.c                         | 15 ++++----
 drivers/dma/owl-dma.c                         |  2 +-
 drivers/dma/pch_dma.c                         | 17 ++++-----
 drivers/dma/pl330.c                           | 32 +++++++++--------
 drivers/dma/plx_dma.c                         | 13 +++----
 drivers/dma/ppc4xx/adma.c                     | 17 ++++-----
 drivers/dma/ppc4xx/adma.h                     |  4 +--
 drivers/dma/ptdma/ptdma-dev.c                 |  2 +-
 drivers/dma/ptdma/ptdma.h                     |  4 +--
 drivers/dma/pxa_dma.c                         |  2 +-
 drivers/dma/qcom/bam_dma.c                    | 35 ++++++++++---------
 drivers/dma/qcom/gpi.c                        | 18 +++++-----
 drivers/dma/qcom/hidma.c                      | 11 +++---
 drivers/dma/qcom/hidma.h                      |  6 ++--
 drivers/dma/qcom/hidma_ll.c                   | 11 +++---
 drivers/dma/qcom/qcom_adm.c                   |  2 +-
 drivers/dma/s3c24xx-dma.c                     |  2 +-
 drivers/dma/sa11x0-dma.c                      | 27 +++++++-------
 drivers/dma/sf-pdma/sf-pdma.c                 | 24 +++++++------
 drivers/dma/sf-pdma/sf-pdma.h                 |  4 +--
 drivers/dma/sprd-dma.c                        |  2 +-
 drivers/dma/st_fdma.c                         |  2 +-
 drivers/dma/ste_dma40.c                       | 17 ++++-----
 drivers/dma/sun6i-dma.c                       | 33 ++++++++---------
 drivers/dma/tegra20-apb-dma.c                 | 19 +++++-----
 drivers/dma/tegra210-adma.c                   |  2 +-
 drivers/dma/ti/edma.c                         |  2 +-
 drivers/dma/ti/k3-udma.c                      | 11 +++---
 drivers/dma/ti/omap-dma.c                     |  2 +-
 drivers/dma/timb_dma.c                        | 23 ++++++------
 drivers/dma/txx9dmac.c                        | 30 ++++++++--------
 drivers/dma/txx9dmac.h                        |  4 +--
 drivers/dma/virt-dma.c                        |  9 ++---
 drivers/dma/virt-dma.h                        |  8 ++---
 drivers/dma/xgene-dma.c                       | 21 +++++------
 drivers/dma/xilinx/xilinx_dma.c               | 23 ++++++------
 drivers/dma/xilinx/xilinx_dpdma.c             | 19 +++++-----
 drivers/dma/xilinx/zynqmp_dma.c               | 21 +++++------
 include/linux/platform_data/dma-iop32x.h      |  4 +--
 80 files changed, 459 insertions(+), 429 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
       [not found] ` <20220419211658.11403-2-apais@linux.microsoft.com>
@ 2022-04-20  2:31   ` Kees Cook
  2022-04-22 16:48     ` Allen Pais
  2022-04-25 15:06   ` Linus Walleij
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 27+ messages in thread
From: Kees Cook @ 2022-04-20  2:31 UTC (permalink / raw)
  To: Allen Pais
  Cc: olivier.dautricourt, sr, vkoul, linux-hardening,
	ludovic.desroches, tudor.ambarus, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, nsaenz, paul, Eugeniy.Paltsev,
	gustavo.pimentel, vireshk, andriy.shevchenko, leoyang.li, zw,
	wangzhou1, shawnguo, s.hauer, sean.wang, matthias.bgg, afaerber,
	mani, logang, sanju.mehta, daniel, haojian.zhuang,
	robert.jarzmik, agross, bjorn.andersson, krzysztof.kozlowski,
	green.wan, orsonzhai, baolin.wang7, zhang.lyra, patrice.chotard,
	linus.walleij, wens, jernej.skrabec, samuel, dmaengine,
	linux-kernel

On Tue, Apr 19, 2022 at 09:16:58PM +0000, 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.

Thanks for working on this! Can you describe the process for the
replacement? For example, was it a 1:1 replacement from one set of
functions to another, or something more nuanced? Did you do this by hand,
or with the help of something like Coccinelle?

Including these details will help maintainers with review, and will help
others do other conversions in the future.

Thanks!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-04-20  2:31   ` [RFC 1/1] drivers/dma/*: replace tasklets with workqueue Kees Cook
@ 2022-04-22 16:48     ` Allen Pais
  0 siblings, 0 replies; 27+ messages in thread
From: Allen Pais @ 2022-04-22 16:48 UTC (permalink / raw)
  To: Kees Cook
  Cc: olivier.dautricourt, sr, vkoul, linux-hardening,
	ludovic.desroches, tudor.ambarus, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, nsaenz, paul, Eugeniy.Paltsev,
	gustavo.pimentel, vireshk, andriy.shevchenko, leoyang.li, zw,
	wangzhou1, shawnguo, s.hauer, sean.wang, matthias.bgg, afaerber,
	mani, logang, sanju.mehta, daniel, haojian.zhuang,
	robert.jarzmik, agross, bjorn.andersson, krzysztof.kozlowski,
	green.wan, orsonzhai, baolin.wang7, zhang.lyra, patrice.chotard,
	linus.walleij, wens, jernej.skrabec, samuel, dmaengine,
	linux-kernel


>> 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.
> 
> Thanks for working on this! Can you describe the process for the
> replacement? For example, was it a 1:1 replacement from one set of
> functions to another, or something more nuanced? Did you do this by hand,
> or with the help of something like Coccinelle?

 For this series, I did the work manually as certain had the potential to be improved.
Also, there are drivers which use queue_work() instead of schedule_work(). 

> Including these details will help maintainers with review, and will help
> others do other conversions in the future.
> 

 I will wait for a couple of more days and send out the rest of the series with
More details.

Thanks.

> Thanks!
> 
> -Kees
> 
> -- 
> Kees Cook


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
       [not found] ` <20220419211658.11403-2-apais@linux.microsoft.com>
  2022-04-20  2:31   ` [RFC 1/1] drivers/dma/*: replace tasklets with workqueue Kees Cook
@ 2022-04-25 15:06   ` Linus Walleij
  2022-04-25 23:59     ` Allen Pais
  2022-04-25 15:56   ` Krzysztof Kozlowski
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 27+ messages in thread
From: Linus Walleij @ 2022-04-25 15:06 UTC (permalink / raw)
  To: Allen Pais
  Cc: olivier.dautricourt, sr, vkoul, keescook, linux-hardening,
	ludovic.desroches, tudor.ambarus, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, nsaenz, paul, Eugeniy.Paltsev,
	gustavo.pimentel, vireshk, andriy.shevchenko, leoyang.li, zw,
	wangzhou1, shawnguo, s.hauer, sean.wang, matthias.bgg, afaerber,
	mani, logang, sanju.mehta, daniel, haojian.zhuang,
	robert.jarzmik, agross, bjorn.andersson, krzysztof.kozlowski,
	green.wan, orsonzhai, baolin.wang7, zhang.lyra, patrice.chotard,
	wens, jernej.skrabec, samuel, dmaengine, linux-kernel

On Tue, Apr 19, 2022 at 11:17 PM Allen Pais <apais@linux.microsoft.com> 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 <apais@linux.microsoft.com>

Booted on:

>  drivers/dma/ste_dma40.c                       | 17 ++++-----

This DMA-controller with no regressions:
Tested-by: Linus Walleij <linus.walleij@linaro.org>

Also looks good so:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
       [not found] ` <20220419211658.11403-2-apais@linux.microsoft.com>
  2022-04-20  2:31   ` [RFC 1/1] drivers/dma/*: replace tasklets with workqueue Kees Cook
  2022-04-25 15:06   ` Linus Walleij
@ 2022-04-25 15:56   ` Krzysztof Kozlowski
  2022-04-25 19:55     ` Gustavo A. R. Silva
  2022-04-26  0:04     ` Allen Pais
  2022-04-27  2:45   ` Vinod Koul
  2022-05-25  9:24   ` Linus Walleij
  4 siblings, 2 replies; 27+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-25 15:56 UTC (permalink / raw)
  To: Allen Pais, olivier.dautricourt, sr, vkoul
  Cc: keescook, linux-hardening, ludovic.desroches, tudor.ambarus,
	f.fainelli, rjui, sbranden, bcm-kernel-feedback-list, nsaenz,
	paul, Eugeniy.Paltsev, gustavo.pimentel, vireshk,
	andriy.shevchenko, leoyang.li, zw, wangzhou1, shawnguo, s.hauer,
	sean.wang, matthias.bgg, afaerber, mani, logang, sanju.mehta,
	daniel, haojian.zhuang, robert.jarzmik, agross, bjorn.andersson,
	krzysztof.kozlowski, green.wan, orsonzhai, baolin.wang7,
	zhang.lyra, patrice.chotard, linus.walleij, wens, jernej.skrabec,
	samuel, dmaengine, linux-kernel

On 19/04/2022 23:16, Allen Pais wrote:
> The tasklet is an old API which will be deprecated, workqueue API
> cab be used instead of them.
> 

Thank you for your patch. There is something to discuss/improve.

> This patch replaces the tasklet usage in drivers/dma/* with a
> simple work.

Minor nits:

1. Don't use "this patch".
https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95
2. Use subject prefix matching subsystem (git log --oneline)

> 
> Github: https://github.com/KSPP/linux/issues/94

3. No external references to some issue management systems, change-ids
etc. Lore link could work, but it's not relevant here, I guess.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-04-25 15:56   ` Krzysztof Kozlowski
@ 2022-04-25 19:55     ` Gustavo A. R. Silva
  2022-04-28  9:29       ` Andy Shevchenko
  2022-04-26  0:04     ` Allen Pais
  1 sibling, 1 reply; 27+ messages in thread
From: Gustavo A. R. Silva @ 2022-04-25 19:55 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Allen Pais, olivier.dautricourt, sr, vkoul
  Cc: keescook, linux-hardening, ludovic.desroches, tudor.ambarus,
	f.fainelli, rjui, sbranden, bcm-kernel-feedback-list, nsaenz,
	paul, Eugeniy.Paltsev, gustavo.pimentel, vireshk,
	andriy.shevchenko, leoyang.li, zw, wangzhou1, shawnguo, s.hauer,
	sean.wang, matthias.bgg, afaerber, mani, logang, sanju.mehta,
	daniel, haojian.zhuang, robert.jarzmik, agross, bjorn.andersson,
	krzysztof.kozlowski, green.wan, orsonzhai, baolin.wang7,
	zhang.lyra, patrice.chotard, linus.walleij, wens, jernej.skrabec,
	samuel, dmaengine, linux-kernel



On 4/25/22 10:56, Krzysztof Kozlowski wrote:
> On 19/04/2022 23:16, Allen Pais wrote:
>> The tasklet is an old API which will be deprecated, workqueue API
>> cab be used instead of them.
>>
> 
> Thank you for your patch. There is something to discuss/improve.
> 
>> This patch replaces the tasklet usage in drivers/dma/* with a
>> simple work.
> 
> Minor nits:
> 
> 1. Don't use "this patch".
> https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95
> 2. Use subject prefix matching subsystem (git log --oneline)
> 
>>
>> Github: https://github.com/KSPP/linux/issues/94
> 
> 3. No external references to some issue management systems, change-ids
> etc. Lore link could work, but it's not relevant here, I guess.

I think the link to the KSPP issue tracker should stay. If something,
just changing 'Github:' to 'Link:'

The KSPP has been an active _upstream_ project for about 7 years now,
and the issue tracker is publicly available. :) So it's not like a random
link to a random project. This also help us to automatically keep track
of the patches sent out to address a particular issue that we want to
have resolved upstream. So please, keep the link in the changelog text,
it's useful. :)

Thanks
--
Gustavo

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-04-25 15:06   ` Linus Walleij
@ 2022-04-25 23:59     ` Allen Pais
  0 siblings, 0 replies; 27+ messages in thread
From: Allen Pais @ 2022-04-25 23:59 UTC (permalink / raw)
  To: Linus Walleij
  Cc: olivier.dautricourt, sr, vkoul, Kees Cook, linux-hardening,
	ludovic.desroches, tudor.ambarus, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, nsaenz, paul, Eugeniy.Paltsev,
	gustavo.pimentel, vireshk, andriy.shevchenko, leoyang.li, zw,
	wangzhou1, shawnguo, s.hauer, sean.wang, matthias.bgg, afaerber,
	mani, logang, sanju.mehta, daniel, haojian.zhuang,
	robert.jarzmik, agross, bjorn.andersson, krzysztof.kozlowski,
	green.wan, orsonzhai, baolin.wang7, zhang.lyra, patrice.chotard,
	wens, jernej.skrabec, samuel, dmaengine, linux-kernel



> On 25-Apr-2022, at 8:06 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> On Tue, Apr 19, 2022 at 11:17 PM Allen Pais <apais@linux.microsoft.com> 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 <apais@linux.microsoft.com>
> 
> Booted on:
> 
>> drivers/dma/ste_dma40.c                       | 17 ++++-----
> 
> This DMA-controller with no regressions:
> Tested-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Also looks good so:
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

 Thanks for review and testing.

> 
> Yours,
> Linus Walleij


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-04-25 15:56   ` Krzysztof Kozlowski
  2022-04-25 19:55     ` Gustavo A. R. Silva
@ 2022-04-26  0:04     ` Allen Pais
  1 sibling, 0 replies; 27+ messages in thread
From: Allen Pais @ 2022-04-26  0:04 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: olivier.dautricourt, sr, vkoul, Kees Cook, linux-hardening,
	ludovic.desroches, tudor.ambarus, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, nsaenz, paul, Eugeniy.Paltsev,
	gustavo.pimentel, vireshk, andriy.shevchenko, leoyang.li, zw,
	wangzhou1, shawnguo, s.hauer, sean.wang, matthias.bgg, afaerber,
	mani, logang, sanju.mehta, daniel, haojian.zhuang,
	robert.jarzmik, agross, bjorn.andersson, krzysztof.kozlowski,
	green.wan, orsonzhai, baolin.wang7, zhang.lyra, patrice.chotard,
	linus.walleij, wens, jernej.skrabec, samuel, dmaengine,
	linux-kernel


>> The tasklet is an old API which will be deprecated, workqueue API
>> cab be used instead of them.
>> 
> 
> Thank you for your patch. There is something to discuss/improve.
> 
>> This patch replaces the tasklet usage in drivers/dma/* with a
>> simple work.
> 
> Minor nits:
> 
> 1. Don't use "this patch".
> https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95
> 2. Use subject prefix matching subsystem (git log --oneline)

 Thank you. Will have it updated.

> 
>> 
>> Github: https://github.com/KSPP/linux/issues/94
> 
> 3. No external references to some issue management systems, change-ids
> etc. Lore link could work, but it's not relevant here, I guess.

We have had other tasks in the past which have carried the links. Ideally, I would like to 
Keep it, I will leave it to the maintainers. 

Thanks.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
       [not found] ` <20220419211658.11403-2-apais@linux.microsoft.com>
                     ` (2 preceding siblings ...)
  2022-04-25 15:56   ` Krzysztof Kozlowski
@ 2022-04-27  2:45   ` Vinod Koul
  2022-04-27 15:20     ` Dave Jiang
  2022-04-27 15:53     ` Allen Pais
  2022-05-25  9:24   ` Linus Walleij
  4 siblings, 2 replies; 27+ messages in thread
From: Vinod Koul @ 2022-04-27  2:45 UTC (permalink / raw)
  To: Allen Pais
  Cc: olivier.dautricourt, sr, keescook, linux-hardening,
	ludovic.desroches, tudor.ambarus, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, nsaenz, paul, Eugeniy.Paltsev,
	gustavo.pimentel, vireshk, andriy.shevchenko, leoyang.li, zw,
	wangzhou1, shawnguo, s.hauer, sean.wang, matthias.bgg, afaerber,
	mani, logang, sanju.mehta, daniel, haojian.zhuang,
	robert.jarzmik, agross, bjorn.andersson, krzysztof.kozlowski,
	green.wan, orsonzhai, baolin.wang7, zhang.lyra, patrice.chotard,
	linus.walleij, wens, jernej.skrabec, samuel, dmaengine,
	linux-kernel

On 19-04-22, 21:16, Allen Pais wrote:
> The tasklet is an old API which will be deprecated, workqueue API
> cab be used instead of them.

What is the reason for tasklet removal, I am not sure old is a reason to
remove an API...

> 
> This patch replaces the tasklet usage in drivers/dma/* with a
> simple work.

Dmaengines need very high throughput, one of the reasons in dmaengine
API design to use tasklet was higher priority given to them. Will the
workqueue allow that...?

-- 
~Vinod

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-04-27  2:45   ` Vinod Koul
@ 2022-04-27 15:20     ` Dave Jiang
  2022-04-27 15:58       ` Allen Pais
  2022-04-27 15:53     ` Allen Pais
  1 sibling, 1 reply; 27+ messages in thread
From: Dave Jiang @ 2022-04-27 15:20 UTC (permalink / raw)
  To: Vinod Koul, Allen Pais
  Cc: olivier.dautricourt, sr, keescook, linux-hardening,
	ludovic.desroches, tudor.ambarus, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, nsaenz, paul, Eugeniy.Paltsev,
	gustavo.pimentel, vireshk, andriy.shevchenko, leoyang.li, zw,
	wangzhou1, shawnguo, s.hauer, sean.wang, matthias.bgg, afaerber,
	mani, logang, sanju.mehta, daniel, haojian.zhuang,
	robert.jarzmik, agross, bjorn.andersson, krzysztof.kozlowski,
	green.wan, orsonzhai, baolin.wang7, zhang.lyra, patrice.chotard,
	linus.walleij, wens, jernej.skrabec, samuel, dmaengine,
	linux-kernel


On 4/26/2022 7:45 PM, Vinod Koul wrote:
> On 19-04-22, 21:16, Allen Pais wrote:
>> The tasklet is an old API which will be deprecated, workqueue API
>> cab be used instead of them.
> What is the reason for tasklet removal, I am not sure old is a reason to
> remove an API...
>
>> This patch replaces the tasklet usage in drivers/dma/* with a
>> simple work.
> Dmaengines need very high throughput, one of the reasons in dmaengine
> API design to use tasklet was higher priority given to them. Will the
> workqueue allow that...?

Wouldn't the logical move be to convert threaded irq IF tasklets are 
being deprecated rather than using workqueue as replacement?

Also, wouldn't all the spin_lock_bh() calls need to be changed to 
spin_lock_irqsave() now? Probably not as simple as just replace tasklet 
with workqueue.



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-04-27  2:45   ` Vinod Koul
  2022-04-27 15:20     ` Dave Jiang
@ 2022-04-27 15:53     ` Allen Pais
  1 sibling, 0 replies; 27+ messages in thread
From: Allen Pais @ 2022-04-27 15:53 UTC (permalink / raw)
  To: Vinod Koul
  Cc: olivier.dautricourt, sr, Kees Cook, linux-hardening,
	ludovic.desroches, tudor.ambarus, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, nsaenz, paul, Eugeniy.Paltsev,
	gustavo.pimentel, vireshk, andriy.shevchenko, leoyang.li, zw,
	wangzhou1, shawnguo, s.hauer, sean.wang, matthias.bgg, afaerber,
	mani, logang, sanju.mehta, daniel, haojian.zhuang,
	robert.jarzmik, agross, bjorn.andersson, krzysztof.kozlowski,
	green.wan, orsonzhai, baolin.wang7, zhang.lyra, patrice.chotard,
	linus.walleij, wens, jernej.skrabec, samuel, dmaengine,
	linux-kernel


>> The tasklet is an old API which will be deprecated, workqueue API
>> cab be used instead of them.
> 
> What is the reason for tasklet removal, I am not sure old is a reason to
> remove an API...

 While we moved to modernised version of tasklet API, there was
A request to entirely remove tasklets. The following patch is an attempt
Towards it. 

> 
>> 
>> This patch replaces the tasklet usage in drivers/dma/* with a
>> simple work.
> 
> Dmaengines need very high throughput, one of the reasons in dmaengine
> API design to use tasklet was higher priority given to them. Will the
> workqueue allow that...?

  It is interesting that you brought up this point. I haven’t had the opportunity
To test the changes by stressing the kernel, what tests/benchmarks would
You prefer to see run on with these changes.

Thanks.

> 
> -- 
> ~Vinod


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-04-27 15:20     ` Dave Jiang
@ 2022-04-27 15:58       ` Allen Pais
  0 siblings, 0 replies; 27+ messages in thread
From: Allen Pais @ 2022-04-27 15:58 UTC (permalink / raw)
  To: Dave Jiang
  Cc: Vinod Koul, olivier.dautricourt, sr, Kees Cook, linux-hardening,
	ludovic.desroches, tudor.ambarus, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, nsaenz, paul, Eugeniy.Paltsev,
	gustavo.pimentel, vireshk, andriy.shevchenko, leoyang.li, zw,
	wangzhou1, shawnguo, s.hauer, sean.wang, matthias.bgg, afaerber,
	mani, logang, sanju.mehta, daniel, haojian.zhuang,
	robert.jarzmik, agross, bjorn.andersson, krzysztof.kozlowski,
	green.wan, orsonzhai, baolin.wang7, zhang.lyra, patrice.chotard,
	linus.walleij, wens, jernej.skrabec, samuel, dmaengine,
	linux-kernel


>> On 19-04-22, 21:16, Allen Pais wrote:
>>> The tasklet is an old API which will be deprecated, workqueue API
>>> cab be used instead of them.
>> What is the reason for tasklet removal, I am not sure old is a reason to
>> remove an API...
>> 
>>> This patch replaces the tasklet usage in drivers/dma/* with a
>>> simple work.
>> Dmaengines need very high throughput, one of the reasons in dmaengine
>> API design to use tasklet was higher priority given to them. Will the
>> workqueue allow that...?
> 
> Wouldn't the logical move be to convert threaded irq IF tasklets are being deprecated rather than using workqueue as replacement?

  Logically yes. Would all tasklets need to be moved to threaded irq, that I am not sure. I think
Workqueues does the job.

> 
> Also, wouldn't all the spin_lock_bh() calls need to be changed to spin_lock_irqsave() now? Probably not as simple as just replace tasklet with workqueue.
> 

Yes, this was carefully looked at as we have moved from the interrupt/softirq context to process context.

Thanks.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-04-25 19:55     ` Gustavo A. R. Silva
@ 2022-04-28  9:29       ` Andy Shevchenko
       [not found]         ` <DA101ED8-F99F-4DCB-9CB7-370A62C44B65@linux.microsoft.com>
  0 siblings, 1 reply; 27+ messages in thread
From: Andy Shevchenko @ 2022-04-28  9:29 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Krzysztof Kozlowski, Allen Pais, olivier.dautricourt, sr, vkoul,
	keescook, linux-hardening, ludovic.desroches, tudor.ambarus,
	f.fainelli, rjui, sbranden, bcm-kernel-feedback-list, nsaenz,
	paul, Eugeniy.Paltsev, gustavo.pimentel, vireshk, leoyang.li, zw,
	wangzhou1, shawnguo, s.hauer, sean.wang, matthias.bgg, afaerber,
	mani, logang, sanju.mehta, daniel, haojian.zhuang,
	robert.jarzmik, agross, bjorn.andersson, krzysztof.kozlowski,
	green.wan, orsonzhai, baolin.wang7, zhang.lyra, patrice.chotard,
	linus.walleij, wens, jernej.skrabec, samuel, dmaengine,
	linux-kernel

On Mon, Apr 25, 2022 at 02:55:22PM -0500, Gustavo A. R. Silva wrote:
> On 4/25/22 10:56, Krzysztof Kozlowski wrote:
> > On 19/04/2022 23:16, Allen Pais wrote:

...

> > > Github: https://github.com/KSPP/linux/issues/94
> > 
> > 3. No external references to some issue management systems, change-ids
> > etc. Lore link could work, but it's not relevant here, I guess.
> 
> I think the link to the KSPP issue tracker should stay. If something,
> just changing 'Github:' to 'Link:'

BugLink: would be more explicit.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
       [not found]         ` <DA101ED8-F99F-4DCB-9CB7-370A62C44B65@linux.microsoft.com>
@ 2022-05-12 21:54           ` Linus Walleij
  2022-05-16 11:40             ` Vinod Koul
  0 siblings, 1 reply; 27+ messages in thread
From: Linus Walleij @ 2022-05-12 21:54 UTC (permalink / raw)
  To: Allen Pais
  Cc: Andy Shevchenko, Gustavo A. R. Silva, Krzysztof Kozlowski,
	olivier.dautricourt, sr, Vinod Koul, Kees Cook, linux-hardening,
	ludovic.desroches, tudor.ambarus, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, nsaenz, paul, Eugeniy.Paltsev,
	gustavo.pimentel, vireshk, leoyang.li, zw, wangzhou1, shawnguo,
	s.hauer, sean.wang, matthias.bgg, afaerber, mani, logang,
	sanju.mehta, daniel, haojian.zhuang, robert.jarzmik, agross,
	bjorn.andersson, krzysztof.kozlowski, green.wan, orsonzhai,
	baolin.wang7, zhang.lyra, patrice.chotard, wens, jernej.skrabec,
	samuel, dmaengine, linux-kernel

On Fri, May 6, 2022 at 7:43 PM Allen Pais <apais@linux.microsoft.com> wrote:

>  - Concerns regarding throughput, would workqueues be as efficient as tasklets (Vinod)

You need to ask the scheduler people about this.

The workqueues goes deep into the scheduler and I can't make
out how they are prioritized, but they are certainly not treated
like any other task.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-05-12 21:54           ` Linus Walleij
@ 2022-05-16 11:40             ` Vinod Koul
  0 siblings, 0 replies; 27+ messages in thread
From: Vinod Koul @ 2022-05-16 11:40 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Allen Pais, Andy Shevchenko, Gustavo A. R. Silva,
	Krzysztof Kozlowski, olivier.dautricourt, sr, Kees Cook,
	linux-hardening, ludovic.desroches, tudor.ambarus, f.fainelli,
	rjui, sbranden, bcm-kernel-feedback-list, nsaenz, paul,
	Eugeniy.Paltsev, gustavo.pimentel, vireshk, leoyang.li, zw,
	wangzhou1, shawnguo, s.hauer, sean.wang, matthias.bgg, afaerber,
	mani, logang, sanju.mehta, daniel, haojian.zhuang,
	robert.jarzmik, agross, bjorn.andersson, krzysztof.kozlowski,
	green.wan, orsonzhai, baolin.wang7, zhang.lyra, patrice.chotard,
	wens, jernej.skrabec, samuel, dmaengine, linux-kernel

On 12-05-22, 23:54, Linus Walleij wrote:
> On Fri, May 6, 2022 at 7:43 PM Allen Pais <apais@linux.microsoft.com> wrote:
> 
> >  - Concerns regarding throughput, would workqueues be as efficient as tasklets (Vinod)
> 
> You need to ask the scheduler people about this.
> 
> The workqueues goes deep into the scheduler and I can't make
> out how they are prioritized, but they are certainly not treated
> like any other task.

+1

-- 
~Vinod

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
       [not found] ` <20220419211658.11403-2-apais@linux.microsoft.com>
                     ` (3 preceding siblings ...)
  2022-04-27  2:45   ` Vinod Koul
@ 2022-05-25  9:24   ` Linus Walleij
  2022-05-25  9:52     ` Vincent Guittot
  2022-05-25 11:03     ` Arnd Bergmann
  4 siblings, 2 replies; 27+ messages in thread
From: Linus Walleij @ 2022-05-25  9:24 UTC (permalink / raw)
  To: Allen Pais, Vincent Guittot, Arnd Bergmann
  Cc: olivier.dautricourt, sr, vkoul, keescook, linux-hardening,
	ludovic.desroches, tudor.ambarus, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, nsaenz, paul, Eugeniy.Paltsev,
	gustavo.pimentel, vireshk, andriy.shevchenko, leoyang.li, zw,
	wangzhou1, shawnguo, s.hauer, sean.wang, matthias.bgg, afaerber,
	mani, logang, sanju.mehta, daniel, haojian.zhuang,
	robert.jarzmik, agross, bjorn.andersson, krzysztof.kozlowski,
	green.wan, orsonzhai, baolin.wang7, zhang.lyra, patrice.chotard,
	wens, jernej.skrabec, samuel, dmaengine, linux-kernel

On Tue, Apr 19, 2022 at 11:17 PM Allen Pais <apais@linux.microsoft.com> 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 <apais@linux.microsoft.com>

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?

For reference:
https://lore.kernel.org/dmaengine/YoI4J8taHehMpjFj@matsya/

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-05-25  9:24   ` Linus Walleij
@ 2022-05-25  9:52     ` Vincent Guittot
  2022-05-25 11:03     ` Arnd Bergmann
  1 sibling, 0 replies; 27+ messages in thread
From: Vincent Guittot @ 2022-05-25  9:52 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Allen Pais, Arnd Bergmann, olivier.dautricourt, sr, vkoul,
	keescook, linux-hardening, ludovic.desroches, tudor.ambarus,
	f.fainelli, rjui, sbranden, bcm-kernel-feedback-list, nsaenz,
	paul, Eugeniy.Paltsev, gustavo.pimentel, vireshk,
	andriy.shevchenko, leoyang.li, zw, wangzhou1, shawnguo, s.hauer,
	sean.wang, matthias.bgg, afaerber, mani, logang, sanju.mehta,
	daniel, haojian.zhuang, robert.jarzmik, agross, bjorn.andersson,
	krzysztof.kozlowski, green.wan, orsonzhai, baolin.wang7,
	zhang.lyra, patrice.chotard, wens, jernej.skrabec, samuel,
	dmaengine, linux-kernel

On Wed, 25 May 2022 at 11:24, Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Tue, Apr 19, 2022 at 11:17 PM Allen Pais <apais@linux.microsoft.com> 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 <apais@linux.microsoft.com>
>
> 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?

workqueue uses cfs thread so they will be scheduled like any other
thread. Furthermore, schedule_work uses the default system workqueue
which is shared with a lot of other stuff and doesn't parallel work so
you can expect some performance impact.
If you really want to use workqueue, you should at least create your
own workqueue. But you should also have a look at irq_work; An example
of usage is kernel/sched/sched_cpufrequtil.c

>
> For reference:
> https://lore.kernel.org/dmaengine/YoI4J8taHehMpjFj@matsya/
>
> Yours,
> Linus Walleij

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-05-25  9:24   ` Linus Walleij
  2022-05-25  9:52     ` Vincent Guittot
@ 2022-05-25 11:03     ` Arnd Bergmann
  2022-05-25 15:14       ` David Laight
  2022-05-27  8:06       ` Vinod Koul
  1 sibling, 2 replies; 27+ messages in thread
From: Arnd Bergmann @ 2022-05-25 11:03 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Allen Pais, Vincent Guittot, Arnd Bergmann, olivier.dautricourt,
	Stefan Roese, Vinod Koul, Kees Cook, linux-hardening,
	Ludovic Desroches, Tudor Ambarus, Florian Fainelli, Ray Jui,
	Scott Branden, bcm-kernel-feedback-list, Nicolas Saenz Julienne,
	Paul Cercueil, Eugeniy.Paltsev, Gustavo Pimentel, Viresh Kumar,
	Andy Shevchenko, Leo Li, zw, Zhou Wang, Shawn Guo, Sascha Hauer,
	Sean Wang, Matthias Brugger, Andreas Färber,
	Manivannan Sadhasivam, Logan Gunthorpe, Sanjay R Mehta,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Andy Gross,
	Bjorn Andersson, Krzysztof Kozlowski, green.wan, Orson Zhai,
	Baolin Wang, Lyra Zhang, Patrice CHOTARD, Chen-Yu Tsai,
	Jernej Škrabec, Samuel Holland, dmaengine,
	Linux Kernel Mailing List

On Wed, May 25, 2022 at 11:24 AM Linus Walleij <linus.walleij@linaro.org> wrote:
> On Tue, Apr 19, 2022 at 11:17 PM Allen Pais <apais@linux.microsoft.com> 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 <apais@linux.microsoft.com>
>
> 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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* RE: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-05-25 11:03     ` Arnd Bergmann
@ 2022-05-25 15:14       ` David Laight
       [not found]         ` <6E248F41-6687-4F2B-B847-DB5459BA1344@linux.microsoft.com>
  2022-05-27  8:06       ` Vinod Koul
  1 sibling, 1 reply; 27+ messages in thread
From: David Laight @ 2022-05-25 15:14 UTC (permalink / raw)
  To: 'Arnd Bergmann', Linus Walleij
  Cc: Allen Pais, Vincent Guittot, olivier.dautricourt, Stefan Roese,
	Vinod Koul, Kees Cook, linux-hardening, Ludovic Desroches,
	Tudor Ambarus, Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Nicolas Saenz Julienne, Paul Cercueil,
	Eugeniy.Paltsev, Gustavo Pimentel, Viresh Kumar, Andy Shevchenko,
	Leo Li, zw, Zhou Wang, Shawn Guo, Sascha Hauer, Sean Wang,
	Matthias Brugger, Andreas Färber, Manivannan Sadhasivam,
	Logan Gunthorpe, Sanjay R Mehta, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Andy Gross, Bjorn Andersson, Krzysztof Kozlowski,
	green.wan, Orson Zhai, Baolin Wang, Lyra Zhang, Patrice CHOTARD,
	Chen-Yu Tsai, Jernej Škrabec, Samuel Holland, dmaengine,
	Linux Kernel Mailing List

From: Arnd Bergmann
> Sent: 25 May 2022 12:04
> 
> On Wed, May 25, 2022 at 11:24 AM Linus Walleij <linus.walleij@linaro.org> wrote:
> > On Tue, Apr 19, 2022 at 11:17 PM Allen Pais <apais@linux.microsoft.com> 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 <apais@linux.microsoft.com>
> >
> > 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:

If the 'tasklet' API is based on the softint (or similar)
then changing to workqueue will cause serious grief in many cases
unless the workqueue process runs at a high priority.

Currently softint callbacks are usually higher priority than
any task/process.
So on a busy system they almost always run.
(They can get caught out by a need_resched() call and suddenly
be fighting with normal user processes for cpu time.)

As arnd said, I suspect this will break anything using tasklets
to chain together audio or video buffers.
Any process code doing that would need probbaly to run at a
'middling' RT priority.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
       [not found]         ` <6E248F41-6687-4F2B-B847-DB5459BA1344@linux.microsoft.com>
@ 2022-05-25 17:48           ` Arnd Bergmann
  2022-05-25 18:04             ` Allen Pais
  0 siblings, 1 reply; 27+ messages in thread
From: Arnd Bergmann @ 2022-05-25 17:48 UTC (permalink / raw)
  To: Allen Pais
  Cc: David Laight, Arnd Bergmann, Linus Walleij, Vincent Guittot,
	olivier.dautricourt, Stefan Roese, Vinod Koul, Kees Cook,
	linux-hardening, Ludovic Desroches, Tudor Ambarus,
	Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Nicolas Saenz Julienne, Paul Cercueil,
	Eugeniy.Paltsev, Gustavo Pimentel, Viresh Kumar, Andy Shevchenko,
	Leo Li, zw, Zhou Wang, Shawn Guo, Sascha Hauer, Sean Wang,
	Matthias Brugger, Andreas Färber, Manivannan Sadhasivam,
	Logan Gunthorpe, Sanjay R Mehta, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Andy Gross, Bjorn Andersson, Krzysztof Kozlowski,
	green.wan, Orson Zhai, Baolin Wang, Lyra Zhang, Patrice CHOTARD,
	Chen-Yu Tsai, Jernej Škrabec, Samuel Holland, dmaengine,
	Linux Kernel Mailing List

On Wed, May 25, 2022 at 6:56 PM Allen Pais <apais@linux.microsoft.com> wrote:
>
> Thank you Linus, Arnd, Vincent and David for the feedback.
>
> This is a lot more than a just conversion of API’s. I am in the process
> Of replacing tasklets with threaded irq’s and hopefully that should be
> A better solution than using workqueues.

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.

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.

        Arnd

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-05-25 17:48           ` Arnd Bergmann
@ 2022-05-25 18:04             ` Allen Pais
  0 siblings, 0 replies; 27+ messages in thread
From: Allen Pais @ 2022-05-25 18:04 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: David Laight, Linus Walleij, Vincent Guittot,
	olivier.dautricourt, Stefan Roese, Vinod Koul, Kees Cook,
	linux-hardening, Ludovic Desroches, Tudor Ambarus,
	Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Nicolas Saenz Julienne, Paul Cercueil,
	Eugeniy.Paltsev, Gustavo Pimentel, Viresh Kumar, Andy Shevchenko,
	Leo Li, zw, Zhou Wang, Shawn Guo, Sascha Hauer, Sean Wang,
	Matthias Brugger, Andreas Färber, Manivannan Sadhasivam,
	Logan Gunthorpe, Sanjay R Mehta, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Andy Gross, Bjorn Andersson, Krzysztof Kozlowski,
	green.wan, Orson Zhai, Baolin Wang, Lyra Zhang, Patrice CHOTARD,
	Chen-Yu Tsai, Jernej Škrabec, Samuel Holland, dmaengine,
	Linux Kernel Mailing List


>> 
>> Thank you Linus, Arnd, Vincent and David for the feedback.
>> 
>> This is a lot more than a just conversion of API’s. I am in the process
>> Of replacing tasklets with threaded irq’s and hopefully that should be
>> A better solution than using workqueues.
> 
> 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.

> 
> 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.
> 




^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-05-25 11:03     ` Arnd Bergmann
  2022-05-25 15:14       ` David Laight
@ 2022-05-27  8:06       ` Vinod Koul
  2022-05-27 10:59         ` Arnd Bergmann
  1 sibling, 1 reply; 27+ messages in thread
From: Vinod Koul @ 2022-05-27  8:06 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Walleij, Allen Pais, Vincent Guittot, olivier.dautricourt,
	Stefan Roese, Kees Cook, linux-hardening, Ludovic Desroches,
	Tudor Ambarus, Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Nicolas Saenz Julienne, Paul Cercueil,
	Eugeniy.Paltsev, Gustavo Pimentel, Viresh Kumar, Andy Shevchenko,
	Leo Li, zw, Zhou Wang, Shawn Guo, Sascha Hauer, Sean Wang,
	Matthias Brugger, Andreas Färber, Manivannan Sadhasivam,
	Logan Gunthorpe, Sanjay R Mehta, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Andy Gross, Bjorn Andersson, Krzysztof Kozlowski,
	green.wan, Orson Zhai, Baolin Wang, Lyra Zhang, Patrice CHOTARD,
	Chen-Yu Tsai, Jernej Škrabec, Samuel Holland, dmaengine,
	Linux Kernel Mailing List

On 25-05-22, 13:03, Arnd Bergmann wrote:
> On Wed, May 25, 2022 at 11:24 AM Linus Walleij <linus.walleij@linaro.org> wrote:
> > On Tue, Apr 19, 2022 at 11:17 PM Allen Pais <apais@linux.microsoft.com> 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 <apais@linux.microsoft.com>
> >
> > 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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-05-27  8:06       ` Vinod Koul
@ 2022-05-27 10:59         ` Arnd Bergmann
  2022-05-31  6:56           ` Vinod Koul
  0 siblings, 1 reply; 27+ messages in thread
From: Arnd Bergmann @ 2022-05-27 10:59 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Arnd Bergmann, Linus Walleij, Allen Pais, Vincent Guittot,
	olivier.dautricourt, Stefan Roese, Kees Cook, linux-hardening,
	Ludovic Desroches, Tudor Ambarus, Florian Fainelli, Ray Jui,
	Scott Branden, bcm-kernel-feedback-list, Nicolas Saenz Julienne,
	Paul Cercueil, Eugeniy.Paltsev, Gustavo Pimentel, Viresh Kumar,
	Andy Shevchenko, Leo Li, zw, Zhou Wang, Shawn Guo, Sascha Hauer,
	Sean Wang, Matthias Brugger, Andreas Färber,
	Manivannan Sadhasivam, Logan Gunthorpe, Sanjay R Mehta,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Andy Gross,
	Bjorn Andersson, Krzysztof Kozlowski, green.wan, Orson Zhai,
	Baolin Wang, Lyra Zhang, Patrice CHOTARD, Chen-Yu Tsai,
	Jernej Škrabec, Samuel Holland, dmaengine,
	Linux Kernel Mailing List

On Fri, May 27, 2022 at 10:06 AM Vinod Koul <vkoul@kernel.org> wrote:
> On 25-05-22, 13:03, Arnd Bergmann wrote:
> > 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...

If the idea is to remove tasklets from the kernel for good, then the
choice is only between workqueue and hardirq at this point. The
workqueue version is the one that would make sense for any driver
that just defers execution from the callback down into task context.
If that gets called in task context already, the driver can be simpler.

I took a brief look at the roughly 150 slave drivers, and it does
seem like very few of them actually want task context:

* Over Half the drivers just do a complete(), which could
  probably be pulled into the dmaengine layer and done from
  hardirq, avoiding the callback entirely

* A lot of the remaining drivers have interrupts disabled for
  the entire callback, which means they might as well use
  hardirqs, regardless of what they want

* drivers/crypto/* and drivers/mmc/* tend to call another tasklet
  to do the real work.

* drivers/ata/sata_dwc_460ex.c and drivers/ntb/ntb_transport.c
   probably want task context

* Some drivers like sound/soc/sh/siu_pcm.c start a new DMA
  from the callback. Is that allowed from hardirq?

If we do the first three steps above, and then add a 'struct
completion' pointer to dma_async_tx_descriptor as an alternative
to the callback, that would already reduce the number of drivers
that end up in a tasklet significantly and should be completely
safe.

Unfortunately we can't just move the rest into hardirq
context because that breaks anything using spin_lock_bh
to protect against concurrent execution of the tasklet.

A possible alternative might be to then replace the global
dmaengine tasklet with a custom softirq. Obviously those
are not so hot either,  but dmaengine could be considered
special enough to fit in the same category as net_rx/tx
and block with their global softirqs.

       Arnd

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-05-27 10:59         ` Arnd Bergmann
@ 2022-05-31  6:56           ` Vinod Koul
       [not found]             ` <0A9EDEDC-9E6C-47F8-89C0-48DCDD3F9DE3@linux.microsoft.com>
  0 siblings, 1 reply; 27+ messages in thread
From: Vinod Koul @ 2022-05-31  6:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Walleij, Allen Pais, Vincent Guittot, olivier.dautricourt,
	Stefan Roese, Kees Cook, linux-hardening, Ludovic Desroches,
	Tudor Ambarus, Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Nicolas Saenz Julienne, Paul Cercueil,
	Eugeniy.Paltsev, Gustavo Pimentel, Viresh Kumar, Andy Shevchenko,
	Leo Li, zw, Zhou Wang, Shawn Guo, Sascha Hauer, Sean Wang,
	Matthias Brugger, Andreas Färber, Manivannan Sadhasivam,
	Logan Gunthorpe, Sanjay R Mehta, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Andy Gross, Bjorn Andersson, Krzysztof Kozlowski,
	green.wan, Orson Zhai, Baolin Wang, Lyra Zhang, Patrice CHOTARD,
	Chen-Yu Tsai, Jernej Škrabec, Samuel Holland, dmaengine,
	Linux Kernel Mailing List

On 27-05-22, 12:59, Arnd Bergmann wrote:
> On Fri, May 27, 2022 at 10:06 AM Vinod Koul <vkoul@kernel.org> wrote:
> > On 25-05-22, 13:03, Arnd Bergmann wrote:
> > > 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...
> 
> If the idea is to remove tasklets from the kernel for good, then the
> choice is only between workqueue and hardirq at this point. The
> workqueue version is the one that would make sense for any driver
> that just defers execution from the callback down into task context.
> If that gets called in task context already, the driver can be simpler.
> 
> I took a brief look at the roughly 150 slave drivers, and it does
> seem like very few of them actually want task context:
> 
> * Over Half the drivers just do a complete(), which could
>   probably be pulled into the dmaengine layer and done from
>   hardirq, avoiding the callback entirely
> 
> * A lot of the remaining drivers have interrupts disabled for
>   the entire callback, which means they might as well use
>   hardirqs, regardless of what they want
> 
> * drivers/crypto/* and drivers/mmc/* tend to call another tasklet
>   to do the real work.
> 
> * drivers/ata/sata_dwc_460ex.c and drivers/ntb/ntb_transport.c
>    probably want task context
> 
> * Some drivers like sound/soc/sh/siu_pcm.c start a new DMA
>   from the callback. Is that allowed from hardirq?
> 
> If we do the first three steps above, and then add a 'struct
> completion' pointer to dma_async_tx_descriptor as an alternative
> to the callback, that would already reduce the number of drivers
> that end up in a tasklet significantly and should be completely
> safe.

That is a good idea, lot of drivers are waiting for completion which can
be signalled from hardirq, this would also reduce the hops we have and
help improve latency a bit. On the downside, some controllers provide
error information, which would need to be dealt with.

I will prototype this on Qcom boards I have...

> 
> Unfortunately we can't just move the rest into hardirq
> context because that breaks anything using spin_lock_bh
> to protect against concurrent execution of the tasklet.
> 
> A possible alternative might be to then replace the global
> dmaengine tasklet with a custom softirq. Obviously those
> are not so hot either,  but dmaengine could be considered
> special enough to fit in the same category as net_rx/tx
> and block with their global softirqs.

Yes that would be a very reasonable mechanism, thanks for the
suggestions.

-- 
~Vinod

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
       [not found]             ` <0A9EDEDC-9E6C-47F8-89C0-48DCDD3F9DE3@linux.microsoft.com>
@ 2022-05-31 18:02               ` Arnd Bergmann
  2022-05-31 18:19                 ` Allen Pais
  0 siblings, 1 reply; 27+ messages in thread
From: Arnd Bergmann @ 2022-05-31 18:02 UTC (permalink / raw)
  To: Allen Pais
  Cc: Vinod Koul, Arnd Bergmann, Linus Walleij, Vincent Guittot,
	olivier.dautricourt, Stefan Roese, Kees Cook, linux-hardening,
	Ludovic Desroches, Tudor Ambarus, Florian Fainelli, Ray Jui,
	Scott Branden, bcm-kernel-feedback-list, Nicolas Saenz Julienne,
	Paul Cercueil, Eugeniy.Paltsev, Gustavo Pimentel, Viresh Kumar,
	Andy Shevchenko, Leo Li, zw, Zhou Wang, Shawn Guo, Sascha Hauer,
	Sean Wang, Matthias Brugger, Andreas Färber,
	Manivannan Sadhasivam, Logan Gunthorpe, Sanjay R Mehta,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Andy Gross,
	Bjorn Andersson, Krzysztof Kozlowski, green.wan, Orson Zhai,
	Baolin Wang, Lyra Zhang, Patrice CHOTARD, Chen-Yu Tsai,
	Jernej Škrabec, Samuel Holland, dmaengine,
	Linux Kernel Mailing List

On Tue, May 31, 2022 at 7:02 PM Allen Pais <apais@linux.microsoft.com> wrote:

[note: something is wrong with your email client, your previous reply appears to
be in HTML]

> > That is a good idea, lot of drivers are waiting for completion which can
> > be signalled from hardirq, this would also reduce the hops we have and
> > help improve latency a bit. On the downside, some controllers provide
> > error information, which would need to be dealt with.
>
>
>    I am not an expert in dma subsystem, but by using completion from
> Hardirq context be a concern? Especially with latency.

I don't see how: to the task waiting for the completion, there should
be no difference, and for the irq handler sending it, it just avoids
a few cycles going into softirq context.

> > Yes that would be a very reasonable mechanism, thanks for the
> > suggestions.
>
>   I have started working on the idea of global softirq. A RFC should be ready
> For review soon.

Ok, thanks!

       Arnd

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-05-31 18:02               ` Arnd Bergmann
@ 2022-05-31 18:19                 ` Allen Pais
  2022-05-31 19:27                   ` Arnd Bergmann
  0 siblings, 1 reply; 27+ messages in thread
From: Allen Pais @ 2022-05-31 18:19 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Vinod Koul, Linus Walleij, Vincent Guittot, olivier.dautricourt,
	Stefan Roese, Kees Cook, linux-hardening, Ludovic Desroches,
	Tudor Ambarus, Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Nicolas Saenz Julienne, Paul Cercueil,
	Eugeniy.Paltsev, Gustavo Pimentel, Viresh Kumar, Andy Shevchenko,
	Leo Li, zw, Zhou Wang, Shawn Guo, Sascha Hauer, Sean Wang,
	Matthias Brugger, Andreas Färber, Manivannan Sadhasivam,
	Logan Gunthorpe, Sanjay R Mehta, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Andy Gross, Bjorn Andersson, Krzysztof Kozlowski,
	green.wan, Orson Zhai, Baolin Wang, Lyra Zhang, Patrice CHOTARD,
	Chen-Yu Tsai, Jernej Škrabec, Samuel Holland, dmaengine,
	Linux Kernel Mailing List


> 
> [note: something is wrong with your email client, your previous reply appears to
> be in HTML]
> 
  Sorry, fixed it.

>>> That is a good idea, lot of drivers are waiting for completion which can
>>> be signalled from hardirq, this would also reduce the hops we have and
>>> help improve latency a bit. On the downside, some controllers provide
>>> error information, which would need to be dealt with.
>> 
>> 
>>   I am not an expert in dma subsystem, but by using completion from
>> Hardirq context be a concern? Especially with latency.
> 
> I don't see how: to the task waiting for the completion, there should
> be no difference, and for the irq handler sending it, it just avoids
> a few cycles going into softirq context.

  Thanks for clarification. 

  If I have understood it correctly, your suggestion is to move the current
Callback mechanism out to dmaengine as a generic helper function
And introduce completion in dma_async_tx_descriptor to handle what
Tasklets currently do.

Thanks.

> 
>>> Yes that would be a very reasonable mechanism, thanks for the
>>> suggestions.
>> 
>>  I have started working on the idea of global softirq. A RFC should be ready
>> For review soon.
> 
> Ok, thanks!
> 
>       Arnd


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [RFC 1/1] drivers/dma/*: replace tasklets with workqueue
  2022-05-31 18:19                 ` Allen Pais
@ 2022-05-31 19:27                   ` Arnd Bergmann
  0 siblings, 0 replies; 27+ messages in thread
From: Arnd Bergmann @ 2022-05-31 19:27 UTC (permalink / raw)
  To: Allen Pais
  Cc: Arnd Bergmann, Vinod Koul, Linus Walleij, Vincent Guittot,
	olivier.dautricourt, Stefan Roese, Kees Cook, linux-hardening,
	Ludovic Desroches, Tudor Ambarus, Florian Fainelli, Ray Jui,
	Scott Branden, bcm-kernel-feedback-list, Nicolas Saenz Julienne,
	Paul Cercueil, Eugeniy.Paltsev, Gustavo Pimentel, Viresh Kumar,
	Andy Shevchenko, Leo Li, zw, Zhou Wang, Shawn Guo, Sascha Hauer,
	Sean Wang, Matthias Brugger, Andreas Färber,
	Manivannan Sadhasivam, Logan Gunthorpe, Sanjay R Mehta,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Andy Gross,
	Bjorn Andersson, Krzysztof Kozlowski, green.wan, Orson Zhai,
	Baolin Wang, Lyra Zhang, Patrice CHOTARD, Chen-Yu Tsai,
	Jernej Škrabec, Samuel Holland, dmaengine,
	Linux Kernel Mailing List

On Tue, May 31, 2022 at 8:19 PM Allen Pais <apais@linux.microsoft.com> wrote:
> >>> That is a good idea, lot of drivers are waiting for completion which can
> >>> be signalled from hardirq, this would also reduce the hops we have and
> >>> help improve latency a bit. On the downside, some controllers provide
> >>> error information, which would need to be dealt with.
> >>
> >>
> >>   I am not an expert in dma subsystem, but by using completion from
> >> Hardirq context be a concern? Especially with latency.
> >
> > I don't see how: to the task waiting for the completion, there should
> > be no difference, and for the irq handler sending it, it just avoids
> > a few cycles going into softirq context.
>
>   Thanks for clarification.
>
>   If I have understood it correctly, your suggestion is to move the current
> Callback mechanism out to dmaengine as a generic helper function
> And introduce completion in dma_async_tx_descriptor to handle what
> Tasklets currently do.

Right: around half the callbacks are a trivial version that does nothing
other than calling complete(), so these will benefit from skipping the
softirq, while the others still need the callback.

       Arnd

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2022-05-31 19:27 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19 21:16 [RFC 0/1] refactor all tasklet users into other APIs Allen Pais
     [not found] ` <20220419211658.11403-2-apais@linux.microsoft.com>
2022-04-20  2:31   ` [RFC 1/1] drivers/dma/*: replace tasklets with workqueue Kees Cook
2022-04-22 16:48     ` Allen Pais
2022-04-25 15:06   ` Linus Walleij
2022-04-25 23:59     ` Allen Pais
2022-04-25 15:56   ` Krzysztof Kozlowski
2022-04-25 19:55     ` Gustavo A. R. Silva
2022-04-28  9:29       ` Andy Shevchenko
     [not found]         ` <DA101ED8-F99F-4DCB-9CB7-370A62C44B65@linux.microsoft.com>
2022-05-12 21:54           ` Linus Walleij
2022-05-16 11:40             ` Vinod Koul
2022-04-26  0:04     ` Allen Pais
2022-04-27  2:45   ` Vinod Koul
2022-04-27 15:20     ` Dave Jiang
2022-04-27 15:58       ` Allen Pais
2022-04-27 15:53     ` Allen Pais
2022-05-25  9:24   ` Linus Walleij
2022-05-25  9:52     ` Vincent Guittot
2022-05-25 11:03     ` Arnd Bergmann
2022-05-25 15:14       ` David Laight
     [not found]         ` <6E248F41-6687-4F2B-B847-DB5459BA1344@linux.microsoft.com>
2022-05-25 17:48           ` Arnd Bergmann
2022-05-25 18:04             ` Allen Pais
2022-05-27  8:06       ` Vinod Koul
2022-05-27 10:59         ` Arnd Bergmann
2022-05-31  6:56           ` Vinod Koul
     [not found]             ` <0A9EDEDC-9E6C-47F8-89C0-48DCDD3F9DE3@linux.microsoft.com>
2022-05-31 18:02               ` Arnd Bergmann
2022-05-31 18:19                 ` Allen Pais
2022-05-31 19:27                   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).