Skip to contentSkip to conversation

User space to kernel space copy optimization

RFC Sinan Kaya 3 participants 6 messages Nov 16, 2015 – Dec 6, 2015

lore
Share & tools
lore

Sinan Kaya

author
#0 lore raw

One of the things I'm interested in is to use a memcpy capable DMA engine HW to optimize user space and kernel space parameter copying.

Of course, this will not be viable for all parameter sizes but I can see this being useful. The goal is to save power in the cost of little performance.

Before I go and invent my own mechanism, I'd like to have ideas on what an acceptable solution would look like. Especially, I'm looking for a generic implementation that could plug into any DMA engine HW.

Signature · 4 lines
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project
#1 lore raw
Quoted 2 lines · Sinan Kaya

One of the things I'm interested in is to use a memcpy capable DMA engine HW to optimize user space and kernel space parameter copying.

Have you looked at why NET_DMA was deprecated and using DMA engine to do kernel->user copy could be a problem?
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/
?id=77873803363c

Quoted 22 lines

Of course, this will not be viable for all parameter sizes but I can see
this being useful. The goal is to save power in the cost of little performance.

Before I go and invent my own mechanism, I'd like to have ideas on what
an acceptable solution would look like. Especially, I'm looking for a generic implementation that could plug into any DMA engine HW.

Signature · 10 lines
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center,
Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe dmaengine"
in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#2 lore raw
Quoted 7 lines · Dave
Quoted 2 lines

One of the things I'm interested in is to use a memcpy capable DMA

Quoted 1 line

engine HW to optimize user space and kernel space parameter copying.

Have you looked at why NET_DMA was deprecated and using DMA engine to do kernel->user copy could be a problem?
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/
?id=77873803363c

As far as I know, the problem was the TCP/IP stack trying to work on a buffer that was given to the DMA engine for moving. It was causing stale data problems.

The goal was to let DMA engine move the data while TCP/IP stack was working on something else. Then, synchronize on a known point. Of course, when above violation happens; things break.

Are you expecting a similar problem on user space to kernel space interaction? I think the ownership buffers are pretty much defined, isn't it?

Signature · 4 lines
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project
#3 lore raw
Quoted 19 lines · Sinan Kaya
Quoted 11 lines · Dave
Quoted 4 lines

One of the things I'm interested in is to use a memcpy capable DMA

Quoted 2 lines

engine HW to optimize user space and kernel space parameter copying.

Have you looked at why NET_DMA was deprecated and using DMA engine to
do kernel->user copy could be a problem?
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/com
mit/
?id=77873803363c

As far as I know, the problem was the TCP/IP stack trying to work on a
buffer that was given to the DMA engine for moving. It was causing stale
data problems.

Quoted 7 lines

The goal was to let DMA engine move the data while TCP/IP stack was working on something else. Then, synchronize on a known point. Of course, when above violation happens; things break.

Are you expecting a similar problem on user space to kernel space interaction? I think the ownership buffers are pretty much defined, isn't it?

No. I thought you were investigating both ways so thought you might need to be aware.

Quoted 8 lines
Signature · 6 lines
-- 
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center,
Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project
#4 lore raw
In reply to Sinan Kaya
Quoted 10 lines · Sinan Kaya

One of the things I'm interested in is to use a memcpy capable DMA engine HW to optimize user space and kernel space parameter copying.

Of course, this will not be viable for all parameter sizes but I can see this being useful. The goal is to save power in the cost of little performance.

Before I go and invent my own mechanism, I'd like to have ideas on what an acceptable solution would look like. Especially, I'm looking for a generic implementation that could plug into any DMA engine HW.

Do you have a proposal on how this generic solution should look like, broad contours of the design to start off with and we can start from that point

Signature · 1 line
~Vinod
author
#5 lore raw
Quoted 8 lines · Vinod Koul
Quoted 7 lines · Sinan Kaya

One of the things I'm interested in is to use a memcpy capable DMA engine HW to optimize user space and kernel space parameter copying.

Of course, this will not be viable for all parameter sizes but I can see this being useful. The goal is to save power in the cost of little performance.

Quoted 7 lines
Quoted 3 lines

Before I go and invent my own mechanism, I'd like to have ideas on what an acceptable solution would look like. Especially, I'm looking for a generic implementation that could plug into any DMA engine HW.

Do you have a proposal on how this generic solution should look like, broad contours of the design to start off with and we can start from that point

No, not yet. AFAIK, some of these optimization ideas have been tried by the Intel IO/AT in the past (kernel 2.6) and were rejected by the upstream. I wanted to see if anybody had better ideas these days that is upstream friendly.

Signature · 4 lines
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project