From owner-freebsd-current Fri Jul 2 1:12: 7 1999 Delivered-To: freebsd-current@freebsd.org Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by hub.freebsd.org (Postfix) with ESMTP id 614AD14D79 for ; Fri, 2 Jul 1999 01:12:03 -0700 (PDT) (envelope-from alc@cs.rice.edu) Received: (from alc@localhost) by cs.rice.edu (8.9.0/8.9.0) id DAA27402; Fri, 2 Jul 1999 03:11:54 -0500 (CDT) Date: Fri, 2 Jul 1999 03:11:54 -0500 From: Alan Cox To: Soren Schmidt Cc: current@freebsd.org Subject: Re: Something weird happening w/ SMP -current Message-ID: <19990702031154.F10611@cs.rice.edu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=QTprm0S8XgL7H0Dt X-Mailer: Mutt 0.95.5us Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --QTprm0S8XgL7H0Dt Content-Type: text/plain; charset=us-ascii Try the attached patch. If this doesn't work, I'll back out the last i386/isa/ipl_funcs.c change. Alan --QTprm0S8XgL7H0Dt Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ipending.patch" Index: i386/i386/swtch.s =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/swtch.s,v retrieving revision 1.82 diff -c -r1.82 swtch.s *** swtch.s 1999/06/01 18:19:45 1.82 --- swtch.s 1999/06/30 07:50:54 *************** *** 311,317 **** * XXX: we had damn well better be sure we had it before doing this! */ CPL_LOCK /* XXX */ ! andl $~SWI_AST_MASK, _ipending /* XXX */ movl $0, _cpl /* XXX Allow ASTs on other CPU */ CPL_UNLOCK /* XXX */ movl $FREE_LOCK, %eax --- 311,317 ---- * XXX: we had damn well better be sure we had it before doing this! */ CPL_LOCK /* XXX */ ! MPLOCKED andl $~SWI_AST_MASK, _ipending /* XXX */ movl $0, _cpl /* XXX Allow ASTs on other CPU */ CPL_UNLOCK /* XXX */ movl $FREE_LOCK, %eax Index: i386/isa/apic_ipl.s =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/apic_ipl.s,v retrieving revision 1.23 diff -c -r1.23 apic_ipl.s *** apic_ipl.s 1999/04/10 19:22:17 1.23 --- apic_ipl.s 1999/06/30 07:43:55 *************** *** 116,121 **** --- 116,122 ---- ALIGN_TEXT splz_unpend: bsfl %ecx,%ecx + lock btrl %ecx,_ipending jnc splz_next cmpl $NHWI,%ecx Index: i386/isa/apic_vector.s =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/apic_vector.s,v retrieving revision 1.40 diff -c -r1.40 apic_vector.s *** apic_vector.s 1999/06/16 03:53:52 1.40 --- apic_vector.s 1999/06/30 07:35:32 *************** *** 398,403 **** --- 398,404 ---- MASK_IRQ(irq_num) ; \ EOI_IRQ(irq_num) ; \ AVCPL_LOCK ; /* MP-safe */ \ + lock ; \ orl $IRQ_BIT(irq_num), _ipending ; \ AVCPL_UNLOCK ; \ lock ; \ *************** *** 409,414 **** --- 410,416 ---- ALIGN_TEXT ; \ 2: ; /* masked by cpl|cml */ \ APIC_ITRACE(apic_itrace_masked, irq_num, APIC_ITRACE_MASKED) ; \ + lock ; \ orl $IRQ_BIT(irq_num), _ipending ; \ AVCPL_UNLOCK ; \ DELOCK ; /* XXX this is going away... */ \ *************** *** 418,423 **** --- 420,426 ---- 3: ; /* other cpu has isr lock */ \ APIC_ITRACE(apic_itrace_noisrlock, irq_num, APIC_ITRACE_NOISRLOCK) ;\ AVCPL_LOCK ; /* MP-safe */ \ + lock ; \ orl $IRQ_BIT(irq_num), _ipending ; \ testl $IRQ_BIT(irq_num), _cpl ; \ jne 4f ; /* this INT masked */ \ *************** *** 485,490 **** --- 488,494 ---- pushl %eax ; \ orl _intr_mask + (irq_num) * 4, %eax ; \ movl %eax, _cpl ; \ + lock ; \ andl $~IRQ_BIT(irq_num), _ipending ; \ AVCPL_UNLOCK ; \ ; \ *************** *** 508,513 **** --- 512,518 ---- MASK_IRQ(irq_num) ; \ EOI_IRQ(irq_num) ; \ AVCPL_LOCK ; /* MP-safe */ \ + lock ; \ orl $IRQ_BIT(irq_num), _ipending ; \ AVCPL_UNLOCK ; \ lock ; \ *************** *** 518,523 **** --- 523,529 ---- ALIGN_TEXT ; \ 2: ; /* masked by cpl, leave iactive set */ \ APIC_ITRACE(apic_itrace_masked, irq_num, APIC_ITRACE_MASKED) ; \ + lock ; \ orl $IRQ_BIT(irq_num), _ipending ; \ AVCPL_UNLOCK ; \ ISR_RELLOCK ; /* XXX this is going away... */ \ *************** *** 527,532 **** --- 533,539 ---- 3: ; /* other cpu has isr lock */ \ APIC_ITRACE(apic_itrace_noisrlock, irq_num, APIC_ITRACE_NOISRLOCK) ;\ AVCPL_LOCK ; /* MP-safe */ \ + lock ; \ orl $IRQ_BIT(irq_num), _ipending ; \ testl $IRQ_BIT(irq_num), _cpl ; \ jne 4f ; /* this INT masked */ \ *************** *** 698,703 **** --- 705,711 ---- movl _cpl, %eax #endif pushl %eax + lock orl $SWI_AST_PENDING, _ipending AVCPL_UNLOCK lock Index: i386/isa/ipl.s =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/ipl.s,v retrieving revision 1.28 diff -c -r1.28 ipl.s *** ipl.s 1999/06/01 18:20:15 1.28 --- ipl.s 1999/06/30 07:46:33 *************** *** 236,241 **** --- 236,242 ---- TEST_CIL /* we enter with cpl locked */ bsfl %ecx, %ecx /* slow, but not worth optimizing */ + lock btrl %ecx, _ipending jnc doreti_next2 /* some intr cleared memory copy */ cmpl $NHWI, %ecx *************** *** 377,383 **** */ cli ICPL_LOCK ! orl $SWI_AST_PENDING, _ipending /* cpl is unlocked in doreti_exit */ subl %eax,%eax #ifdef CPL_AND_CML --- 378,384 ---- */ cli ICPL_LOCK ! MPLOCKED orl $SWI_AST_PENDING, _ipending /* cpl is unlocked in doreti_exit */ subl %eax,%eax #ifdef CPL_AND_CML --QTprm0S8XgL7H0Dt-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message