Received: from eggs.gnu.org ([2001:4830:134:3::10]:55372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcz7S-0004bi-9M for qemu-devel@nongnu.org; Thu, 25 Aug 2016 14:11:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bcz7P-0007dO-J8 for qemu-devel@nongnu.org; Thu, 25 Aug 2016 14:11:14 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33403) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcz7P-0007dE-Ax for qemu-devel@nongnu.org; Thu, 25 Aug 2016 14:11:11 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u7PI8wbQ008339 for ; Thu, 25 Aug 2016 14:11:10 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 251w7wjmf6-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 25 Aug 2016 14:11:09 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Aug 2016 19:11:07 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id E79B91B0805F for ; Thu, 25 Aug 2016 19:12:45 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u7PIB5iA23658660 for ; Thu, 25 Aug 2016 18:11:05 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u7PIB5eJ014557 for ; Thu, 25 Aug 2016 12:11:05 -0600 From: Christian Borntraeger Date: Thu, 25 Aug 2016 20:11:26 +0200 Message-Id: <1472148686-39841-1-git-send-email-borntraeger@de.ibm.com> Subject: [Qemu-devel] [PATCH] translate: early exit in tb_flush if there is no tcg List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Brent Baccala , Richard Henderson , Paolo Bonzini , "Emilio G. Cota" , Christian Borntraeger tb_flush does all kind of things, which are very tcg specific. As it is called from some places even for KVM (e.g. gdb server) it is better to detect these cases and do an early exit. This also fixes a crash in the gdb server that was triggered by commit 909eaac9bbc2 ("tb hash: track translated blocks with qht"). Suggested-by: Paolo Bonzini Reported-by: Richard Henderson Reported-by: Brent Baccala Signed-off-by: Christian Borntraeger --- translate-all.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/translate-all.c b/translate-all.c index efeba29..0dd6466 100644 --- a/translate-all.c +++ b/translate-all.c @@ -834,6 +834,9 @@ static void page_flush_tb(void) /* XXX: tb_flush is currently not thread safe */ void tb_flush(CPUState *cpu) { + if (!tcg_enabled()) { + return; + } #if defined(DEBUG_FLUSH) printf("qemu: flush code_size=%ld nb_tbs=%d avg_tb_size=%ld\n", (unsigned long)(tcg_ctx.code_gen_ptr - tcg_ctx.code_gen_buffer), -- 2.5.5