From patchwork Tue Nov 3 03:39:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 320381 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp4254413ilc; Mon, 2 Nov 2020 19:40:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1hOPe/ij0tR5PZvTswMlT3Ag9MIUawROR+tPmLtIQDn88Rsxe/8ULPJnFHoEARZ7fh5nF X-Received: by 2002:ac8:1e84:: with SMTP id c4mr17874919qtm.340.1604374847076; Mon, 02 Nov 2020 19:40:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604374847; cv=none; d=google.com; s=arc-20160816; b=i5S0N+LPTa2qk3PJmzIqsz/locU/Hqy+Cmf5o8mIzJOfyLFAg4s4JtRiT5I72CiwdR i1dd4NfQ8aRSNkUfiIWKfWQUt/KhxlARxfMKRxcxNW7X/Y4JyLgo6hGYtg7Q3AEq8rjm VIDIzgRghYDJIsSHGcygEucagY4Otb98p7EPj70pmOV9849cIvUPvlbq2ZvPWljsgZ8T jKKjOUL34Ve9AKAjKYnsaDq11du35dVyWu/iOgedvdAYUhKkIuZ/iWDiikmE6UB39xI9 XTR4I+tywA/FwndlnTaaZrG2s3fBToQvkVU5CYgckLUyhIFDoLszCukUK3BTPkV1x9hx xDag== 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:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature; bh=bfjAIfz0w/Qz72IXs6gPJpI6mQ4YZEZ6ztRDcjP9YP4=; b=k/mJREoVkkI9Qri+5C12djIDzX/WJEs4TTHtb9jB1dSAEZFT6JU1dAqcP0RQveQi6v eAnjziYEhfstHpOyVlG6Ov7dVBGn0QRRgJgxZrTJ90lx8dF7JgWeKlVq3qCNzi/pSaqi rS4eESHzWb0Qffy3owfaPza6GdzCDCc4hOGBqOlt8+lQGQeglk6XJ55XoJjxTEGILira owIO7QGgSNU9VEj6v5slrNr09RbnGcjQdsh5E7en9vJQNmKjryNFLcyE7+FVdQqVS7/W opP61mmLEu1aST369Fw6siyiJMmR7dSUqACFrpL08Y/UyBcoFIcWyLyfi4Ff9UOvofqd qvDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WKT6Jqh9; 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=pass (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 i1si9358441qkk.372.2020.11.02.19.40.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Nov 2020 19:40:47 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=WKT6Jqh9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZnBe-00069f-KH for patch@linaro.org; Mon, 02 Nov 2020 22:40:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZnAm-00069V-Gy for qemu-devel@nongnu.org; Mon, 02 Nov 2020 22:39:52 -0500 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:46490) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kZnAk-000635-Mi for qemu-devel@nongnu.org; Mon, 02 Nov 2020 22:39:52 -0500 Received: by mail-pg1-x543.google.com with SMTP id w4so2373394pgg.13 for ; Mon, 02 Nov 2020 19:39:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bfjAIfz0w/Qz72IXs6gPJpI6mQ4YZEZ6ztRDcjP9YP4=; b=WKT6Jqh9laSkSuK0Gx4ybedfN1D9vFCRx56mPQkSKXL8cFkS3kGH0APhVPMqahGe1/ qtqiybKaqa0D3wTMSVa4zPIHQfg4X1swtqPeovt5MuzUbtGB1tRRQOp71h2FT2kE1q+8 MOMONCd+Q55s7gYYBTQQkebfwkYnpZBuECDNkHkAtdGn7ByLQXngCOGVBoK8DOAtvLGR r/TCIBSVPAp2NUdnC3rxH2JroOWnbADTFdeZ1Kxq25u2BHKHj7+YN2bNt9gUFSx1X8do sm/SGXEtA+gs9f9k2MvW2U//XMRJe0jNWSgZJH5E2D5FiHcJgSQgUroiMneFtGY1sA0r mE1w== 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:mime-version :content-transfer-encoding; bh=bfjAIfz0w/Qz72IXs6gPJpI6mQ4YZEZ6ztRDcjP9YP4=; b=EPyKY4bnskPsUa+u8sp3xjHlVBH9QCpKhi0C1ombyWiUF47b2CsI5AqlLPFj+L0iDw ehlglCJN0IMzq6Ba2PKHVYCzoC5rNPo2erIFbPwyftv/1yjCN7UTpo6hCIEZYQZ4UaCI o/zr2eoH9cZCkK4P0dMP3Yg0VPll5wW3hRr1EHu3XyQBZMb5ZUqSpz7rl+llqoTA5Lau eh4ZH8NeYlA3KF1UMX6zMu0qknJzpyIfdJC9RA+BGLzGP6N0aRw9zo+8Qc0bG7WTzTsW T6+3eVwr9FJhfKI9mgDrrnLIhs+ouCqO1J6vv24JqK4am0j5qLQMIWwDWSq8ukkTa66W HwWA== X-Gm-Message-State: AOAM531QtrcPM0V+UTUchv9WkqKw082/e64tozboLI5bci8zNe04I4q2 kyWEX78S9osrtGSWmeZBkjE2nciLINyR0w== X-Received: by 2002:a17:90b:783:: with SMTP id l3mr1673992pjz.122.1604374788665; Mon, 02 Nov 2020 19:39:48 -0800 (PST) Received: from localhost.localdomain (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id j5sm952875pjb.56.2020.11.02.19.39.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 19:39:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH for-5.2] tcg: Remove assert from set_jmp_reset_offset Date: Mon, 2 Nov 2020 19:39:47 -0800 Message-Id: <20201103033947.94157-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::543; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x543.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sai Pavan Boddu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The range check done here is done later, more appropriately, at the end of tcg_gen_code. There, a failing range check results in a returned error code, which causes the TB to be restarted at half the size. Reported-by: Sai Pavan Boddu Signed-off-by: Richard Henderson --- Sai, would you try this against your failing testcase? r~ --- tcg/tcg.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.25.1 Tested-by: Sai Pavan Boddu Reviewed-by: Philippe Mathieu-Daudé diff --git a/tcg/tcg.c b/tcg/tcg.c index f49f1a7f35..43c6cf8f52 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -335,10 +335,11 @@ static bool tcg_resolve_relocs(TCGContext *s) static void set_jmp_reset_offset(TCGContext *s, int which) { - size_t off = tcg_current_code_size(s); - s->tb_jmp_reset_offset[which] = off; - /* Make sure that we didn't overflow the stored offset. */ - assert(s->tb_jmp_reset_offset[which] == off); + /* + * We will check for overflow at the end of the opcode loop in + * tcg_gen_code, where we bound tcg_current_code_size to UINT16_MAX. + */ + s->tb_jmp_reset_offset[which] = tcg_current_code_size(s); } #include "tcg-target.c.inc"