From patchwork Mon Oct 21 13:37:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 177081 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3434369ill; Mon, 21 Oct 2019 06:39:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/82ANSqiDJ6g9r3ynZMBI7N72fP4bPhfjU8ssTXmcOlE0XO/VSuJPe+9HUG7tb+DNs+Xq X-Received: by 2002:aa7:cfcd:: with SMTP id r13mr25503068edy.146.1571665142045; Mon, 21 Oct 2019 06:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571665142; cv=none; d=google.com; s=arc-20160816; b=RVqhM+gPJOf+VkYjQifeF5v/LuekGdGxiABatwpWs33MTee0xicFkS2I6tXcoeOiqY 2ziK24fW3se5UiOlLhSt3NJu8MAimH5cOMAibcEYPpQQi3/5Xt5rYl7E9Spto0fxeoRS qKVrYW7JGNKeiqAIUefWuDROn3RXUlrzR2ipYXAy5wZ3sDBhRhLUOXLoDc6h1nQHmX29 AQ3i9VNvUBjdxbWrg/Gsfomwyb30mH05CJz03xq1TUn0p4y0U3yJ0ZsFqCnPgNUYYv4K LcTFJpWHKx6VcmBuFwgcua52sK59jlTl7lgmh8aUfQtRF1yMCEokKMS0urzpNOkqsfFn oivQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qr/bvplJ30C7wNumFuWQe06HetcMf2BinGY14xwqtTM=; b=AZ9s7kbQcY30P3/sybLwVuV5kuemIwvf+FsTKLKwJeZKPuo7lRYNDC40qMzNtyMBgH BDR6zG3Az21zNF0011K/2/BlEe/TidnwZCy1T62qf9kACijmkcYjIrBhtgyB4I5v8T7t SNDISrCCAreBBNs5prQA3b60H+BoDkmHPCv44iwF5C04n+rAUIk11lk6U1YwAe15mskr wkm8JZCnydOY0TzfPWoQxN43wKN4bQdkHDoO4CfDEgNMtbSN/iPdAzo0uBELm70yE7Qr o9KN9eFEeMTAVmSMiSPvoOlalWZLQkfWsGO5gYsDW1rXpR2GqvB6R8EG1u7kPjZ8Vgj8 cO9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M3L5YYbl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u8si8708337ejt.219.2019.10.21.06.39.01; Mon, 21 Oct 2019 06:39:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M3L5YYbl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729124AbfJUNi7 (ORCPT + 26 others); Mon, 21 Oct 2019 09:38:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:40400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728872AbfJUNi6 (ORCPT ); Mon, 21 Oct 2019 09:38:58 -0400 Received: from quaco.ghostprotocols.net (unknown [179.97.35.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2D73A21928; Mon, 21 Oct 2019 13:38:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571665137; bh=0ZXePMfFtOMKmPrnY+D4JgmIn+h6ZV2J/BeW8xctlsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M3L5YYblANRmu3AVttvHd9DpJbb2DmUjoYqMWlIvL1dJogsdbjMtk64qbgErFuHRT QtoJ7xTCbIRI+h4RBY4te34qJkfEu+hA+rzlFJCw1CBQ85/4fgnUSCo3hNGNbhrNHN VSpwc1Y4oMKTFsVaxNf8Rx1vh5pItajVU8T0Tsy8= From: Arnaldo Carvalho de Melo To: Ingo Molnar , Thomas Gleixner Cc: Jiri Olsa , Namhyung Kim , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Leo Yan , Alexander Shishkin , Jiri Olsa , Mark Rutland , Arnaldo Carvalho de Melo Subject: [PATCH 05/57] perf test: Avoid infinite loop for task exit case Date: Mon, 21 Oct 2019 10:37:42 -0300 Message-Id: <20191021133834.25998-6-acme@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191021133834.25998-1-acme@kernel.org> References: <20191021133834.25998-1-acme@kernel.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leo Yan When executing the task exit testing case, perf gets stuck in an endless loop this case and doesn't return back on Arm64 Juno board. After digging into this issue, since Juno board has Arm's big.LITTLE CPUs, thus the PMUs are not compatible between the big CPUs and little CPUs. This leads to a PMU event that cannot be enabled properly when the traced task is migrated from one variant's CPU to another variant. Finally, the test case runs into infinite loop for cannot read out any event data after return from polling. Eventually, we need to work out formal solution to allow PMU events can be freely migrated from one CPU variant to another, but this is a difficult task and a different topic. This patch tries to fix the Perf test case to avoid infinite loop, when the testing detects 1000 times retrying for reading empty events, it will directly bail out and return failure. This allows the Perf tool can continue its other test cases. Signed-off-by: Leo Yan Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Link: http://lore.kernel.org/lkml/20191011091942.29841-2-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/task-exit.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.21.0 diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index 19fa7cb429fd..adaff9044331 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c @@ -54,6 +54,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused struct perf_cpu_map *cpus; struct perf_thread_map *threads; struct mmap *md; + int retry_count = 0; signal(SIGCHLD, sig_handler); @@ -133,6 +134,13 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused out_init: if (!exited || !nr_exit) { evlist__poll(evlist, -1); + + if (retry_count++ > 1000) { + pr_debug("Failed after retrying 1000 times\n"); + err = -1; + goto out_free_maps; + } + goto retry; }