History log of /openbsd-current/sys/arch/i386/include/intr.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.50 26-May-2024 kettenis

Implement wakeup interrupts on amd64. Provide a dummy implementation for
i386 such that we can call the necessary hooks in the suspend/resume code
without adding #ifdefs. Tweak the arm64 implementation such that we can
call the hooks earlier as this is necessary to mask MSI and MSI-X
interrupts on arm64.

ok deraadt@, mlarkin@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.49 14-Dec-2021 deraadt

delete incorrect comment about sys/cdefs.h


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.48 20-Aug-2018 visa

Remove unused spllock().

OK deraadt@ mpi@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.47 13-Sep-2015 kettenis

intr_barrier(9) for i386.


Revision tags: OPENBSD_5_8_BASE
# 1.46 19-Jul-2015 sf

Make i386_send_ipi() return void

Nobody uses its return value.


# 1.45 16-Jul-2015 guenther

Move grab/release of the kernel_lock for softintrs from the ASM stubs to
softintr_dispatch(). Delete traces of long superseded stats code.

ok beck@ mpi@ uebayasi@


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.44 29-Mar-2014 guenther

It's been a quarter century: we can assume volatile is present with that name.

ok dlg@ mpi@ deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.43 05-Jul-2011 oga

N: Thou shalt not call hardclock() with biglock held.

i386 disobeys the Nth commandment. Fix this. While here, make i386 and amd64
definitions of iplclock and statclock match.

ok art@, kettenis@


# 1.42 23-Mar-2011 pirofti

Normalize sentinel. Use _MACHINE_*_H_ and _<ARCH>_*_H_ properly and consitently.

Discussed and okay drahn@. Okay deraadt@.


Revision tags: OPENBSD_4_9_BASE
# 1.41 27-Dec-2010 guenther

Eliminate x86_multicast_ipi() as unused and broken (doesn't handle #cpu>32).
The i386 version was removed some time ago, so kill its declaration too.
ok tedu@ kettenis@


# 1.40 21-Dec-2010 claudio

Convert netisr to a normal soft interrupt instead of hanving MD code
for it. This makes the netisr a real C function which will help further
development. No noticable performance change on i386 and amd64.
With input from kettenis@ and miod@ additional OKs mikeb@ and henning@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.39 13-Aug-2009 kettenis

Make the i386 APIC code closer to the amd64 version. Many whitespace fixes,
some additional code.

ok toby@, oga@


Revision tags: OPENBSD_4_6_BASE
# 1.38 19-Apr-2009 oga

Switch the softinterrupt code on x86 over to mutexes instead of
simplelocks + splhigh().

First part of making it possible to make mpsafe softinterrupts.

"oh yes, definitely" miod@


# 1.37 15-Mar-2009 miod

Introduce splsoftassert(), similar to splassert() but for soft interrupt
levels. This will allow for platforms where soft interrupt levels do not
map to real hardware interrupt levels to have soft ipl values overlapping
hard ipl values without breaking spl asserts.


Revision tags: OPENBSD_4_5_BASE
# 1.36 28-Sep-2008 brad

Always include machine/cpu.h and remove i82489reg.h/i82489var.h.

ok kettenis@


Revision tags: OPENBSD_4_4_BASE
# 1.35 07-May-2008 kettenis

Move i386 to __HAVE_GENERIC_SOFT_INTERRUPTS

ok dlg@, tested by dlg@, oga@, jsg@, deraadt@


# 1.34 25-Apr-2008 kettenis

Make ipending per-cpu. Should fix PR 5788.

ok weingart@


Revision tags: OPENBSD_4_3_BASE
# 1.33 07-Sep-2007 art

Remove some left-overs from the TSC based microtime. We don't need
to synchronize the tsc between CPUs anymore. While here, also remove
the slow TLB IPI since it's been dead for a while.

noticed by mickey
toby@ ok


Revision tags: OPENBSD_4_2_BASE
# 1.32 25-May-2007 art

Replace the overdesigned and overcomplicated tlb shootdown code with
very simple and dumb fast tlb IPI handlers that have in the order of
the same amount of instructions as the old code had function calls.

All TLB shootdowns are reorganized so that we always shoot the,
without looking at PG_U and when we're shooting a range (primarily in
pmap_remove), we shoot the range when there are 32 or less pages in
it, otherwise we just nuke the whole TLB (this might need tweaking if
someone is interested in micro-optimization). The IPIs are not handled
through the normal interrupt vectoring code, they are not blockable
and they only shoot one page or a range of pages or the whole tlb.

This gives a 15% reduction in system time on my dual-core laptop
during a kernel compile and an 18% reduction in real time on a quad
machine doing bulk ports build.

Tested by many, in snaps for a week, no slowdowns reported (although not
everyone is seeing such huge wins).


# 1.31 16-May-2007 thib

