From patchwork Sun Dec 29 17:23:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 182559 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp5461897ild; Sun, 29 Dec 2019 09:48:45 -0800 (PST) X-Google-Smtp-Source: APXvYqz4PavXtnxoeg50DbSDXQxXFD4e2LfmOBmEqPpBODjCp6a1mNfphee6tJVqtLUW4NDpP1cC X-Received: by 2002:a9d:3676:: with SMTP id w109mr51423407otb.35.1577641725655; Sun, 29 Dec 2019 09:48:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577641725; cv=none; d=google.com; s=arc-20160816; b=QlwKhBB47dFbQq0V2tlQh2gdG3VsSjF86LWTNFDD9MhKjbiS7NdGvI1HW9lYlL3hCJ FYQjp3bCyIe0NH1X6A9KLjbUR1yZYrPRtsNg/+HaBX/cZZRezMo30urvdA7UGP8U5hFI SM3bGUXl6YjaSrrv5iC4bVcSTg49/ArRHLDI3GsiDOlP3Ozj6DpL25sebCBVfP3cC85T HR05ocswOQY07MVxVsSLwNdqAXt5o3p8Qc4wa8/piSQWYHgCPb1S+Gznh0THW4iRW1k9 kzHAO6eNOjM4V1PFClu62OEuGQ29OAU2C7lspsFYdotd6T6k7JBe9RweKGLErgyAStyq RKfQ== 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=YPo6NMIf8P7ucrWFUChGuokDhceNpTKAHWsl8w/H5t+02suKeUWzH62hGY8SAH35aL RutygSSeQCFsO54X25UBqrS+qc7R7Zw9pZ70WseZuG4RCFFPQMVzoptJ+8DSTbHfi3M6 8bj9RK9kFeAqzr0nUY2jZJ8QSEK6riPmV1PL8bBeTKyg6UROs/+ahwlw+CtyXioTtzX4 Jmd4Q9nkfewKrL7QxkBcAIJqAnoA45GR8WpkBr8rQe4tAMupsHNpVUUJMmYziPDSf4/z cn+GOPU9vvkpfrjjyLgTtZ0w13QWoNSoH0J0CJKVcBwB2CRr8xxEYRs0b0ATho5YS9+9 PGSQ== 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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 n137si20289953oig.127.2019.12.29.09.48.45; Sun, 29 Dec 2019 09:48:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730832AbfL2Rso (ORCPT + 14 others); Sun, 29 Dec 2019 12:48:44 -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 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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(+) -- 2.20.1 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; }