From 4afe74da8355aa980815090e96abc447d49f4f66 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 19 Sep 2010 08:54:37 -0700 Subject: [PATCH] kernel - cleanup and some KTR work for x86_64 * Make the KTR option compile for x86_64 builds. It's very expensive still and not recommended due to the way x86_64 handles va_args. * On the userland side do not attempt vprintf the va_args yet in the ktrdump code, right now it just crashes. * Cleanup some kprintfs --- sys/kern/kern_event.c | 6 ++---- sys/kern/kern_ktr.c | 2 ++ sys/platform/pc64/x86_64/trap.c | 2 +- usr.bin/ktrdump/ktrdump.c | 13 ++++++++++++- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index f0b5b353a3..899dded508 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1287,16 +1287,14 @@ restart: } /* - * If the note is not empty we have to wait. + * If the hint is non-zero we have to wait or risk + * losing the state the caller is trying to update. * * XXX This is a real problem, certain process * and signal filters will bump kn_data for * already-processed notes more than once if * we restart the list scan. FIXME. */ - kprintf("Warning: knote() on busy " - "knote (ev=%d hint=%08lx)\n", - kn->kn_filter, hint); kn->kn_status |= KN_WAITING | KN_REPROCESS; tsleep(kn, 0, "knotec", hz); goto restart; diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c index 9329469257..238762e584 100644 --- a/sys/kern/kern_ktr.c +++ b/sys/kern/kern_ktr.c @@ -629,8 +629,10 @@ db_mach_vtrace(int cpu, struct ktr_entry *kp, int idx) } db_printf("%s\t", kp->ktr_info->kf_name); db_printf("from(%p,%p) ", kp->ktr_caller1, kp->ktr_caller2); +#ifdef __i386__ if (kp->ktr_info->kf_format) db_vprintf(kp->ktr_info->kf_format, (__va_list)kp->ktr_data); +#endif db_printf("\n"); return(1); diff --git a/sys/platform/pc64/x86_64/trap.c b/sys/platform/pc64/x86_64/trap.c index 07eb2c966b..67d72ae964 100644 --- a/sys/platform/pc64/x86_64/trap.c +++ b/sys/platform/pc64/x86_64/trap.c @@ -1043,7 +1043,7 @@ syscall2(struct trapframe *frame) #endif KTR_LOG(kernentry_syscall, p->p_pid, lp->lwp_tid, - frame->tf_eax); + frame->tf_rax); #ifdef SMP KASSERT(td->td_mpcount == 0, diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c index 593c91a330..6ae30bedb1 100644 --- a/usr.bin/ktrdump/ktrdump.c +++ b/usr.bin/ktrdump/ktrdump.c @@ -471,9 +471,16 @@ print_entry(FILE *fo, int n, int row, struct ktr_entry *entry, if (pflag) { if (info == NULL) info = kvm_ktrinfo(entry->ktr_info, &infoctx); - if (info) + if (info) { +#ifdef __amd64__ + /* XXX todo */ + kvmfprintf(fo, kvm_string(info->kf_format, &fmtctx), + (void *)&entry->ktr_data); +#else kvmfprintf(fo, kvm_string(info->kf_format, &fmtctx), (void *)&entry->ktr_data); +#endif + } } fprintf(fo, "\n"); *last_timestamp = entry->ktr_timestamp; @@ -978,6 +985,10 @@ kvmfprintf(FILE *fp, const char *ctl, va_list va) static struct save_ctx strctx; const char *s; +#ifdef __amd64__ + /* XXX todo crashes right now */ + return; +#endif while (*ctl) { for (n = 0; ctl[n]; ++n) { fmt[n] = ctl[n]; -- 2.11.4.GIT