splassert_ctl defaults to 1 now, so dont wrap the checks for
splassert_ctl > 0 in __predict_false().

ok deraadt@


# 1.30 21-Apr-2007 gwk

Introduce a smp aware hw.setperf mechanism, it will scale all CPUs or
cores by the same amount, i.e. if you do hw.setperf=50 both cores will
be scaled to the opearting state corresponing to 50%. Tested by many with
est (mainly on core2duo machines like X60 thinkpads). Only enable est
during GENERIC.MP build no one tested powernow.

ok art@


# 1.29 03-Apr-2007 art

Make the ast on i386 per-process instead of per-cpu. This makes
signal delivery more reliable in some cases when a process switches
cpu.

kettenis@ ok


# 1.28 23-Mar-2007 art

Remove duplicated defines from intr.h that are already defined in
intrdefs.h that is inlucded first thing in intr.h.

eyeballed for sanity by pedro@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.27 29-May-2006 mickey

implement reliable microtime on smp (joint work w/ otto):
send a bcast ipi from the cpu0 to all others to timestamp tsc
on every clock intr. this way using local tsc provides accurate
microtime() measurements. thus gettimeofday test passes now.
otto@ deraadt@ ok


# 1.26 12-Mar-2006 brad

remove IPL_IMP and splimp().


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.25 19-Apr-2005 mickey

nothing uses spllowersoftclock() anymore


Revision tags: OPENBSD_3_7_BASE
# 1.24 07-Jan-2005 pascoe

Fix profiled kernel builds on i386 by moving splraise/splx code into macros
permitting non-recursive reuse in mcount.

Should be a no-op for normal builds.


# 1.23 24-Dec-2004 pvalchev

Rewrite intlock/intunlock not to pass around interrupt frame directly
without copying which is against C conventions and broke GENERIC.MP
with a gcc3 optimization
From niklas, tested by many


Revision tags: OPENBSD_3_6_BASE
# 1.22 16-Jun-2004 grange

We need __splbarrier to compile kernel, tho it should be
replaced with a real gcc barrier.

ok deraadt@


# 1.21 13-Jun-2004 niklas

debranch SMP, have fun


Revision tags: SMP_SYNC_A SMP_SYNC_B
# 1.20 23-May-2004 tedu

workaround gcc brokenness by outlining spl functions.
finally solves vfs corruption. hint and ok art@, ok deraadt@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE UBC_SYNC_A
# 1.19 17-Apr-2003 drahn

i386 changes to move to ELF. asm cleanup. Change MAXDSIZ to 512M for 1Gsep.
DARPA funded work.


Revision tags: OPENBSD_3_3_BASE
# 1.18 11-Dec-2002 art

Some people say that "__asm __volatile("")" is not enough.
Use "__asm __volatile("":::"memory")" to completly avoid reordering.


Revision tags: OPENBSD_3_2_BASE UBC_SYNC_B
# 1.17 19-Jul-2002 art

Define an IPL_VM and mark IPL_IMP as "not to be used".


# 1.16 11-Jun-2002 art

define IPL_STATCLOCK


# 1.15 22-May-2002 art

Implement splassert. Even simpler than on the sparc.


# 1.14 29-Apr-2002 miod

Define placeholders for art's splassert() debugging stuff on all arches.
Currently as no-ops everywhere.

ok art@, deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.13 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: UBC_BASE
# 1.12 14-Dec-2001 niklas

branches: 1.12.2;
SMALL_KERNEL -> outline splx


# 1.11 13-Dec-2001 niklas

remover registers. bracket spl regions with asm volatiles


# 1.10 04-Dec-2001 niklas

New try at a level based irq system.


# 1.9 18-Nov-2001 aaron

Revert niklas's broken ICU interrupt handling changes; deraadt@ ok


# 1.8 12-Nov-2001 niklas

Redo the ICU interrupt handling system to better emulate an APIC system.
This is done by representing the current blockings of interrupts with
a priority level instead of an interrupt mask. This makes it possible to
share implementations for spl* functions/macros between both ICU
and APIC (a must when going MP) systems. In this process, assign
soft interrupts their own levels to match the way things will be on
APIC systems where they actually will be real interrupts and not just
bits in a pending mask as they are now.
Heavily inspired by Bill Studenmunds SMP work in NetBSD


Revision tags: OPENBSD_3_0_BASE
# 1.7 24-Jun-2001 miod

Define splvm() for arches who don't already provide it, with the same
definition as splimp().
art@ ok


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.6 05-Aug-2000 niklas

$OpenBSD$


# 1.5 06-Jul-2000 ho

Change splsoftclock() to raise the spl, instead of lowering it.
Add spllowersoftclock() for the former behaviour. Update comment. (art@ ok)


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE SMP_BASE kame_19991208
# 1.4 26-Jul-1999 csapuntz

branches: 1.4.4;


