examples/performance-thread: fix build issue with clang 12.0.1

Message ID 20210816131914.544110-1-jerinj@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series examples/performance-thread: fix build issue with clang 12.0.1 |

Checks

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

Commit Message

Jerin Jacob Kollanukkaran Aug. 16, 2021, 1:19 p.m. UTC
  From: Jerin Jacob <jerinj@marvell.com>

In clang 12.0.1 version, the use of pthread_yield() deprecated,
use sched_yield() instead.

log:

Compiling C object
examples/dpdk-pthread_shim.p/performance-thread_pthread_shim_main.c.o
../examples/performance-thread/pthread_shim/main.c: In function
'helloworld_pthread':
../examples/performance-thread/pthread_shim/main.c:75:9: warning:
'pthread_yield' is deprecated: pthread_yield is deprecated, use
sched_yield instead [-Wdeprecated-declarations]

Fixes: 433ba6228f9a ("examples/performance-thread: add pthread_shim app")

Bugzilla ID: 745

Cc: alialnu@oss.nvidia.com

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
---
 examples/performance-thread/pthread_shim/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ali Alnubani Aug. 19, 2021, 7:09 a.m. UTC | #1
> -----Original Message-----
> From: jerinj@marvell.com <jerinj@marvell.com>
> Sent: Monday, August 16, 2021 4:19 PM
> To: John McNamara <john.mcnamara@intel.com>; Ian Betts
> <ian.betts@intel.com>; Tomasz Kulasek <tomaszx.kulasek@intel.com>
> Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; bruce.richardson@intel.com;
> david.marchand@redhat.com; Jerin Jacob <jerinj@marvell.com>; Ali
> Alnubani <alialnu@nvidia.com>
> Subject: [PATCH] examples/performance-thread: fix build issue with clang
> 12.0.1
> 
> From: Jerin Jacob <jerinj@marvell.com>
> 
> In clang 12.0.1 version, the use of pthread_yield() deprecated, use
> sched_yield() instead.
> 
> log:
> 
> Compiling C object
> examples/dpdk-pthread_shim.p/performance-
> thread_pthread_shim_main.c.o
> ../examples/performance-thread/pthread_shim/main.c: In function
> 'helloworld_pthread':
> ../examples/performance-thread/pthread_shim/main.c:75:9: warning:
> 'pthread_yield' is deprecated: pthread_yield is deprecated, use sched_yield
> instead [-Wdeprecated-declarations]
> 
> Fixes: 433ba6228f9a ("examples/performance-thread: add pthread_shim
> app")
> 
> Bugzilla ID: 745
> 
> Cc: alialnu@oss.nvidia.com
> 
> Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> ---

I think this issue might be specific to Fedora Rawhide's build of clang 12.0.1, see my comment in the ticket:
https://bugs.dpdk.org/show_bug.cgi?id=745#c3

Tested-by: Ali Alnubani <alialnu@nvidia.com>

Thanks Jerin.

Ali
  
Thomas Monjalon Aug. 27, 2021, 11:36 a.m. UTC | #2
19/08/2021 09:09, Ali Alnubani:
> From: jerinj@marvell.com <jerinj@marvell.com>
> > In clang 12.0.1 version, the use of pthread_yield() deprecated, use
> > sched_yield() instead.
> > 
> > log:
> > 
> > Compiling C object
> > examples/dpdk-pthread_shim.p/performance-
> > thread_pthread_shim_main.c.o
> > ../examples/performance-thread/pthread_shim/main.c: In function
> > 'helloworld_pthread':
> > ../examples/performance-thread/pthread_shim/main.c:75:9: warning:
> > 'pthread_yield' is deprecated: pthread_yield is deprecated, use sched_yield
> > instead [-Wdeprecated-declarations]
> > 
> > Fixes: 433ba6228f9a ("examples/performance-thread: add pthread_shim
> > app")

adding Cc: stable for other branches.

> > 
> > Bugzilla ID: 745
> > 
> > Cc: alialnu@oss.nvidia.com
> > 
> > Signed-off-by: Jerin Jacob <jerinj@marvell.com>
> > ---
> 
> I think this issue might be specific to Fedora Rawhide's build of clang 12.0.1, see my comment in the ticket:
> https://bugs.dpdk.org/show_bug.cgi?id=745#c3

I hit the same issue on Arch Linux.

> Tested-by: Ali Alnubani <alialnu@nvidia.com>
> 
> Thanks Jerin.

Applied, thanks.
  

Patch

diff --git a/examples/performance-thread/pthread_shim/main.c b/examples/performance-thread/pthread_shim/main.c
index 257de50692..7ce6cfb0c8 100644
--- a/examples/performance-thread/pthread_shim/main.c
+++ b/examples/performance-thread/pthread_shim/main.c
@@ -72,7 +72,7 @@  void *helloworld_pthread(void *arg)
 	print_count++;
 
 	/* yield thread to give opportunity for lock contention */
-	pthread_yield();
+	sched_yield();
 
 	/* retrieve arg from TLS */
 	uint64_t thread_no = (uint64_t) pthread_getspecific(key);