gpu/cuda: fix getenv related build error

Message ID 20230803162512.41396-1-levendsayar@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series gpu/cuda: fix getenv related build error |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/Intel-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-unit-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS

Commit Message

Levend Sayar Aug. 3, 2023, 4:25 p.m. UTC
  If gdrapi.h is available, meson sets DRIVERS_GPU_CUDA_GDRCOPY_H as 1.
This causes gdrcopy.c build to give an error;
because compiler can not find signature of getenv.
stdlib.h is included for the definition of getenv function.

Fixes: ca12f5e8a7db ("gpu/cuda: mark unused GDRCopy functions parameters")

Signed-off-by: Levend Sayar <levendsayar@gmail.com>
---
 drivers/gpu/cuda/gdrcopy.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

David Marchand Sept. 29, 2023, 3 p.m. UTC | #1
On Thu, Aug 3, 2023 at 6:25 PM Levend Sayar <levendsayar@gmail.com> wrote:
>
> If gdrapi.h is available, meson sets DRIVERS_GPU_CUDA_GDRCOPY_H as 1.
> This causes gdrcopy.c build to give an error;
> because compiler can not find signature of getenv.
> stdlib.h is included for the definition of getenv function.
>

There was a bug report for this issue:
Bugzilla ID: 1133

> Fixes: ca12f5e8a7db ("gpu/cuda: mark unused GDRCopy functions parameters")

It is probably worth backporting:
Cc: stable@dpdk.org

>
> Signed-off-by: Levend Sayar <levendsayar@gmail.com>

Elena, this is a quick one, review please.
  
Elena Agostini Oct. 5, 2023, 12:42 p.m. UTC | #2
Sounds good to me

Thanks
EA

From: David Marchand <david.marchand@redhat.com>
Date: Friday, 29 September 2023 at 17:00
To: Elena Agostini <eagostini@nvidia.com>
Cc: dev@dpdk.org <dev@dpdk.org>, Levend Sayar <levendsayar@gmail.com>, Aaron Conole <aconole@redhat.com>, romein@astron.nl <romein@astron.nl>
Subject: Re: [PATCH] gpu/cuda: fix getenv related build error
External email: Use caution opening links or attachments


On Thu, Aug 3, 2023 at 6:25 PM Levend Sayar <levendsayar@gmail.com> wrote:
>
> If gdrapi.h is available, meson sets DRIVERS_GPU_CUDA_GDRCOPY_H as 1.
> This causes gdrcopy.c build to give an error;
> because compiler can not find signature of getenv.
> stdlib.h is included for the definition of getenv function.
>

There was a bug report for this issue:
Bugzilla ID: 1133

> Fixes: ca12f5e8a7db ("gpu/cuda: mark unused GDRCopy functions parameters")

It is probably worth backporting:
Cc: stable@dpdk.org

>
> Signed-off-by: Levend Sayar <levendsayar@gmail.com>

Elena, this is a quick one, review please.


--
David Marchand
  
David Marchand Oct. 6, 2023, 10:07 a.m. UTC | #3
On Thu, Aug 3, 2023 at 6:25 PM Levend Sayar <levendsayar@gmail.com> wrote:
>
> If gdrapi.h is available, meson sets DRIVERS_GPU_CUDA_GDRCOPY_H as 1.
> This causes gdrcopy.c build to give an error;
> because compiler can not find signature of getenv.
> stdlib.h is included for the definition of getenv function.
>
> Fixes: ca12f5e8a7db ("gpu/cuda: mark unused GDRCopy functions parameters")
>
> Signed-off-by: Levend Sayar <levendsayar@gmail.com>

Applied, thanks Levend.
  
Levend Sayar Oct. 6, 2023, 7:45 p.m. UTC | #4
My pleasure.
Thanks for ACKing Elena.
Thanks for applying David.

Best,
Levend

> On 6 Oct 2023, at 13:07, David Marchand <david.marchand@redhat.com> wrote:
> 
> On Thu, Aug 3, 2023 at 6:25 PM Levend Sayar <levendsayar@gmail.com> wrote:
>> 
>> If gdrapi.h is available, meson sets DRIVERS_GPU_CUDA_GDRCOPY_H as 1.
>> This causes gdrcopy.c build to give an error;
>> because compiler can not find signature of getenv.
>> stdlib.h is included for the definition of getenv function.
>> 
>> Fixes: ca12f5e8a7db ("gpu/cuda: mark unused GDRCopy functions parameters")
>> 
>> Signed-off-by: Levend Sayar <levendsayar@gmail.com>
> 
> Applied, thanks Levend.
> 
> 
> -- 
> David Marchand
>
  

Patch

diff --git a/drivers/gpu/cuda/gdrcopy.c b/drivers/gpu/cuda/gdrcopy.c
index 322a5dbeb2..bd56b73ce4 100644
--- a/drivers/gpu/cuda/gdrcopy.c
+++ b/drivers/gpu/cuda/gdrcopy.c
@@ -6,6 +6,8 @@ 
 
 #ifdef DRIVERS_GPU_CUDA_GDRCOPY_H
 
+#include <stdlib.h>
+
 static void *gdrclib;
 static gdr_t (*sym_gdr_open)(void);
 static int (*sym_gdr_pin_buffer)(gdr_t g, unsigned long addr, size_t size,