linux_dsm_epyc7002/arch
Jeff Dike 53b173327d [PATCH] uml: fix I/O hang
Fix a UML hang in which everything would just stop until some I/O happened
- a ping, someone whacking the keyboard - at which point everything would
start up again as though nothing had happened.

The cause was gcc reordering some code which absolutely needed to be
executed in the order in the source.  When unblock_signals switches signals
from off to on, it needs to see if any interrupts had happened in the
critical section.  The interrupt handlers check signals_enabled - if it is
zero, then the handler adds a bit to the "pending" bitmask and returns.
unblock_signals checks this mask to see if any signals need to be
delivered.

The crucial part is this:
	signals_enabled = 1;
	save_pending = pending;
	if(save_pending == 0)
		return;
	pending = 0;

In order to avoid an interrupt arriving between reading pending and setting
it to zero, in which case, the record of the interrupt would be erased,
signals are enabled.

What happened was that gcc reordered this so that 'save_pending = pending'
came before 'signals_enabled = 1', creating a one-instruction window within
which an interrupt could arrive, set its bit in pending, and have it be
immediately erased.

When the I/O workload is purely disk-based, the loss of a block device
interrupt stops the entire I/O system because the next block request will
wait for the current one to finish.  Thus the system hangs until something
else causes some I/O to arrive, such as a network packet or console input.

The fix to this particular problem is a memory barrier between enabling
signals and reading the pending signal mask.  An xchg would also probably
work.

Looking over this code for similar problems led me to do a few more
things:

- make signals_enabled and pending volatile so that they don't get cached
  in registers

- add an mb() to the return paths of block_signals and unblock_signals so
  that the modification of signals_enabled doesn't get shuffled into the
  caller in the event that these are inlined in the future.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-11-03 12:27:58 -08:00
..
alpha [PATCH] vmlinux.lds: consolidate initcall sections 2006-10-27 15:34:51 -07:00
arm [ARM] 3914/1: [Jornada7xx] - Typo Fix in cpu-sa1110.c (b != B) 2006-10-29 21:52:29 +00:00
arm26 [PATCH] remove bogus arch-specific syscall exports 2006-10-11 11:17:07 -07:00
avr32 [PATCH] vmlinux.lds: consolidate initcall sections 2006-10-27 15:34:51 -07:00
cris [PATCH] cryptocop: double spin_lock_irqsave() 2006-10-30 12:08:41 -08:00
frv [PATCH] vmlinux.lds: consolidate initcall sections 2006-10-27 15:34:51 -07:00
h8300 [PATCH] vmlinux.lds: consolidate initcall sections 2006-10-27 15:34:51 -07:00
i386 [PATCH] acpi_noirq section fix 2006-11-03 12:27:58 -08:00
ia64 Merge branch 'release' of master.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6 2006-10-31 17:03:50 -08:00
m32r [PATCH] vmlinux.lds: consolidate initcall sections 2006-10-27 15:34:51 -07:00
m68k [PATCH] m68k: consolidate initcall sections 2006-10-29 12:07:41 -08:00
m68knommu [PATCH] vmlinux.lds: consolidate initcall sections 2006-10-27 15:34:51 -07:00
mips [MIPS] Do not use -msym32 option for modules. 2006-11-02 17:23:34 +00:00
parisc [PATCH] vmlinux.lds: consolidate initcall sections 2006-10-27 15:34:51 -07:00
powerpc [PATCH] powerpc: Eliminate "exceeds stub group size" linker warning 2006-11-01 14:56:59 -08:00
ppc [POWERPC] Make alignment exception always check exception table 2006-11-01 15:16:04 +11:00
s390 Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6 2006-10-28 11:38:39 -07:00
sh sh: Titan defconfig update. 2006-10-31 12:53:29 +09:00
sh64 [PATCH] vmlinux.lds: consolidate initcall sections 2006-10-27 15:34:51 -07:00
sparc Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6 2006-10-27 15:36:21 -07:00
sparc64 [SPARC64]: Add some missing print_symbol() calls. 2006-10-30 19:33:33 -08:00
um [PATCH] uml: fix I/O hang 2006-11-03 12:27:58 -08:00
v850 [PATCH] vmlinux.lds: consolidate initcall sections 2006-10-27 15:34:51 -07:00
x86_64 [PATCH] fix i386 regparm=3 RT signal handlers on x86_64 2006-10-30 12:12:21 -08:00
xtensa [PATCH] vmlinux.lds: consolidate initcall sections 2006-10-27 15:34:51 -07:00