Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2100793yba; Fri, 19 Apr 2019 12:08:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLjiiDSAZnD+FGEmZ7LXPIicC9EBrfMtX/9uB8GJxwWwlEzkrfy8CLRVTJwbxMpzhL5QYs X-Received: by 2002:a63:6ac1:: with SMTP id f184mr5533460pgc.25.1555700890897; Fri, 19 Apr 2019 12:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555700890; cv=none; d=google.com; s=arc-20160816; b=NVZwlt1/sRydksNGaRHT8ZjSju76YREmfiCbJq6oMoZgJAPBfm/A5NB1OQWKU1cxw2 ENaLmOqhFsOKNsSapuVMJtBzQUA4pE1F7xYDbUq98mjcCwXDwmt+PgHyMKYtVlL2qMVM Nh3y6P0B8JAQm41pDXlFtMsZdpEUDKrPNWogiSt9Vg92MTwQmfgSA3ybCGaK9VUYRdfM c5Cbb5QAjl1WsgMUC55amVgia1NsfpZGgw0lBBCkxucHt4UZUDXwBkyIkqMFoy+mZI6u T72G0xtXIsNX/RHLsSSdo85HHxBpIkUhRcSjzKKkDHe5x3KoEUXjnhzjXyrmSBwKqp0K IMjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=9aMUz3v12otTjvjuVLZXNSBqxpeJu+jJcyYftk2YjPU=; b=rmhyN9KL2pyuLOr5jS4Cjb4g3PdnaXR5CvTU6VIVez6f8kEX9Dus1SS7SLX5v7ELgZ vIZ4SEhiBeV7iFWxTOZMFtuUpfI7a+O9HtwZlbTV3kwy8yTUddYdIYqQViwXKXq0N0fR ApGpYy7BAXOKM0w6d1nfM5jXI9MIPUBH0armMW/V11wRr/FIYHGxh9Px9ukfAn4AnUgq qEvR8IACbKDThHvcAiOE9bzhptf8vJ2eKOCexNC9CyPjMsCvDWQv69RjPL2LXK7JiGX7 jdG8OceAdafBiBI3jfiXEBbEkogTn0UtYUGCvvN3OdeMav95dVxzVs3QKwiTMF1Vnn8M 1Pbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019041745 header.b=vGeojem1; 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=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b74si6014704pfj.121.2019.04.19.12.07.55; Fri, 19 Apr 2019 12:08:10 -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=@zytor.com header.s=2019041745 header.b=vGeojem1; 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=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729028AbfDSTGA (ORCPT + 99 others); Fri, 19 Apr 2019 15:06:00 -0400 Received: from terminus.zytor.com ([198.137.202.136]:42949 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729097AbfDSTDt (ORCPT ); Fri, 19 Apr 2019 15:03:49 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x3JHJONv359277 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 19 Apr 2019 10:19:24 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x3JHJONv359277 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019041745; t=1555694365; bh=9aMUz3v12otTjvjuVLZXNSBqxpeJu+jJcyYftk2YjPU=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=vGeojem1GVQIvH0KdgnMNwf94aqiY0uJh1f3pn0N2z0QE9CDfqirSNBrwzROR9iRG jwjc/zWzdjygeuu7fT+VzDwjPifACzOEHDO93O6SnDZC6Xuj7ZA/zOjlbUuB4z1ThU qZvWYVWtxW/4/5s2TNgQeqcq6WSEJanlyzlTdz2mdKD7bdhFSgPtfTBIwSaS+fgx63 NR/EO0tDyAj/lmvb7Ln0MGVzRbe7+3HmyMJhFU3KIV/EyEFrROdZxmfzIMV4DARwS7 f8TiIiFUgxGPvAvna70ar1CTFmulfKYu947Vd8yOpO6Q7nhOijYdFBdBbQMC5T5Lp7 hNEX67AErsHPA== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x3JHJN3s359274; Fri, 19 Apr 2019 10:19:23 -0700 Date: Fri, 19 Apr 2019 10:19:23 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Jiri Olsa Message-ID: Cc: acme@redhat.com, namhyung@kernel.org, jolsa@kernel.org, daniel@iogearbox.net, ast@kernel.org, alexander.shishkin@linux.intel.com, peterz@infradead.org, songliubraving@fb.com, hpa@zytor.com, mingo@kernel.org, adrian.hunter@intel.com, tglx@linutronix.de, ak@linux.intel.com, linux-kernel@vger.kernel.org Reply-To: adrian.hunter@intel.com, mingo@kernel.org, ak@linux.intel.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, namhyung@kernel.org, acme@redhat.com, peterz@infradead.org, alexander.shishkin@linux.intel.com, ast@kernel.org, jolsa@kernel.org, daniel@iogearbox.net, hpa@zytor.com, songliubraving@fb.com In-Reply-To: <20190416160127.30203-9-jolsa@kernel.org> References: <20190416160127.30203-9-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf evlist: Fix side band thread draining Git-Commit-ID: adc6257c4a6f23ff97dca8314fcd33828e2d8db5 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=0.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_12_24,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, DKIM_VALID_EF autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: adc6257c4a6f23ff97dca8314fcd33828e2d8db5 Gitweb: https://git.kernel.org/tip/adc6257c4a6f23ff97dca8314fcd33828e2d8db5 Author: Jiri Olsa AuthorDate: Tue, 16 Apr 2019 18:01:23 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 17 Apr 2019 14:30:11 -0300 perf evlist: Fix side band thread draining Current perf_evlist__poll_thread() code could finish without draining the data. Adding the logic that makes sure we won't finish before the drain. Signed-off-by: Jiri Olsa Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Alexei Starovoitov Cc: Andi Kleen Cc: Daniel Borkmann Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Song Liu Fixes: 657ee5531903 ("perf evlist: Introduce side band thread") Link: http://lkml.kernel.org/r/20190416160127.30203-9-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evlist.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 6689378ee577..51ead577533f 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -1868,12 +1868,12 @@ static void *perf_evlist__poll_thread(void *arg) { struct perf_evlist *evlist = arg; bool draining = false; - int i; + int i, done = 0; + + while (!done) { + bool got_data = false; - while (draining || !(evlist->thread.done)) { - if (draining) - draining = false; - else if (evlist->thread.done) + if (evlist->thread.done) draining = true; if (!draining) @@ -1894,9 +1894,13 @@ static void *perf_evlist__poll_thread(void *arg) pr_warning("cannot locate proper evsel for the side band event\n"); perf_mmap__consume(map); + got_data = true; } perf_mmap__read_done(map); } + + if (draining && !got_data) + break; } return NULL; }