Some people don't have enough RAM in their PCs and expect swapping to
work.

Fix an array bounds problem with the imask[] array.


# 1.3 23-Jul-1999 niklas

From NetBSD; let i386 run audio at a high IPL


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.2 06-Aug-1996 deraadt

splstatclock to splhigh; problem pointed out by gopal


# 1.1 25-May-1996 deraadt

sync


# 1.49 14-Dec-2021 deraadt

delete incorrect comment about sys/cdefs.h


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.48 20-Aug-2018 visa

Remove unused spllock().

OK deraadt@ mpi@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.47 13-Sep-2015 kettenis

intr_barrier(9) for i386.


Revision tags: OPENBSD_5_8_BASE
# 1.46 19-Jul-2015 sf

Make i386_send_ipi() return void

Nobody uses its return value.


# 1.45 16-Jul-2015 guenther

Move grab/release of the kernel_lock for softintrs from the ASM stubs to
softintr_dispatch(). Delete traces of long superseded stats code.

ok beck@ mpi@ uebayasi@


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.44 29-Mar-2014 guenther

It's been a quarter century: we can assume volatile is present with that name.

ok dlg@ mpi@ deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.43 05-Jul-2011 oga

N: Thou shalt not call hardclock() with biglock held.

i386 disobeys the Nth commandment. Fix this. While here, make i386 and amd64
definitions of iplclock and statclock match.

ok art@, kettenis@


# 1.42 23-Mar-2011 pirofti

Normalize sentinel. Use _MACHINE_*_H_ and _<ARCH>_*_H_ properly and consitently.

Discussed and okay drahn@. Okay deraadt@.


Revision tags: OPENBSD_4_9_BASE
# 1.41 27-Dec-2010 guenther

Eliminate x86_multicast_ipi() as unused and broken (doesn't handle #cpu>32).
The i386 version was removed some time ago, so kill its declaration too.
ok tedu@ kettenis@


# 1.40 21-Dec-2010 claudio

Convert netisr to a normal soft interrupt instead of hanving MD code
for it. This makes the netisr a real C function which will help further
development. No noticable performance change on i386 and amd64.
With input from kettenis@ and miod@ additional OKs mikeb@ and henning@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.39 13-Aug-2009 kettenis

Make the i386 APIC code closer to the amd64 version. Many whitespace fixes,
some additional code.

ok toby@, oga@


Revision tags: OPENBSD_4_6_BASE
# 1.38 19-Apr-2009 oga

Switch the softinterrupt code on x86 over to mutexes instead of
simplelocks + splhigh().

First part of making it possible to make mpsafe softinterrupts.

"oh yes, definitely" miod@


# 1.37 15-Mar-2009 miod

Introduce splsoftassert(), similar to splassert() but for soft interrupt
levels. This will allow for platforms where soft interrupt levels do not
map to real hardware interrupt levels to have soft ipl values overlapping
hard ipl values without breaking spl asserts.


Revision tags: OPENBSD_4_5_BASE
# 1.36 28-Sep-2008 brad

Always include machine/cpu.h and remove i82489reg.h/i82489var.h.

ok kettenis@


Revision tags: OPENBSD_4_4_BASE
# 1.35 07-May-2008 kettenis

Move i386 to __HAVE_GENERIC_SOFT_INTERRUPTS

ok dlg@, tested by dlg@, oga@, jsg@, deraadt@


# 1.34 25-Apr-2008 kettenis

Make ipending per-cpu. Should fix PR 5788.

ok weingart@


Revision tags: OPENBSD_4_3_BASE
# 1.33 07-Sep-2007 art

Remove some left-overs from the TSC based microtime. We don't need
to synchronize the tsc between CPUs anymore. While here, also remove
the slow TLB IPI since it's been dead for a while.

noticed by mickey
toby@ ok


Revision tags: OPENBSD_4_2_BASE
# 1.32 25-May-2007 art

Replace the overdesigned and overcomplicated tlb shootdown code with
very simple and dumb fast tlb IPI handlers that have in the order of
the same amount of instructions as the old code had function calls.

All TLB shootdowns are reorganized so that we always shoot the,
without looking at PG_U and when we're shooting a range (primarily in
pmap_remove), we shoot the range when there are 32 or less pages in
it, otherwise we just nuke the whole TLB (this might need tweaking if
someone is interested in micro-optimization). The IPIs are not handled
through the normal interrupt vectoring code, they are not blockable
and they only shoot one page or a range of pages or the whole tlb.

This gives a 15% reduction in system time on my dual-core laptop
during a kernel compile and an 18% reduction in real time on a quad
machine doing bulk ports build.

Tested by many, in snaps for a week, no slowdowns reported (although not
everyone is seeing such huge wins).


# 1.31 16-May-2007 thib

splassert_ctl defaults to 1 now, so dont wrap the checks for
splassert_ctl > 0 in __predict_false().

