mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-01-06 01:11:00 +01:00
CLEANUP: debug: no longer set nor use TH_FL_DUMPING_OTHERS
TH_FL_DUMPING_OTHERS was being used to try to perform exclusion between threads running "show threads" and those producing warnings. Now that it is much more cleanly handled, we don't need that type of protection anymore, which was adding to the complexity of the solution. Let's just get rid of it.
This commit is contained in:
parent
513397ac82
commit
874ba2afed
@ -64,7 +64,7 @@ enum {
|
||||
#define TH_FL_SLEEPING 0x00000008 /* thread won't check its task list before next wakeup */
|
||||
#define TH_FL_STARTED 0x00000010 /* set once the thread starts */
|
||||
#define TH_FL_IN_LOOP 0x00000020 /* set only inside the polling loop */
|
||||
#define TH_FL_DUMPING_OTHERS 0x00000040 /* thread currently dumping other threads */
|
||||
/* unused 0x00000040 */
|
||||
#define TH_FL_IN_SIG_HANDLER 0x00000080 /* thread currently in the generic signal handler */
|
||||
#define TH_FL_IN_DBG_HANDLER 0x00000100 /* thread currently in the debug signal handler */
|
||||
#define TH_FL_IN_WDT_HANDLER 0x00000200 /* thread currently in the wdt signal handler */
|
||||
|
||||
19
src/debug.c
19
src/debug.c
@ -401,18 +401,6 @@ struct buffer *ha_thread_dump_fill(struct buffer *buf, int thr)
|
||||
/* silence bogus warning in gcc 11 without threads */
|
||||
ASSUME(0 <= thr && thr < MAX_THREADS);
|
||||
|
||||
/* A thread that's currently dumping other threads cannot be dumped, or
|
||||
* it will very likely cause a deadlock.
|
||||
*/
|
||||
if (HA_ATOMIC_LOAD(&ha_thread_ctx[thr].flags) & TH_FL_DUMPING_OTHERS)
|
||||
return NULL;
|
||||
|
||||
/* This will be undone in ha_thread_dump_done(). We're using an atomic
|
||||
* OR to also block any possible re-entrance.
|
||||
*/
|
||||
if (HA_ATOMIC_FETCH_OR(&th_ctx->flags, TH_FL_DUMPING_OTHERS) & TH_FL_DUMPING_OTHERS)
|
||||
return NULL;
|
||||
|
||||
if (thr != tid) {
|
||||
struct buffer *old = NULL;
|
||||
|
||||
@ -435,11 +423,8 @@ struct buffer *ha_thread_dump_fill(struct buffer *buf, int thr)
|
||||
buf = HA_ATOMIC_LOAD(&ha_thread_ctx[thr].thread_dump_buffer);
|
||||
if ((ulong)buf & 0x1)
|
||||
break;
|
||||
if (!buf) {
|
||||
/* cancelled: no longer dumping */
|
||||
HA_ATOMIC_AND(&th_ctx->flags, ~TH_FL_DUMPING_OTHERS);
|
||||
if (!buf)
|
||||
return buf;
|
||||
}
|
||||
ha_thread_relax();
|
||||
}
|
||||
}
|
||||
@ -486,8 +471,6 @@ void ha_thread_dump_done(int thr)
|
||||
continue;
|
||||
}
|
||||
} while (!HA_ATOMIC_CAS(&ha_thread_ctx[thr].thread_dump_buffer, &old, NULL));
|
||||
|
||||
HA_ATOMIC_AND(&th_ctx->flags, ~TH_FL_DUMPING_OTHERS);
|
||||
}
|
||||
|
||||
/* dumps into the buffer some information related to task <task> (which may
|
||||
|
||||
@ -2857,9 +2857,6 @@ void run_poll_loop()
|
||||
/* Process a few tasks */
|
||||
process_runnable_tasks();
|
||||
|
||||
/* If this happens this is an accidental leak */
|
||||
BUG_ON(HA_ATOMIC_LOAD(&th_ctx->flags) & TH_FL_DUMPING_OTHERS);
|
||||
|
||||
/* also stop if we failed to cleanly stop all tasks */
|
||||
if (killed > 1)
|
||||
break;
|
||||
|
||||
@ -99,15 +99,13 @@ void wdt_handler(int sig, siginfo_t *si, void *arg)
|
||||
if (!p)
|
||||
goto update_and_leave;
|
||||
|
||||
if ((_HA_ATOMIC_LOAD(&ha_thread_ctx[thr].flags) & (TH_FL_SLEEPING|TH_FL_DUMPING_OTHERS)) ||
|
||||
if ((_HA_ATOMIC_LOAD(&ha_thread_ctx[thr].flags) & TH_FL_SLEEPING) ||
|
||||
(_HA_ATOMIC_LOAD(&ha_tgroup_ctx[tgrp-1].threads_harmless) & thr_bit)) {
|
||||
/* This thread is currently doing exactly nothing
|
||||
* waiting in the poll loop (unlikely but possible),
|
||||
* waiting for all other threads to join the rendez-vous
|
||||
* point (common), or waiting for another thread to
|
||||
* finish an isolated operation (unlikely but possible),
|
||||
* or waiting for another thread to finish dumping its
|
||||
* stack.
|
||||
* finish an isolated operation (unlikely but possible).
|
||||
*/
|
||||
goto update_and_leave;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user