Skip to content

Commit b45056a

Browse files
committed
/home/fox/release/dtrace/dtrace-20111209.tar.bz2
1 parent 581c85f commit b45056a

11 files changed

Lines changed: 172 additions & 73 deletions

File tree

.release

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
date=Tue Dec 6 23:08:02 GMT 2011
2-
release=dtrace-20111206
3-
build=337
1+
date=Fri Dec 9 20:50:38 GMT 2011
2+
release=dtrace-20111209
3+
build=338

Changes

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
Fri Dec 9 20:01:25 2011 fox
2+
3+
621* tools/tail.pl: Tool to do tail -f on any file, but specific
4+
char special device files. Defaults to /proc/dtrace/trace.
5+
6+
620* Archive: 1.0131
7+
8+
619* dtrace.c: Added some monitoring around the kmem_free in
9+
dtrace_state_destroy. Not needed, but something to watch.
10+
11+
618* x_call.c: Whilst priming the other cpus for action, attempt
12+
to drawin any pending call against ourselves. Reduce the
13+
poll time (ack_wait) a little, to try and gain better performance.
14+
15+
617* mutex.c: Dont disable interrupts for interrupt level mutexes.
16+
(And, by implication, we dont need to restore them). Parameterise
17+
this change.
18+
Every 500m iterations, dump a "taking a long time message". Havent
19+
seen this get hit.
20+
21+
Thu Dec 8 21:44:49 2011 fox
22+
23+
616* toxic.c: Re-enable more of the functions. We shouldnt have the old
24+
problems anymore.
25+
26+
Wed Dec 7 20:57:52 2011 fox
27+
28+
615* tools/cpustuck.pl: Simple tool to look for stuck cpus.
29+
130
Sun Dec 4 12:03:45 2011 fox
231

332
614* dtrace.c: Tone down the teardown logic to avoid two

archive.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
NAME=dtrace
22
MAJ_VERSION=1
3-
MIN_VERSION=0130
3+
MIN_VERSION=0131
44
EXCLUDE="*.ko *.o .git"
55
EXCLUDE_DIRS="build-"
6-
#date Sun Dec 4 12:08:49 GMT 2011
6+
#date Fri Dec 9 20:12:02 GMT 2011

driver/dtrace.c

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5941,9 +5941,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1,
59415941
while (lock_teardown >= 0) {
59425942
extern void xcall_slave2(void);
59435943
xcall_slave2();
5944-
dcnt[0]++;
59455944
if (cnt++ >= smp_processor_id() * 10/*000*/) {
5946-
dcnt[1]++;
59475945
break;
59485946
}
59495947
}
@@ -10524,7 +10522,32 @@ dtrace_ecb_destroy(dtrace_ecb_t *ecb)
1052410522
lock_teardown = smp_processor_id();
1052510523
}
1052610524

10525+
#if linux
10526+
/***********************************************/
10527+
/* Put some timings around the free. We */
10528+
/* dont need this, but its interesting when */
10529+
/* monitoring /proc/dtrace/trace. */
10530+
/***********************************************/
10531+
{static unsigned cnt;
10532+
static hrtime_t max_t;
10533+
hrtime_t s = dtrace_gethrtime();
10534+
10535+
cnt++;
10536+
1052710537
kmem_free(ecb, sizeof (dtrace_ecb_t));
10538+
10539+
s = dtrace_gethrtime() - s;
10540+
if (s > max_t) {
10541+
max_t = s;
10542+
dtrace_printf("kmem_free t=%s (%d)\n", hrtime_str(s), cnt);
10543+
} else if ((cnt % 10000) == 0) {
10544+
dtrace_printf("kmem_free cnt=%d\n", cnt);
10545+
}
10546+
}
10547+
10548+
#else
10549+
kmem_free(ecb, sizeof (dtrace_ecb_t));
10550+
#endif
1052810551
}
1052910552

1053010553
static dtrace_ecb_t *
@@ -13654,7 +13677,7 @@ HERE();
1365413677
* in the second we disable whatever is left over.
1365513678
*/
1365613679

