* [PATCH v1 1/2] gpudev: add GPU page_size to info
@ 2022-03-01 19:05 eagostini
2022-03-01 19:05 ` [PATCH v1 2/2] gpudev: use page_size in comm_list creation eagostini
2022-03-08 23:59 ` [PATCH v2 1/2] gpudev: add GPU page_size to info eagostini
0 siblings, 2 replies; 5+ messages in thread
From: eagostini @ 2022-03-01 19:05 UTC (permalink / raw)
To: dev; +Cc: Elena Agostini
From: Elena Agostini <eagostini@nvidia.com>
Page alignment on the GPU can be different from
the CPU page alignment.
Signed-off-by: Elena Agostini <eagostini@nvidia.com>
---
drivers/gpu/cuda/cuda.c | 4 ++++
lib/gpudev/rte_gpudev.h | 2 ++
2 files changed, 6 insertions(+)
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index efb5d146f6..2f8c4684ce 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -523,6 +523,8 @@ cuda_dev_info_get(struct rte_gpu *dev, struct rte_gpu_info *info)
}
dev->mpshared->info.total_memory = parent_info.total_memory;
+ dev->mpshared->info.page_size = parent_info.page_size;
+
/*
* GPU Device private info
*/
@@ -1173,6 +1175,8 @@ cuda_gpu_probe(__rte_unused struct rte_pci_driver *pci_drv, struct rte_pci_devic
return -rte_errno;
}
+ dev->mpshared->info.page_size = (size_t)GPU_PAGE_SIZE;
+
/*
* GPU Device private info
*/
diff --git a/lib/gpudev/rte_gpudev.h b/lib/gpudev/rte_gpudev.h
index 7e2401a4b7..971aeacfff 100644
--- a/lib/gpudev/rte_gpudev.h
+++ b/lib/gpudev/rte_gpudev.h
@@ -61,6 +61,8 @@ struct rte_gpu_info {
size_t total_memory;
/* Local NUMA memory ID. -1 if unknown. */
int16_t numa_node;
+ /* Get GPU memory page size. */
+ size_t page_size;
};
/** Flags passed in notification callback. */
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 2/2] gpudev: use page_size in comm_list creation
2022-03-01 19:05 [PATCH v1 1/2] gpudev: add GPU page_size to info eagostini
@ 2022-03-01 19:05 ` eagostini
2022-03-08 23:59 ` [PATCH v2 1/2] gpudev: add GPU page_size to info eagostini
1 sibling, 0 replies; 5+ messages in thread
From: eagostini @ 2022-03-01 19:05 UTC (permalink / raw)
To: dev; +Cc: Elena Agostini
From: Elena Agostini <eagostini@nvidia.com>
Memory allocated for CPU mapping the status flag
in the communication list should be aligned to the
GPU page size.
Signed-off-by: Elena Agostini <eagostini@nvidia.com>
---
lib/gpudev/gpudev.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/gpudev/gpudev.c b/lib/gpudev/gpudev.c
index fb1bee344c..56033f4a5f 100644
--- a/lib/gpudev/gpudev.c
+++ b/lib/gpudev/gpudev.c
@@ -820,6 +820,7 @@ rte_gpu_comm_create_list(uint16_t dev_id,
uint32_t idx_l;
int ret;
struct rte_gpu *dev;
+ struct rte_gpu_info info;
if (num_comm_items == 0) {
rte_errno = EINVAL;
@@ -833,6 +834,12 @@ rte_gpu_comm_create_list(uint16_t dev_id,
return NULL;
}
+ ret = rte_gpu_info_get(dev_id, &info);
+ if (ret < 0) {
+ rte_errno = ENODEV;
+ return NULL;
+ }
+
comm_list = rte_zmalloc(NULL,
sizeof(struct rte_gpu_comm_list) * num_comm_items, 0);
if (comm_list == NULL) {
@@ -855,7 +862,7 @@ rte_gpu_comm_create_list(uint16_t dev_id,
*/
comm_list[0].status_d = rte_gpu_mem_alloc(dev_id,
sizeof(enum rte_gpu_comm_list_status) * num_comm_items,
- rte_mem_page_size());
+ info.page_size);
if (ret < 0) {
rte_errno = ENOMEM;
return NULL;
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] gpudev: use page_size in comm_list creation
2022-03-08 23:59 ` [PATCH v2 2/2] gpudev: use page_size in comm_list creation eagostini
@ 2022-03-08 22:32 ` Thomas Monjalon
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2022-03-08 22:32 UTC (permalink / raw)
To: Elena Agostini; +Cc: dev
09/03/2022 00:59, eagostini@nvidia.com:
> From: Elena Agostini <eagostini@nvidia.com>
>
> Memory allocated for CPU mapping the status flag
> in the communication list should be aligned to the
> GPU page size.
>
> Fixes: 9b8cae4d991e ("gpudev: use CPU mapping in communication list")
> Signed-off-by: Elena Agostini <eagostini@nvidia.com>
Patches squashed and applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] gpudev: add GPU page_size to info
2022-03-01 19:05 [PATCH v1 1/2] gpudev: add GPU page_size to info eagostini
2022-03-01 19:05 ` [PATCH v1 2/2] gpudev: use page_size in comm_list creation eagostini
@ 2022-03-08 23:59 ` eagostini
2022-03-08 23:59 ` [PATCH v2 2/2] gpudev: use page_size in comm_list creation eagostini
1 sibling, 1 reply; 5+ messages in thread
From: eagostini @ 2022-03-08 23:59 UTC (permalink / raw)
To: dev; +Cc: Elena Agostini
From: Elena Agostini <eagostini@nvidia.com>
Page alignment on the GPU can be different from
the CPU page alignment.
Fixes: 9b8cae4d991e ("gpudev: use CPU mapping in communication list")
Signed-off-by: Elena Agostini <eagostini@nvidia.com>
---
drivers/gpu/cuda/cuda.c | 4 ++++
lib/gpudev/rte_gpudev.h | 2 ++
2 files changed, 6 insertions(+)
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index cf9e59535c..8505d39d64 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -523,6 +523,8 @@ cuda_dev_info_get(struct rte_gpu *dev, struct rte_gpu_info *info)
}
dev->mpshared->info.total_memory = parent_info.total_memory;
+ dev->mpshared->info.page_size = parent_info.page_size;
+
/*
* GPU Device private info
*/
@@ -1173,6 +1175,8 @@ cuda_gpu_probe(__rte_unused struct rte_pci_driver *pci_drv, struct rte_pci_devic
return -rte_errno;
}
+ dev->mpshared->info.page_size = (size_t)GPU_PAGE_SIZE;
+
/*
* GPU Device private info
*/
diff --git a/lib/gpudev/rte_gpudev.h b/lib/gpudev/rte_gpudev.h
index 7e2401a4b7..971aeacfff 100644
--- a/lib/gpudev/rte_gpudev.h
+++ b/lib/gpudev/rte_gpudev.h
@@ -61,6 +61,8 @@ struct rte_gpu_info {
size_t total_memory;
/* Local NUMA memory ID. -1 if unknown. */
int16_t numa_node;
+ /* Get GPU memory page size. */
+ size_t page_size;
};
/** Flags passed in notification callback. */
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] gpudev: use page_size in comm_list creation
2022-03-08 23:59 ` [PATCH v2 1/2] gpudev: add GPU page_size to info eagostini
@ 2022-03-08 23:59 ` eagostini
2022-03-08 22:32 ` Thomas Monjalon
0 siblings, 1 reply; 5+ messages in thread
From: eagostini @ 2022-03-08 23:59 UTC (permalink / raw)
To: dev; +Cc: Elena Agostini
From: Elena Agostini <eagostini@nvidia.com>
Memory allocated for CPU mapping the status flag
in the communication list should be aligned to the
GPU page size.
Fixes: 9b8cae4d991e ("gpudev: use CPU mapping in communication list")
Signed-off-by: Elena Agostini <eagostini@nvidia.com>
---
lib/gpudev/gpudev.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/gpudev/gpudev.c b/lib/gpudev/gpudev.c
index fb1bee344c..56033f4a5f 100644
--- a/lib/gpudev/gpudev.c
+++ b/lib/gpudev/gpudev.c
@@ -820,6 +820,7 @@ rte_gpu_comm_create_list(uint16_t dev_id,
uint32_t idx_l;
int ret;
struct rte_gpu *dev;
+ struct rte_gpu_info info;
if (num_comm_items == 0) {
rte_errno = EINVAL;
@@ -833,6 +834,12 @@ rte_gpu_comm_create_list(uint16_t dev_id,
return NULL;
}
+ ret = rte_gpu_info_get(dev_id, &info);
+ if (ret < 0) {
+ rte_errno = ENODEV;
+ return NULL;
+ }
+
comm_list = rte_zmalloc(NULL,
sizeof(struct rte_gpu_comm_list) * num_comm_items, 0);
if (comm_list == NULL) {
@@ -855,7 +862,7 @@ rte_gpu_comm_create_list(uint16_t dev_id,
*/
comm_list[0].status_d = rte_gpu_mem_alloc(dev_id,
sizeof(enum rte_gpu_comm_list_status) * num_comm_items,
- rte_mem_page_size());
+ info.page_size);
if (ret < 0) {
rte_errno = ENOMEM;
return NULL;
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-03-08 22:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 19:05 [PATCH v1 1/2] gpudev: add GPU page_size to info eagostini
2022-03-01 19:05 ` [PATCH v1 2/2] gpudev: use page_size in comm_list creation eagostini
2022-03-08 23:59 ` [PATCH v2 1/2] gpudev: add GPU page_size to info eagostini
2022-03-08 23:59 ` [PATCH v2 2/2] gpudev: use page_size in comm_list creation eagostini
2022-03-08 22:32 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).