summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorJames Simmons <jsimmons@maxwell.earthlink.net>2002-07-23 19:16:08 -0700
committerJames Simmons <jsimmons@maxwell.earthlink.net>2002-07-23 19:16:08 -0700
commit89863ff414f5af7ebdd54607d7385a58bcf7dae7 (patch)
treed5cef4d48d67f690a84b107a6781605f9594212d /Documentation
parent928c62247fda6febe8142bf163373746ff5e7ff3 (diff)
parent9b4651a22d079c28f209740ce89d5d882468383a (diff)
Use local files for now. Then add in m68k changes
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/cli-sti-removal.txt39
-rw-r--r--Documentation/preempt-locking.txt7
-rw-r--r--Documentation/s390/cds.txt4
3 files changed, 38 insertions, 12 deletions
diff --git a/Documentation/cli-sti-removal.txt b/Documentation/cli-sti-removal.txt
index 8192ffefc711..13c744dac866 100644
--- a/Documentation/cli-sti-removal.txt
+++ b/Documentation/cli-sti-removal.txt
@@ -2,10 +2,10 @@
#### cli()/sti() removal guide, started by Ingo Molnar <mingo@redhat.com>
-as of 2.5.28, four popular macros have been removed on SMP, and
+as of 2.5.28, five popular macros have been removed on SMP, and
are being phased out on UP:
- cli(), sti(), save_flags(flags), restore_flags(flags)
+ cli(), sti(), save_flags(flags), save_flags_cli(flags), restore_flags(flags)
until now it was possible to protect driver code against interrupt
handlers via a cli(), but from now on other, more lightweight methods
@@ -86,25 +86,44 @@ the above code has a number of advantages:
cli() on the other hand was used by many drivers, and extended
the critical section to the whole IRQ handler function - creating
serious lock contention.
-
+
to make the transition easier, we've still kept the cli(), sti(),
-save_flags() and restore_flags() macros defined on UP systems - but
-their usage will be phased out until the 2.6 kernel is released.
+save_flags(), save_flags_cli() and restore_flags() macros defined
+on UP systems - but their usage will be phased out until 2.6 is
+released.
drivers that want to disable local interrupts (interrupts on the
-current CPU), can use the following four macros:
+current CPU), can use the following five macros:
- __cli(), __sti(), __save_flags(flags), __restore_flags(flags)
+ local_irq_disable(), local_irq_enable(), local_irq_save(flags),
+ local_irq_save_off(flags), local_irq_restore(flags)
but beware, their meaning and semantics are much simpler, far from
-that of cli(), sti(), save_flags(flags) and restore_flags(flags).
+that of the old cli(), sti(), save_flags(flags) and restore_flags(flags)
+SMP meaning:
+
+ local_irq_disable() => turn local IRQs off
+
+ local_irq_enable() => turn local IRQs on
+ local_irq_save(flags) => save the current IRQ state into flags. The
+ state can be on or off. (on some
+ architectures there's even more bits in it.)
+
+ local_irq_save_off(flags) => save the current IRQ state into flags and
+ disable interrupts.
+
+ local_irq_restore(flags) => restore the IRQ state from flags.
+
+(local_irq_save can save both irqs on and irqs off state, and
+local_irq_restore can restore into both irqs on and irqs off state.)
another related change is that synchronize_irq() now takes a parameter:
synchronize_irq(irq). This change too has the purpose of making SMP
-synchronization more lightweight - this way you can wait for your own
-interrupt handler to finish, no need to wait for other IRQ sources.
+to make the transition easier, we've still kept the cli(), sti(),
+save_flags() and restore_flags() macros defined on UP systems - but
+their usage will be phased out until the 2.6 kernel is released.
why were these changes done? The main reason was the architectural burden
diff --git a/Documentation/preempt-locking.txt b/Documentation/preempt-locking.txt
index 580814915c70..08e6035a0e13 100644
--- a/Documentation/preempt-locking.txt
+++ b/Documentation/preempt-locking.txt
@@ -82,6 +82,13 @@ Note that you do not need to explicitly prevent preemption if you are holding
any locks or interrupts are disabled, since preemption is implicitly disabled
in those cases.
+But keep in mind that 'irqs disabled' is a fundamentally unsafe way of
+disabling preemption - any spin_unlock() decreasing the preemption count
+to 0 might trigger a reschedule. A simple printk() might trigger a reschedule.
+So use this implicit preemption-disabling property only if you know that the
+affected codepath does not do any of this. Best policy is to use this only for
+small, atomic code that you wrote and which calls no complex functions.
+
Example:
cpucache_t *cc; /* this is per-CPU */
diff --git a/Documentation/s390/cds.txt b/Documentation/s390/cds.txt
index 82f37646bfbc..38aeab5b50df 100644
--- a/Documentation/s390/cds.txt
+++ b/Documentation/s390/cds.txt
@@ -885,8 +885,8 @@ Usage Notes :
Prior to call do_IO() the device driver must assure disabled state, i.e. the
I/O mask value in the PSW must be disabled. This can be accomplished by calling
-__save_flags( flags). The current PSW flags are preserved and can be restored
-by __restore_flags( flags) at a later time.
+local_save_flags( flags). The current PSW flags are preserved and can be restored
+by local_irq_restore( flags) at a later time.
If the device driver violates this rule while running in a uni-processor
environment an interrupt might be presented prior to the do_IO() routine