qemu-e2k/target/ppc
Laurent Vivier aef92d87c5 pseries: fix kvmppc_set_fwnmi()
QEMU issues the ioctl(KVM_CAP_PPC_FWNMI) on the first vCPU.

If the first vCPU is currently running, the vCPU mutex is held
and the ioctl() cannot be done and waits until the mutex is released.
This never happens and the VM is stuck.

To avoid this deadlock, issue the ioctl on the same vCPU doing the
RTAS call.

The problem can be reproduced by booting a guest with several vCPUs
(the probability to have the problem is (n - 1) / n,  n = # of CPUs),
and then by triggering a kernel crash with "echo c >/proc/sysrq-trigger".

On the reboot, the kernel hangs after:

...
[    0.000000] -----------------------------------------------------
[    0.000000] ppc64_pft_size    = 0x0
[    0.000000] phys_mem_size     = 0x48000000
[    0.000000] dcache_bsize      = 0x80
[    0.000000] icache_bsize      = 0x80
[    0.000000] cpu_features      = 0x0001c06f8f4f91a7
[    0.000000]   possible        = 0x0003fbffcf5fb1a7
[    0.000000]   always          = 0x00000003800081a1
[    0.000000] cpu_user_features = 0xdc0065c2 0xaee00000
[    0.000000] mmu_features      = 0x3c006041
[    0.000000] firmware_features = 0x00000085455a445f
[    0.000000] physical_start    = 0x8000000
[    0.000000] -----------------------------------------------------
[    0.000000] numa:   NODE_DATA [mem 0x47f33c80-0x47f3ffff]

Fixes: ec010c0066 ("ppc/spapr: KVM FWNMI should not be enabled until guest requests it")
Cc: npiggin@gmail.com
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Message-Id: <20200724083533.281700-1-lvivier@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-07-27 11:09:25 +10:00
..
translate target/ppc: Use tcg_gen_gvec_rotlv 2020-06-02 08:42:37 -07:00
arch_dump.c
compat.c error: Eliminate error_propagate() with Coccinelle, part 1 2020-07-10 15:18:08 +02:00
cpu-models.c
cpu-models.h
cpu-param.h
cpu-qom.h x86 and machine queue for 5.0 soft freeze 2020-03-19 14:22:46 +00:00
cpu.c
cpu.h target/ppc: Restrict PPCVirtualHypervisorClass to system-mode 2020-06-12 11:12:45 -04:00
dfp_helper.c
excp_helper.c ppc/spapr: Add hotremovable flag on DIMM LMBs on drmem_v2 2020-05-27 15:29:36 +10:00
fpu_helper.c target/ppc: Fix typo in comments 2020-02-21 09:15:04 +11:00
gdbstub.c gdbstub: Introduce gdb_get_float64() to get 64-bit float registers 2020-05-06 09:29:26 +01:00
helper_regs.h
helper.h target/ppc: Use tcg_gen_gvec_rotlv 2020-06-02 08:42:37 -07:00
int_helper.c target/ppc: Use tcg_gen_gvec_rotlv 2020-06-02 08:42:37 -07:00
internal.h
kvm_ppc.h pseries: fix kvmppc_set_fwnmi() 2020-07-27 11:09:25 +10:00
kvm-stub.c
kvm.c pseries: fix kvmppc_set_fwnmi() 2020-07-27 11:09:25 +10:00
machine.c
Makefile.objs
mem_helper.c
mfrom_table_gen.c
mfrom_table.inc.c
misc_helper.c
mmu_helper.c target: Remove unnecessary CPU() cast 2020-05-15 07:08:14 +02:00
mmu-book3s-v3.c
mmu-book3s-v3.h
mmu-hash32.c
mmu-hash32.h
mmu-hash64.c error: Strip trailing '\n' from error string arguments (again) 2020-07-24 12:56:44 +02:00
mmu-hash64.h
mmu-radix64.c target/ppc: Fix argument to ppc_radix64_partition_scoped_xlate() again 2020-05-27 15:29:36 +10:00
mmu-radix64.h target/ppc: Pass const pointer to ppc_radix64_get_prot_amr() 2020-05-27 15:29:36 +10:00
monitor.c
timebase_helper.c hw/ppc: Take QEMU lock when calling ppc_dcr_read/write() 2020-03-24 11:56:37 +11:00
trace-events
translate_init.inc.c qom: Put name parameter before value / visitor parameter 2020-07-10 15:18:08 +02:00
translate.c target/ppc: Add support for scv and rfscv instructions 2020-05-27 15:29:24 +10:00
user_only_helper.c