Set thread and CPU channels to ignore duplicates

Some of the PRV channels no longer need to skip duplicates.
This commit is contained in:
Rodrigo Arias 2023-03-13 17:17:14 +01:00 committed by Rodrigo Arias Mallo
parent e625897766
commit 8da0342760
2 changed files with 17 additions and 13 deletions

View File

@ -27,10 +27,8 @@ static int chan_type[] = {
[CPU_CHAN_THACT] = -1,
};
static long chan_flags[] = {
[CPU_CHAN_PID] = PRV_SKIPDUP,
[CPU_CHAN_TID] = PRV_SKIPDUP,
[CPU_CHAN_NRUN] = PRV_SKIPDUP | PRV_ZERO,
static long prv_flags[] = {
[CPU_CHAN_NRUN] = PRV_ZERO,
};
void
@ -116,11 +114,12 @@ cpu_init_end(struct cpu *cpu)
chan_fmt, cpu->gindex, chan_name[i]);
}
chan_prop_set(&cpu->chan[CPU_CHAN_NRUN], CHAN_ALLOW_DUP, 1);
chan_prop_set(&cpu->chan[CPU_CHAN_TID], CHAN_ALLOW_DUP, 1);
chan_prop_set(&cpu->chan[CPU_CHAN_PID], CHAN_ALLOW_DUP, 1);
chan_prop_set(&cpu->chan[CPU_CHAN_THRUN], CHAN_ALLOW_DUP, 1);
chan_prop_set(&cpu->chan[CPU_CHAN_THACT], CHAN_ALLOW_DUP, 1);
/* Duplicates may be written when a thread changes the state */
chan_prop_set(&cpu->chan[CPU_CHAN_NRUN], CHAN_IGNORE_DUP, 1);
chan_prop_set(&cpu->chan[CPU_CHAN_TID], CHAN_IGNORE_DUP, 1);
chan_prop_set(&cpu->chan[CPU_CHAN_PID], CHAN_IGNORE_DUP, 1);
chan_prop_set(&cpu->chan[CPU_CHAN_THRUN], CHAN_IGNORE_DUP, 1);
chan_prop_set(&cpu->chan[CPU_CHAN_THACT], CHAN_IGNORE_DUP, 1);
cpu->is_init = 1;
@ -155,7 +154,7 @@ cpu_connect(struct cpu *cpu, struct bay *bay, struct recorder *rec)
continue;
long row = cpu->gindex;
long flags = chan_flags[i];
long flags = prv_flags[i];
if (prv_register(prv, row, type, bay, c, flags)) {
err("prv_register failed");
return -1;

View File

@ -22,8 +22,11 @@ static const int chan_type[] = {
};
static const long prv_flags[] = {
[TH_CHAN_CPU] = PRV_SKIPDUP | PRV_NEXT, /* Add one to the cpu gindex */
[TH_CHAN_TID] = PRV_SKIPDUP,
/* Add one to the zero-based cpu gindex */
[TH_CHAN_CPU] = PRV_NEXT,
/* FIXME: Only needed for delayed connect, as the state channel is used
* as select in the muxes, which is set to dirty when connecting it. */
[TH_CHAN_STATE] = PRV_SKIPDUP,
};
@ -144,7 +147,9 @@ thread_init_end(struct thread *th)
chan_fmt, th->gindex, chan_name[i]);
}
chan_prop_set(&th->chan[TH_CHAN_TID], CHAN_ALLOW_DUP, 1);
/* The transition Running -> Cooling causes a duplicate (the thread is
* still active) */
chan_prop_set(&th->chan[TH_CHAN_TID], CHAN_IGNORE_DUP, 1);
th->is_init = 1;
return 0;