ok deraadt@


# 1.30 21-Apr-2007 gwk

Introduce a smp aware hw.setperf mechanism, it will scale all CPUs or
cores by the same amount, i.e. if you do hw.setperf=50 both cores will
be scaled to the opearting state corresponing to 50%. Tested by many with
est (mainly on core2duo machines like X60 thinkpads). Only enable est
during GENERIC.MP build no one tested powernow.

ok art@


# 1.29 03-Apr-2007 art

Make the ast on i386 per-process instead of per-cpu. This makes
signal delivery more reliable in some cases when a process switches
cpu.

kettenis@ ok


# 1.28 23-Mar-2007 art

Remove duplicated defines from intr.h that are already defined in
intrdefs.h that is inlucded first thing in intr.h.

eyeballed for sanity by pedro@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.27 29-May-2006 mickey

implement reliable microtime on smp (joint work w/ otto):
send a bcast ipi from the cpu0 to all others to timestamp tsc
on every clock intr. this way using local tsc provides accurate
microtime() measurements. thus gettimeofday test passes now.
otto@ deraadt@ ok


# 1.26 12-Mar-2006 brad

remove IPL_IMP and splimp().


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.25 19-Apr-2005 mickey

nothing uses spllowersoftclock() anymore


Revision tags: OPENBSD_3_7_BASE
# 1.24 07-Jan-2005 pascoe

Fix profiled kernel builds on i386 by moving splraise/splx code into macros
permitting non-recursive reuse in mcount.

Should be a no-op for normal builds.


# 1.23 24-Dec-2004 pvalchev

Rewrite intlock/intunlock not to pass around interrupt frame directly
without copying which is against C conventions and broke GENERIC.MP
with a gcc3 optimization
From niklas, tested by many


Revision tags: OPENBSD_3_6_BASE
# 1.22 16-Jun-2004 grange

We need __splbarrier to compile kernel, tho it should be
replaced with a real gcc barrier.

ok deraadt@


# 1.21 13-Jun-2004 niklas

debranch SMP, have fun


Revision tags: SMP_SYNC_A SMP_SYNC_B
# 1.20 23-May-2004 tedu

workaround gcc brokenness by outlining spl functions.
finally solves vfs corruption. hint and ok art@, ok deraadt@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE UBC_SYNC_A
# 1.19 17-Apr-2003 drahn

i386 changes to move to ELF. asm cleanup. Change MAXDSIZ to 512M for 1Gsep.
DARPA funded work.


Revision tags: OPENBSD_3_3_BASE
# 1.18 11-Dec-2002 art

Some people say that "__asm __volatile("")" is not enough.
Use "__asm __volatile("":::"memory")" to completly avoid reordering.


Revision tags: OPENBSD_3_2_BASE UBC_SYNC_B
# 1.17 19-Jul-2002 art

Define an IPL_VM and mark IPL_IMP as "not to be used".


# 1.16 11-Jun-2002 art

define IPL_STATCLOCK


# 1.15 22-May-2002 art

Implement splassert. Even simpler than on the sparc.


# 1.14 29-Apr-2002 miod

Define placeholders for art's splassert() debugging stuff on all arches.
Currently as no-ops everywhere.

ok art@, deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.13 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: UBC_BASE
# 1.12 14-Dec-2001 niklas

branches: 1.12.2;
SMALL_KERNEL -> outline splx


# 1.11 13-Dec-2001 niklas

remover registers. bracket spl regions with asm volatiles


# 1.10 04-Dec-2001 niklas

New try at a level based irq system.


# 1.9 18-Nov-2001 aaron

Revert niklas's broken ICU interrupt handling changes; deraadt@ ok


# 1.8 12-Nov-2001 niklas

Redo the ICU interrupt handling system to better emulate an APIC system.
This is done by representing the current blockings of interrupts with
a priority level instead of an interrupt mask. This makes it possible to
share implementations for spl* functions/macros between both ICU
and APIC (a must when going MP) systems. In this process, assign
soft interrupts their own levels to match the way things will be on
APIC systems where they actually will be real interrupts and not just
bits in a pending mask as they are now.
Heavily inspired by Bill Studenmunds SMP work in NetBSD


Revision tags: OPENBSD_3_0_BASE
# 1.7 24-Jun-2001 miod

Define splvm() for arches who don't already provide it, with the same
definition as splimp().
art@ ok


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.6 05-Aug-2000 niklas

$OpenBSD$


# 1.5 06-Jul-2000 ho

Change splsoftclock() to raise the spl, instead of lowering it.
Add spllowersoftclock() for the former behaviour. Update comment. (art@ ok)


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE SMP_BASE kame_19991208
# 1.4 26-Jul-1999 csapuntz

branches: 1.4.4;


Some people don't have enough RAM in their PCs and expect swapping to
work.

Fix an array bounds problem with the imask[] array.