13657-
extern unsigned long cnt_xcall1;
13680+
{extern unsigned long cnt_xcall1;
1365813681
hrtime_t s = dtrace_gethrtime();
1365913682
dtrace_printf("teardown start xcalls=%lu probes=%llu\n", cnt_xcall1, cnt_probes - cnt_free1);
1366013683

@@ -13690,12 +13713,11 @@ dtrace_printf("teardown start xcalls=%lu probes=%llu\n", cnt_xcall1, cnt_probes
1369013713
/* Dump some stats on how long the teardown */
1369113714
/* took. */
1369213715
/***********************************************/
13693-
{
13694-
hrtime_t e = dtrace_gethrtime() - s;
13695-
dtrace_printf("teardown done %llu.%09llu xcalls=%lu probes=%llu\n", e / (1000 * 1000 * 1000), e % (1000 * 1000 * 1000), cnt_xcall1,
13696-
cnt_probes - cnt_free1);
13697-
}
13698-
13716+
s = dtrace_gethrtime() - s;
13717+
dtrace_printf("teardown done %s xcalls=%lu probes=%llu\n", hrtime_str(s),
13718+
cnt_xcall1,
13719+
cnt_probes - cnt_free1);
13720+
}
1369913721

1370013722
/*
1370113723
* Before we free the buffers, perform one more sync to assure that

driver/instr_linux.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ instr_is_patched(char *name, uint8_t *addr)
112112

113113
for (; fbt != NULL; fbt = fbt->insp_hashnext) {
114114
if (fbt->insp_patchpoint == addr) {
115-
dtrace_printf("fbt:dup patch: %p %s\n", addr, name);
115+
dtrace_printf("instr:dup patch: %p %s\n", addr, name);
116116
return 1;
117117
}
118118
}
@@ -475,7 +475,7 @@ instr_provide_function(struct modctl *mp, par_module_t *pmp,
475475
char pred_buf[128];
476476

477477
# define UNHANDLED_FBT() if (do_print || dtrace_unhandled) { \
478-
printk("fbt:unhandled instr %s:%p %02x %02x %02x %02x\n", \
478+
printk("instr:unhandled instr %s:%p %02x %02x %02x %02x\n", \
479479
name, instr, instr[0], instr[1], instr[2], instr[3]); \
480480
}
481481

driver/mutex.c

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ unsigned long cnt_mtx1;
4040
unsigned long cnt_mtx2;
4141
unsigned long cnt_mtx3;
4242

43+
static const int disable_ints;
44+
4345
void
4446
dmutex_init(mutex_t *mp)
4547
{
@@ -60,7 +62,7 @@ dmutex_init(mutex_t *mp)
6062
void
6163
mutex_enter_common(mutex_t *mp, int dflag)
6264
{ unsigned long flags;
63-
unsigned long cnt;
65+
unsigned int cnt;
6466

6567
if (!mp->m_initted) {
6668
/***********************************************/
@@ -108,7 +110,7 @@ mutex_enter_common(mutex_t *mp, int dflag)
108110
return;
109111
}
110112

