From: Fenghua Yu <fenghua.yu@intel.com>
To: "Vinod Koul" <vkoul@kernel.org>, "Dave Jiang" <dave.jiang@intel.com>
Cc: dmaengine@vger.kernel.org,
"linux-kernel" <linux-kernel@vger.kernel.org>,
Tony Zhu <tony.zhu@intel.com>, Fenghua Yu <fenghua.yu@intel.com>
Subject: [PATCH v2 07/16] dmaengine: idxd: create kmem cache for event log fault items
Date: Mon, 6 Mar 2023 08:31:29 -0800 [thread overview]
Message-ID: <20230306163138.587484-8-fenghua.yu@intel.com> (raw)
In-Reply-To: <20230306163138.587484-1-fenghua.yu@intel.com>
From: Dave Jiang <dave.jiang@intel.com>
Add a kmem cache per device for allocating event log fault context. The
context allows an event log entry to be copied and passed to a software
workqueue to be processed. Due to each device can have different sized
event log entry depending on device type, it's not possible to have a
global kmem cache.
Tested-by: Tony Zhu <tony.zhu@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Co-developed-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
drivers/dma/idxd/idxd.h | 10 ++++++++++
drivers/dma/idxd/init.c | 9 +++++++++
drivers/dma/idxd/sysfs.c | 1 +
3 files changed, 20 insertions(+)
diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h
index 6e56361ae658..c5d99c179902 100644
--- a/drivers/dma/idxd/idxd.h
+++ b/drivers/dma/idxd/idxd.h
@@ -274,6 +274,15 @@ struct idxd_evl {
u16 head;
};
+struct idxd_evl_fault {
+ struct work_struct work;
+ struct idxd_wq *wq;
+ u8 status;
+
+ /* make this last member always */
+ struct __evl_entry entry[];
+};
+
struct idxd_device {
struct idxd_dev idxd_dev;
struct idxd_driver_data *data;
@@ -331,6 +340,7 @@ struct idxd_device {
unsigned long *opcap_bmap;
struct idxd_evl *evl;
+ struct kmem_cache *evl_cache;
struct dentry *dbgfs_dir;
struct dentry *dbgfs_evl_file;
diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
index d19bc6389221..a7c98fac7a85 100644
--- a/drivers/dma/idxd/init.c
+++ b/drivers/dma/idxd/init.c
@@ -346,6 +346,15 @@ static int idxd_init_evl(struct idxd_device *idxd)
spin_lock_init(&evl->lock);
evl->size = IDXD_EVL_SIZE_MIN;
+
+ idxd->evl_cache = kmem_cache_create(dev_name(idxd_confdev(idxd)),
+ sizeof(struct idxd_evl_fault) + evl_ent_size(idxd),
+ 0, 0, NULL);
+ if (!idxd->evl_cache) {
+ kfree(evl);
+ return -ENOMEM;
+ }
+
idxd->evl = evl;
return 0;
}
diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
index 163fdfaa5022..8b9dfa0d2b99 100644
--- a/drivers/dma/idxd/sysfs.c
+++ b/drivers/dma/idxd/sysfs.c
@@ -1718,6 +1718,7 @@ static void idxd_conf_device_release(struct device *dev)
kfree(idxd->wqs);
kfree(idxd->engines);
kfree(idxd->evl);
+ kmem_cache_destroy(idxd->evl_cache);
ida_free(&idxd_ida, idxd->id);
bitmap_free(idxd->opcap_bmap);
kfree(idxd);
--
2.37.1
next prev parent reply other threads:[~2023-03-06 16:46 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-06 16:31 [PATCH v2 00/16] Enable DSA 2.0 Event Log and completion record faulting features Fenghua Yu
2023-03-06 16:31 ` [PATCH v2 01/16] dmaengine: idxd: make misc interrupt one shot Fenghua Yu
2023-03-06 16:31 ` [PATCH v2 02/16] dmaengine: idxd: add event log size sysfs attribute Fenghua Yu
2023-03-06 16:31 ` [PATCH v2 03/16] dmaengine: idxd: setup event log configuration Fenghua Yu
2023-03-06 16:31 ` [PATCH v2 04/16] dmaengine: idxd: add interrupt handling for event log Fenghua Yu
2023-03-06 16:31 ` [PATCH v2 05/16] dmanegine: idxd: add debugfs for event log dump Fenghua Yu
2023-03-06 16:31 ` [PATCH v2 06/16] dmaengine: idxd: add per DSA wq workqueue for processing cr faults Fenghua Yu
2023-03-06 16:31 ` Fenghua Yu [this message]
2023-03-06 16:31 ` [PATCH v2 08/16] iommu: define and export iommu_access_remote_vm() Fenghua Yu
2023-03-07 1:41 ` Baolu Lu
2023-03-07 17:55 ` Fenghua Yu
2023-03-08 2:23 ` Baolu Lu
2023-03-20 13:35 ` Christoph Hellwig
2023-03-31 0:44 ` Fenghua Yu
2023-03-07 8:40 ` Jean-Philippe Brucker
2023-03-07 16:33 ` Fenghua Yu
2023-03-11 17:31 ` Fenghua Yu
2023-03-06 16:31 ` [PATCH v2 09/16] dmaengine: idxd: process user page faults for completion record Fenghua Yu
2023-03-06 16:31 ` [PATCH v2 10/16] dmaengine: idxd: add descs_completed field " Fenghua Yu
2023-03-06 16:31 ` [PATCH v2 11/16] dmaengine: idxd: process batch descriptor completion record faults Fenghua Yu
2023-03-06 16:31 ` [PATCH v2 12/16] dmaengine: idxd: add per file user counters for " Fenghua Yu
2023-03-06 16:31 ` [PATCH v2 13/16] dmaengine: idxd: add a device to represent the file opened Fenghua Yu
2023-03-06 16:31 ` [PATCH v2 14/16] dmaengine: idxd: expose fault counters to sysfs Fenghua Yu
2023-03-06 16:31 ` [PATCH v2 15/16] dmaengine: idxd: add pid to exported sysfs attribute for opened file Fenghua Yu
2023-03-06 16:31 ` [PATCH v2 16/16] dmaengine: idxd: add per wq PRS disable Fenghua Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230306163138.587484-8-fenghua.yu@intel.com \
--to=fenghua.yu@intel.com \
--cc=dave.jiang@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.zhu@intel.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox