From patchwork Fri Jun 9 17:00:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 103537 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp301710qgd; Fri, 9 Jun 2017 10:01:18 -0700 (PDT) X-Received: by 10.55.140.193 with SMTP id o184mr35317481qkd.127.1497027678208; Fri, 09 Jun 2017 10:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497027678; cv=none; d=google.com; s=arc-20160816; b=q+CJi4Ux+3yh2tiHkjHJ2Sg2qiAPhdLHPTSciDwAHQvBrL6rzxajp4tcCudoodIEf/ 2q4aUqyhLM190lIybyGd82I+tz2TRYJ3c3ZhkS1L7EVDlw3IhyqUZDUazExoQwevF/Dz cxVc/fpBqmazRMtx1rYB9Cbn7zTYv+mi1UNtpHAqh3D2WpL/HQittkUXW1TA89dT//Gq CtaJqMJfYSIaNvVGbATFoOzAVPb3kPS1YZ4kC/uZthLQthsuAMjJUjNXvNBl9MV1peAk B0H1HAx6AbSJbPuiHqqNq5svYVZ3kjzBHhJpONWvW5fToiAmk3wKkdALoYAioUGzftWl /U+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 :content-transfer-encoding:mime-version:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=FOI2F4Dxo/DvEFIFFxxGPwDjt5B8qhMjU9n41NRVBO0=; b=zg2rlpQL0FIo8lSFpRsFviK/atVrtb6Z1A80zEwiN3sjyZHPW5Rn26wBnTFzbVg+ys bnfXawenMTQpIszTQFtoG7GiWsOwHR9waZPwLIJvtxB7a04ViunI95D0SWCjtC4Kgkef 5JUVSLzpx+RZQ8gkuvm+397wyM5lHafc+C8HHp46SyjuGFhrnph2CnYXJNKlgyTn514w BA3z6Mhh5GhYkgLrNRFYHfQ+kUNhjl8VFrmlJL5fk2/+ZoLF7dBCyX+AayzkZbKDTr94 z4Pe75IvpV1vfgoNWLkLJDt64sPH64iKfKvateHP8nwHPHaSPz5UQU9Fdz8QFr4gepaP m2dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o4si1494220qkf.1.2017.06.09.10.01.17 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 09 Jun 2017 10:01:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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 ([::1]:55816 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJNHf-00058S-Mt for patch@linaro.org; Fri, 09 Jun 2017 13:01:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJNHD-00056y-Pe for qemu-devel@nongnu.org; Fri, 09 Jun 2017 13:00:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJNHA-0004i7-PA for qemu-devel@nongnu.org; Fri, 09 Jun 2017 13:00:47 -0400 Received: from mail-wr0-x231.google.com ([2a00:1450:400c:c0c::231]:33799) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dJNHA-0004hy-Ih for qemu-devel@nongnu.org; Fri, 09 Jun 2017 13:00:44 -0400 Received: by mail-wr0-x231.google.com with SMTP id g76so39239932wrd.1 for ; Fri, 09 Jun 2017 10:00: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=FOI2F4Dxo/DvEFIFFxxGPwDjt5B8qhMjU9n41NRVBO0=; b=fVU25KdrGszzMNX+f8mC83kpddwGiVyLLUIu23N0h/6Xe/va2ABpHkkmGcO5CbZZQ9 hhKumFGpWLRBQvxqjKJ8u/LuIep7xIOsmIM6r+BNCfgrs7uHyrv2bXEhaYkuDltT8gjB 0LEqqi2J1C+RZkVh46Us4EjnR8GrBKybnNR4U= 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=FOI2F4Dxo/DvEFIFFxxGPwDjt5B8qhMjU9n41NRVBO0=; b=nUsQivQVI9RJdpnK183mOCVoyfZawmCMBRFNeozxTkGhKS8+mBDqWlrpSL4w8LwCi2 MzmBOT0m1L4G9kTgpgFtolWhfnZJ/ZyEXyta/wOUwkp7b2v3dYbcFW0rqrUHzXFAC1zB hKYH/ifAHDqKm/iu4AvYkK0nddE9cSQrkkppthyk+HF4q7+YMPbL1jMfIiBZM8Va+P/z VRMxdNKAvjS4GWD1dcrTzCHJnubZEW+4hw8nPbgyyVkE3bSdzMraIPlQcjCm7tmW+HML 4BUzWbDs4cM7bAAc+uhz2J8Xu5u5iIib+l73E+ysGuBoF116xRiGiWu2Jus5r9zoPdcO GXng== X-Gm-Message-State: AKS2vOwit+eGMaFYtw/6+FVBcjaVfmFXuDIg5iJzVl9ZPLNLe42fY0o+ rrtO38gENZYv+nuV X-Received: by 10.28.88.70 with SMTP id m67mr506102wmb.47.1497027643221; Fri, 09 Jun 2017 10:00:43 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id k56sm1767661wrk.45.2017.06.09.10.00.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jun 2017 10:00:42 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 85E523E023D; Fri, 9 Jun 2017 18:01:11 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, pbonzini@redhat.com, edgar.iglesias@xilinx.com, cota@braap.org Date: Fri, 9 Jun 2017 18:00:57 +0100 Message-Id: <20170609170100.3599-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::231 Subject: [Qemu-devel] [RFC DEBUG PATCH 0/3] debug patch for lookup-ptr hang 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: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Hi, These are debug patches only but represent how much I have narrowed down the problem so far. I've included Thomas' patch to fix the thread=single|multi option as that is currently broken upstream. So far it seems though the problem is unrelated to multi-threading. As discussed in the other thread I found not returning to a tb_htable_lookup but adding it to the tb_jmp_cache made the problem go away. I also tried various printfs but they also seemed to un-wedge the hang I was seeing. It is not really a hang rather than a busy-spin that will eventually given enough time unwind. So added a new TB flag (is_magic) which if set would skip returning the code ptr and default to exiting the loop via the epilogue and set it for all DISAS_JUMP/DISAS_UPDATE paths that trigger lookup_and_goto_ptr. After selectively commenting them out I found the RET instruction is responsible for my particular fail case. I find this confusing because BL and BLR basically do the same thing and they seem to work fine. I have an uneasy feeling there is some subtle black magic in the interaction between cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags), addr and the TCGv cpu_pc but I haven't nailed it down. I'm posting this for those that still have some Friday left in case it prompts any thoughts. Over to you, hopefully inspiration will strike before I return to the fray on Monday ;-) Cheers, Alex Bennée (2): tcg-runtime: light re-factor of lookup_tb_ptr translate-a64: fix lookup_tb_ptr hang (DEBUG!) Thomas Huth (1): vl: Fix broken thread=xxx option of the --accel parameter include/exec/exec-all.h | 2 ++ target/arm/translate-a64.c | 21 +++++++++++++++++---- target/arm/translate.h | 2 ++ tcg-runtime.c | 37 +++++++++++++++++++++---------------- vl.c | 13 +++++-------- 5 files changed, 47 insertions(+), 28 deletions(-) -- 2.13.0