1
0
forked from rpms/bind
bind/bind-9.16-unit-tests-multicore.patch
DistroBaker 1984850958 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/bind.git#84e2317aef685da5ba32268db0d9abe7b9799362
2021-01-22 20:42:08 +00:00

85 lines
2.7 KiB
Diff

From 0175b942efc2fb6a05a2c76d62a9fb9157141757 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
Date: Wed, 20 Jan 2021 01:01:52 +0100
Subject: [PATCH] Workaround errors in unit test on 56 CPU machine
hp.c should be just implementation detail, but unit tests use it
repeatedly without resetting tid_v_base. Reset the base counter, when
number of processors is configured. Configure it when creating network
manager.
Use id of current thread as a base. Should be usually 0, but must not be
below id of the main thread.
---
bin/named/main.c | 7 -------
lib/isc/hp.c | 1 +
lib/isc/netmgr/netmgr.c | 8 ++++++++
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/bin/named/main.c b/bin/named/main.c
index 9836de9d7f..d1be43a632 100644
--- a/bin/named/main.c
+++ b/bin/named/main.c
@@ -24,7 +24,6 @@
#include <isc/dir.h>
#include <isc/file.h>
#include <isc/hash.h>
-#include <isc/hp.h>
#include <isc/httpd.h>
#include <isc/netmgr.h>
#include <isc/os.h>
@@ -909,12 +908,6 @@ create_managers(void) {
"using %u UDP listener%s per interface", named_g_udpdisp,
named_g_udpdisp == 1 ? "" : "s");
- /*
- * We have ncpus network threads, ncpus worker threads, ncpus
- * old network threads - make it 4x just to be safe. The memory
- * impact is negligible.
- */
- isc_hp_init(4 * named_g_cpus);
named_g_nm = isc_nm_start(named_g_mctx, named_g_cpus);
if (named_g_nm == NULL) {
UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_nm_start() failed");
diff --git a/lib/isc/hp.c b/lib/isc/hp.c
index 3ea13bbe24..e4a98afc82 100644
--- a/lib/isc/hp.c
+++ b/lib/isc/hp.c
@@ -95,6 +95,7 @@ void
isc_hp_init(int max_threads) {
isc__hp_max_threads = max_threads;
isc__hp_max_retired = max_threads * HP_MAX_HPS;
+ atomic_store_release(&tid_v_base, tid());
}
isc_hp_t *
diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c
index 46f0758620..e3469f4c3a 100644
--- a/lib/isc/netmgr/netmgr.c
+++ b/lib/isc/netmgr/netmgr.c
@@ -17,6 +17,7 @@
#include <isc/buffer.h>
#include <isc/condition.h>
#include <isc/errno.h>
+#include <isc/hp.h>
#include <isc/magic.h>
#include <isc/mem.h>
#include <isc/netmgr.h>
@@ -238,6 +239,13 @@ isc_nm_start(isc_mem_t *mctx, uint32_t workers) {
atomic_init(&mgr->keepalive, 30000);
atomic_init(&mgr->advertised, 30000);
+ /*
+ * We have ncpus network threads, ncpus worker threads, ncpus
+ * old network threads - make it 4x just to be safe. The memory
+ * impact is negligible.
+ */
+ isc_hp_init(4 * workers);
+
isc_mutex_init(&mgr->reqlock);
isc_mempool_create(mgr->mctx, sizeof(isc__nm_uvreq_t), &mgr->reqpool);
isc_mempool_setname(mgr->reqpool, "nm_reqpool");
--
2.26.2