From nobody Fri May 3 13:57:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570004866; cv=none; d=zoho.com; s=zohoarc; b=CgdbTPFoV013P2vYAgPYqOsKeFN+KPcIIqSU9DSgRokC2hxjyRjY0B3Ll8OoZOaC+n0WjnEVQM43mydiKnuPJalGT4nViOHIIIDHi4OnG9ARBLEkdyZAHiXJIXSg1FppbfHXPCNY2ol7aPk64x7v8pUkR+x7+aFTpBXWJQEMKsQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570004866; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=cdIVH0GupNtlVXQ8+lA61sbOddMmvKDLz5HV8+9Bylg=; b=nIp/t9olo80P3iQiMLDtJGlrlHmszSCE1/Ieq6s2+Ak5N5q90x5czxR5Gx0QxQCAyorFar47YeWWeLFZCLTikq4x0xzASWGdH4imKxHQcB0zukq95SMFNfG/SH6x4SCh0K+YbWd1GgpDS9+2UMrE2FnbNA6GUDsA0RPcgSCfjeI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1570004866977732.3347259409721; Wed, 2 Oct 2019 01:27:46 -0700 (PDT) Received: from localhost ([::1]:52510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFZyw-0003O7-3L for importer@patchew.org; Wed, 02 Oct 2019 04:27:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37028) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFZy8-0002vs-4K for qemu-devel@nongnu.org; Wed, 02 Oct 2019 04:26:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFZy7-0002zx-48 for qemu-devel@nongnu.org; Wed, 02 Oct 2019 04:26:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33816) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFZy6-0002zg-VV; Wed, 02 Oct 2019 04:26:43 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B0B230860B5; Wed, 2 Oct 2019 08:26:42 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-58.ams2.redhat.com [10.36.117.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id A089C5D9D6; Wed, 2 Oct 2019 08:26:37 +0000 (UTC) From: David Hildenbrand To: qemu-devel@nongnu.org Subject: [PATCH v2] s390x/tcg: MVCL: Exit to main loop if requested Date: Wed, 2 Oct 2019 10:26:36 +0200 Message-Id: <20191002082636.7739-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 02 Oct 2019 08:26:42 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 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: qemu-s390x@nongnu.org, Cornelia Huck , Richard Henderson , Thomas Huth , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" MVCL is interruptible and we should check for interrupts and process them after writing back the variables to the registers. Let's check for any exit requests and exit to the main loop. When booting Fedora 30, I can see a handful of these exits and it seems to work reliable. (it never get's triggered via EXECUTE, though) Suggested-by: Richard Henderson Signed-off-by: David Hildenbrand Acked-by: Alex Benn=C3=A9e --- v1 -> v2: - Check only if icount_decr.u32 < 0 - Drop should_interrupt_instruction() and perform the check inline - Rephrase comment, subject, and description --- target/s390x/mem_helper.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 4254548935..87e4ebd169 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1015,6 +1015,7 @@ uint32_t HELPER(mvcl)(CPUS390XState *env, uint32_t r1= , uint32_t r2) uint64_t srclen =3D env->regs[r2 + 1] & 0xffffff; uint64_t src =3D get_address(env, r2); uint8_t pad =3D env->regs[r2 + 1] >> 24; + CPUState *cs =3D env_cpu(env); S390Access srca, desta; uint32_t cc, cur_len; =20 @@ -1065,7 +1066,14 @@ uint32_t HELPER(mvcl)(CPUS390XState *env, uint32_t r= 1, uint32_t r2) env->regs[r1 + 1] =3D deposit64(env->regs[r1 + 1], 0, 24, destlen); set_address_zero(env, r1, dest); =20 - /* TODO: Deliver interrupts. */ + /* + * MVCL is interruptible. Check if somebody (e.g., cpu_interrupt()= or + * cpu_exit()) asked us to return to the main loop. In case there = is + * no deliverable interrupt, we'll end up back in this handler. + */ + if (unlikely((int32_t)atomic_read(&cpu_neg(cs)->icount_decr.u32) <= 0)) { + cpu_loop_exit_restore(cs, ra); + } } return cc; } --=20 2.21.0