Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ ifdef NO_DEVICES
CFLAGS += -DNO_DEVICES
endif

ifdef LOGBUF
CFLAGS += -DH2K_LOGBUF
endif

ifdef MULTICORE
CFLAGS += -DMULTICORE
endif
Expand Down Expand Up @@ -138,6 +134,34 @@ $(foreach MODPATH,$(MKINCLUDES),$(eval $(DO_INCLUDE)))

ALL_OFILES := $(REF_OFILES) $(CHECK_OFILES) $(OPT_V2_OFILES) $(OPT_V3_OFILES) $(OPT_V4_OFILES) $(OPT_V5_OFILES) $(OPT_V60_OFILES) $(OPT_V65_OFILES) $(OPT_V68_OFILES) $(OPT_V73_OFILES) $(OPT_V81_OFILES)

ifdef LOGBUF
_logbuf_one_mod := $(word 1,$(subst [, ,$(LOGBUF)))
_logbuf_one_level := $(subst ],,$(word 2,$(subst [, ,$(LOGBUF))))
ifeq ($(_logbuf_one_mod),1)
CFLAGS += -DH2K_LOGBUF
ifneq ($(_logbuf_one_level),)
CFLAGS += -DH2K_LOG_LEVEL=$(_logbuf_one_level)
endif
else
_logbuf_comma := ,

$(foreach _tok,$(subst $(_logbuf_comma), ,$(LOGBUF)),\
$(eval _ll_mod := $(word 1,$(subst [, ,$(_tok))))\
$(eval _ll_level := $(subst ],,$(word 2,$(subst [, ,$(_tok)))))\
$(eval _logbuf_hits := $(filter %/$(basename $(_ll_mod)).o,$(ALL_OFILES)))\
$(if $(_logbuf_hits),,\
$(eval _logbuf_hits := $(foreach _o,$(ALL_OFILES),$(if $(findstring /$(_ll_mod)/,$(_o)),$(_o)))))\
$(if $(_logbuf_hits),\
$(eval $(_logbuf_hits) : CFLAGS += -DH2K_LOGBUF)\
$(if $(_ll_level),$(eval $(_logbuf_hits) : CFLAGS += -DH2K_LOG_LEVEL=$(_ll_level))),\
$(warning LOGBUF: token '$(_ll_mod)' matched no kernel sources)))

$(foreach _o,$(ALL_OFILES),\
$(if $(findstring /util/log/,$(_o)),$(eval $(_o) : CFLAGS += -DH2K_LOGBUF)) \
$(if $(findstring /init/setup/,$(_o)),$(eval $(_o) : CFLAGS += -DH2K_LOGBUF)))
endif
endif

$(ALL_OFILES): $(DEST_HFILES)

ifeq ($(ARCHV),3)
Expand Down
4 changes: 2 additions & 2 deletions kernel/data/globals/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ typedef struct {
u32_t noc_sbase; // 4k pages

H2K_spinlock_t logbuf_lock;
char *logbuf;
u32_t logbuf_pos; // first free byte
char *logbuf[MAX_HTHREADS];
u32_t logbuf_pos[MAX_HTHREADS];
u32_t logbuf_enable;
u32_t log_enable;
H2K_spinlock_t angel_lock;
Expand Down
8 changes: 4 additions & 4 deletions kernel/data/readylist/readylist.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static inline void H2K_update_coprocs(u32_t hthread, u32_t hthread_xe, u32_t hth
}
} else {
if (head_xe) {
H2K_log("hthread %d update_coprocs: add xe\n", hthread);
H2K_log_once_ht("hthread %d update_coprocs: add xe\n", hthread);
}
}
if (hthread_xe2) {
Expand Down Expand Up @@ -148,7 +148,7 @@ static inline H2K_thread_context *H2K_ready_head(u32_t prio, u32_t hthread) {
u32_t need_tmp = need; // save # needed coprocs when walking ready list
u32_t i;

H2K_log("hthread %d have %d need %d head_xe %d head_xe2 %d head_xe3 %d counts %d %d %d %d \n\tcheck task 0x%08x\n", hthread, have, need, head_xe, head_xe2, head_xe3,H2K_gp->coproc_count[0], H2K_gp->coproc_count[1], H2K_gp->coproc_count[2], H2K_gp->coproc_count[3], ret);
H2K_log("hthread %d have %d need %d head_xe %d head_xe2 %d head_xe3 %d counts %d %d %d %d \n\tcheck task 0x%08x\n", hthread, have, need, head_xe, head_xe2, head_xe3,H2K_gp->coproc_count[0], H2K_gp->coproc_count[1], H2K_gp->coproc_count[2], H2K_gp->coproc_count[3], (u32_t)ret);


if (H2K_gp->coproc_count[cluster] + (need - have) <= H2K_gp->coproc_max) { // within limit
Expand Down Expand Up @@ -201,7 +201,7 @@ static inline H2K_thread_context *H2K_ready_head(u32_t prio, u32_t hthread) {
}
while (ret != NULL && (need_tmp = (((ret->ssr_xe || ret->ccr_xe3) ? 1 : 0) + ((ret->ssr_xe2) ? 1 : 0)) + min_coprocs) > H2K_gp->coproc_max);

H2K_log("hthread %d try new task 0x%08x\n", ret);
H2K_log("hthread %d try new task 0x%08x\n", hthread, (u32_t)ret);
} while (ret != NULL);

/* Didn't find another task to schedule, so pick up the head task even though this unbalances the coprocs */
Expand All @@ -220,7 +220,7 @@ static inline H2K_thread_context *H2K_ready_getbest(u32_t hthread)
H2K_thread_context *ret;
u32_t prio;

H2K_log("hthread %d getbest\n", hthread);
H2K_log_throttle_ht(1000000, "hthread %d getbest\n", hthread);
prio = H2K_ready_best_prio();
if (prio >= MAX_PRIOS) { // !H2K_ready_any_valid(), go to sleep
#ifdef CLUSTER_SCHED
Expand Down
2 changes: 1 addition & 1 deletion kernel/data/readylist/test/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

OBJS+=test.o
RECOMPILE_DIRS += $(H2DIR)/kernel/data/readylist
RECOMPILE_SRCS_PREFS += readylist
Expand Down
12 changes: 6 additions & 6 deletions kernel/traps/hwconfig/hwconfig.ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ u32_t H2K_trap_hwconfig_hlxbits(u32_t unused, void *unusedp, u32_t xa3, u32_t x
BKL_LOCK();
if (xe3 && !(me->ccr & CCR_XE3_BIT_MASK)) { // turning xe3 on
// block as if we got resched interrupt
H2K_log("hthread %d hlxbits: task 0x%08x setting xe3\n", me->hthread, me);
H2K_log("hthread %d hlxbits: task 0x%08x setting xe3\n", me->hthread, (u32_t)me);
me->ccr = Q6_R_insert_RII(me->ccr, xa3, CCR_XA3_NBITS, CCR_XA3_BITS);
me->ccr = Q6_R_insert_RII(me->ccr, xe3, 1, CCR_XE3_BIT);
me->r00 = 0;
Expand All @@ -286,7 +286,7 @@ u32_t H2K_trap_hwconfig_hlxbits(u32_t unused, void *unusedp, u32_t xa3, u32_t x
u32_t hthread_xe2 = ((me->ssr & SSR_XE2_BIT_MASK) ? 1 : 0);

xex(me->hthread, hthread_xe, hthread_xe2, 0, hthread_xe, hthread_xe2, 1);
H2K_log("hthread %d hlxbits: task 0x%08x clearing xe3\n", me->hthread, me);
H2K_log("hthread %d hlxbits: task 0x%08x clearing xe3\n", me->hthread, (u32_t)me);
}
BKL_UNLOCK();
}
Expand All @@ -309,7 +309,7 @@ u32_t H2K_trap_hwconfig_hmxbits(u32_t unused, void *unusedp, u32_t xe2, u32_t un
BKL_LOCK();
if (xe2 && !(me->ssr & SSR_XE2_BIT_MASK)) { // turning xe2 on
// block as if we got resched interrupt
H2K_log("hthread %d hmxbits: task 0x%08x setting xe2\n", me->hthread, me);
H2K_log("hthread %d hmxbits: task 0x%08x setting xe2\n", me->hthread, (u32_t)me);
// me->ccr = Q6_R_insert_RII(me->ccr, xa2, CCR_XA2_NBITS, CCR_XA2_BITS);
me->ssr = Q6_R_insert_RII(me->ssr, xe2, 1, SSR_XE2_BIT);
me->r00 = 0;
Expand All @@ -322,7 +322,7 @@ u32_t H2K_trap_hwconfig_hmxbits(u32_t unused, void *unusedp, u32_t xe2, u32_t un
u32_t hthread_xe3 = ((me->ccr & CCR_XE3_BIT_MASK) ? 1 : 0);

xex(me->hthread, hthread_xe, 0, hthread_xe3, hthread_xe, 1, hthread_xe3);
H2K_log("hthread %d hmxbits: task 0x%08x clearing xe2\n", me->hthread, me);
H2K_log("hthread %d hmxbits: task 0x%08x clearing xe2\n", me->hthread, (u32_t)me);
}
BKL_UNLOCK();
}
Expand All @@ -346,7 +346,7 @@ u32_t H2K_trap_hwconfig_extbits(u32_t unused, void *unusedp, u32_t xa, u32_t xe,
BKL_LOCK();
if (xe && !(me->ssr & SSR_XE_BIT_MASK)) { // turning xe on
// block as if we got resched interrupt
H2K_log("hthread %d extbits: task 0x%08x setting xe\n", me->hthread, me);
H2K_log("hthread %d extbits: task 0x%08x setting xe\n", me->hthread, (u32_t)me);

if ((xa < EXT_HVX_XA_START || xa >= EXT_HVX_XA_START + H2K_gp->coproc_contexts) // not in HVX range
#ifdef DO_EXT_SWITCH
Expand All @@ -368,7 +368,7 @@ u32_t H2K_trap_hwconfig_extbits(u32_t unused, void *unusedp, u32_t xa, u32_t xe,
u32_t hthread_xe3 = ((me->ccr & CCR_XE3_BIT_MASK) ? 1 : 0);

xex(me->hthread, 0, hthread_xe2, hthread_xe3, 1, hthread_xe2, hthread_xe3);
H2K_log("hthread %d extbits: task 0x%08x clearing xe\n", me->hthread, me);
H2K_log("hthread %d extbits: task 0x%08x clearing xe\n", me->hthread, (u32_t)me);
}
BKL_UNLOCK();
}
Expand Down
Loading
Loading