lkml.org 
[lkml]   [2017]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 06/60] hyper_dmabuf: map shared pages only once when importing.
Date
From: Mateusz Polrola <mateuszx.potrola@intel.com>

If shared pages of buffer were already mapped on importer side, do
not map them again on next request to export fd.

Signed-off-by: Mateusz Polrola <mateuszx.potrola@intel.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c b/drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c
index 90e0c65..af94359 100644
--- a/drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c
+++ b/drivers/xen/hyper_dmabuf/hyper_dmabuf_ioctl.c
@@ -203,7 +203,7 @@ static int hyper_dmabuf_export_fd_ioctl(void *data)

if (!data) {
printk("user data is NULL\n");
- return -1;
+ return -EINVAL;
}

export_fd_attr = (struct ioctl_hyper_dmabuf_export_fd *)data;
@@ -218,15 +218,17 @@ static int hyper_dmabuf_export_fd_ioctl(void *data)
imported_sgt_info->last_len, imported_sgt_info->nents,
HYPER_DMABUF_ID_IMPORTER_GET_SDOMAIN_ID(imported_sgt_info->hyper_dmabuf_id));

- imported_sgt_info->sgt = hyper_dmabuf_map_pages(imported_sgt_info->gref,
- imported_sgt_info->frst_ofst,
- imported_sgt_info->last_len,
- imported_sgt_info->nents,
- HYPER_DMABUF_ID_IMPORTER_GET_SDOMAIN_ID(imported_sgt_info->hyper_dmabuf_id),
- &imported_sgt_info->shared_pages_info);
-
if (!imported_sgt_info->sgt) {
- return -1;
+ imported_sgt_info->sgt = hyper_dmabuf_map_pages(imported_sgt_info->gref,
+ imported_sgt_info->frst_ofst,
+ imported_sgt_info->last_len,
+ imported_sgt_info->nents,
+ HYPER_DMABUF_ID_IMPORTER_GET_SDOMAIN_ID(imported_sgt_info->hyper_dmabuf_id),
+ &imported_sgt_info->shared_pages_info);
+ if (!imported_sgt_info->sgt) {
+ printk("Failed to create sgt\n");
+ return -EINVAL;
+ }
}

export_fd_attr->fd = hyper_dmabuf_export_fd(imported_sgt_info, export_fd_attr->flags);
--
2.7.4
\
 
 \ /
  Last update: 2017-12-19 20:51    [W:0.396 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site