Skip to contentSkip to conversation

idxd: shared workqueues and dmaengine

DISCUSSION Kevin Krakauer 2 participants 4 messages Mar 27, 2025 dmaengine

lore
Share & tools
lore
#0 lore raw

Hey, I'm trying to use idxd inside the kernel via dmaengine. I'm attempting to get shared work queues (SWQs) via dma_find_channel(), which stubbornly returns NULL.

After a lot of printk-ing, I finally ran across DMA_PRIVATE. I also found [1] and saw that DMA_PRIVATE is also set in the idxd driver since c06e424be5f51844 ("dmaengine: idxd: set DMA channel to be private").

It seems like this forces use of dma_request_channel(). But I believe the idea behind SWQs is that they don't have to be exclusively owned.

Is there a way to use SWQs via dma_find_channel()? dma_request_channel() seems like overkill, as the point of SWQs is to not be exclusive. Also a good chance I'm missing something basic here :)

Thanks!
Kevin

1 - https://lore.kernel.org/dmaengine/[email protected]/#R

#1 lore raw
Quoted 8 lines · Kevin Krakauer

Hey, I'm trying to use idxd inside the kernel via dmaengine. I'm attempting to get shared work queues (SWQs) via dma_find_channel(), which stubbornly returns NULL.

After a lot of printk-ing, I finally ran across DMA_PRIVATE. I also found [1] and saw that DMA_PRIVATE is also set in the idxd driver since c06e424be5f51844 ("dmaengine: idxd: set DMA channel to be private").

Quoted 6 lines

It seems like this forces use of dma_request_channel(). But I believe the idea behind SWQs is that they don't have to be exclusively owned.

Is there a way to use SWQs via dma_find_channel()? dma_request_channel() seems like overkill, as the point of SWQs is to not be exclusive. Also a good chance I'm missing something basic here :)

+Vinicius, current maintainer of the driver.

So I think maybe a new sysfs attribute can be added to wq to allow the user to choose whether to make the channel DMA_PRIVATE or not. By default it can be set to DMA_PRIVATE to keep legacy behavior. I think that should solve the issue you are encountering?

Quoted 5 lines

Thanks!
Kevin

1 - https://lore.kernel.org/dmaengine/[email protected]/#R

#2 lore raw
Quoted 1 line · Dave Jiang

So I think maybe a new sysfs attribute can be added to wq to allow the user to choose whether to make the channel DMA_PRIVATE or not. By default it can be set to DMA_PRIVATE to keep legacy behavior. I think that should solve the issue you are encountering?

Yep, that would do it. Thanks for helping me understand -- I was wondering whether I was missing something.

Easy for me to workaround for now, or maybe I'll just add the sysfs attribute and send it to the list. Thanks!

#3 lore raw
Quoted 8 lines · Kevin Krakauer
Quoted 1 line · Dave Jiang

So I think maybe a new sysfs attribute can be added to wq to allow the user to choose whether to make the channel DMA_PRIVATE or not. By default it can be set to DMA_PRIVATE to keep legacy behavior. I think that should solve the issue you are encountering?

Yep, that would do it. Thanks for helping me understand -- I was wondering whether I was missing something.

Easy for me to workaround for now, or maybe I'll just add the sysfs attribute and send it to the list. Thanks!

Patches are always welcome. I'm sure Vinicius would appreciate it.