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] app/test-gpudev: use GPU ptr to CPU unmap
Date: Mon, 21 Feb 2022 23:00:52 +0000	[thread overview]
Message-ID: <20220221230052.17607-1-eagostini@nvidia.com> (raw)

From: Elena Agostini <eagostini@nvidia.com>

Use rte_gpu_mem_cpu_map with the GPU memory
pointer.

Signed-off-by: Elena Agostini <eagostini@nvidia.com>
---
 app/test-gpudev/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/test-gpudev/main.c b/app/test-gpudev/main.c
index 417f2d78b7..d4b8b8971d 100644
--- a/app/test-gpudev/main.c
+++ b/app/test-gpudev/main.c
@@ -210,7 +210,7 @@ gpu_mem_cpu_map(uint16_t gpu_id)
 		fprintf(stderr, "rte_gpu_mem_cpu_map returned error\n");
 		goto error;
 	}
-	printf("GPU memory mapped for CPU access at 0x%p\n", ptr_cpu);
+	printf("GPU memory CPU mapped at 0x%p\n", ptr_cpu);
 
 	((uint8_t *)ptr_cpu)[0] = 0x4;
 	((uint8_t *)ptr_cpu)[1] = 0x5;
@@ -221,12 +221,12 @@ gpu_mem_cpu_map(uint16_t gpu_id)
 			((uint8_t *)ptr_cpu)[1],
 			((uint8_t *)ptr_cpu)[2]);
 
-	ret = rte_gpu_mem_cpu_unmap(gpu_id, ptr_cpu);
+	ret = rte_gpu_mem_cpu_unmap(gpu_id, ptr_gpu);
 	if (ret < 0) {
 		fprintf(stderr, "rte_gpu_mem_cpu_unmap returned error %d\n", ret);
 		goto error;
 	}
-	printf("GPU memory mapped for CPU access at 0x%p\n", ptr_cpu);
+	printf("GPU memory CPU unmapped, 0x%p not valid anymore\n", ptr_cpu);
 
 	ret = rte_gpu_mem_free(gpu_id, ptr_gpu);
 	if (ret < 0) {
@@ -240,7 +240,7 @@ gpu_mem_cpu_map(uint16_t gpu_id)
 
 error:
 
-	rte_gpu_mem_cpu_unmap(gpu_id, ptr_cpu);
+	rte_gpu_mem_cpu_unmap(gpu_id, ptr_gpu);
 	rte_gpu_mem_free(gpu_id, ptr_gpu);
 
 	printf("\n=======> TEST: FAILED\n");
-- 
2.17.1


             reply	other threads:[~2022-02-21 14:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21 23:00 eagostini [this message]
2022-02-22 19:05 ` 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=20220221230052.17607-1-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).