From patchwork Thu Jun 30 03:16:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 586093 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp945665mab; Wed, 29 Jun 2022 20:17:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vphR1Q8hj73GT5XoeyZledBTjnURprgT0iggZoA84MdfijPQKDC5PQ6m2vNRLKzBmyeo+q X-Received: by 2002:a05:6214:2343:b0:43d:684c:f538 with SMTP id hu3-20020a056214234300b0043d684cf538mr10712948qvb.58.1656559067806; Wed, 29 Jun 2022 20:17:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656559067; cv=none; d=google.com; s=arc-20160816; b=OvYhdGtfRDyxsxD4HTsqUNiCR+wqbSFhCRolCTZ6JUJ+Er1gENq+N7A0d3pTs3aIhw +mleLpuYQCGiuzDfHIZC6L7eAtQjQ3GL6hARVlk29RpvU2QH25mVxgMJniwqjPYCWQ9r 3y6i2IRf36IY+Se3Eq7azysGFEG9ta24iurQpUN0/aeYIXY24kJJZoOPipeODqfQBJUK omsXDQdRJXuMHzG57TXJHQz3hmUqfFvTcR+bJdIpEi8MbpdDRGxZPEpYLplF9VUXa6RC s+dWokGG62AAtMZXN0cNpnsrn21JZYMFiMP5RYNgPKrSlpEplkZBUU7j1yTns5ixFBRj u6dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=bXcV7WzdJB6v6tRs5Y7JbMW0b+6unrNcPOHqTvkpgwc=; b=GBi/oWpiMC2iG5/6JXnK4pq57KU7hbSSBK8CypcRHNeHjc377TadBa/rojdkQfeaCl BmPfJxRvRot4eYVo7x9r3CBS9xKsRgh3kBlMYAM5vwJ23EJ9QQAnyc33+CpiuQCYTrhX NO9OdwOHnD3iIZWgoHQPZZ8g5pzihxO3jxi19SOXFN20e1CzCbUZ/Fm9gs83L7D2uVgG kXK8HMfHt7gGQgYrC+UbZb28TR0u1Hi9nwAE6gYlN9xmxRhZUuiZklc5HxThxjaUvh9m fo6bpCwcqx1QjEh61I2BXhSQeJx/s4cLILsF6C7aTkWDWTnQQVk8X+5n4djSN+EXS1mI pxww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n8ebV8fi; 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 d16-20020ac86150000000b0031c4793c099si2610491qtm.466.2022.06.29.20.17.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Jun 2022 20:17:47 -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=pass header.i=@linaro.org header.s=google header.b=n8ebV8fi; 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]:53406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o6kgd-0005pk-Cp for patch@linaro.org; Wed, 29 Jun 2022 23:17:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6kfe-0005mD-BX for qemu-devel@nongnu.org; Wed, 29 Jun 2022 23:16:46 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:45885) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o6kfc-0005uN-Rh for qemu-devel@nongnu.org; Wed, 29 Jun 2022 23:16:46 -0400 Received: by mail-pf1-x42a.google.com with SMTP id 128so16839032pfv.12 for ; Wed, 29 Jun 2022 20:16:44 -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:mime-version :content-transfer-encoding; bh=bXcV7WzdJB6v6tRs5Y7JbMW0b+6unrNcPOHqTvkpgwc=; b=n8ebV8fixtqYIBNwfl3l3NaghidRUTQLGITrRS2N2pFyRcR5UKYYp+kFvHmhxGpLcX QKfkNnDOI5R/iABQTCA0mCC0qbiVu5HPtzn6pARaW1Zv67/NexUNvOWCmwIaSs8pJ80C IIr5H+iTaW7f+XEewIDTT+HmiRijXX1QlNu+FRlhgFIrGM7q5FFDPUo6Pg4FbnbvMgBW yiUumD6QuQUA3ddOv6RRgrYn1beIZeEy9CEPhgwfltkuR0lVm9oMpsJpspU1L+GJxAg7 VKlv6BFbXSx2X35n0GQjFdQVCYySqy4OnwEjPp0q2K1N+J7QXDuaPd23Eg7+cGImCcCU DqXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bXcV7WzdJB6v6tRs5Y7JbMW0b+6unrNcPOHqTvkpgwc=; b=yNHTXNtyZZbamQPsQ47WcbPA/8MB65A0fiO0mZW6to6XMvI6REqqK0kypECTgnFaSq IhquGpxEm958gvg2CTJm5YYkQ0ZjEV436xIP7anPVKosDcRKXFI2qxX3pzm2wu/DUlCJ xJtR6Yn6D3xx/nntXJ5/aBWBSN20DiSno75qXgry5zeS9qVVqHW0d55F/jBadBRP9zNq +n3wloXTKgqSJDg6Cv3gfdo8WxSF6XDSRKDyCPDk1uClTtdhdXr0uy9Wc3VAI6p4zp+w 0xCJ6xW0RfPtTDq8jK8QGCEjg9cXhXgX6tX5cnsvkYU4WtDo/9O/4R2vS79QaRZd02mU 1sgw== X-Gm-Message-State: AJIora/8F0v0UsJpOGxcfGHRcClyY6Ff1PCnleA+v0xVdfY9BepOW7Vu sOe6mUDIOMGFlX6i/fg9HKYf2Ac7A3Q6DDgk X-Received: by 2002:aa7:8895:0:b0:525:79c8:eb6a with SMTP id z21-20020aa78895000000b0052579c8eb6amr13176113pfe.35.1656559003059; Wed, 29 Jun 2022 20:16:43 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id s3-20020a170902c64300b0016a61301293sm11997060pls.212.2022.06.29.20.16.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 20:16:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Sven Schnelle Subject: [PATCH] target/s390x: Exit tb after executing ex_value Date: Thu, 30 Jun 2022 08:46:35 +0530 Message-Id: <20220630031635.271353-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.google.com 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" When EXECUTE sets ex_value to interrupt the constructed instruction, we implicitly disable interrupts so that the value is not corrupted. Exit to the main loop after execution, so that we re-evaluate any pending interrupts. Reported-by: Sven Schnelle Signed-off-by: Richard Henderson --- Hi Sven. Will you test this vs your testcase? Thanks, r~ --- target/s390x/tcg/translate.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index fd2433d625..e52c2a4a6f 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -6620,11 +6620,18 @@ static void s390x_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) dc->base.is_jmp = translate_one(env, dc); if (dc->base.is_jmp == DISAS_NEXT) { - uint64_t page_start; - - page_start = dc->base.pc_first & TARGET_PAGE_MASK; - if (dc->base.pc_next - page_start >= TARGET_PAGE_SIZE || dc->ex_value) { - dc->base.is_jmp = DISAS_TOO_MANY; + if (unlikely(dc->ex_value)) { + /* + * Because ex_value was set, s390_cpu_exec_interrupt may + * have skipped an interrupt. Exit to the main loop to + * re-evaluate interrupts, as we do for LCTL. + */ + dc->base.is_jmp = DISAS_PC_STALE_NOCHAIN; + } else { + uint64_t page_start = dc->base.pc_first & TARGET_PAGE_MASK; + if (dc->base.pc_next - page_start >= TARGET_PAGE_SIZE) { + dc->base.is_jmp = DISAS_TOO_MANY; + } } } }