From patchwork Fri Apr 26 17:24:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 162959 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1014960jan; Fri, 26 Apr 2019 10:36:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkEQ07hiah5B1ynSgKS5qRGOB4sIZByRu9n7/Bx3Pwy4CF8GMqVztHwu1S6s5md1XoQL+5 X-Received: by 2002:a1c:be0e:: with SMTP id o14mr8282985wmf.11.1556300174912; Fri, 26 Apr 2019 10:36:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556300174; cv=none; d=google.com; s=arc-20160816; b=Gmcy5uGmBds3yASsqaonE20uYsbhwNvlFw38gqDpOmZUT8iag99bWY6JI3EavUiybe z/K5gY0npXKZX00Ba/zAyAS98h+60C6dTQq+Bqp/Jnmvk7PrJEQjOKiBhF4fB7zim744 ABQZfSaiyfxoQGWLSdYz6EnhxFznnOLv/QsZpebLBZgRHlLgz050Ydz97RW7KR+Xxj5e zcWaOO/jfdJSgrNprlX5MydoktmIUMOS8uGIh1jy7+xC9y6WsC/BFmK4XjDJAxj+d/P7 ZG4RodWuF1Gxu7AFBI8tJygIsixUHjHSSktYg84zuDmEg50KFyBP+jE4d1M13Li1yDQs VF/g== 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; bh=Th3t/m0PioLpL2J3JR8QFGClCdlEYB4fbvw9qC7v3uc=; b=ZPiHfQPh3PjVtrmKcIy0fCEG6LyTMpGsPO+/2KKWCvjLyNBRrsCF3e4NCM32EA0uGz oMbWDiMDImilbhq7moCRyCoyahhkwa0TBau53BTRrUIMNo95my6hp0wm4+RXeYALrJi6 lDRC851BQKRwE5yqb8SMTVH5EaZOersIIGy65G8I9njk3b46msb8yeQ0+/UHnz3jKE8K xL0P38vhf0p8K5nr0W6dPX75GUbQN0P20fQnedSd/nRS5SHq0D+1E9+plJPLFKzSisDm 2382aVWR53I6l34tVOAKQhBeC/ui54lRKoByEC5ryOpifl8qqextwWLSTauvsVrIsQ3K VJBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="bQN6xkF/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id o204si18371210wmo.13.2019.04.26.10.36.14 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 26 Apr 2019 10:36:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="bQN6xkF/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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 ([127.0.0.1]:50075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hK4lh-0002iK-Ql for patch@linaro.org; Fri, 26 Apr 2019 13:36:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hK4aV-00006v-C6 for qemu-devel@nongnu.org; Fri, 26 Apr 2019 13:24:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hK4aU-0006ry-By for qemu-devel@nongnu.org; Fri, 26 Apr 2019 13:24:39 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:37750) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hK4aU-0006p7-5b for qemu-devel@nongnu.org; Fri, 26 Apr 2019 13:24:38 -0400 Received: by mail-pl1-x62f.google.com with SMTP id z8so1890877pln.4 for ; Fri, 26 Apr 2019 10:24:38 -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=Th3t/m0PioLpL2J3JR8QFGClCdlEYB4fbvw9qC7v3uc=; b=bQN6xkF/6mjgQD6aoiJqtsk8mR0nzfMl75mMliR0HvOyqTyOSLkC+nS54FGwy3wrAN ec4JcnGOH0gDVgLJhdz/ZjVxjozWSn/H/MfoGlIVzqMl55sYRIgDE8wguYCbmQ+34P0J FJqx6JEr5KIEiIgQdSkGC4gZiQIX+JDeJFcchFDaKhL1eQ3og9oXXJLHRd7HdWmbnapA r9hAgjUsAsEsD2G40ia2iQLXGy9LxaK37E+H0QYD+Ih1td3bgseSvME1NVtiKEw9pnNO J5S6vc1DDkzVcdRagOD600pOzJIzNIQiM2LeeqUzAES8W4I4a90IABdfgRoaXnjGtrsq f6KA== 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=Th3t/m0PioLpL2J3JR8QFGClCdlEYB4fbvw9qC7v3uc=; b=f/5jwPrFTVxB7vsbGuWLHsuvRVToMKoRjth+k7pi92/NN0bGUZatOjaNeq2cMu8g4R uY7a1akP24zUytO5V7x7e4qsCMOtVUT34orsekmzg2zUu5hY3preTjdQdr4VIOqZdEO6 PCMLOT9yxFflCtnx0X7W4er2iE7OebivV/stgtFYPqbwkz6r2Y1hpiRMYn9R85xYSpVC gvivTAHRxmcqUbcl22Bz7FubrgNFJcSZ4bcO0RpizN8ILvzvchOg7t4RBcn+9V7io4bv NwDpJkRPLy8EdAytvZ+RXIQ6zi6ICDxLPeUFhUCL6KiIHhQwCGc3QIvY2zfk75uXF77v xarQ== X-Gm-Message-State: APjAAAXAlxJ6adhYAslxEZbj2mW/73tunmAwsweTJASMxsd/kAaWEoke ItU3y96e1B2izcFSmzprhab8Ece/Yek= X-Received: by 2002:a17:902:758b:: with SMTP id j11mr10005815pll.87.1556299476903; Fri, 26 Apr 2019 10:24:36 -0700 (PDT) Received: from localhost.localdomain (97-113-179-147.tukw.qwest.net. [97.113.179.147]) by smtp.gmail.com with ESMTPSA id j5sm7901762pfg.186.2019.04.26.10.24.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 10:24:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 26 Apr 2019 10:24:17 -0700 Message-Id: <20190426172421.27133-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190426172421.27133-1-richard.henderson@linaro.org> References: <20190426172421.27133-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::62f Subject: [Qemu-devel] [PULL 11/15] tcg: Restart TB generation after constant pool overflow 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is part b of relocation overflow handling. Signed-off-by: Richard Henderson --- tcg/tcg-pool.inc.c | 12 +++++++----- tcg/tcg.c | 9 +++++---- 2 files changed, 12 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/tcg/tcg-pool.inc.c b/tcg/tcg-pool.inc.c index 7af5513ff3..4eaa84b631 100644 --- a/tcg/tcg-pool.inc.c +++ b/tcg/tcg-pool.inc.c @@ -121,14 +121,14 @@ static inline void new_pool_l8(TCGContext *s, int rtype, tcg_insn_unit *label, /* To be provided by cpu/tcg-target.inc.c. */ static void tcg_out_nop_fill(tcg_insn_unit *p, int count); -static bool tcg_out_pool_finalize(TCGContext *s) +static int tcg_out_pool_finalize(TCGContext *s) { TCGLabelPoolData *p = s->pool_labels; TCGLabelPoolData *l = NULL; void *a; if (p == NULL) { - return true; + return 0; } /* ??? Round up to qemu_icache_linesize, but then do not round @@ -142,15 +142,17 @@ static bool tcg_out_pool_finalize(TCGContext *s) size_t size = sizeof(tcg_target_ulong) * p->nlong; if (!l || l->nlong != p->nlong || memcmp(l->data, p->data, size)) { if (unlikely(a > s->code_gen_highwater)) { - return false; + return -1; } memcpy(a, p->data, size); a += size; l = p; } - patch_reloc(p->label, p->rtype, (intptr_t)a - size, p->addend); + if (!patch_reloc(p->label, p->rtype, (intptr_t)a - size, p->addend)) { + return -2; + } } s->code_ptr = a; - return true; + return 0; } diff --git a/tcg/tcg.c b/tcg/tcg.c index 752c45a0ec..0394e8ab34 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1019,8 +1019,8 @@ void tcg_prologue_init(TCGContext *s) #ifdef TCG_TARGET_NEED_POOL_LABELS /* Allow the prologue to put e.g. guest_base into a pool entry. */ { - bool ok = tcg_out_pool_finalize(s); - tcg_debug_assert(ok); + int result = tcg_out_pool_finalize(s); + tcg_debug_assert(result == 0); } #endif @@ -4005,8 +4005,9 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) } #endif #ifdef TCG_TARGET_NEED_POOL_LABELS - if (!tcg_out_pool_finalize(s)) { - return -1; + i = tcg_out_pool_finalize(s); + if (i < 0) { + return i; } #endif if (!tcg_resolve_relocs(s)) {