# 1.3 23-Jul-1999 niklas

From NetBSD; let i386 run audio at a high IPL


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.2 06-Aug-1996 deraadt

splstatclock to splhigh; problem pointed out by gopal


# 1.1 25-May-1996 deraadt

sync


# 1.48 20-Aug-2018 visa

Remove unused spllock().

OK deraadt@ mpi@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.47 13-Sep-2015 kettenis

intr_barrier(9) for i386.


Revision tags: OPENBSD_5_8_BASE
# 1.46 19-Jul-2015 sf

Make i386_send_ipi() return void

Nobody uses its return value.


# 1.45 16-Jul-2015 guenther

Move grab/release of the kernel_lock for softintrs from the ASM stubs to
softintr_dispatch(). Delete traces of long superseded stats code.

ok beck@ mpi@ uebayasi@


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.44 29-Mar-2014 guenther

It's been a quarter century: we can assume volatile is present with that name.

ok dlg@ mpi@ deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.43 05-Jul-2011 oga

N: Thou shalt not call hardclock() with biglock held.

i386 disobeys the Nth commandment. Fix this. While here, make i386 and amd64
definitions of iplclock and statclock match.

ok art@, kettenis@


# 1.42 23-Mar-2011 pirofti

Normalize sentinel. Use _MACHINE_*_H_ and _<ARCH>_*_H_ properly and consitently.

Discussed and okay drahn@. Okay deraadt@.


Revision tags: OPENBSD_4_9_BASE
# 1.41 27-Dec-2010 guenther

Eliminate x86_multicast_ipi() as unused and broken (doesn't handle #cpu>32).
The i386 version was removed some time ago, so kill its declaration too.
ok tedu@ kettenis@


# 1.40 21-Dec-2010 claudio

Convert netisr to a normal soft interrupt instead of hanving MD code
for it. This makes the netisr a real C function which will help further
development. No noticable performance change on i386 and amd64.
With input from kettenis@ and miod@ additional OKs mikeb@ and henning@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.39 13-Aug-2009 kettenis

Make the i386 APIC code closer to the amd64 version. Many whitespace fixes,
some additional code.

ok toby@, oga@


Revision tags: OPENBSD_4_6_BASE
# 1.38 19-Apr-2009 oga

Switch the softinterrupt code on x86 over to mutexes instead of
simplelocks + splhigh().

First part of making it possible to make mpsafe softinterrupts.

"oh yes, definitely" miod@


# 1.37 15-Mar-2009 miod

Introduce splsoftassert(), similar to splassert() but for soft interrupt
levels. This will allow for platforms where soft interrupt levels do not
map to real hardware interrupt levels to have soft ipl values overlapping
hard ipl values without breaking spl asserts.


Revision tags: OPENBSD_4_5_BASE
# 1.36 28-Sep-2008 brad

Always include machine/cpu.h and remove i82489reg.h/i82489var.h.

ok kettenis@


Revision tags: OPENBSD_4_4_BASE
# 1.35 07-May-2008 kettenis

Move i386 to __HAVE_GENERIC_SOFT_INTERRUPTS

ok dlg@, tested by dlg@, oga@, jsg@, deraadt@


# 1.34 25-Apr-2008 kettenis

Make ipending per-cpu. Should fix PR 5788.

ok weingart@


Revision tags: OPENBSD_4_3_BASE
# 1.33 07-Sep-2007 art

Remove some left-overs from the TSC based microtime. We don't need
to synchronize the tsc between CPUs anymore. While here, also remove
the slow TLB IPI since it's been dead for a while.

noticed by mickey
toby@ ok


Revision tags: OPENBSD_4_2_BASE
# 1.32 25-May-2007 art

Replace the overdesigned and overcomplicated tlb shootdown code with
very simple and dumb fast tlb IPI handlers that have in the order of
the same amount of instructions as the old code had function calls.

All TLB shootdowns are reorganized so that we always shoot the,
without looking at PG_U and when we're shooting a range (primarily in
pmap_remove), we shoot the range when there are 32 or less pages in
it, otherwise we just nuke the whole TLB (this might need tweaking if
someone is interested in micro-optimization). The IPIs are not handled
through the normal interrupt vectoring code, they are not blockable
and they only shoot one page or a range of pages or the whole tlb.

This gives a 15% reduction in system time on my dual-core laptop
during a kernel compile and an 18% reduction in real time on a quad
machine doing bulk ports build.

Tested by many, in snaps for a week, no slowdowns reported (although not
everyone is seeing such huge wins).


# 1.31 16-May-2007 thib

splassert_ctl defaults to 1 now, so dont wrap the checks for
splassert_ctl > 0 in __predict_false().

ok deraadt@


# 1.30 21-Apr-2007 gwk

