diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-11-21 11:32:55 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-11-21 13:11:03 +0000 |
commit | 2713f71a2611c13e801c7077e2803096ee23237d (patch) | |
tree | ac3933b8c821fd57c6b804e5f1f09dd7625673f9 /meta | |
parent | 1889fb34554fc9fae9bc0a61109afb23ad09c3d3 (diff) | |
download | poky-2713f71a2611c13e801c7077e2803096ee23237d.tar.gz |
qemu: Add patch to avoid qemuppc boot hangs
qemuppc boots are occasionally hanging on the autobuilder. This adds a
patch which fixes the issue in local testing. Its being discussed with
upstream qemu.
(From OE-Core rev: 87719e35db08b21cd43ab3ebd72f4567ca0fdc65)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/ppc_locking.patch | 105 | ||||
-rw-r--r-- | meta/recipes-devtools/qemu/qemu_2.10.1.bb | 1 |
2 files changed, 106 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/ppc_locking.patch b/meta/recipes-devtools/qemu/qemu/ppc_locking.patch new file mode 100644 index 0000000000..6f722433d4 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/ppc_locking.patch | |||
@@ -0,0 +1,105 @@ | |||
1 | I've tracked down what I think is a problem causing qemu-system-ppc | ||
2 | to hang whilst booting images. | ||
3 | |||
4 | I believe the decrementer timer stops receiving interrupts so | ||
5 | tasks in our images hang indefinitely as the timer stopped. | ||
6 | |||
7 | It can be summed up with this line of debug: | ||
8 | |||
9 | ppc_set_irq: 0x55b4e0d562f0 n_IRQ 8 level 1 => pending 00000100req 00000004 | ||
10 | |||
11 | It should normally read: | ||
12 | |||
13 | ppc_set_irq: 0x55b4e0d562f0 n_IRQ 8 level 1 => pending 00000100req 00000002 | ||
14 | |||
15 | The question is why CPU_INTERRUPT_EXITTB ends up being set when the | ||
16 | lines above this log message clearly sets CPU_INTERRUPT_HARD (via | ||
17 | cpu_interrupt() ). | ||
18 | |||
19 | I note in cpu.h: | ||
20 | |||
21 | /* updates protected by BQL */ | ||
22 | uint32_t interrupt_request; | ||
23 | |||
24 | (for struct CPUState) | ||
25 | |||
26 | The ppc code does "cs->interrupt_request |= CPU_INTERRUPT_EXITTB" in 5 | ||
27 | places, 3 in excp_helper.c and 2 in helper_regs.h. In all cases, | ||
28 | g_assert(qemu_mutex_iothread_locked()); fails. If I do something like: | ||
29 | |||
30 | if (!qemu_mutex_iothread_locked()) { | ||
31 | qemu_mutex_lock_iothread(); | ||
32 | cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); | ||
33 | qemu_mutex_unlock_iothread(); | ||
34 | } else { | ||
35 | cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); | ||
36 | } | ||
37 | |||
38 | in these call sites then I can no longer lock qemu up with my test | ||
39 | case. | ||
40 | |||
41 | I suspect the _HARD setting gets overwritten which stops the | ||
42 | decrementer interrupts being delivered. | ||
43 | |||
44 | Upstream-Status: Submitted [Issue discussed on qemu mailing list 2017/11/20] | ||
45 | RP 2017/11/20 | ||
46 | |||
47 | Index: qemu-2.10.1/target/ppc/excp_helper.c | ||
48 | =================================================================== | ||
49 | --- qemu-2.10.1.orig/target/ppc/excp_helper.c | ||
50 | +++ qemu-2.10.1/target/ppc/excp_helper.c | ||
51 | @@ -207,7 +207,9 @@ static inline void powerpc_excp(PowerPCC | ||
52 | "Entering checkstop state\n"); | ||
53 | } | ||
54 | cs->halted = 1; | ||
55 | - cs->interrupt_request |= CPU_INTERRUPT_EXITTB; | ||
56 | + qemu_mutex_lock_iothread(); | ||
57 | + cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); | ||
58 | + qemu_mutex_unlock_iothread(); | ||
59 | } | ||
60 | if (env->msr_mask & MSR_HVB) { | ||
61 | /* ISA specifies HV, but can be delivered to guest with HV clear | ||
62 | @@ -940,7 +942,9 @@ void helper_store_msr(CPUPPCState *env, | ||
63 | |||
64 | if (excp != 0) { | ||
65 | CPUState *cs = CPU(ppc_env_get_cpu(env)); | ||
66 | - cs->interrupt_request |= CPU_INTERRUPT_EXITTB; | ||
67 | + qemu_mutex_lock_iothread(); | ||
68 | + cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); | ||
69 | + qemu_mutex_unlock_iothread(); | ||
70 | raise_exception(env, excp); | ||
71 | } | ||
72 | } | ||
73 | @@ -995,7 +999,9 @@ static inline void do_rfi(CPUPPCState *e | ||
74 | /* No need to raise an exception here, | ||
75 | * as rfi is always the last insn of a TB | ||
76 | */ | ||
77 | - cs->interrupt_request |= CPU_INTERRUPT_EXITTB; | ||
78 | + qemu_mutex_lock_iothread(); | ||
79 | + cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); | ||
80 | + qemu_mutex_unlock_iothread(); | ||
81 | |||
82 | /* Reset the reservation */ | ||
83 | env->reserve_addr = -1; | ||
84 | Index: qemu-2.10.1/target/ppc/helper_regs.h | ||
85 | =================================================================== | ||
86 | --- qemu-2.10.1.orig/target/ppc/helper_regs.h | ||
87 | +++ qemu-2.10.1/target/ppc/helper_regs.h | ||
88 | @@ -114,11 +114,15 @@ static inline int hreg_store_msr(CPUPPCS | ||
89 | } | ||
90 | if (((value >> MSR_IR) & 1) != msr_ir || | ||
91 | ((value >> MSR_DR) & 1) != msr_dr) { | ||
92 | - cs->interrupt_request |= CPU_INTERRUPT_EXITTB; | ||
93 | + qemu_mutex_lock_iothread(); | ||
94 | + cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); | ||
95 | + qemu_mutex_unlock_iothread(); | ||
96 | } | ||
97 | if ((env->mmu_model & POWERPC_MMU_BOOKE) && | ||
98 | ((value >> MSR_GS) & 1) != msr_gs) { | ||
99 | - cs->interrupt_request |= CPU_INTERRUPT_EXITTB; | ||
100 | + qemu_mutex_lock_iothread(); | ||
101 | + cpu_interrupt(cs, CPU_INTERRUPT_EXITTB); | ||
102 | + qemu_mutex_unlock_iothread(); | ||
103 | } | ||
104 | if (unlikely((env->flags & POWERPC_FLAG_TGPR) && | ||
105 | ((value ^ env->msr) & (1 << MSR_TGPR)))) { | ||
diff --git a/meta/recipes-devtools/qemu/qemu_2.10.1.bb b/meta/recipes-devtools/qemu/qemu_2.10.1.bb index 6e9b68b0ff..8e3ca3c949 100644 --- a/meta/recipes-devtools/qemu/qemu_2.10.1.bb +++ b/meta/recipes-devtools/qemu/qemu_2.10.1.bb | |||
@@ -24,6 +24,7 @@ SRC_URI = "http://wiki.qemu-project.org/download/${BP}.tar.bz2 \ | |||
24 | file://0003-Introduce-condition-in-TPM-backend-for-notification.patch \ | 24 | file://0003-Introduce-condition-in-TPM-backend-for-notification.patch \ |
25 | file://0004-Add-support-for-VM-suspend-resume-for-TPM-TIS-v2.9.patch \ | 25 | file://0004-Add-support-for-VM-suspend-resume-for-TPM-TIS-v2.9.patch \ |
26 | file://apic-fixup-fallthrough-to-PIC.patch \ | 26 | file://apic-fixup-fallthrough-to-PIC.patch \ |
27 | file://ppc_locking.patch \ | ||
27 | " | 28 | " |
28 | UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+\..*)\.tar" | 29 | UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+\..*)\.tar" |
29 | 30 | ||