From 832342e3a4c25520ea95b4bac9402798832dfaf2 Mon Sep 17 00:00:00 2001 From: hsandid Date: Wed, 20 Dec 2023 15:41:54 +0100 Subject: vlib: add error checks to thread pinning Type: fix Added error checks around pthread_setaffinity_np calls to stop vpp launch if pinning fails. Change-Id: Iec391c485d1832b6c2ff20fbf789608f6bcf7b57 Signed-off-by: hsandid --- src/vpp/vnet/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/vpp') diff --git a/src/vpp/vnet/main.c b/src/vpp/vnet/main.c index be34228f01d..3257d9cda57 100644 --- a/src/vpp/vnet/main.c +++ b/src/vpp/vnet/main.c @@ -325,7 +325,13 @@ defaulted: { CPU_ZERO (&cpuset); CPU_SET (main_core, &cpuset); - pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset); + if (pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), + &cpuset)) + { + clib_unix_error ( + "pthread_setaffinity_np() on cpu %d failed for main thread", + main_core); + } } /* Set up the plugin message ID allocator right now... */ -- cgit 1.2.3-korg