Introduce a smp aware hw.setperf mechanism, it will scale all CPUs or
cores by the same amount, i.e. if you do hw.setperf=50 both cores will
be scaled to the opearting state corresponing to 50%. Tested by many with
est (mainly on core2duo machines like X60 thinkpads). Only enable est
during GENERIC.MP build no one tested powernow.

ok art@


# 1.29 03-Apr-2007 art

Make the ast on i386 per-process instead of per-cpu. This makes
signal delivery more reliable in some cases when a process switches
cpu.

kettenis@ ok


# 1.28 23-Mar-2007 art

Remove duplicated defines from intr.h that are already defined in
intrdefs.h that is inlucded first thing in intr.h.

eyeballed for sanity by pedro@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.27 29-May-2006 mickey

implement reliable microtime on smp (joint work w/ otto):
send a bcast ipi from the cpu0 to all others to timestamp tsc
on every clock intr. this way using local tsc provides accurate
microtime() measurements. thus gettimeofday test passes now.
otto@ deraadt@ ok


# 1.26 12-Mar-2006 brad

remove IPL_IMP and splimp().


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.25 19-Apr-2005 mickey

nothing uses spllowersoftclock() anymore


Revision tags: OPENBSD_3_7_BASE
# 1.24 07-Jan-2005 pascoe

Fix profiled kernel builds on i386 by moving splraise/splx code into macros
permitting non-recursive reuse in mcount.

Should be a no-op for normal builds.


# 1.23 24-Dec-2004 pvalchev

Rewrite intlock/intunlock not to pass around interrupt frame directly
without copying which is against C conventions and broke GENERIC.MP
with a gcc3 optimization
From niklas, tested by many


Revision tags: OPENBSD_3_6_BASE
# 1.22 16-Jun-2004 grange

We need __splbarrier to compile kernel, tho it should be
replaced with a real gcc barrier.

ok deraadt@


# 1.21 13-Jun-2004 niklas

debranch SMP, have fun


Revision tags: SMP_SYNC_A SMP_SYNC_B
# 1.20 23-May-2004 tedu

workaround gcc brokenness by outlining spl functions.
finally solves vfs corruption. hint and ok art@, ok deraadt@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE UBC_SYNC_A
# 1.19 17-Apr-2003 drahn

i386 changes to move to ELF. asm cleanup. Change MAXDSIZ to 512M for 1Gsep.
DARPA funded work.


Revision tags: OPENBSD_3_3_BASE
# 1.18 11-Dec-2002 art

Some people say that "__asm __volatile("")" is not enough.
Use "__asm __volatile("":::"memory")" to completly avoid reordering.


Revision tags: OPENBSD_3_2_BASE UBC_SYNC_B
# 1.17 19-Jul-2002 art

Define an IPL_VM and mark IPL_IMP as "not to be used".


# 1.16 11-Jun-2002 art

define IPL_STATCLOCK


# 1.15 22-May-2002 art

Implement splassert. Even simpler than on the sparc.


# 1.14 29-Apr-2002 miod

Define placeholders for art's splassert() debugging stuff on all arches.
Currently as no-ops everywhere.

ok art@, deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.13 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: UBC_BASE
# 1.12 14-Dec-2001 niklas

branches: 1.12.2;
SMALL_KERNEL -> outline splx


# 1.11 13-Dec-2001 niklas

remover registers. bracket spl regions with asm volatiles


# 1.10 04-Dec-2001 niklas

New try at a level based irq system.


# 1.9 18-Nov-2001 aaron

Revert niklas's broken ICU interrupt handling changes; deraadt@ ok


# 1.8 12-Nov-2001 niklas

Redo the ICU interrupt handling system to better emulate an APIC system.
This is done by representing the current blockings of interrupts with
a priority level instead of an interrupt mask. This makes it possible to
share implementations for spl* functions/macros between both ICU
and APIC (a must when going MP) systems. In this process, assign
soft interrupts their own levels to match the way things will be on
APIC systems where they actually will be real interrupts and not just
bits in a pending mask as they are now.
Heavily inspired by Bill Studenmunds SMP work in NetBSD


Revision tags: OPENBSD_3_0_BASE
# 1.7 24-Jun-2001 miod

Define splvm() for arches who don't already provide it, with the same
definition as splimp().
art@ ok


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.6 05-Aug-2000 niklas

$OpenBSD$


# 1.5 06-Jul-2000 ho

Change splsoftclock() to raise the spl, instead of lowering it.
Add spllowersoftclock() for the former behaviour. Update comment. (art@ ok)


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE SMP_BASE kame_19991208
# 1.4 26-Jul-1999 csapuntz

branches: 1.4.4;


Some people don't have enough RAM in their PCs and expect swapping to
work.

Fix an array bounds problem with the imask[] array.


# 1.3 23-Jul-1999 niklas

From NetBSD; let i386 run audio at a high IPL


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.2 06-Aug-1996 deraadt

