kernel - cleanup and some KTR work for x86_64
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 19 Sep 2010 15:54:37 +0000 (08:54 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 19 Sep 2010 15:54:37 +0000 (08:54 -0700)
* 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
sys/kern/kern_ktr.c
sys/platform/pc64/x86_64/trap.c
usr.bin/ktrdump/ktrdump.c

index f0b5b35..899dded 100644 (file)
@@ -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;
index 9329469..238762e 100644 (file)
@@ -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);
index 07eb2c9..67d72ae 100644 (file)
@@ -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,
index 593c91a..6ae30be 100644 (file)
@@ -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];