qemu-patch-raspberry4/hw
Greg Kurz f1a6cf3ef7 spapr_rng: fix race with main loop
Since commit "60253ed1e6ec rng: add request queue support to rng-random",
the use of a spapr_rng device may hang vCPU threads.

The following path is taken without holding the lock to the main loop mutex:

h_random()
  rng_backend_request_entropy()
    rng_random_request_entropy()
      qemu_set_fd_handler()

The consequence is that entropy_available() may be called before the vCPU
thread could even queue the request: depending on the scheduling, it may
happen that entropy_available() does not call random_recv()->qemu_sem_post().
The vCPU thread will then sleep forever in h_random()->qemu_sem_wait().

This could not happen before 60253ed1e6 because entropy_available() used
to call random_recv() unconditionally.

This patch ensures the lock is held to avoid the race.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Cédric Le Goater <clg@fr.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-03-16 09:55:06 +11:00
..
9pfs all: Clean up includes 2016-02-23 12:43:05 +00:00
acpi nvdimm acpi: emulate dsm method 2016-03-11 16:59:11 +02:00
alpha loader: Add data swap option to load-elf 2016-03-04 11:30:21 +00:00
arm vfio: Generalize region support 2016-03-10 20:03:16 -07:00
audio all: Clean up includes 2016-02-23 12:43:05 +00:00
block fdc: add function to determine drive chs limits 2016-03-11 14:55:15 +02:00
bt hw: Clean up includes 2016-01-29 15:07:25 +00:00
char ui: Shorten references into InputEvent 2016-03-05 10:41:55 +01:00
core loader: Add data swap option to load-elf 2016-03-04 11:30:21 +00:00
cpu hw/intc/arm_gic.c: Implement GICv2 GICC_DIR 2016-03-04 11:30:22 +00:00
cris loader: Add data swap option to load-elf 2016-03-04 11:30:21 +00:00
display qxl: lock current_async update in qxl_soft_reset 2016-03-01 07:51:32 +01:00
dma i8257: fix Terminal Count status 2016-03-07 13:18:28 +01:00
gpio ARM: PL061: Checking register r/w accesses to reserved area 2016-02-26 15:09:42 +00:00
i2c hw: Clean up includes 2016-01-29 15:07:25 +00:00
i386 hw/acpi: fix GSI links UID 2016-03-15 16:16:57 +02:00
ide ahci: prohibit "restarting" the FIS or CLB engines 2016-02-10 13:29:40 -05:00
input ui: Shorten references into InputEvent 2016-03-05 10:41:55 +01:00
intc msi_supported -> msi_nonbroken 2016-03-11 16:45:21 +02:00
ipack hw: Clean up includes 2016-01-29 15:07:25 +00:00
ipmi ipmi: add some local variables in ipmi_sdr_init 2016-03-11 16:59:13 +02:00
isa ich9lpc: fix typo 2016-03-11 16:45:21 +02:00
lm32 loader: Add data swap option to load-elf 2016-03-04 11:30:21 +00:00
m68k loader: Add data swap option to load-elf 2016-03-04 11:30:21 +00:00
mem pc-dimm: fix error handling in pc_dimm_check_memdev_is_busy() 2016-03-11 14:55:15 +02:00
microblaze loader: Add data swap option to load-elf 2016-03-04 11:30:21 +00:00
mips loader: Add data swap option to load-elf 2016-03-04 11:30:21 +00:00
misc memory: Drop MemoryRegion.ram_addr 2016-03-07 13:26:29 +01:00
moxie loader: Add data swap option to load-elf 2016-03-04 11:30:21 +00:00
net rocker: allow user to specify rocker world by property 2016-03-08 15:34:18 +08:00
nvram fw_cfg: expose control register size in fw_cfg.h 2016-03-08 10:46:30 +01:00
openrisc loader: Add data swap option to load-elf 2016-03-04 11:30:21 +00:00
pci msi_supported -> msi_nonbroken 2016-03-11 16:45:21 +02:00
pci-bridge pxb: cleanup 2016-03-11 16:59:12 +02:00
pci-host loader: Add data swap option to load-elf 2016-03-04 11:30:21 +00:00
pcmcia hw: Clean up includes 2016-01-29 15:07:25 +00:00
ppc spapr_rng: fix race with main loop 2016-03-16 09:55:06 +11:00
s390x vhost, virtio, pci, pc, acpi 2016-03-15 16:43:48 +00:00
scsi scsi-bus: Remove tape command from scsi_req_xfer 2016-03-07 17:56:23 +01:00
sd sdhci: Implement DeviceClass reset 2016-03-04 11:30:17 +00:00
sh4 sh4: Clean up includes 2016-01-29 15:07:24 +00:00
smbios hw: Clean up includes 2016-01-29 15:07:25 +00:00
sparc loader: Add data swap option to load-elf 2016-03-04 11:30:21 +00:00
sparc64 loader: Add data swap option to load-elf 2016-03-04 11:30:21 +00:00
ssi hw: Clean up includes 2016-01-29 15:07:25 +00:00
timer tusb6010: move from hw/timer to hw/usb 2016-02-23 10:38:00 +01:00
tpm hw: Clean up includes 2016-01-29 15:07:25 +00:00
tricore loader: Add data swap option to load-elf 2016-03-04 11:30:21 +00:00
unicore32 unicore: Clean up includes 2016-01-29 15:07:22 +00:00
usb usb-redirect: Avoid double free of data 2016-02-29 11:45:26 +01:00
vfio vfio/pci: replace fixed string limit by g_strdup_printf 2016-03-10 20:50:43 -07:00
virtio virtio-pci: call pci reset variant when guest requests reset. 2016-03-11 16:45:21 +02:00
watchdog watchdog/diag288: avoid race condition on expired watchdog 2016-03-01 12:15:28 +01:00
xen xen: drop XenXC and associated interface wrappers 2016-02-10 12:01:24 +00:00
xenpv xen: Clean up includes 2016-01-29 15:07:23 +00:00
xtensa loader: Add data swap option to load-elf 2016-03-04 11:30:21 +00:00
Makefile.objs Add a base IPMI interface 2015-12-22 18:39:19 +02:00