111-
if (dflag)
113+
if (disable_ints && dflag)
112114
flags = dtrace_interrupt_disable();
113115
else
114116
flags = dtrace_interrupt_get();
@@ -122,23 +124,16 @@ mutex_enter_common(mutex_t *mp, int dflag)
122124
/***********************************************/
123125
if ((cnt++ % 100) == 0)
124126
xcall_slave2();
127+
125128
/***********************************************/
126-
/* We want to avoid locking the kernel if */
127-
/* something is broken, but if we do exit */
128-
/* prematurely, we will have the caller */
129-
/* race against someone else (eg syscall::: */
130-
/* and fbt::: in a continuous restart */
131-
/* loop). For now, we will hang til the */
132-
/* traffic jam is passed. */
129+
/* If we start locking up the kernel, let */
130+
/* user know something bad is happening. */
131+
/* Probably pointless if mutex is working */
132+
/* correctly. */
133133
/***********************************************/
134-
if (cnt++ == 1500 * 1000 * 1000) {
134+
if ((cnt++ % (500 * 1000 * 1000)) == 0) {
135135
dtrace_printf("mutex_enter: taking a long time to grab lock mtx3=%llu\n", cnt_mtx3);
136-
xcall_slave2();
137136
cnt_mtx3++;
138-
// break;
139-
/* dtrace_interrupt_enable(flags);
140-
dtrace_linux_panic("mutex");
141-
break;*/
142137
}
143138
}
144139
//preempt_disable();
@@ -187,7 +182,7 @@ if (f++ == 70) {
187182

188183
cnt_mtx2++;
189184
mutex_enter_common(mp, FALSE);
190-
if (irqs_disabled()) {
185+
if (disable_ints && irqs_disabled()) {
191186
dtrace_printf("%p: mutex_enter with irqs disabled fl:%lx level:%d cpu:%d\n",
192187
mp, mp->m_flags, mp->m_level, mp->m_cpu);
193188
dtrace_printf("orig: init=%d fl:%lx cpu:%d\n", imp.m_initted, imp.m_flags, imp.m_cpu);
@@ -210,7 +205,8 @@ dmutex_exit(mutex_t *mp)
210205
*/
211206

212207
mp->m_count = 0;
213-
dtrace_interrupt_enable(fl);
208+
if (disable_ints)
209+
dtrace_interrupt_enable(fl);
214210
//preempt_enable_no_resched();
215211
}
216212

driver/printf.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ static hrtime_t hrt0;
198198
dtrace_printf_int(smp_processor_id());
199199
ADDCH(' ');
200200
dtrace_printf_int(get_current()->pid);
201-
ADDCH(':');
201+
if (irqs_disabled()) {
202+
ADDCH('-');
203+
} else {
204+
ADDCH(':');
205+
}
202206

203207
while ((ch = *fmt++) != '\0') {
204208
if (ch != '%') {

driver/toxic.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ char toxic_probe_tbl[] = {
5656
"__kprobes_text_start"
5757
"__mod_timer "
5858
"__show_registers "
59-
"__mutex_init "
60-
"__mutex_lock_interruptible_slowpath "
61-
"__mutex_lock_killable_slowpath "
62-
"__mutex_lock_slowpath "
63-
"__mutex_trylock_slowpath "
64-
"__mutex_unlock_slowpath "
59+
// "__mutex_init "
60+
// "__mutex_lock_interruptible_slowpath "
61+
// "__mutex_lock_killable_slowpath "
62+
// "__mutex_lock_slowpath "
63+
// "__mutex_trylock_slowpath "
64+
// "__mutex_unlock_slowpath "
6565
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
6666
"__tasklet_hi_schedule "
6767
"__tasklet_schedule "
@@ -95,8 +95,8 @@ char toxic_probe_tbl[] = {
9595
"kmem_cache_free "
9696
"level3_kernel_pgt " // this is a data element in the code segment
9797
"level2_kernel_pgt " // this is a data element in the code segment
98-
"mutex_lock "
99-
"mutex_unlock "
98+
// "mutex_lock "
99+
// "mutex_unlock "
100100
"native_get_debugreg "
101101
"on_each_cpu " // Needed by dtrace_xcall
102102
"oops_exit "

driver/x_call.c

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929

3030
extern void dtrace_sync_func(void);
31-
int in_xcall;
31+
int in_xcall = -1;
3232
char nmi_masks[NCPU];
3333

3434
/**********************************************************************/
@@ -294,36 +294,19 @@ void
294294
dtrace_xcall1(processorid_t cpu, dtrace_xcall_t func, void *arg)
295295
{
296296

297-
/***********************************************/
298-
/* We dont disable interrupts whilst doing */
299-
/* an xcall. We may have two cpus trying to */
300-
/* do this at the same time, so we need to */
301-
/* run in a lockless mode. */
302-
/* */
303-
/* We do run with preempt_disable to avoid */
304-
/* any chance of rescheduling the calling */
305-
/* process whilst we wait for long periods */
306-
/* of time. (Note that disable is not */
307-
/* nested; does this matter if we have */
308-
/* multiple cpus coming in at the same */
309-
/* time? */
310-
/***********************************************/
311-
// preempt_disable();
312-
313297
/***********************************************/
314298
/* Just track re-entrancy events - we will */
315299
/* be lockless in dtrace_xcall2. */
316300
/***********************************************/
317-
if (in_xcall) {
301+
if (in_xcall >= 0 && (cnt_xcall0 < 500 || (cnt_xcall0 % 50) == 0)) {
302+
dtrace_printf("x_call: re-entrant call in progress (%d) other=%d.\n", cnt_xcall0, in_xcall);
318303
cnt_xcall0++;
319-
if (cnt_xcall0 < 10 || (cnt_xcall0 % 50) == 0)
320-
dtrace_printf("x_call: re-entrant call in progress (%d).\n", cnt_xcall0);
321-
//dump_all_stacks();
322304
}
323-
in_xcall = 1;
305+
in_xcall = smp_processor_id();
306+
//int flags = dtrace_interrupt_disable();
324307
dtrace_xcall2(cpu, func, arg);
325-
in_xcall = 0;
326-
// preempt_enable();
308+
//dtrace_interrupt_enable(flags);
309+
in_xcall = -1;
327310
}
328311
void
329312
dtrace_xcall2(processorid_t cpu, dtrace_xcall_t func, void *arg)
@@ -434,6 +417,7 @@ typedef struct cpumask cpumask_t;
434417
dtrace_printf("[%d] cpu%d in wrong state (state=%d)\n",
435418
smp_processor_id(), c, xc->xc_state);
436419
}
420+
// xcall_slave2();
437421
if (cnt == 100 * 1000 * 1000) {
438422
dtrace_printf("[%d] cpu%d - busting lock\n",
439423
smp_processor_id(), c);
@@ -485,7 +469,6 @@ typedef struct cpumask cpumask_t;
485469
/* us whilst we are calling them. */
486470
/***********************************************/
487471
while (cpus_todo > 0) {
488-
//static int first = 1;
489472
for (c = 0; c < nr_cpus && cpus_todo > 0; c++) {
490473
xcall_slave2();
491474
if (c == cpu_id || (cpu & (1 << c)) == 0)
@@ -495,17 +478,12 @@ typedef struct cpumask cpumask_t;
495478
/* Wait a little while for this cpu to */
496479
/* respond before going on to the next one. */
497480
/***********************************************/
498-
if (ack_wait(c, 1000)) {
481+
if (ack_wait(c, 100)) {
499482
cpus_todo--;
500483
cpu &= ~(1 << c);
501484
}
502485
}
503-
/*if (cpus_todo > 0 && first) {
504-
cnt_xcall8++;
505-
void dump_all_stacks(void); first = FALSE; dtrace_printf("xcall deadlock:\n"); }
506-
*/
507486
}
508-
509487
// smp_mb();
510488

511489
xcall_levels[cpu_id]--;

0 commit comments

Comments
 (0)