From patchwork Fri May 13 00:13:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9087291 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E9F809F1C3 for ; Fri, 13 May 2016 00:37:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EE61920204 for ; Fri, 13 May 2016 00:37:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7362A201F4 for ; Fri, 13 May 2016 00:37:03 +0000 (UTC) Received: from localhost ([::1]:60500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b116E-00045W-KX for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 May 2016 20:37:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b10lo-0002rc-1B for qemu-devel@nongnu.org; Thu, 12 May 2016 20:16:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b10li-00037n-Bh for qemu-devel@nongnu.org; Thu, 12 May 2016 20:15:55 -0400 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:34206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b10li-00037d-62 for qemu-devel@nongnu.org; Thu, 12 May 2016 20:15:50 -0400 Received: by mail-qk0-x242.google.com with SMTP id i7so7140713qkd.1 for ; Thu, 12 May 2016 17:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=h2YRHpXZT+EVvMmLlJDh0aLZ0GrNvbqmDiHOUlQIhRc=; b=RNYi6PoxafGFZQmqu0Sm+Fnqg3E/Q0WvwlegzB0TD9k1LB4CMt4kuwEY2iVyLAfd4q 1KlnkiECREpRqw1ietNeo+8+8z7L96S+Baab/uRZy3TkqRL4Af1Rk0Gs5iXuFKdAGBx4 jkxNGMwY0T6G5CBkN9PaKgL5nkpmjDMQDgpNo9iC3CRKvc3BTIOminltu56drVR1ARny izNAwz6NCleMklonotcRdg89crXjU/lQXSE/od49CNj7QFaxK6/LeWPkOMYbvEJ/6a9W Fyo5fLEf8j67xd/zSibteDSJGHyAEhWA9MxB/eF9VgQgB9adtewY6z4NliK2vOZtEaGF ElwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=h2YRHpXZT+EVvMmLlJDh0aLZ0GrNvbqmDiHOUlQIhRc=; b=krGTlPNegqBNuaX3AIsLoa7/Ynroc20zafZ7GHNoGIp/qjfu+OcYyVNQsbFvcmK7Er EhzvWMq3j0w+2219cZ9n7WFV4Fcg8y9ouPBzWYnbHwNEYCJ0hypS4coJNB2x05mXg5tm ofNaL497JGyHja36IJvc+/kXHkwGcDuypYOnTXrvDSDkp5go8yvn85mnMzt525JWY5fr 01T7tX8PPn6HUqg/i4bVS4foeFPQKcFomBhgPiYqcDLT9o/gVOUxR4CykpLyuB3RQL+s 56vM2VmyhGsCZASWSry3RXeXw+gJTIWkZeTFISEsPXmspffuzh9TR68GJRO1B9Ivd9VH 9voA== X-Gm-Message-State: AOPr4FVLuNKwnTtZ0zRMjyiLqd+9hYF5KidIROOtjF6P3M+PKrwTpPLZ+Tim1RarUMJhsg== X-Received: by 10.55.132.3 with SMTP id g3mr13599947qkd.126.1463098549902; Thu, 12 May 2016 17:15:49 -0700 (PDT) Received: from bigtime.com ([172.56.44.137]) by smtp.gmail.com with ESMTPSA id w16sm7171321qka.35.2016.05.12.17.15.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 May 2016 17:15:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 12 May 2016 14:13:33 -1000 Message-Id: <1463098420-29113-33-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1463098420-29113-1-git-send-email-rth@twiddle.net> References: <1463098420-29113-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::242 Subject: [Qemu-devel] [PULL 32/39] tcg: Remove needless CPUState::current_tb X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Sergey Fedorov , Sergey Fedorov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sergey Fedorov This field was used for telling cpu_interrupt() to unlink a chain of TBs being executed when it worked that way. Now, cpu_interrupt() don't do this anymore. So we don't need this field anymore. Signed-off-by: Sergey Fedorov Signed-off-by: Sergey Fedorov Message-Id: <1462273462-14036-1-git-send-email-sergey.fedorov@linaro.org> Signed-off-by: Richard Henderson --- cpu-exec-common.c | 2 -- cpu-exec.c | 4 ---- cputlb.c | 13 ------------- hw/i386/kvmvapic.c | 1 - include/qom/cpu.h | 2 -- qom/cpu.c | 1 - translate-all.c | 20 ++------------------ 7 files changed, 2 insertions(+), 41 deletions(-) diff --git a/cpu-exec-common.c b/cpu-exec-common.c index 1b1731c..6bdda6b 100644 --- a/cpu-exec-common.c +++ b/cpu-exec-common.c @@ -68,7 +68,6 @@ void cpu_reloading_memory_map(void) void cpu_loop_exit(CPUState *cpu) { - cpu->current_tb = NULL; siglongjmp(cpu->jmp_env, 1); } @@ -77,6 +76,5 @@ void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc) if (pc) { cpu_restore_state(cpu, pc); } - cpu->current_tb = NULL; siglongjmp(cpu->jmp_env, 1); } diff --git a/cpu-exec.c b/cpu-exec.c index 7380b1e..d43d5ae 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -216,11 +216,9 @@ static void cpu_exec_nocache(CPUState *cpu, int max_cycles, | (ignore_icount ? CF_IGNORE_ICOUNT : 0)); tb->orig_tb = cpu->tb_flushed ? NULL : orig_tb; cpu->tb_flushed |= old_tb_flushed; - cpu->current_tb = tb; /* execute the generated code */ trace_exec_tb_nocache(tb, tb->pc); cpu_tb_exec(cpu, tb); - cpu->current_tb = NULL; tb_phys_invalidate(tb, -1); tb_free(tb); } @@ -532,9 +530,7 @@ int cpu_exec(CPUState *cpu) uintptr_t ret; trace_exec_tb(tb, tb->pc); /* execute the generated code */ - cpu->current_tb = tb; ret = cpu_tb_exec(cpu, tb); - cpu->current_tb = NULL; last_tb = (TranslationBlock *)(ret & ~TB_EXIT_MASK); tb_exit = ret & TB_EXIT_MASK; switch (tb_exit) { diff --git a/cputlb.c b/cputlb.c index 466663b..167280a 100644 --- a/cputlb.c +++ b/cputlb.c @@ -76,10 +76,6 @@ void tlb_flush(CPUState *cpu, int flush_global) tlb_debug("(%d)\n", flush_global); - /* must reset current TB so that interrupts cannot modify the - links while we are modifying them */ - cpu->current_tb = NULL; - memset(env->tlb_table, -1, sizeof(env->tlb_table)); memset(env->tlb_v_table, -1, sizeof(env->tlb_v_table)); memset(cpu->tb_jmp_cache, 0, sizeof(cpu->tb_jmp_cache)); @@ -95,9 +91,6 @@ static inline void v_tlb_flush_by_mmuidx(CPUState *cpu, va_list argp) CPUArchState *env = cpu->env_ptr; tlb_debug("start\n"); - /* must reset current TB so that interrupts cannot modify the - links while we are modifying them */ - cpu->current_tb = NULL; for (;;) { int mmu_idx = va_arg(argp, int); @@ -152,9 +145,6 @@ void tlb_flush_page(CPUState *cpu, target_ulong addr) tlb_flush(cpu, 1); return; } - /* must reset current TB so that interrupts cannot modify the - links while we are modifying them */ - cpu->current_tb = NULL; addr &= TARGET_PAGE_MASK; i = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); @@ -193,9 +183,6 @@ void tlb_flush_page_by_mmuidx(CPUState *cpu, target_ulong addr, ...) va_end(argp); return; } - /* must reset current TB so that interrupts cannot modify the - links while we are modifying them */ - cpu->current_tb = NULL; addr &= TARGET_PAGE_MASK; i = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c index 4bb695d..f14445d 100644 --- a/hw/i386/kvmvapic.c +++ b/hw/i386/kvmvapic.c @@ -446,7 +446,6 @@ static void patch_instruction(VAPICROMState *s, X86CPU *cpu, target_ulong ip) resume_all_vcpus(); if (!kvm_enabled()) { - cs->current_tb = NULL; tb_gen_code(cs, current_pc, current_cs_base, current_flags, 1); cpu_resume_from_signal(cs, NULL); } diff --git a/include/qom/cpu.h b/include/qom/cpu.h index c1ae24d..4349c46 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -253,7 +253,6 @@ struct kvm_run; * @as: Pointer to the first AddressSpace, for the convenience of targets which * only have a single AddressSpace * @env_ptr: Pointer to subclass-specific CPUArchState field. - * @current_tb: Currently executing TB. * @gdb_regs: Additional GDB registers. * @gdb_num_regs: Number of total registers accessible to GDB. * @gdb_num_g_regs: Number of registers in GDB 'g' packets. @@ -305,7 +304,6 @@ struct CPUState { MemoryRegion *memory; void *env_ptr; /* CPUArchState */ - struct TranslationBlock *current_tb; struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE]; struct GDBRegisterState *gdb_regs; int gdb_num_regs; diff --git a/qom/cpu.c b/qom/cpu.c index c9007d3..751e992 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -254,7 +254,6 @@ static void cpu_common_reset(CPUState *cpu) } cpu->interrupt_request = 0; - cpu->current_tb = NULL; cpu->halted = 0; cpu->mem_io_pc = 0; cpu->mem_io_vaddr = 0; diff --git a/translate-all.c b/translate-all.c index 2d1957b..b54f472 100644 --- a/translate-all.c +++ b/translate-all.c @@ -305,7 +305,6 @@ bool cpu_restore_state(CPUState *cpu, uintptr_t retaddr) cpu_restore_state_from_tb(cpu, tb, retaddr); if (tb->cflags & CF_NOCACHE) { /* one-shot translation, invalidate it immediately */ - cpu->current_tb = NULL; tb_phys_invalidate(tb, -1); tb_free(tb); } @@ -1309,9 +1308,9 @@ void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end) void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end, int is_cpu_write_access) { - TranslationBlock *tb, *tb_next, *saved_tb; - CPUState *cpu = current_cpu; + TranslationBlock *tb, *tb_next; #if defined(TARGET_HAS_PRECISE_SMC) + CPUState *cpu = current_cpu; CPUArchState *env = NULL; #endif tb_page_addr_t tb_start, tb_end; @@ -1378,20 +1377,7 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end, ¤t_flags); } #endif /* TARGET_HAS_PRECISE_SMC */ - /* we need to do that to handle the case where a signal - occurs while doing tb_phys_invalidate() */ - saved_tb = NULL; - if (cpu != NULL) { - saved_tb = cpu->current_tb; - cpu->current_tb = NULL; - } tb_phys_invalidate(tb, -1); - if (cpu != NULL) { - cpu->current_tb = saved_tb; - if (cpu->interrupt_request && cpu->current_tb) { - cpu_interrupt(cpu, cpu->interrupt_request); - } - } } tb = tb_next; } @@ -1407,7 +1393,6 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end, /* we generate a block containing just the instruction modifying the memory. It will ensure that it cannot modify itself */ - cpu->current_tb = NULL; tb_gen_code(cpu, current_pc, current_cs_base, current_flags, 1); cpu_resume_from_signal(cpu, NULL); } @@ -1512,7 +1497,6 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr, /* we generate a block containing just the instruction modifying the memory. It will ensure that it cannot modify itself */ - cpu->current_tb = NULL; tb_gen_code(cpu, current_pc, current_cs_base, current_flags, 1); if (locked) { mmap_unlock();