summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-04-18 20:20:36 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-04-18 20:20:36 +0000
commit8f36c2ecb4df730fd9642eba3fce269d6982f136 (patch)
tree80bbd7323d3ab74313ab8aa12a76a8dd03c5cff8 /sys
parent5736a8a4b6681c5414f6a97e4b572b7db69f266d (diff)
Now that i386 has a per-process astpending, we can garbage collect ipi_ast
and do an ipi_nop cross-call from signotify() instead. ok miod@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/i386/apicvec.s22
-rw-r--r--sys/arch/i386/i386/ipifuncs.c10
-rw-r--r--sys/arch/i386/i386/lapic.c3
-rw-r--r--sys/arch/i386/i386/machdep.c39
-rw-r--r--sys/arch/i386/include/cpu.h8
-rw-r--r--sys/arch/i386/include/i82489var.h10
-rw-r--r--sys/arch/i386/include/intrdefs.h19
7 files changed, 44 insertions, 67 deletions
diff --git a/sys/arch/i386/i386/apicvec.s b/sys/arch/i386/i386/apicvec.s
index da710c4dbe5..c5493f3438f 100644
--- a/sys/arch/i386/i386/apicvec.s
+++ b/sys/arch/i386/i386/apicvec.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: apicvec.s,v 1.10 2007/05/25 15:55:26 art Exp $ */
+/* $OpenBSD: apicvec.s,v 1.11 2008/04/18 20:20:35 kettenis Exp $ */
/* $NetBSD: apicvec.s,v 1.1.2.2 2000/02/21 21:54:01 sommerfeld Exp $ */
/*-
@@ -67,26 +67,6 @@ XINTR(ipi):
popl CPL
INTRFASTEXIT
- .globl XINTR(ipi_ast)
-XINTR(ipi_ast):
- pushl %eax
- pushl %ds
- movl $GSEL(GDATA_SEL, SEL_KPL), %eax
- movl %eax, %ds
-
- ioapic_asm_ack()
-
- movl $IPL_SOFTAST, %eax
- orl $(1 << SIR_AST), _C_LABEL(ipending)
-
- orl $(LAPIC_DLMODE_FIXED|LAPIC_LVL_ASSERT|LAPIC_DEST_SELF), %eax
- movl %eax, _C_LABEL(local_apic) + LAPIC_ICRLO
-
- movl _C_LABEL(local_apic) + LAPIC_ID, %eax
- popl %ds
- popl %eax
- iret
-
.globl XINTR(ipi_invltlb)
.p2align 4,0x90
XINTR(ipi_invltlb):
diff --git a/sys/arch/i386/i386/ipifuncs.c b/sys/arch/i386/i386/ipifuncs.c
index 83a3c944121..55565075770 100644
--- a/sys/arch/i386/i386/ipifuncs.c
+++ b/sys/arch/i386/i386/ipifuncs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipifuncs.c,v 1.11 2008/04/13 16:11:28 kettenis Exp $ */
+/* $OpenBSD: ipifuncs.c,v 1.12 2008/04/18 20:20:35 kettenis Exp $ */
/* $NetBSD: ipifuncs.c,v 1.1.2.3 2000/06/26 02:04:06 sommerfeld Exp $ */
/*-
@@ -71,9 +71,12 @@ void i386_ipi_flush_fpu(struct cpu_info *);
#define i386_ipi_flush_fpu 0
#endif
+void i386_ipi_nop(struct cpu_info *);
+
void (*ipifunc[I386_NIPI])(struct cpu_info *) =
{
i386_ipi_halt,
+ i386_ipi_nop,
i386_ipi_flush_fpu,
i386_ipi_synch_fpu,
#if 0
@@ -92,6 +95,11 @@ void (*ipifunc[I386_NIPI])(struct cpu_info *) =
};
void
+i386_ipi_nop(struct cpu_info *ci)
+{
+}
+
+void
i386_ipi_halt(struct cpu_info *ci)
{
disable_intr();
diff --git a/sys/arch/i386/i386/lapic.c b/sys/arch/i386/i386/lapic.c
index 517129f84c0..46e3fa6a277 100644
--- a/sys/arch/i386/i386/lapic.c
+++ b/sys/arch/i386/i386/lapic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lapic.c,v 1.20 2008/01/26 11:18:42 kettenis Exp $ */
+/* $OpenBSD: lapic.c,v 1.21 2008/04/18 20:20:35 kettenis Exp $ */
/* $NetBSD: lapic.c,v 1.1.2.8 2000/02/23 06:10:50 sommerfeld Exp $ */
/*-
@@ -183,7 +183,6 @@ lapic_boot_init(paddr_t lapic_base)
#ifdef MULTIPROCESSOR
idt_vec_set(LAPIC_IPI_VECTOR, Xintripi);
- idt_vec_set(LAPIC_IPI_AST, Xintripi_ast);
idt_vec_set(LAPIC_IPI_INVLTLB, Xintripi_invltlb);
idt_vec_set(LAPIC_IPI_INVLPG, Xintripi_invlpg);
idt_vec_set(LAPIC_IPI_INVLRANGE, Xintripi_invlrange);
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index b939df2139d..c55cc520598 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.423 2008/04/18 18:54:39 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.424 2008/04/18 20:20:35 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -2135,29 +2135,6 @@ ibcs2_sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
#endif
/*
- * To send an AST to a process on another cpu we send an IPI to that cpu,
- * the IPI schedules a special soft interrupt (that does nothing) and then
- * returns through the normal interrupt return path which in turn handles
- * the AST.
- *
- * The IPI can't handle the AST because it usually requires grabbing the
- * biglock and we can't afford spinning in the IPI handler with interrupts
- * unlocked (so that we take further IPIs and grow our stack until it
- * overflows).
- */
-void
-aston(struct proc *p)
-{
-#ifdef MULTIPROCESSOR
- if (i386_atomic_testset_i(&p->p_md.md_astpending, 1) == 0 &&
- p->p_cpu != curcpu())
- i386_fast_ipi(p->p_cpu, LAPIC_IPI_AST);
-#else
- p->p_md.md_astpending = 1;
-#endif
-}
-
-/*
* Send an interrupt to process.
*
* Stack is set up to allow sigcode stored
@@ -2356,6 +2333,20 @@ sys_sigreturn(struct proc *p, void *v, register_t *retval)
return (EJUSTRETURN);
}
+/*
+ * Notify the current process (p) that it has a signal pending,
+ * process as soon as possible.
+ */
+void
+signotify(struct proc *p)
+{
+ aston(p);
+#ifdef MULTIPROCESSOR
+ if (p->p_cpu != curcpu() && p->p_cpu != NULL)
+ i386_send_ipi(p->p_cpu, I386_IPI_NOP);
+#endif
+}
+
int waittime = -1;
struct pcb dumppcb;
diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h
index 94fc2fb7dad..aa2e676f503 100644
--- a/sys/arch/i386/include/cpu.h
+++ b/sys/arch/i386/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.100 2008/04/13 11:35:55 thib Exp $ */
+/* $OpenBSD: cpu.h,v 1.101 2008/04/18 20:20:35 kettenis Exp $ */
/* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */
/*-
@@ -219,6 +219,8 @@ extern void cpu_init_idle_pcbs(void);
#endif
+#define aston(p) ((p)->p_md.md_astpending = 1)
+
#define curpcb curcpu()->ci_curpcb
#define want_resched (curcpu()->ci_want_resched)
@@ -238,8 +240,6 @@ extern void need_resched(struct cpu_info *);
*/
#define PROC_PC(p) ((p)->p_md.md_regs->tf_eip)
-void aston(struct proc *);
-
/*
* Give a profiling tick to the current process when the user profiling
* buffer pages are invalid. On the i386, request an ast to send us
@@ -251,7 +251,7 @@ void aston(struct proc *);
* Notify the current process (p) that it has a signal pending,
* process as soon as possible.
*/
-#define signotify(p) aston(p)
+void signotify(struct proc *);
/*
* We need a machine-independent name for this.
diff --git a/sys/arch/i386/include/i82489var.h b/sys/arch/i386/include/i82489var.h
index 3fac16e9011..03ce41551b7 100644
--- a/sys/arch/i386/include/i82489var.h
+++ b/sys/arch/i386/include/i82489var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: i82489var.h,v 1.6 2007/05/26 22:09:17 weingart Exp $ */
+/* $OpenBSD: i82489var.h,v 1.7 2008/04/18 20:20:35 kettenis Exp $ */
/* $NetBSD: i82489var.h,v 1.1.2.2 2000/02/21 18:46:14 sommerfeld Exp $ */
/*-
@@ -108,12 +108,10 @@ extern void Xintrltimer(void);
* Special IPI vectors. We can use IDT 0xf0 - 0xff for this.
*/
#define LAPIC_IPI_OFFSET 0xf0
-#define LAPIC_IPI_AST (LAPIC_IPI_OFFSET + 0)
-#define LAPIC_IPI_INVLTLB (LAPIC_IPI_OFFSET + 1)
-#define LAPIC_IPI_INVLPG (LAPIC_IPI_OFFSET + 2)
-#define LAPIC_IPI_INVLRANGE (LAPIC_IPI_OFFSET + 3)
+#define LAPIC_IPI_INVLTLB (LAPIC_IPI_OFFSET + 0)
+#define LAPIC_IPI_INVLPG (LAPIC_IPI_OFFSET + 1)
+#define LAPIC_IPI_INVLRANGE (LAPIC_IPI_OFFSET + 2)
-extern void Xintripi_ast(void);
extern void Xintripi_invltlb(void);
extern void Xintripi_invlpg(void);
extern void Xintripi_invlrange(void);
diff --git a/sys/arch/i386/include/intrdefs.h b/sys/arch/i386/include/intrdefs.h
index b420765376b..474fecf591c 100644
--- a/sys/arch/i386/include/intrdefs.h
+++ b/sys/arch/i386/include/intrdefs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intrdefs.h,v 1.9 2007/09/07 08:37:38 art Exp $ */
+/* $OpenBSD: intrdefs.h,v 1.10 2008/04/18 20:20:35 kettenis Exp $ */
/* $NetBSD: intrdefs.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */
#ifndef _i386_INTRDEFS_H
@@ -108,16 +108,17 @@
#define IDT_INTR_HIGH 0xef
#define I386_IPI_HALT 0x00000001
-#define I386_IPI_FLUSH_FPU 0x00000002
-#define I386_IPI_SYNCH_FPU 0x00000004
-#define I386_IPI_MTRR 0x00000008
-#define I386_IPI_GDT 0x00000010
-#define I386_IPI_DDB 0x00000020 /* synchronize while in ddb */
-#define I386_IPI_SETPERF 0x00000040
+#define I386_IPI_NOP 0x00000002
+#define I386_IPI_FLUSH_FPU 0x00000004
+#define I386_IPI_SYNCH_FPU 0x00000008
+#define I386_IPI_MTRR 0x00000010
+#define I386_IPI_GDT 0x00000020
+#define I386_IPI_DDB 0x00000040 /* synchronize while in ddb */
+#define I386_IPI_SETPERF 0x00000080
-#define I386_NIPI 7
+#define I386_NIPI 8
-#define I386_IPI_NAMES { "halt IPI", "FPU flush IPI", \
+#define I386_IPI_NAMES { "halt IPI", "nop IPI", "FPU flush IPI", \
"FPU synch IPI", \
"MTRR update IPI", "GDT update IPI", \
"DDB IPI", "setperf IPI" }