From patchwork Wed Jun 14 14:02:06 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: 105521 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp309404qgd; Wed, 14 Jun 2017 07:04:10 -0700 (PDT) X-Received: by 10.31.162.199 with SMTP id l190mr168283vke.110.1497449049972; Wed, 14 Jun 2017 07:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497449049; cv=none; d=google.com; s=arc-20160816; b=c8oGbJnTYS6WcFY5Kqlwxqz2KoOo6v0HXYxtWIyczxk5AL0jhiUou36FixZ7y4Wrns N60Aet5kfW2BYVKU4/UbuRRf0SByItyTjfvEwDrFX7Wumwfz/zuMidIg/QpKmo/pj1pc 9L0bGroYQjNW+j7X829/ILsSWH1h2vFlqO3qw5slyWk1tp155j8j9QQ6R9FZLBoY6Spz MNgYnGrww4H5Z0mtL2KzvEdPBId1gCDJYpT2TaJGJwbrj5bZa/RDSQn1gV+72QOhl/6Q XHf+hiqRz11kY1Ra5r3TsoJmJCWU8Xe/udRrlHIiwTfjRPdEftywqpKZFW2aKz9Hamjq KX+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=8ugDRKGiEGlv9LnYbk0F8bHWZL9kWFaOLyLIXE1HlXM=; b=ij725pajFM2RX3U0VXwaRRIp+rKqUeNYe+lVwYGXQX/Nwa6z6P7VEO4VUa10DhP7DH rfLRZtxTWkkMBJyR26n/cyJHScZxBmZrgAttsJQGKXleSF9RG4fHoCgI/t42pz2KtjZW becEsboZ5Dq/3D27184eg9LCGR3RY8+yitAWG25arPudcJBwd5+/H78PQ3GaTlTep6Er 7f3q9r1Piy0tZYX+0YjcozgAF3JO8RPQzrZuxrPzOJd+7yiCs6AKxgUiG9vlme9QPlRR 5GPJ3tNzrzbZvCh+8Jzf2bUexdDZg4UMPo9MAMyiguxMrdwGGknD3w/rReRDaXjpK4TK 534A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=ftd0ZNmF; 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 v203si61426vkd.15.2017.06.14.07.04.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 14 Jun 2017 07:04:09 -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 header.b=ftd0ZNmF; 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]:49232 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dL8u0-0007qJ-RA for patch@linaro.org; Wed, 14 Jun 2017 10:04:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dL8re-0005rh-Er for qemu-devel@nongnu.org; Wed, 14 Jun 2017 10:01:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dL8rZ-0008FE-M6 for qemu-devel@nongnu.org; Wed, 14 Jun 2017 10:01:42 -0400 Received: from mail-wr0-x22c.google.com ([2a00:1450:400c:c0c::22c]:33799) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dL8rZ-0008Ek-EQ for qemu-devel@nongnu.org; Wed, 14 Jun 2017 10:01:37 -0400 Received: by mail-wr0-x22c.google.com with SMTP id 77so2069847wrb.1 for ; Wed, 14 Jun 2017 07:01:37 -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=8ugDRKGiEGlv9LnYbk0F8bHWZL9kWFaOLyLIXE1HlXM=; b=ftd0ZNmF/oJBkfKqdckrDlfSKT8Phmb6FzrmqGlIQ4IDyPxJSdH7omymByi1bnf6zG ZZXEeYYlnCu8g6BwqYXoLXppJ6o+o++SSAu4OIXAndhjxDqJFb7uQoWEJ0j6JyAmOzXA LJTQjem3hy7Bq+NX69d9+SAu5jo0XQqt4lr1w= 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=8ugDRKGiEGlv9LnYbk0F8bHWZL9kWFaOLyLIXE1HlXM=; b=dw/ZalRJAlEpQYD6kfqe6xW7pK95Fuh+ZIsmSAFawyFJZdcj53kN5Y8FtsQTUPS8gT PItVo8f7AbpjEY3DvRjLUv4i0ceoDGk3bhYzIjdHKlFqw370rLU/WRJw4m8BaTZpSW/8 0YvADqsaHTwuv++qpgZQ0pwJlicbyiK7KghVL7yPiaPLLaW94Ot+4qbR/bL6LJkOiNxK GpIEsbY76U5xrTVVgmRrlA0cjDZqGOX2BqkCdYExZs8PSM0bQtmSN/dX96cCvYcEJY8j zUQb1utKoiDHbajmrczMjD7UYFNCSaomGAOK8tWXeWd85E4d1+T4RzL5QfBsnxWc3ZQC hv0w== X-Gm-Message-State: AKS2vOxoDta8GkeOAIfk5P2XvUamQa4BWWNcPkE40tb5FwluhvYEoFBU raPFlOTT0D2giu2r X-Received: by 10.223.150.170 with SMTP id u39mr168798wrb.184.1497448895253; Wed, 14 Jun 2017 07:01:35 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o4sm148354wrb.27.2017.06.14.07.01.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 07:01:34 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 5C5823E014F; Wed, 14 Jun 2017 15:02:09 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, pbonzini@redhat.com, rth@twiddle.net, cota@braap.org Date: Wed, 14 Jun 2017 15:02:06 +0100 Message-Id: <20170614140209.29847-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::22c Subject: [Qemu-devel] [PATCH v1 0/3] Fixes for TCG hangs 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, This is an alternative approach to fixing the hang that Emilio zeroed in on with: https://lists.nongnu.org/archive/html/qemu-devel/2017-06/msg03224.html Instead of forcing the front-end to treat any MSRs differently we shortcut the lookup_tb_ptr by checking for icount_decr and cpu->interrupt_request conditions. Fundamentally the problem was that an interrupt was pending (interrupt_request was set) but the "msr daifclr" operations when the kernel did local_irq/fiq_enable() never got handled because the cpu_idle loop was being very efficiently chained. As a result we never got around to exiting the TCG code and calling arm_cpu_do_interrupt which would then raise the IRQ to move things on. Emilio's fix is also correct - we should exit the loop whenever the IRQ conditions may have changed. However by checking in the lookup_ptr function we avoid churn in figuring out all the other cases in the front ends. This may have a potential cost for code with lots of calculated jumps although I would argue its fairly minimal given we've already sucked up the cost of a helper function and I don't think the difference between the helper function and a full exit is that marginal. I've also included Thomas's thread fix as it has yet to be merged. I humbly submit my patches to the TCG gods to decide which is the best approach ;-) Alex Bennée (2): tcg-runtime: light re-factor of lookup_tb_ptr tcg-runtime: short-circuit lookup_tb_ptr on IRQs Thomas Huth (1): vl: Fix broken thread=xxx option of the --accel parameter tcg-runtime.c | 52 +++++++++++++++++++++++++++++++--------------------- vl.c | 13 +++++-------- 2 files changed, 36 insertions(+), 29 deletions(-) -- 2.13.0 Tested-by: Philippe Mathieu-Daudé