drm/radeon: Sync to Linux 3.11
[dragonfly.git] / sys / kern / kern_ktr.c
1 /*
2  * Copyright (c) 2005 The DragonFly Project.  All rights reserved.
3  * 
4  * This code is derived from software contributed to The DragonFly Project
5  * by Matthew Dillon <dillon@backplane.com>
6  * 
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  * 3. Neither the name of The DragonFly Project nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific, prior written permission.
20  * 
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  */
34 /*
35  * The following copyright applies to the DDB command code:
36  *
37  * Copyright (c) 2000 John Baldwin <jhb@FreeBSD.org>
38  * All rights reserved.
39  *
40  * Redistribution and use in source and binary forms, with or without
41  * modification, are permitted provided that the following conditions
42  * are met:
43  * 1. Redistributions of source code must retain the above copyright
44  *    notice, this list of conditions and the following disclaimer.
45  * 2. Redistributions in binary form must reproduce the above copyright
46  *    notice, this list of conditions and the following disclaimer in the
47  *    documentation and/or other materials provided with the distribution.
48  * 3. Neither the name of the author nor the names of any co-contributors
49  *    may be used to endorse or promote products derived from this software
50  *    without specific prior written permission.
51  *
52  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
53  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
56  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62  * SUCH DAMAGE.
63  */
64
65 /*
66  * Kernel tracepoint facility.
67  */
68
69 #include "opt_ddb.h"
70 #include "opt_ktr.h"
71
72 #include <sys/param.h>
73 #include <sys/cons.h>
74 #include <sys/kernel.h>
75 #include <sys/libkern.h>
76 #include <sys/proc.h>
77 #include <sys/sysctl.h>
78 #include <sys/ktr.h>
79 #include <sys/systm.h>
80 #include <sys/time.h>
81 #include <sys/malloc.h>
82 #include <sys/spinlock.h>
83 #include <sys/thread2.h>
84 #include <sys/spinlock2.h>
85 #include <sys/ctype.h>
86
87 #include <machine/cpu.h>
88 #include <machine/cpufunc.h>
89 #include <machine/specialreg.h>
90 #include <machine/md_var.h>
91
92 #include <ddb/ddb.h>
93
94 #ifndef KTR_ENTRIES
95 #define KTR_ENTRIES             2048
96 #elif (KTR_ENTRIES & KTR_ENTRIES - 1)
97 #error KTR_ENTRIES must be a power of two
98 #endif
99 #define KTR_ENTRIES_MASK        (KTR_ENTRIES - 1)
100
101 /*
102  * Used by earlier boot; default value consumes ~64K BSS.
103  *
104  * NOTE:
105  * We use a small value here; this prevents kernel or module loading
106  * failure due to excessive BSS usage if KTR_ENTRIES is large.
107  */
108 #if (KTR_ENTRIES < 256)
109 #define KTR_ENTRIES_BOOT0       KTR_ENTRIES
110 #else
111 #define KTR_ENTRIES_BOOT0       256
112 #endif
113 #define KTR_ENTRIES_BOOT0_MASK  (KTR_ENTRIES_BOOT0 - 1)
114
115 /*
116  * test logging support.  When ktr_testlogcnt is non-zero each synchronization
117  * interrupt will issue six back-to-back ktr logging messages on cpu 0
118  * so the user can determine KTR logging overheads.
119  */
120 #if !defined(KTR_TESTLOG)
121 #define KTR_TESTLOG     KTR_ALL
122 #endif
123 KTR_INFO_MASTER(testlog);
124 #if KTR_TESTLOG
125 KTR_INFO(KTR_TESTLOG, testlog, test1, 0, "test1 %d %d %d %d", int dummy1, int dummy2, int dummy3, int dummy4);
126 KTR_INFO(KTR_TESTLOG, testlog, test2, 1, "test2 %d %d %d %d", int dummy1, int dummy2, int dummy3, int dummy4);
127 KTR_INFO(KTR_TESTLOG, testlog, test3, 2, "test3 %d %d %d %d", int dummy1, int dummy2, int dummy3, int dummy4);
128 KTR_INFO(KTR_TESTLOG, testlog, test4, 3, "test4");
129 KTR_INFO(KTR_TESTLOG, testlog, test5, 4, "test5");
130 KTR_INFO(KTR_TESTLOG, testlog, test6, 5, "test6");
131 KTR_INFO(KTR_TESTLOG, testlog, pingpong, 6, "pingpong");
132 KTR_INFO(KTR_TESTLOG, testlog, pipeline, 7, "pipeline");
133 KTR_INFO(KTR_TESTLOG, testlog, crit_beg, 8, "crit_beg");
134 KTR_INFO(KTR_TESTLOG, testlog, crit_end, 9, "crit_end");
135 KTR_INFO(KTR_TESTLOG, testlog, spin_beg, 10, "spin_beg");
136 KTR_INFO(KTR_TESTLOG, testlog, spin_end, 11, "spin_end");
137 #define logtest(name)   KTR_LOG(testlog_ ## name, 0, 0, 0, 0)
138 #define logtest_noargs(name)    KTR_LOG(testlog_ ## name)
139 #endif
140
141 MALLOC_DEFINE(M_KTR, "ktr", "ktr buffers");
142
143 SYSCTL_NODE(_debug, OID_AUTO, ktr, CTLFLAG_RW, 0, "ktr");
144
145 static int      ktr_entries = KTR_ENTRIES_BOOT0;
146 SYSCTL_INT(_debug_ktr, OID_AUTO, entries, CTLFLAG_RD, &ktr_entries, 0,
147     "Size of the event buffer");
148 static int      ktr_entries_mask = KTR_ENTRIES_BOOT0_MASK;
149
150 static int      ktr_version = KTR_VERSION;
151 SYSCTL_INT(_debug_ktr, OID_AUTO, version, CTLFLAG_RD, &ktr_version, 0, "");
152
153 static int      ktr_stacktrace = 1;
154 SYSCTL_INT(_debug_ktr, OID_AUTO, stacktrace, CTLFLAG_RD, &ktr_stacktrace, 0, "");
155
156 static int      ktr_resynchronize = 0;
157 SYSCTL_INT(_debug_ktr, OID_AUTO, resynchronize, CTLFLAG_RW,
158     &ktr_resynchronize, 0, "Resynchronize TSC 10 times a second");
159
160 #if KTR_TESTLOG
161 static int      ktr_testlogcnt = 0;
162 SYSCTL_INT(_debug_ktr, OID_AUTO, testlogcnt, CTLFLAG_RW, &ktr_testlogcnt, 0, "");
163 static int      ktr_testipicnt = 0;
164 static int      ktr_testipicnt_remainder;
165 SYSCTL_INT(_debug_ktr, OID_AUTO, testipicnt, CTLFLAG_RW, &ktr_testipicnt, 0, "");
166 static int      ktr_testcritcnt = 0;
167 SYSCTL_INT(_debug_ktr, OID_AUTO, testcritcnt, CTLFLAG_RW, &ktr_testcritcnt, 0, "");
168 static int      ktr_testspincnt = 0;
169 SYSCTL_INT(_debug_ktr, OID_AUTO, testspincnt, CTLFLAG_RW, &ktr_testspincnt, 0, "");
170 #endif
171
172 /*
173  * Give cpu0 a static buffer so the tracepoint facility can be used during
174  * early boot (note however that we still use a critical section, XXX).
175  */
176 static struct   ktr_entry ktr_buf0[KTR_ENTRIES_BOOT0];
177
178 struct ktr_cpu ktr_cpu[MAXCPU] = {
179         { .core.ktr_buf = &ktr_buf0[0] }
180 };
181
182 static int64_t  ktr_sync_tsc;
183 struct callout  ktr_resync_callout;
184
185 #ifdef KTR_VERBOSE
186 int     ktr_verbose = KTR_VERBOSE;
187 TUNABLE_INT("debug.ktr.verbose", &ktr_verbose);
188 SYSCTL_INT(_debug_ktr, OID_AUTO, verbose, CTLFLAG_RW, &ktr_verbose, 0,
189     "Log events to the console as well");
190 #endif
191
192 static void ktr_resync_callback(void *dummy __unused);
193
194 extern int64_t tsc_offsets[];
195
196 static void
197 ktr_sysinit(void *dummy)
198 {
199         struct ktr_cpu_core *kcpu;
200         int i;
201
202         for (i = 0; i < ncpus; ++i) {
203                 kcpu = &ktr_cpu[i].core;
204                 kcpu->ktr_buf = kmalloc(KTR_ENTRIES * sizeof(struct ktr_entry),
205                                         M_KTR, M_WAITOK | M_ZERO);
206                 if (i == 0) {
207                         /* Migrate ktrs on CPU0 to the new location */
208                         memcpy(kcpu->ktr_buf, ktr_buf0, sizeof(ktr_buf0));
209                 }
210         }
211         cpu_sfence();
212         ktr_entries = KTR_ENTRIES;
213         ktr_entries_mask = KTR_ENTRIES_MASK;
214
215         callout_init_mp(&ktr_resync_callout);
216         callout_reset(&ktr_resync_callout, hz / 10, ktr_resync_callback, NULL);
217 }
218 SYSINIT(ktr_sysinit, SI_BOOT2_KLD, SI_ORDER_ANY, ktr_sysinit, NULL);
219
220 /*
221  * Try to resynchronize the TSC's for all cpus.  This is really, really nasty.
222  * We have to send an IPIQ message to all remote cpus, wait until they 
223  * get into their IPIQ processing code loop, then do an even stricter hard
224  * loop to get the cpus as close to synchronized as we can to get the most
225  * accurate reading.
226  *
227  * This callback occurs on cpu0.
228  */
229 #if KTR_TESTLOG
230 static void ktr_pingpong_remote(void *dummy);
231 static void ktr_pipeline_remote(void *dummy);
232 #endif
233
234 #ifdef _RDTSC_SUPPORTED_
235
236 static void ktr_resync_remote(void *dummy);
237
238 /*
239  * We use a callout callback instead of a systimer because we cannot afford
240  * to preempt anyone to do this, or we might deadlock a spin-lock or 
241  * serializer between two cpus.
242  */
243 static
244 void 
245 ktr_resync_callback(void *dummy __unused)
246 {
247         struct lwkt_cpusync cs;
248 #if KTR_TESTLOG
249         int count;
250 #endif
251
252         KKASSERT(mycpu->gd_cpuid == 0);
253
254 #if KTR_TESTLOG
255         /*
256          * Test logging
257          */
258         if (ktr_testlogcnt) {
259                 --ktr_testlogcnt;
260                 cpu_disable_intr();
261                 logtest(test1);
262                 logtest(test2);
263                 logtest(test3);
264                 logtest_noargs(test4);
265                 logtest_noargs(test5);
266                 logtest_noargs(test6);
267                 cpu_enable_intr();
268         }
269
270         /*
271          * Test IPI messaging
272          */
273         if (ktr_testipicnt && ktr_testipicnt_remainder == 0 && ncpus > 1) {
274                 ktr_testipicnt_remainder = ktr_testipicnt;
275                 ktr_testipicnt = 0;
276                 lwkt_send_ipiq_bycpu(1, ktr_pingpong_remote, NULL);
277         }
278
279         /*
280          * Test critical sections
281          */
282         if (ktr_testcritcnt) {
283                 crit_enter();
284                 crit_exit();
285                 logtest_noargs(crit_beg);
286                 for (count = ktr_testcritcnt; count; --count) {
287                         crit_enter();
288                         crit_exit();
289                 }
290                 logtest_noargs(crit_end);
291                 ktr_testcritcnt = 0;
292         }
293
294         /*
295          * Test spinlock sections
296          */
297         if (ktr_testspincnt) {
298                 struct spinlock spin;
299
300                 spin_init(&spin, "ktrresync");
301                 spin_lock(&spin);
302                 spin_unlock(&spin);
303                 logtest_noargs(spin_beg);
304                 for (count = ktr_testspincnt; count; --count) {
305                         spin_lock(&spin);
306                         spin_unlock(&spin);
307                 }
308                 logtest_noargs(spin_end);
309                 ktr_testspincnt = 0;
310         }
311 #endif
312
313         /*
314          * Resynchronize the TSC
315          */
316         if (ktr_resynchronize == 0)
317                 goto done;
318         if ((cpu_feature & CPUID_TSC) == 0)
319                 return;
320
321         crit_enter();
322         lwkt_cpusync_init(&cs, smp_active_mask, ktr_resync_remote,
323                           (void *)(intptr_t)mycpu->gd_cpuid);
324         lwkt_cpusync_interlock(&cs);
325         ktr_sync_tsc = rdtsc();
326         lwkt_cpusync_deinterlock(&cs);
327         crit_exit();
328 done:
329         callout_reset(&ktr_resync_callout, hz / 10, ktr_resync_callback, NULL);
330 }
331
332 /*
333  * The remote-end of the KTR synchronization protocol runs on all cpus.
334  * The one we run on the controlling cpu updates its tsc continuously
335  * until the others have finished syncing (theoretically), but we don't
336  * loop forever.
337  *
338  * This is a bit ad-hoc but we need to avoid livelocking inside an IPI
339  * callback.  rdtsc() is a synchronizing instruction (I think).
340  */
341 static void
342 ktr_resync_remote(void *arg)
343 {
344         globaldata_t gd = mycpu;
345         int64_t delta;
346         int i;
347
348         if (gd->gd_cpuid == (int)(intptr_t)arg) {
349                 for (i = 0; i < 2000; ++i)
350                         ktr_sync_tsc = rdtsc();
351         } else {
352                 delta = rdtsc() - ktr_sync_tsc;
353                 if (tsc_offsets[gd->gd_cpuid] == 0)
354                         tsc_offsets[gd->gd_cpuid] = delta;
355                 tsc_offsets[gd->gd_cpuid] =
356                         (tsc_offsets[gd->gd_cpuid] * 7 + delta) / 8;
357         }
358 }
359
360 #if KTR_TESTLOG
361
362 static
363 void
364 ktr_pingpong_remote(void *dummy __unused)
365 {
366         int other_cpu;
367
368         logtest_noargs(pingpong);
369         other_cpu = 1 - mycpu->gd_cpuid;
370         if (ktr_testipicnt_remainder) {
371                 --ktr_testipicnt_remainder;
372                 lwkt_send_ipiq_bycpu(other_cpu, ktr_pingpong_remote, NULL);
373         } else {
374                 lwkt_send_ipiq_bycpu(other_cpu, ktr_pipeline_remote, NULL);
375                 lwkt_send_ipiq_bycpu(other_cpu, ktr_pipeline_remote, NULL);
376                 lwkt_send_ipiq_bycpu(other_cpu, ktr_pipeline_remote, NULL);
377                 lwkt_send_ipiq_bycpu(other_cpu, ktr_pipeline_remote, NULL);
378                 lwkt_send_ipiq_bycpu(other_cpu, ktr_pipeline_remote, NULL);
379         }
380 }
381
382 static
383 void
384 ktr_pipeline_remote(void *dummy __unused)
385 {
386         logtest_noargs(pipeline);
387 }
388
389 #endif
390
391 #else   /* !_RDTSC_SUPPORTED_ */
392
393 /*
394  * The resync callback for UP doesn't do anything other then run the test
395  * log messages.  If test logging is not enabled, don't bother resetting
396  * the callout.
397  */
398 static
399 void 
400 ktr_resync_callback(void *dummy __unused)
401 {
402 #if KTR_TESTLOG
403         /*
404          * Test logging
405          */
406         if (ktr_testlogcnt) {
407                 --ktr_testlogcnt;
408                 cpu_disable_intr();
409                 logtest(test1);
410                 logtest(test2);
411                 logtest(test3);
412                 logtest_noargs(test4);
413                 logtest_noargs(test5);
414                 logtest_noargs(test6);
415                 cpu_enable_intr();
416         }
417         callout_reset(&ktr_resync_callout, hz / 10, ktr_resync_callback, NULL);
418 #endif
419 }
420
421 #endif
422
423 /*
424  * Setup the next empty slot and return it to the caller to store the data
425  * directly.
426  */
427 struct ktr_entry *
428 ktr_begin_write_entry(struct ktr_info *info, const char *file, int line)
429 {
430         struct ktr_cpu_core *kcpu;
431         struct ktr_entry *entry;
432         int cpu;
433
434         cpu = mycpu->gd_cpuid;
435         kcpu = &ktr_cpu[cpu].core;
436         if (panicstr)                   /* stop logging during panic */
437                 return NULL;
438         if (kcpu->ktr_buf == NULL)      /* too early in boot */
439                 return NULL;
440
441         crit_enter();
442         entry = kcpu->ktr_buf + (kcpu->ktr_idx & ktr_entries_mask);
443         ++kcpu->ktr_idx;
444 #ifdef _RDTSC_SUPPORTED_
445         if (cpu_feature & CPUID_TSC) {
446                 entry->ktr_timestamp = rdtsc() - tsc_offsets[cpu];
447         } else
448 #endif
449         {
450                 entry->ktr_timestamp = get_approximate_time_t();
451         }
452         entry->ktr_info = info;
453         entry->ktr_file = file;
454         entry->ktr_line = line;
455         crit_exit();
456         return entry;
457 }
458
459 int
460 ktr_finish_write_entry(struct ktr_info *info, struct ktr_entry *entry)
461 {
462         if (ktr_stacktrace)
463                 cpu_ktr_caller(entry);
464 #ifdef KTR_VERBOSE
465         if (ktr_verbose && info->kf_format) {
466                 kprintf("cpu%d ", mycpu->gd_cpuid);
467                 if (ktr_verbose > 1) {
468                         kprintf("%s.%d\t", entry->ktr_file, entry->ktr_line);
469                 }
470                 return !0;
471         }
472 #endif
473         return 0;
474 }
475
476 #ifdef DDB
477
478 #define NUM_LINES_PER_PAGE      19
479
480 struct tstate {
481         int     cur;
482         int     first;
483 };
484
485 static  int db_ktr_verbose;
486 static  int db_mach_vtrace(int cpu, struct ktr_entry *kp, int idx);
487
488 DB_SHOW_COMMAND(ktr, db_ktr_all)
489 {
490         struct ktr_cpu_core *kcpu;
491         int a_flag = 0;
492         int c;
493         int nl = 0;
494         int i;
495         struct tstate tstate[MAXCPU];
496         int printcpu = -1;
497
498         for(i = 0; i < ncpus; i++) {
499                 kcpu = &ktr_cpu[i].core;
500                 tstate[i].first = -1;
501                 tstate[i].cur = (kcpu->ktr_idx - 1) & ktr_entries_mask;
502         }
503         db_ktr_verbose = 0;
504         while ((c = *(modif++)) != '\0') {
505                 if (c == 'v') {
506                         db_ktr_verbose = 1;
507                 }
508                 else if (c == 'a') {
509                         a_flag = 1;
510                 }
511                 else if (c == 'c') {
512                         printcpu = 0;
513                         while ((c = *(modif++)) != '\0') {
514                                 if (isdigit(c)) {
515                                         printcpu *= 10;
516                                         printcpu += c - '0';
517                                 }
518                                 else {
519                                         modif++;
520                                         break;
521                                 }
522                         }
523                         modif--;
524                 }
525         }
526         if (printcpu > ncpus - 1) {
527                 db_printf("Invalid cpu number\n");
528                 return;
529         }
530         /*
531          * Lopp throug all the buffers and print the content of them, sorted
532          * by the timestamp.
533          */
534         while (1) {
535                 int counter;
536                 u_int64_t highest_ts;
537                 int highest_cpu;
538                 struct ktr_entry *kp;
539
540                 if (a_flag == 1 && cncheckc() != -1)
541                         return;
542                 highest_ts = 0;
543                 highest_cpu = -1;
544                 /*
545                  * Find the lowest timestamp
546                  */
547                 for (i = 0, counter = 0; i < ncpus; i++) {
548                         kcpu = &ktr_cpu[i].core;
549                         if (kcpu->ktr_buf == NULL)
550                                 continue;
551                         if (printcpu != -1 && printcpu != i)
552                                 continue;
553                         if (tstate[i].cur == -1) {
554                                 counter++;
555                                 if (counter == ncpus) {
556                                         db_printf("--- End of trace buffer ---\n");
557                                         return;
558                                 }
559                                 continue;
560                         }
561                         if (kcpu->ktr_buf[tstate[i].cur].ktr_timestamp > highest_ts) {
562                                 highest_ts = kcpu->ktr_buf[tstate[i].cur].ktr_timestamp;
563                                 highest_cpu = i;
564                         }
565                 }
566                 if (highest_cpu < 0) {
567                         db_printf("no KTR data available\n");
568                         break;
569                 }
570                 i = highest_cpu;
571                 kcpu = &ktr_cpu[i].core;
572                 kp = &kcpu->ktr_buf[tstate[i].cur];
573                 if (tstate[i].first == -1)
574                         tstate[i].first = tstate[i].cur;
575                 if (--tstate[i].cur < 0)
576                         tstate[i].cur = ktr_entries - 1;
577                 if (tstate[i].first == tstate[i].cur) {
578                         db_mach_vtrace(i, kp, tstate[i].cur + 1);
579                         tstate[i].cur = -1;
580                         continue;
581                 }
582                 if (kcpu->ktr_buf[tstate[i].cur].ktr_info == NULL)
583                         tstate[i].cur = -1;
584                 if (db_more(&nl) == -1)
585                         break;
586                 if (db_mach_vtrace(i, kp, tstate[i].cur + 1) == 0)
587                         tstate[i].cur = -1;
588         }
589 }
590
591 static int
592 db_mach_vtrace(int cpu, struct ktr_entry *kp, int idx)
593 {
594         if (kp->ktr_info == NULL)
595                 return(0);
596         db_printf("cpu%d ", cpu);
597         db_printf("%d: ", idx);
598         if (db_ktr_verbose) {
599                 db_printf("%10.10lld %s.%d\t", (long long)kp->ktr_timestamp,
600                     kp->ktr_file, kp->ktr_line);
601         }
602         db_printf("%s\t", kp->ktr_info->kf_name);
603         db_printf("from(%p,%p) ", kp->ktr_caller1, kp->ktr_caller2);
604 #ifdef __i386__
605         if (kp->ktr_info->kf_format)
606                 db_vprintf(kp->ktr_info->kf_format, (__va_list)kp->ktr_data);
607 #endif
608         db_printf("\n");
609
610         return(1);
611 }
612
613 #endif  /* DDB */