From patchwork Tue Oct 10 19:29:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 115455 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp4118512qgn; Tue, 10 Oct 2017 12:35:22 -0700 (PDT) X-Received: by 10.200.35.39 with SMTP id a36mr20497712qta.308.1507664122882; Tue, 10 Oct 2017 12:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507664122; cv=none; d=google.com; s=arc-20160816; b=FwhGfZiyIJXg7EcOS4chs+XkUVCe1bryord3uCLs7qK4cAQC6tXcktBSLNA0yP66Px SKBU/Uq4MbguF8IS4Y2UyEPKR6bzrhesr4lgalIR13XS0Hf9Ev6WxgKhBS3L2aBn9xMx d7HAMRHsARb1M0+QfWoe0Pzy39ruvIsGrw9w9w4eqT5xqHOVEB9PLkpAWTfVxX6fhcp2 L2D0cqwowXyb5GQ6rwNZ/Oqij0/REmnKRsoL4o/tagEbp1yQ5U9xsas5Xf67TuVx0v4z b59rEqALFTc6aIWx04QRI0zhAaPW5Ioc37UGgRGJ0zlBCl5I/TNQPfwP5RODu3sbMhrW AFHA== 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=bEw3sKV1VyD+t34o1yF+mtIWXrvvabOy1jspjVF2CcFOHOo5yQj5z0tyZgJ3HvMxlC TyxIzpyhVuHxi8Y78DTozbsZ4UKKEteKb5lvNjU84qW6FgyiFQh/u7QgZpueoJW/5hc2 kaS2olThm825bJYSbgsvikM2qAn/gIc0KgdoAXlmQ/AblHKBTdVS3hEJ7ZH36+l3MqRn qLqlHSJIa3pMjCOFa44flfowK39uMDd0gHhnWmGqbVUfpnnOHJ3jDkFTGTfLKynd5apE gxuGnd7gUu800oPzQAGVQqiwMMuMK/lNUBbAXeicM7dV7IYs3jYrC1CtCNOqAVUk2LEt ChOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MWXNv1Pp; 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 y3si7583586qti.39.2017.10.10.12.35.22 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Oct 2017 12:35:22 -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=MWXNv1Pp; 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]:36813 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e20JE-0003zV-ON for patch@linaro.org; Tue, 10 Oct 2017 15:35:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e20EW-0000hu-Gl for qemu-devel@nongnu.org; Tue, 10 Oct 2017 15:30:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e20EP-00054P-A2 for qemu-devel@nongnu.org; Tue, 10 Oct 2017 15:30:23 -0400 Received: from mail-pf0-x235.google.com ([2607:f8b0:400e:c00::235]:53300) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e20EO-00054C-St for qemu-devel@nongnu.org; Tue, 10 Oct 2017 15:30:21 -0400 Received: by mail-pf0-x235.google.com with SMTP id n73so11596349pfg.10 for ; Tue, 10 Oct 2017 12:30:20 -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=MWXNv1Pphelk+q724Nyv4l3lTjDRRs1T3HmCv7m8Fzu0jzl4l7UIjEdQ2wWZUE9jFQ CHcTDVah8dxJ/D5P2vw6L+Fo3DIK0j8bnjHUgEyskwh+bqlJ/pEQBiG8vtwiYxDa3jEt SHkiepDDzCqYfLNHJAlZgXb+ON4pFpK6tNS6s= 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=MKwf4w+cZ6heookGqE44T/hF535hS4auQiZc3MTltuMPGJK7GfjF7ICstt2SHQS98+ V4XYpo9fLBS1m4m+hhjsOcs1Rg7ImuRnNg+iBGN0B5hjplCjB/Ei3In8uv4UB3M91Wh+ D91RTMvijG7ex4Gn3z/pkJtjzTeb1WSvk4f+mgDVSBgWV7o/gduw26A93DOaZgpy6Alj hhTaI6W4WICV7lSbOqwgNe6uPz1Gbva42YpWXZ4hinMSyQGo076sbuuXPduI8Lr8DpXh gPd7CZI2rye6NjIbHZ0yHj8qlr8dsoqjiRMUmJQKZRwbVj2LjoHjI31KwywUzm6v1e58 pheg== X-Gm-Message-State: AMCzsaW/xBT/iejl7LSLScYp4/QJZtiP1oPRlE7OOE+0o/zMIN3mUm06 RgvAW7p6FLsctEutBuy9ksN6tvumOCE= X-Google-Smtp-Source: AOwi7QDzMHTo8WpEeOpAQ8mk5otI5CeG9i9eawZ7HXXoagll5ywevsvmOjy7cmWjDauaWJBxoJwVwQ== X-Received: by 10.98.181.3 with SMTP id y3mr4256181pfe.264.1507663819652; Tue, 10 Oct 2017 12:30:19 -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 r22sm19859788pfl.15.2017.10.10.12.30.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Oct 2017 12:30:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 10 Oct 2017 12:29:53 -0700 Message-Id: <20171010193003.28857-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171010193003.28857-1-richard.henderson@linaro.org> References: <20171010193003.28857-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::235 Subject: [Qemu-devel] [PULL v2 10/20] 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