DPDK patches and discussions
 help / color / mirror / Atom feed
From: <eagostini@nvidia.com>
To: <dev@dpdk.org>
Cc: Elena Agostini <eagostini@nvidia.com>
Subject: [PATCH v1 2/2] gpudev: use page_size in comm_list creation
Date: Tue, 1 Mar 2022 19:05:55 +0000	[thread overview]
Message-ID: <20220301190555.20012-2-eagostini@nvidia.com> (raw)
In-Reply-To: <20220301190555.20012-1-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.

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


  reply	other threads:[~2022-03-01 10:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01 19:05 [PATCH v1 1/2] gpudev: add GPU page_size to info eagostini
2022-03-01 19:05 ` eagostini [this message]
2022-03-08 23:59 ` [PATCH v2 " 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

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=20220301190555.20012-2-eagostini@nvidia.com \
    --to=eagostini@nvidia.com \
    --cc=dev@dpdk.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;
as well as URLs for NNTP newsgroup(s).