From: John L. <mov...@us...> - 2001-08-14 02:38:32
|
Update of /cvsroot/oprofile/oprofile In directory usw-pr-cvs1:/tmp/cvs-serv13284 Modified Files: ChangeLog op_syscalls.c oprofile.c Log Message: masking again during set_gate Index: ChangeLog =================================================================== RCS file: /cvsroot/oprofile/oprofile/ChangeLog,v retrieving revision 1.75 retrieving revision 1.76 diff -u -d -r1.75 -r1.76 --- ChangeLog 2001/08/11 12:37:56 1.75 +++ ChangeLog 2001/08/14 02:38:29 1.76 @@ -1,3 +1,10 @@ +2001-08-14 John Levon <mo...@co...> + + * op_syscalls.c: some small fixes + + * oprofile.c: add back unmasking code during set_gate, but only + LVTPC + 2001-08-11 John Levon <mo...@co...> * oprofile.h: 2.4.8 doesn't either. *sigh*. looks like we need Index: op_syscalls.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/op_syscalls.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- op_syscalls.c 2001/08/10 13:36:37 1.14 +++ op_syscalls.c 2001/08/14 02:38:29 1.15 @@ -164,6 +164,7 @@ if (!dname_stack) return -EFAULT; dname_top = 0; + memset(dname_stack, 0, DNAME_STACK_MAX * sizeof(struct qstr *)); hash_map = rvmalloc(PAGE_ALIGN(OP_HASH_MAP_SIZE)); if (!hash_map) @@ -253,6 +254,8 @@ dname_stack[dname_top] = dname; if (dname_top != DNAME_STACK_MAX) dname_top++; + else + printk("oprofile: overflowed dname stack !\n"); } inline static struct qstr *pop_dname(void) @@ -276,7 +279,7 @@ /* wind the dentries onto the stack pages */ for (;;) { - if (d->d_name.len > OP_HASH_LINE) + if (d->d_name.len >= OP_HASH_LINE) goto too_large; /* deleted ? */ Index: oprofile.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/oprofile.c,v retrieving revision 1.70 retrieving revision 1.71 diff -u -d -r1.70 -r1.71 --- oprofile.c 2001/08/11 01:38:29 1.70 +++ oprofile.c 2001/08/14 02:38:29 1.71 @@ -127,13 +127,29 @@ static ulong idt_addr; static ulong kernel_nmi; +static ulong lvtpc_masked; +/* this masking code is unsafe and nasty but might deal with the small + * race when installing the NMI entry into the IDT + */ +void mask_lvtpc(void * e) +{ + ulong v = apic_read(APIC_LVTPC); + lvtpc_masked = v & APIC_LVT_MASKED; + apic_write(APIC_LVTPC, v | APIC_LVT_MASKED); +} + +void unmask_lvtpc(void * e) +{ + if (!lvtpc_masked) + apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED); +} + static void install_nmi(void) { volatile struct _descr descr = { 0, 0,}; volatile struct _idt_descr *de; - __cli(); store_idt(descr); idt_addr = descr.base; de = (struct _idt_descr *)idt_addr; @@ -142,15 +158,20 @@ /* see Intel Vol.3 Figure 5-2, interrupt gate */ kernel_nmi = (de->a & 0xffff) | (de->b & 0xffff0000); + smp_call_function(mask_lvtpc, NULL, 0, 1); + mask_lvtpc(NULL); _set_gate(de, 14, 0, &op_nmi); - __sti(); + smp_call_function(unmask_lvtpc, NULL, 0, 1); + unmask_lvtpc(NULL); } static void restore_nmi(void) { - __cli(); + smp_call_function(mask_lvtpc, NULL, 0, 1); + mask_lvtpc(NULL); _set_gate(((char *)(idt_addr)) + 16, 14, 0, kernel_nmi); - __sti(); + smp_call_function(unmask_lvtpc, NULL, 0, 1); + unmask_lvtpc(NULL); } /* ---------------- APIC setup ------------------ */ |