Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13474078ybl; Sun, 29 Dec 2019 12:46:37 -0800 (PST) X-Google-Smtp-Source: APXvYqz1kA6JYirszr/8GZJMiewY9lWA4GLkSovjWyTXt1WsHx3bCe6IiHr3xQz/kNciOU8kLirg X-Received: by 2002:a9d:4d86:: with SMTP id u6mr47817203otk.42.1577652397346; Sun, 29 Dec 2019 12:46:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652397; cv=none; d=google.com; s=arc-20160816; b=Aa7CFXSsflZs62z+CQIp3fqNl6IS8XIFsycxstJxuT4zEoWuf5eJKqpLV481BjTnHg Q7wJkNA01Pj5PcUaS0zvlh040wdogI42FrJyIpjcgxUBdlXbHN/Z7qcsn2O1NjJs7vX0 wSQXzJAIVkTNI1nKi2HQxrA7TW3/t8No0BKMUhdNdqajusXPQGnGb++y5SqlNBPGtsAA 65qzWpsb5RZEGjjzyUPTt9lHhKI/dPz/BHoOP4ixNkkkUOLUw2o2yMixD38iJcrGZ4CI OJ5FqA5V/TFa9nS6XZrUNL2Ly0/j9IsOvn8nU4MGQAmHEqF8HiSPiwTZij5BCigkVWWN 4TvQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SiNxYMdr22qa8DFw384BhuNj8mQASmAAE3copw1w9FQ=; b=yKpEndC34gSs7kDpMym5nAtyHZ8PBqdoOslbOc9fTQHuo9cjdiJZFdORC5X3AVfpyt GJ74ZAKcmdEyEZTzI60GLDTKtczeQtD8gAVNBzBcZ8RIYY2U2EzVDqjleJDpZbPvODaV ejK69HQbgPPJE1OuiqiTEcjDSPiz3F6r+yNjempYMASs+lGE6ozPlLy1JJ6AdyN73Yfw jz79EJefyHN0WY43nGKRWP88rZNaPX4T6XlibkGJXz+7cYtxoTDjH3Up2JVZC69khQQw twqeFZOl1VK1DQBNXsnI2Ak0Gx9AYpJt1PjvKVtjBHnvGoAFdB09zC3lo1k20PcQ3uDA /hRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qmenAAsz; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b17si19535068otl.320.2019.12.29.12.46.25; Sun, 29 Dec 2019 12:46:37 -0800 (PST) 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=qmenAAsz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731506AbfL2Rsq (ORCPT + 99 others); Sun, 29 Dec 2019 12:48:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:60210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729297AbfL2Rsn (ORCPT ); Sun, 29 Dec 2019 12:48:43 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 8C6B3207FD; Sun, 29 Dec 2019 17:48:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577641723; bh=r9HNGkrrcvcIgewxqzftcT+iHS7Y814AmtaQcyc85as=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qmenAAszLEMlAjlLR2W+LYlnBMoLwIu9eE0uwUa3vhvp6UUtMAik5r+9vjcMmzMjy WMpxRmgDoAZemHVy7LTyiV+gURbzAdj7BhJn7ZFNv9d7ulHTEhAjicLyPKsqRZhDDh fwoSm1vWTYN6xdUNEI9rlXYg73hvjf6IG3hSry/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Yan , Alexander Shishkin , Jiri Olsa , Mark Rutland , Namhyung Kim , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.4 147/434] perf test: Avoid infinite loop for task exit case Date: Sun, 29 Dec 2019 18:23:20 +0100 Message-Id: <20191229172711.515478736@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leo Yan [ Upstream commit 791ce9c48c79210d2ffcdbe69421e7783b32921f ] 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 Signed-off-by: Sasha Levin --- tools/perf/tests/task-exit.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index ca0a6ca43b13..d85c9f608564 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c @@ -53,6 +53,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); @@ -132,6 +133,13 @@ retry: 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; } -- 2.20.1