From patchwork Tue Oct 10 00:55:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 115321 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3173369qgn; Mon, 9 Oct 2017 18:06:39 -0700 (PDT) X-Received: by 10.55.43.227 with SMTP id r96mr12493576qkr.216.1507597599448; Mon, 09 Oct 2017 18:06:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507597599; cv=none; d=google.com; s=arc-20160816; b=RWuHQxJGaB01YwkwlNxqkC+RL/ppycR14nbcX+ty7v0JZ0POJIAoIXKxEE9EJC8BTh I542GrE22dx2AiPTLAb+zoOCiP5OwIO0uE3vVQCy9juI/TcxNpija1Q39ePdrxU3NRw1 50sqSlwLiAMkn7y6Fa17gHNrV+ylRSWNC6jxYHo7zQZ6pt/KVBkAYMzWUPRkhAM5LQkG h63L0XVffY3qlcAw4aPxSDMLZ7q1xCgFXqnZFoQQ9ze8+CgA6+Gpx/4wmPj5s13HCujT LG/S7Q4d+Ul9+bKbQYiwHafrHnBldaRfMoXFxLL8lVkHdeVoveSA78gQPQMkN7ZlAJjU Tf/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=AlG96ZS7wj0sBsmbSuh4GY4IomgcygTB/0W6OfuBaEA=; b=mGN3JVIZCxRRenUaYUO95MTgr1uk3psvg0WtuDmdaTO2xhsMkG17gHWy2SdHpiH3v6 KbcVqcUJE9X/KeH8SxXQH/0dyPKDghWm56sdYzRms/41slAj6/FHguw1sqGdenc9/DdQ t6z82K6BUiVeR39GOEMoVFXmz9kHMMIEjcOzATtgTJkQckt1zsxzmqVD9DgJRkYP7ZZj MZbuJCXh9Uf2WbSfLuGX95nq/iKmoRfIudPqIkm7fbdWoL/wrfhcFFIYMpoPa+2cI7A/ JAM5/oRu4vKmQaFia5WQWNmoUDqzkmGZSkyUpfO92FaWmNzqL6eaI4wqCPHBfZHcaxft xo6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=G0DYuYbs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id a62si1678895qkg.117.2017.10.09.18.06.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 09 Oct 2017 18:06:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=G0DYuYbs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1j0H-0001cd-Al for patch@linaro.org; Mon, 09 Oct 2017 21:06:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1iqI-0002It-O5 for qemu-devel@nongnu.org; Mon, 09 Oct 2017 20:56:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1iqH-0004S3-Pm for qemu-devel@nongnu.org; Mon, 09 Oct 2017 20:56:18 -0400 Received: from mail-pf0-x236.google.com ([2607:f8b0:400e:c00::236]:54344) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e1iqH-0004Re-Jd for qemu-devel@nongnu.org; Mon, 09 Oct 2017 20:56:17 -0400 Received: by mail-pf0-x236.google.com with SMTP id m28so10541643pfi.11 for ; Mon, 09 Oct 2017 17:56:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AlG96ZS7wj0sBsmbSuh4GY4IomgcygTB/0W6OfuBaEA=; b=G0DYuYbswv2AS39VrGqe6eCYnwlVl1fytQv28d72McUZP1LlA02MEg1eGN+jKgwHDC QYHzbAska5yWazmuVCHpGO9/bwMHEFoCUeBa4bKF1dBRq0G4PljxvHWxlQ6/e6PsvX+x 4YARsL//jmcCxgmjru66gHyEuQwZxkIYQVfLU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AlG96ZS7wj0sBsmbSuh4GY4IomgcygTB/0W6OfuBaEA=; b=fQybZuGOlpczasFssCsmfeeuxvA7UwRPFSBzymv6AwodQ0ERM99qep9uzzsOdrC5Pi QTHwvt1vEKcEH2wwgMgKS6cTL0Gkv+4Ggvh/4asauMiG3WxrXEy6b0hXnHueq93GYSVS t6X13A2T0Py051KNr/dgHYTg/24uhYo8mlLRmJW2/PWS+6hckesy3CXN0AE4IBx2/ZuA DM1b/A1zei+IjNc8OoTG2NGaZOpYMYxm2jrtHampZkk12Z9oG9LuHJaku9M0Ho3q6JhW M7FZ98Cf9eBTPeX6gH5LOg5zTUmCnl7BW04oZP4bijf4jh/Y6KE8cFPto7F+1q0CegG1 zfhQ== X-Gm-Message-State: AMCzsaWMcf6VFdBoRUT8dSuipu+OJaodViJA4tgBPObbk/Eg7dAPkEl3 DQq3JwhDuDdvKHaXj6SLPvfx1Ssqt60= X-Google-Smtp-Source: AOwi7QD+bYE8DBryiAeWWW40yiLRbO7JODXr0wKWd0T1+6fXofFQ19+KU5LuLXzXaY7blw/WFC/gXg== X-Received: by 10.98.245.152 with SMTP id b24mr11911825pfm.56.1507596976323; Mon, 09 Oct 2017 17:56:16 -0700 (PDT) Received: from bigtime.twiddle.net (97-126-104-76.tukw.qwest.net. [97.126.104.76]) by smtp.gmail.com with ESMTPSA id n19sm17121368pfj.52.2017.10.09.17.56.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Oct 2017 17:56:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 9 Oct 2017 17:55:47 -0700 Message-Id: <20171010005600.28735-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171010005600.28735-1-richard.henderson@linaro.org> References: <20171010005600.28735-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::236 Subject: [Qemu-devel] [PULL 10/23] exec-all: bring tb->invalid into tb->cflags 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, "Emilio G. Cota" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This gets rid of a hole in struct TranslationBlock. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 3 +-- include/exec/tb-lookup.h | 2 +- accel/tcg/cpu-exec.c | 4 ++-- accel/tcg/translate-all.c | 3 +-- 4 files changed, 5 insertions(+), 7 deletions(-) -- 2.13.6 diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index a9a8bb6f83..3135aaf4c9 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -314,12 +314,11 @@ struct TranslationBlock { #define CF_NOCACHE 0x10000 /* To be freed after execution */ #define CF_USE_ICOUNT 0x20000 #define CF_IGNORE_ICOUNT 0x40000 /* Do not generate icount code */ +#define CF_INVALID 0x80000 /* TB is stale. Setters must acquire tb_lock */ /* Per-vCPU dynamic tracing state used to generate this TB */ uint32_t trace_vcpu_dstate; - uint16_t invalid; - void *tc_ptr; /* pointer to the translated code */ uint8_t *tc_search; /* pointer to search data */ /* original tb when cflags has CF_NOCACHE */ diff --git a/include/exec/tb-lookup.h b/include/exec/tb-lookup.h index 9d32cb0c6e..436b6d5ecf 100644 --- a/include/exec/tb-lookup.h +++ b/include/exec/tb-lookup.h @@ -35,7 +35,7 @@ tb_lookup__cpu_state(CPUState *cpu, target_ulong *pc, target_ulong *cs_base, tb->cs_base == *cs_base && tb->flags == *flags && tb->trace_vcpu_dstate == *cpu->trace_dstate && - !atomic_read(&tb->invalid))) { + !(atomic_read(&tb->cflags) & CF_INVALID))) { return tb; } tb = tb_htable_lookup(cpu, *pc, *cs_base, *flags); diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index f8a1d68db7..9cd809d607 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -294,7 +294,7 @@ static bool tb_cmp(const void *p, const void *d) tb->cs_base == desc->cs_base && tb->flags == desc->flags && tb->trace_vcpu_dstate == desc->trace_vcpu_dstate && - !atomic_read(&tb->invalid)) { + !(atomic_read(&tb->cflags) & CF_INVALID)) { /* check next page if needed */ if (tb->page_addr[1] == -1) { return true; @@ -412,7 +412,7 @@ static inline TranslationBlock *tb_find(CPUState *cpu, tb_lock(); acquired_tb_lock = true; } - if (!tb->invalid) { + if (!(tb->cflags & CF_INVALID)) { tb_add_jump(last_tb, tb_exit, tb); } } diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index a7c1d4e3f2..ed65d68709 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1073,7 +1073,7 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr) assert_tb_locked(); - atomic_set(&tb->invalid, true); + atomic_set(&tb->cflags, tb->cflags | CF_INVALID); /* remove the TB from the hash list */ phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK); @@ -1269,7 +1269,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tb->flags = flags; tb->cflags = cflags; tb->trace_vcpu_dstate = *cpu->trace_dstate; - tb->invalid = false; #ifdef CONFIG_PROFILER tcg_ctx.tb_count1++; /* includes aborted translations because of