From owner-svn-src-head@FreeBSD.ORG Tue Jan 26 05:11:48 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C8E61065676; Tue, 26 Jan 2010 05:11:48 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D0808FC1F; Tue, 26 Jan 2010 05:11:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0Q5Bm8W086973; Tue, 26 Jan 2010 05:11:48 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0Q5BmpV086970; Tue, 26 Jan 2010 05:11:48 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201001260511.o0Q5BmpV086970@svn.freebsd.org> From: Randall Stewart Date: Tue, 26 Jan 2010 05:11:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203009 - head/sys/mips/rmi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jan 2010 05:11:48 -0000 Author: rrs Date: Tue Jan 26 05:11:48 2010 New Revision: 203009 URL: http://svn.freebsd.org/changeset/base/203009 Log: To prevent a LOR we need to pass in a lock flag in the pic routines. In some places we hold the pic lock, others we do not. Modified: head/sys/mips/rmi/intr_machdep.c head/sys/mips/rmi/pic.h Modified: head/sys/mips/rmi/intr_machdep.c ============================================================================== --- head/sys/mips/rmi/intr_machdep.c Tue Jan 26 05:10:10 2010 (r203008) +++ head/sys/mips/rmi/intr_machdep.c Tue Jan 26 05:11:48 2010 (r203009) @@ -147,17 +147,17 @@ cpu_intr(struct trapframe *tf) if ((i == IPI_AST) || (i == IPI_RENDEZVOUS) || (i == IPI_STOP) || (i == IPI_SMP_CALL_FUNCTION)) { write_c0_eirr64(1ULL << i); - pic_ack(i); + pic_ack(i,0); smp_handle_ipi(tf, i); - pic_delayed_ack(i); + pic_delayed_ack(i,0); continue; } #ifdef XLR_PERFMON if (i == IPI_PERFMON) { write_c0_eirr64(1ULL << i); - pic_ack(i); + pic_ack(i,0); xlr_perfmon_sampler(NULL); - pic_delayed_ack(i); + pic_delayed_ack(i,0); continue; } #endif @@ -167,7 +167,7 @@ cpu_intr(struct trapframe *tf) ie = mih->mih_event; write_c0_eirr64(1ULL << i); - pic_ack(i); + pic_ack(i, 0); if (!ie || TAILQ_EMPTY(&ie->ie_handlers)) { printf("stray interrupt %d\n", i); continue; @@ -175,7 +175,7 @@ cpu_intr(struct trapframe *tf) if (intr_event_handle(ie, tf) != 0) { printf("stray interrupt %d\n", i); } - pic_delayed_ack(i); + pic_delayed_ack(i, 0); } critical_exit(); } Modified: head/sys/mips/rmi/pic.h ============================================================================== --- head/sys/mips/rmi/pic.h Tue Jan 26 05:10:10 2010 (r203008) +++ head/sys/mips/rmi/pic.h Tue Jan 26 05:11:48 2010 (r203009) @@ -29,6 +29,8 @@ * RMI_BSD */ #ifndef _RMI_PIC_H_ #define _RMI_PIC_H_ +#include +__FBSDID("$FreeBSD$"); extern int rmi_spin_mutex_safe; @@ -202,44 +204,44 @@ extern struct mtx xlr_pic_lock; static __inline__ __uint32_t -pic_read_control(void) +pic_read_control(int haslock) { xlr_reg_t *mmio = xlr_io_mmio(XLR_IO_PIC_OFFSET); __uint32_t reg; - if (rmi_spin_mutex_safe) + if ((rmi_spin_mutex_safe) && (haslock == 0)) mtx_lock_spin(&xlr_pic_lock); xlr_read_reg(mmio, PIC_CTRL); - if (rmi_spin_mutex_safe) + if ((rmi_spin_mutex_safe) && (haslock == 0)) mtx_unlock_spin(&xlr_pic_lock); return reg; } static __inline__ void -pic_write_control(__uint32_t control) +pic_write_control(__uint32_t control, int haslock) { xlr_reg_t *mmio = xlr_io_mmio(XLR_IO_PIC_OFFSET); - if (rmi_spin_mutex_safe) + if ((rmi_spin_mutex_safe) && (haslock == 0)) mtx_lock_spin(&xlr_pic_lock); xlr_write_reg(mmio, PIC_CTRL, control); - if (rmi_spin_mutex_safe) + if ((rmi_spin_mutex_safe) && (haslock == 0)) mtx_unlock_spin(&xlr_pic_lock); } static __inline__ void -pic_update_control(__uint32_t control) +pic_update_control(__uint32_t control, int haslock) { xlr_reg_t *mmio = xlr_io_mmio(XLR_IO_PIC_OFFSET); - if (rmi_spin_mutex_safe) + if ((rmi_spin_mutex_safe) && (haslock == 0)) mtx_lock_spin(&xlr_pic_lock); xlr_write_reg(mmio, PIC_CTRL, (control | xlr_read_reg(mmio, PIC_CTRL))); - if (rmi_spin_mutex_safe) + if ((rmi_spin_mutex_safe) && (haslock == 0)) mtx_unlock_spin(&xlr_pic_lock); } static __inline__ void -pic_ack(int irq) +pic_ack(int irq, int haslock) { xlr_reg_t *mmio = xlr_io_mmio(XLR_IO_PIC_OFFSET); @@ -248,10 +250,10 @@ pic_ack(int irq) return; if (PIC_IRQ_IS_EDGE_TRIGGERED(irq)) { - if (rmi_spin_mutex_safe) + if ((rmi_spin_mutex_safe) && (haslock == 0)) mtx_lock_spin(&xlr_pic_lock); xlr_write_reg(mmio, PIC_INT_ACK, (1 << (irq - PIC_IRQ_BASE))); - if (rmi_spin_mutex_safe) + if ((rmi_spin_mutex_safe) && (haslock == 0)) mtx_unlock_spin(&xlr_pic_lock); return; } @@ -259,7 +261,7 @@ pic_ack(int irq) } static inline void -pic_delayed_ack(int irq) +pic_delayed_ack(int irq, int haslock) { xlr_reg_t *mmio = xlr_io_mmio(XLR_IO_PIC_OFFSET); @@ -267,10 +269,10 @@ pic_delayed_ack(int irq) return; if (!PIC_IRQ_IS_EDGE_TRIGGERED(irq)) { - if (rmi_spin_mutex_safe) + if ((rmi_spin_mutex_safe)&& (haslock == 0)) mtx_lock_spin(&xlr_pic_lock); xlr_write_reg(mmio, PIC_INT_ACK, (1 << (irq - PIC_IRQ_BASE))); - if (rmi_spin_mutex_safe) + if ((rmi_spin_mutex_safe) && (haslock == 0)) mtx_unlock_spin(&xlr_pic_lock); return; }