splstatclock to splhigh; problem pointed out by gopal


# 1.1 25-May-1996 deraadt

sync


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.47 13-Sep-2015 kettenis

intr_barrier(9) for i386.


Revision tags: OPENBSD_5_8_BASE
# 1.46 19-Jul-2015 sf

Make i386_send_ipi() return void

Nobody uses its return value.


# 1.45 16-Jul-2015 guenther

Move grab/release of the kernel_lock for softintrs from the ASM stubs to
softintr_dispatch(). Delete traces of long superseded stats code.

ok beck@ mpi@ uebayasi@


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.44 29-Mar-2014 guenther

It's been a quarter century: we can assume volatile is present with that name.

ok dlg@ mpi@ deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.43 05-Jul-2011 oga

N: Thou shalt not call hardclock() with biglock held.

i386 disobeys the Nth commandment. Fix this. While here, make i386 and amd64
definitions of iplclock and statclock match.

ok art@, kettenis@


# 1.42 23-Mar-2011 pirofti

Normalize sentinel. Use _MACHINE_*_H_ and _<ARCH>_*_H_ properly and consitently.

Discussed and okay drahn@. Okay deraadt@.


Revision tags: OPENBSD_4_9_BASE
# 1.41 27-Dec-2010 guenther

Eliminate x86_multicast_ipi() as unused and broken (doesn't handle #cpu>32).
The i386 version was removed some time ago, so kill its declaration too.
ok tedu@ kettenis@


# 1.40 21-Dec-2010 claudio

Convert netisr to a normal soft interrupt instead of hanving MD code
for it. This makes the netisr a real C function which will help further
development. No noticable performance change on i386 and amd64.
With input from kettenis@ and miod@ additional OKs mikeb@ and henning@


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.39 13-Aug-2009 kettenis

Make the i386 APIC code closer to the amd64 version. Many whitespace fixes,
some additional code.

ok toby@, oga@


Revision tags: OPENBSD_4_6_BASE
# 1.38 19-Apr-2009 oga

Switch the softinterrupt code on x86 over to mutexes instead of
simplelocks + splhigh().

First part of making it possible to make mpsafe softinterrupts.

"oh yes, definitely" miod@


# 1.37 15-Mar-2009 miod

Introduce splsoftassert(), similar to splassert() but for soft interrupt
levels. This will allow for platforms where soft interrupt levels do not
map to real hardware interrupt levels to have soft ipl values overlapping
hard ipl values without breaking spl asserts.


Revision tags: OPENBSD_4_5_BASE
# 1.36 28-Sep-2008 brad

Always include machine/cpu.h and remove i82489reg.h/i82489var.h.

ok kettenis@


Revision tags: OPENBSD_4_4_BASE
# 1.35 07-May-2008 kettenis

Move i386 to __HAVE_GENERIC_SOFT_INTERRUPTS

ok dlg@, tested by dlg@, oga@, jsg@, deraadt@


# 1.34 25-Apr-2008 kettenis

Make ipending per-cpu. Should fix PR 5788.

ok weingart@


Revision tags: OPENBSD_4_3_BASE
# 1.33 07-Sep-2007 art

Remove some left-overs from the TSC based microtime. We don't need
to synchronize the tsc between CPUs anymore. While here, also remove
the slow TLB IPI since it's been dead for a while.

noticed by mickey
toby@ ok


Revision tags: OPENBSD_4_2_BASE
# 1.32 25-May-2007 art

Replace the overdesigned and overcomplicated tlb shootdown code with
very simple and dumb fast tlb IPI handlers that have in the order of
the same amount of instructions as the old code had function calls.

All TLB shootdowns are reorganized so that we always shoot the,
without looking at PG_U and when we're shooting a range (primarily in
pmap_remove), we shoot the range when there are 32 or less pages in
it, otherwise we just nuke the whole TLB (this might need tweaking if
someone is interested in micro-optimization). The IPIs are not handled
through the normal interrupt vectoring code, they are not blockable
and they only shoot one page or a range of pages or the whole tlb.

This gives a 15% reduction in system time on my dual-core laptop
during a kernel compile and an 18% reduction in real time on a quad
machine doing bulk ports build.

Tested by many, in snaps for a week, no slowdowns reported (although not
everyone is seeing such huge wins).


# 1.31 16-May-2007 thib

splassert_ctl defaults to 1 now, so dont wrap the checks for
splassert_ctl > 0 in __predict_false().

ok deraadt@


# 1.30 21-Apr-2007 gwk

Introduce a smp aware hw.setperf mechanism, it will scale all CPUs or
cores by the same amount, i.e. if you do hw.setperf=50 both cores will
be scaled to the opearting state corresponing to 50%. Tested by many with
est (mainly on core2duo machines like X60 thinkpads). Only enable est
during GENERIC.MP build no one tested powernow.

ok art@


