[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <157428509565.36836.4500949956170655742.stgit@djiang5-desk3.ch.intel.com>
Date: Wed, 20 Nov 2019 14:24:55 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org,
vkoul@...nel.org
Cc: dan.j.williams@...el.com, tony.luck@...el.com, jing.lin@...el.com,
ashok.raj@...el.com, sanjay.k.kumar@...el.com, megha.dey@...el.com,
jacob.jun.pan@...el.com, yi.l.liu@...el.com, axboe@...nel.dk,
akpm@...ux-foundation.org, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, fenghua.yu@...el.com, hpa@...or.com
Subject: [PATCH RFC 12/14] dmaengine: request submit optimization
Adding dsa direct call to dmaengine for optimization. Spectre-v2 makes
indirect branches expensive. Adding direct call to the driver in order
to mitigate that and reduce cycles to initiate a descriptor submit.
Signed-off-by: Dave Jiang <dave.jiang@...el.com>
---
drivers/dma/idxd/dma.c | 5 +++--
include/linux/dmaengine.h | 6 +++++-
include/linux/idxd.h | 23 +++++++++++++++++++++++
usr/include/Makefile | 1 +
4 files changed, 32 insertions(+), 3 deletions(-)
create mode 100644 include/linux/idxd.h
diff --git a/drivers/dma/idxd/dma.c b/drivers/dma/idxd/dma.c
index 07fbc98668ae..b9b4621e504a 100644
--- a/drivers/dma/idxd/dma.c
+++ b/drivers/dma/idxd/dma.c
@@ -8,6 +8,7 @@
#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/dmaengine.h>
#include <uapi/linux/idxd.h>
+#include <linux/idxd.h>
#include "../dmaengine.h"
#include "registers.h"
#include "idxd.h"
@@ -29,8 +30,7 @@ void idxd_parse_completion_status(u8 status, enum dmaengine_tx_result *res)
}
}
-static int idxd_dma_submit_request(struct dma_chan *chan,
- struct dma_request *req)
+int idxd_dma_submit_request(struct dma_chan *chan, struct dma_request *req)
{
struct idxd_wq *wq = container_of(chan, struct idxd_wq, dma_chan);
@@ -39,6 +39,7 @@ static int idxd_dma_submit_request(struct dma_chan *chan,
return -EINVAL;
}
+EXPORT_SYMBOL_GPL(idxd_dma_submit_request);
static int idxd_dma_alloc_chan_resources(struct dma_chan *chan)
{
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 220d241d71ed..cebfa8db60a0 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -1395,6 +1395,7 @@ static inline int dma_get_slave_caps(struct dma_chan *chan,
}
#endif
+#include <linux/idxd.h>
/* dmaengine_submit_request - helper routine for caller to submit
* a DMA request.
* @chan: dma channel context
@@ -1412,7 +1413,10 @@ static inline int dmaengine_submit_request(struct dma_chan *chan,
if (!ddev->device_submit_request)
return -EINVAL;
- return ddev->device_submit_request(chan, req);
+ if (ddev->device_submit_request == idxd_dma_submit_request)
+ return idxd_dma_submit_request(chan, req);
+ else
+ return ddev->device_submit_request(chan, req);
}
/* dmaengine_submit_request_and_wait - helper routine for caller to submit
diff --git a/include/linux/idxd.h b/include/linux/idxd.h
new file mode 100644
index 000000000000..3b7b3fbe86c8
--- /dev/null
+++ b/include/linux/idxd.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright(c) 2019 Intel Corporation. All rights rsvd. */
+#ifndef _LINUX_IDXD_H_
+#define _LINUX_IDXD_H_
+
+struct dmaengine_result;
+struct dma_request;
+struct dma_chan;
+
+typedef void (*dma_async_tx_callback_result)(void *dma_async_param,
+ const struct dmaengine_result *result);
+
+#if IS_ENABLED(CONFIG_INTEL_IDXD)
+int idxd_dma_submit_request(struct dma_chan *chan, struct dma_request *req);
+#else
+static inline int idxd_dma_submit_request(struct dma_chan *chan,
+ struct dma_request *req)
+{
+ return -EOPNOTSUPP;
+}
+#endif
+
+#endif
diff --git a/usr/include/Makefile b/usr/include/Makefile
index 57b20f7b6729..e5cf680efbc2 100644
--- a/usr/include/Makefile
+++ b/usr/include/Makefile
@@ -29,6 +29,7 @@ header-test- += linux/android/binderfs.h
header-test-$(CONFIG_CPU_BIG_ENDIAN) += linux/byteorder/big_endian.h
header-test-$(CONFIG_CPU_LITTLE_ENDIAN) += linux/byteorder/little_endian.h
header-test- += linux/coda.h
+header-test- += linux/iadx.h
header-test- += linux/elfcore.h
header-test- += linux/errqueue.h
header-test- += linux/fsmap.h
Powered by blists - more mailing lists