Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp141235iog; Wed, 29 Jun 2022 20:15:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uui40QvrLdmouQ+Co8bhS9r+A4mvyBSj+JW6FV9kFU4LsNdl933qzH9XRLwvjk5n+sL82B X-Received: by 2002:a17:903:2312:b0:16a:4a5b:a615 with SMTP id d18-20020a170903231200b0016a4a5ba615mr12310083plh.48.1656558936260; Wed, 29 Jun 2022 20:15:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656558936; cv=none; d=google.com; s=arc-20160816; b=brauLKfL/d9uSi9iTR+qA6Lfr/doKmOURtDDeZNgLgLuu2hVQsX5V/dTKkanWj3jwI bIdxAYH2n7bm2ZDbdPVm+NjqwbOZg/JlO8QIZytwMxbBmlcC7elF9EPOFYpvhCul0/GV GI0hjjijaufyTCU7qYOLI8DO3Uq08goKyJ3uc4GlXUFA23Iih7GCLHwxbUBscjOmaqCB VQS5fPbV7WYu1yEAzjXoZr/OH2GflhVyQynKzATLwRiVdQT3rilbea+IFsjM4XNnBw1j UJKafd08BpolWbDA8DfFEQnoAd8ud++QhPwyTBbpYnL9V/KMIv8Z25DxEBieMf67JpAq FOBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=eFrmibnOmK8XtuM6Tf2P09vssNYtvI09arlKksnBKmE=; b=M/s0tQdsXYqtT34df74DGkaOnW4ZyuhCOuSbwSSdJKZPMl0Qs0YofbITvUWWeGXT/3 jVEI0NagmpnEE3ih+PWdkp+XFHeDA8NH4iIWVcl6vX+mJm32rtno5sLc/85mELHX357R DTmP3vcA7oefdWBMs+wvY5GlLQT4rYkN+uhfNHpYdHCY+BHtUoANkg3nr8woeWv9qO5y mb0Hh1VpXVSGcQGFXWQCCiBTR7bSTH/e1Hlit+161I81cEoR+a4XOoXuxmvfK9Sdw4Lz 6euvBYHHtoQgnsXGeyBnTPs3nDwSLwnIbpoWeFXsbltpr6acv0A1ZLzaUEX3/QZV1mrA 8Rng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="gh082DJ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b38-20020a631b66000000b0040d6a795447si22484849pgm.510.2022.06.29.20.15.22; Wed, 29 Jun 2022 20:15:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="gh082DJ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231124AbiF3DDd (ORCPT + 99 others); Wed, 29 Jun 2022 23:03:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbiF3DDc (ORCPT ); Wed, 29 Jun 2022 23:03:32 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A85B92FFC8 for ; Wed, 29 Jun 2022 20:03:31 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id g4so10270055pgc.1 for ; Wed, 29 Jun 2022 20:03:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=eFrmibnOmK8XtuM6Tf2P09vssNYtvI09arlKksnBKmE=; b=gh082DJ/aYAWrrxFP3fklYYjtIoW+j/NN4MkEMRnj4P4EZJNZUvCVpg+Zc2sAZiNln HkviLYrDCvJA2USF4UphbxO4twsOAgYkmU4Uq0063yklzyZZen9dI5QYtjT+2vqiZUuR 2kH0TwJGGzem1LZ8vtMUD5kT8RYrX6U6sEtBrgnv2jWWxm3nrPF2qoQ/YHgH5Rr69+A+ OnBuOt78XCgmfOi8JSbbvmwaz67r5STd9pRHYkxzBQtzBOxlJineMGCRRUfY0V7fjeXp 0GdMPB2QQRtSM14x8tiaq/JmtPC5F+hjcDaXDGAyxQR+mFladnfaQ2xKWQORA463rSl8 5xUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=eFrmibnOmK8XtuM6Tf2P09vssNYtvI09arlKksnBKmE=; b=UyHW79pAXEgPxKv7FVohFcLN+h6hn6EMo80tDz2rKnsf5AcSfjljLmSdyloqEkq19L sS75eQlJqFYYv7HQo2ODKmFdvINuBKZXIXsCKMJTbLaojmuijEAeRgig55wJzRTvD9gD Q96tgx+y3fVUaz5pVLY5CeOO4uocF2jXg/IasP6DbkE9rDGgA2qt8E9WmC4IHh96Dp+j qqN7zu0dgpxC+tSgjRT1+dQ9S/+/sgcrQJ65LWnZBo5U8uqlSBRx5U5sGi+lK72DPthv nZU5Q+TQM+wF/+gm5CagA4qXnfxpR7XCQkwpOTOLiLimn95T1Sk9ec4SDjMIOn8rwAWu xTrQ== X-Gm-Message-State: AJIora8W/KdYk4nxUsROnN19zVO10mEOPaiiQRezO5DNZi+Yn2q+sit7 VlUx2UpEKbGTTRbK4i2nKl4GEg== X-Received: by 2002:a05:6a00:168a:b0:4f7:e161:83cd with SMTP id k10-20020a056a00168a00b004f7e16183cdmr13470004pfc.56.1656558211129; Wed, 29 Jun 2022 20:03:31 -0700 (PDT) Received: from [192.168.123.227] ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id e13-20020aa7824d000000b0052527e3c5easm12224285pfn.87.2022.06.29.20.03.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Jun 2022 20:03:30 -0700 (PDT) Message-ID: Date: Thu, 30 Jun 2022 08:33:17 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: qemu-system-s390x hang in tcg Content-Language: en-US To: Sven Schnelle , =?UTF-8?Q?Alex_Benn=c3=a9e?= Cc: David Hildenbrand , Janosch Frank , Liam Howlett , Heiko Carstens , Claudio Imbrenda , Andrew Morton , Guenter Roeck , "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Yu Zhao , Juergen Gross , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Andreas Krebbel , Ilya Leoshkevich , Thomas Huth , qemu-devel@nongnu.org, qemu-s390x@nongnu.org References: <20220426150616.3937571-24-Liam.Howlett@oracle.com> <20220428201947.GA1912192@roeck-us.net> <20220429003841.cx7uenepca22qbdl@revolver> <20220428181621.636487e753422ad0faf09bd6@linux-foundation.org> <20220502001358.s2azy37zcc27vgdb@revolver> <20220501172412.50268e7b217d0963293e7314@linux-foundation.org> <20220502133050.kuy2kjkzv6msokeb@revolver> <20220503215520.qpaukvjq55o7qwu3@revolver> <60a3bc3f-5cd6-79ac-a7a8-4ecc3d7fd3db@linux.ibm.com> <15f5f8d6-dc92-d491-d455-dd6b22b34bc3@redhat.com> <87pmirj3aq.fsf@linaro.org> From: Richard Henderson In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/29/22 16:16, Sven Schnelle wrote: > Thanks, that was very helpful. I added debugging and it turned out > that the TB is left because of a pending irq. The code then calls > s390_cpu_exec_interrupt: > > bool s390_cpu_exec_interrupt(CPUState *cs, int interrupt_request) > { > if (interrupt_request & CPU_INTERRUPT_HARD) { > S390CPU *cpu = S390_CPU(cs); > CPUS390XState *env = &cpu->env; > > if (env->ex_value) { > /* Execution of the target insn is indivisible from > the parent EXECUTE insn. */ > return false; > } > if (s390_cpu_has_int(cpu)) { > s390_cpu_do_interrupt(cs); > return true; > } > if (env->psw.mask & PSW_MASK_WAIT) { > /* Woken up because of a floating interrupt but it has already > * been delivered. Go back to sleep. */ > cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HALT); > } > } > return false; > } > > Note the 'if (env->ex_value) { }' check. It looks like this function > just returns false in case tcg is executing an EX instruction. After > that the information that the TB should be exited because of an > interrupt is gone. So the TB's are never exited again, although the > interrupt wasn't handled. At least that's my assumption now, if i'm > wrong please tell me. Ah, yes, I see. We wanted to treat ex_value != 0 as if interrupts are disabled, because we have no way of stacking that value for re-execution after the interrupt (which itself could use EXECUTE). One solution might be to zap ex_value and arrange to re-execute the EXECUTE instruction after the interrupt. Another solution is to generate an exit from any TB translating ex_value, so that interrupts are re-examined. This is probably cleanest. I'll prepare a patch. r~