# 1.29 03-Apr-2007 art

Make the ast on i386 per-process instead of per-cpu. This makes
signal delivery more reliable in some cases when a process switches
cpu.

kettenis@ ok


# 1.28 23-Mar-2007 art

Remove duplicated defines from intr.h that are already defined in
intrdefs.h that is inlucded first thing in intr.h.

eyeballed for sanity by pedro@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.27 29-May-2006 mickey

implement reliable microtime on smp (joint work w/ otto):
send a bcast ipi from the cpu0 to all others to timestamp tsc
on every clock intr. this way using local tsc provides accurate
microtime() measurements. thus gettimeofday test passes now.
otto@ deraadt@ ok


# 1.26 12-Mar-2006 brad

remove IPL_IMP and splimp().


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.25 19-Apr-2005 mickey

nothing uses spllowersoftclock() anymore


Revision tags: OPENBSD_3_7_BASE
# 1.24 07-Jan-2005 pascoe

Fix profiled kernel builds on i386 by moving splraise/splx code into macros
permitting non-recursive reuse in mcount.

Should be a no-op for normal builds.


# 1.23 24-Dec-2004 pvalchev

Rewrite intlock/intunlock not to pass around interrupt frame directly
without copying which is against C conventions and broke GENERIC.MP
with a gcc3 optimization
From niklas, tested by many


Revision tags: OPENBSD_3_6_BASE
# 1.22 16-Jun-2004 grange

We need __splbarrier to compile kernel, tho it should be
replaced with a real gcc barrier.

ok deraadt@


# 1.21 13-Jun-2004 niklas

debranch SMP, have fun


Revision tags: SMP_SYNC_A SMP_SYNC_B
# 1.20 23-May-2004 tedu

workaround gcc brokenness by outlining spl functions.
finally solves vfs corruption. hint and ok art@, ok deraadt@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE UBC_SYNC_A
# 1.19 17-Apr-2003 drahn

i386 changes to move to ELF. asm cleanup. Change MAXDSIZ to 512M for 1Gsep.
DARPA funded work.


Revision tags: OPENBSD_3_3_BASE
# 1.18 11-Dec-2002 art

Some people say that "__asm __volatile("")" is not enough.
Use "__asm __volatile("":::"memory")" to completly avoid reordering.


Revision tags: OPENBSD_3_2_BASE UBC_SYNC_B
# 1.17 19-Jul-2002 art

Define an IPL_VM and mark IPL_IMP as "not to be used".


# 1.16 11-Jun-2002 art

define IPL_STATCLOCK


# 1.15 22-May-2002 art

Implement splassert. Even simpler than on the sparc.


# 1.14 29-Apr-2002 miod

Define placeholders for art's splassert() debugging stuff on all arches.
Currently as no-ops everywhere.

ok art@, deraadt@


Revision tags: OPENBSD_3_1_BASE
# 1.13 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: UBC_BASE
# 1.12 14-Dec-2001 niklas

branches: 1.12.2;
SMALL_KERNEL -> outline splx


# 1.11 13-Dec-2001 niklas

remover registers. bracket spl regions with asm volatiles


# 1.10 04-Dec-2001 niklas

New try at a level based irq system.


# 1.9 18-Nov-2001 aaron

Revert niklas's broken ICU interrupt handling changes; deraadt@ ok


# 1.8 12-Nov-2001 niklas

Redo the ICU interrupt handling system to better emulate an APIC system.
This is done by representing the current blockings of interrupts with
a priority level instead of an interrupt mask. This makes it possible to
share implementations for spl* functions/macros between both ICU
and APIC (a must when going MP) systems. In this process, assign
soft interrupts their own levels to match the way things will be on
APIC systems where they actually will be real interrupts and not just
bits in a pending mask as they are now.
Heavily inspired by Bill Studenmunds SMP work in NetBSD


Revision tags: OPENBSD_3_0_BASE
# 1.7 24-Jun-2001 miod

Define splvm() for arches who don't already provide it, with the same
definition as splimp().
art@ ok


Revision tags: OPENBSD_2_8_BASE OPENBSD_2_9_BASE
# 1.6 05-Aug-2000 niklas

$OpenBSD$


# 1.5 06-Jul-2000 ho

Change splsoftclock() to raise the spl, instead of lowering it.
Add spllowersoftclock() for the former behaviour. Update comment. (art@ ok)


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE SMP_BASE kame_19991208
# 1.4 26-Jul-1999 csapuntz

branches: 1.4.4;


Some people don't have enough RAM in their PCs and expect swapping to
work.

Fix an array bounds problem with the imask[] array.


# 1.3 23-Jul-1999 niklas

From NetBSD; let i386 run audio at a high IPL


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.2 06-Aug-1996 deraadt

splstatclock to splhigh; problem pointed out by gopal


# 1.1 25-May-1996 deraadt

sync