BUG/MINOR: cpu-topo: use ha_diag_notice() to report thread creations

Using ha_diag_warning() to report the number of threads created resulted
in warnings being counted and possibly an error being fired when combined
with -dW:

  $ printf "global\nstats socket /tmp/sock1\n" | ./haproxy -dD -dW -c -f /dev/stdin; echo $?
  [NOTICE]   (10406) : haproxy version is 3.5-dev0-5091ac-35
  [NOTICE]   (10406) : path to executable is ./haproxy
  [DIAG]     (10406) : Created 20 threads split into 2 groups
  [ALERT]    (10406) : Some warnings were found and 'zero-warning' is set. Aborting.
  1

Now that we have ha_diag_notice(), let's use it:

  $ printf "global\nstats socket /tmp/sock1\n" | ./haproxy -dD -dW -c -f /dev/stdin; echo $?
  [DIAG]     (10513) : Created 20 threads split into 2 groups
  0

It would make sense to backport this to 3.2 because it helps validate configs
against diag warnings without triggering a false positive. It depends on
this previous patch:

  MINOR: errors: add ha_diag_notice() to report diag-level notifications
This commit is contained in:
Willy Tarreau 2026-06-11 18:40:08 +02:00
parent 7d63efa5f5
commit 960fa1c921

View file

@ -1279,7 +1279,7 @@ static int cpu_policy_first_usable_node(int policy, int tmin, int tmax, int gmin
if (tmin <= thr_count && thr_count < tmax)
tmax = thr_count;
ha_diag_warning("Multi-socket cpu detected, automatically binding on active CPUs of '%d' (%u active cpu(s))\n", first_node_id, cpu_count);
ha_diag_notice("Multi-socket cpu detected, automatically binding on active CPUs of '%d' (%u active cpu(s))\n", first_node_id, cpu_count);
if (!global.nbthread)
global.nbthread = tmax;
@ -1586,9 +1586,9 @@ static int cpu_policy_group_by_cluster(int policy, int tmin, int tmax, int gmin,
}
if (global.nbthread)
ha_diag_warning("Created %d threads split into %d groups\n", global.nbthread, global.nbtgroups);
ha_diag_notice("Created %d threads split into %d groups\n", global.nbthread, global.nbtgroups);
else
ha_diag_warning("Could not determine any CPU cluster\n");
ha_diag_notice("Could not determine any CPU cluster\n");
return 0;
}
@ -1684,9 +1684,9 @@ static int cpu_policy_group_by_ccx(int policy, int tmin, int tmax, int gmin, int
}
if (global.nbthread)
ha_diag_warning("Created %d threads split into %d groups\n", global.nbthread, global.nbtgroups);
ha_diag_notice("Created %d threads split into %d groups\n", global.nbthread, global.nbtgroups);
else
ha_diag_warning("Could not determine any CPU cluster\n");
ha_diag_notice("Could not determine any CPU cluster\n");
return 0;
}