Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 1 | From 7354b9b24c36ee712bb6e881d39504bf1b6a4c8b Mon Sep 17 00:00:00 2001 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 2 | From: Victor Kamensky <kamensky@cisco.com> |
| 3 | Date: Fri, 23 Mar 2018 18:26:45 +0000 |
| 4 | Subject: [PATCH] arm/translate-a64: treat DISAS_UPDATE as variant of |
| 5 | DISAS_EXIT |
| 6 | MIME-Version: 1.0 |
| 7 | Content-Type: text/plain; charset=UTF-8 |
| 8 | Content-Transfer-Encoding: 8bit |
| 9 | |
| 10 | In OE project 4.15 linux kernel boot hang was observed under |
| 11 | single cpu aarch64 qemu. Kernel code was in a loop waiting for |
| 12 | vtimer arrival, spinning in TC generated blocks, while interrupt |
| 13 | was pending unprocessed. This happened because when qemu tried to |
| 14 | handle vtimer interrupt target had interrupts disabled, as |
| 15 | result flag indicating TCG exit, cpu->icount_decr.u16.high, |
| 16 | was cleared but arm_cpu_exec_interrupt function did not call |
| 17 | arm_cpu_do_interrupt to process interrupt. Later when target |
| 18 | reenabled interrupts, it happened without exit into main loop, so |
| 19 | following code that waited for result of interrupt execution |
| 20 | run in infinite loop. |
| 21 | |
| 22 | To solve the problem instructions that operate on CPU sys state |
| 23 | (i.e enable/disable interrupt), and marked as DISAS_UPDATE, |
| 24 | should be considered as DISAS_EXIT variant, and should be |
| 25 | forced to exit back to main loop so qemu will have a chance |
| 26 | processing pending CPU state updates, including pending |
| 27 | interrupts. |
| 28 | |
| 29 | This change brings consistency with how DISAS_UPDATE is treated |
| 30 | in aarch32 case. |
| 31 | |
| 32 | CC: Peter Maydell <peter.maydell@linaro.org> |
| 33 | CC: Alex Bennée <alex.bennee@linaro.org> |
| 34 | CC: qemu-stable@nongnu.org |
| 35 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> |
| 36 | Signed-off-by: Victor Kamensky <kamensky@cisco.com> |
| 37 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
| 38 | Message-id: 1521526368-1996-1-git-send-email-kamensky@cisco.com |
| 39 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
| 40 | Upstream-Status: Backport |
| 41 | --- |
| 42 | target/arm/translate-a64.c | 6 +++--- |
| 43 | 1 file changed, 3 insertions(+), 3 deletions(-) |
| 44 | |
| 45 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 46 | index 625ef2d..c381091 100644 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 47 | --- a/target/arm/translate-a64.c |
| 48 | +++ b/target/arm/translate-a64.c |
Brad Bishop | d5ae7d9 | 2018-06-14 09:52:03 -0700 | [diff] [blame] | 49 | @@ -11384,12 +11384,12 @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 50 | case DISAS_UPDATE: |
| 51 | gen_a64_set_pc_im(dc->pc); |
| 52 | /* fall through */ |
| 53 | - case DISAS_JUMP: |
| 54 | - tcg_gen_lookup_and_goto_ptr(); |
| 55 | - break; |
| 56 | case DISAS_EXIT: |
| 57 | tcg_gen_exit_tb(0); |
| 58 | break; |
| 59 | + case DISAS_JUMP: |
| 60 | + tcg_gen_lookup_and_goto_ptr(); |
| 61 | + break; |
| 62 | case DISAS_NORETURN: |
| 63 | case DISAS_SWI: |
| 64 | break; |