Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3496321yba; Tue, 16 Apr 2019 12:34:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyCyDmzKFU5u2EDBJyj79DkETUNnUnTLo3IJYSxd1EvwoUi+bvtz/Cw/K2yn+6VZZtgpTk X-Received: by 2002:aa7:8251:: with SMTP id e17mr67402757pfn.147.1555443275315; Tue, 16 Apr 2019 12:34:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555443275; cv=none; d=google.com; s=arc-20160816; b=m8CHAa+s+Y80P8WRjRaLvR3HY/tOAyLFMzcBo57j+OSZrnXgTz8A6xuZbTJQy1jKci qITM2pnOg2A6xlgaHE2nZxIaeVLZE2hRe7xIIrsZqG7NXJMYP8kAbcIlBykD6auwioDD QteEHZtvM6IjLpZHp4DrJkYhr8DRovE/GjxIC6TzRge9mnKnhgbqaauF/IlXyVQFbt1L 53E8+5rx0L8u3qfejn0GETlezHxtvu40h0vELpiFvKiEhY07U2avFYJdufApNBVcg3zC Z8RHJLAmDqSqRDk33TxRzZHQILb1Krv02VxhjqCU7WfatpU1/WkNe476ldPFsgcWyz3z NjlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=0ASbOHLSF52KJJ31MlDPvA+KUWSUFceU54AR9l+z7EI=; b=rS1rJ/jkKdrybq86wb4VKOq9r6yNvjfO2bFXH82941sgMdLWgk7VLxKSiu18OzOPe9 h3SF1ZcuNRHBgsIkXNZXzVVrpH4QhTaRTUrgRyvqoYDTR3rLvVdzgdfNEOi8+pdwzYVp kEG2O83BkEFn1vrB1+yj5trmB5zW1omlhrY/+hThU2dyaH10CdqX68EnJO3E92dPgHgT NQq1F7Ju+CGW1P045gegLoy4/JoLYWQ6mQFOlxyuxt6EwFbax3lpj66siupPfpuNQ233 S9Abx0tFt9y9tff+Nhil2FHX82nDIP3DDyALezeA5Sf4N2t+u7s5seLDyg8hX3laoiy9 TevQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V9rwbTH2; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v1si38362095pfv.192.2019.04.16.12.34.17; Tue, 16 Apr 2019 12:34:35 -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=@gmail.com header.s=20161025 header.b=V9rwbTH2; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729874AbfDPTd0 (ORCPT + 99 others); Tue, 16 Apr 2019 15:33:26 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:36685 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726860AbfDPTd0 (ORCPT ); Tue, 16 Apr 2019 15:33:26 -0400 Received: by mail-qt1-f193.google.com with SMTP id s15so24726570qtn.3 for ; Tue, 16 Apr 2019 12:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0ASbOHLSF52KJJ31MlDPvA+KUWSUFceU54AR9l+z7EI=; b=V9rwbTH2NSsyXr3F5FG5BEhFNlE8kCs0YsNd0W7bpBu4iOORCQX/OTfh04x+6Q8Qm/ jgsAJoyig7Z4z7Xy7X7ZDHBx93RFuVRLdNnThSeKWc2RW4Ctrzh/zKE0qpac5jgNJX6b fVTXGvauUQCIFkuBZGGL0K7eZG3ojmVxZEGXs1lPgPiJjfMFkzXerwUQL6MP7eO9aPpL 0lALvIaksH+jRGZozGPgwYDODweu1EmrbPrgPlY0IUB1Qm3AH0Y3mukSOSQNH4zqwVCi hMrPtHoZOnlj688svUB5MqSuRYxwuKB4+Wa+DE0/dVCtX4Pk9pVp1MmVkDs35jESgpIo 77tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=0ASbOHLSF52KJJ31MlDPvA+KUWSUFceU54AR9l+z7EI=; b=O4BbbZrv+PZeMgW5GSStk+0lxR+x72aZPMMHyIq4k3V3AERrfzdgolGcilC4AlD1wG FhSrocIF+wfDw7G02S4+X12P1UMi6VlFD0+Tqw+8eZvfE36rxT8StAO+71BOWsq0UnDk bEEmOTCdRO8ZPWbCBHZmiY31tlelBrVJZzJQaNidRCnupA2GjSJeDxUB8PrJ7mv8K0hq stXyEeWR5WAOTKd6ZVPhdvPfXSRHx2JX++NeGI0T7cfzr4341KJ/6Az5d+8fRgwlentG HbZzT3gQFaI8zkKanmavKFkwRP6z9bXpSPjCnGc2AS0Ehci3RbWvPInZdNDJB2m/qwzK gSWg== X-Gm-Message-State: APjAAAUzszfGD2iZ1nj2gaLTr3hnx6MW3AfY2QkYwryG+zWBXnJFq3Wv CpBzZzQG8jCX0Vk9djSMwgY= X-Received: by 2002:ac8:2d13:: with SMTP id n19mr64050144qta.31.1555443205267; Tue, 16 Apr 2019 12:33:25 -0700 (PDT) Received: from quaco.ghostprotocols.net (179-240-182-11.3g.claro.net.br. [179.240.182.11]) by smtp.gmail.com with ESMTPSA id y13sm29683279qkj.30.2019.04.16.12.33.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Apr 2019 12:33:24 -0700 (PDT) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id E8E104039C; Tue, 16 Apr 2019 16:33:20 -0300 (-03) Date: Tue, 16 Apr 2019 16:33:20 -0300 To: Jiri Olsa Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Andi Kleen , Adrian Hunter , Song Liu , Alexei Starovoitov , Daniel Borkmann Subject: Re: [PATCH 08/12] perf tools: Fix side band thread draining Message-ID: <20190416193320.GC9247@kernel.org> References: <20190416160127.30203-1-jolsa@kernel.org> <20190416160127.30203-9-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190416160127.30203-9-jolsa@kernel.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Apr 16, 2019 at 06:01:23PM +0200, Jiri Olsa escreveu: > 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. > > Fixes: 657ee5531903 ("perf evlist: Introduce side band thread") Thanks, applied to perf/urgent. - Arnaldo > Link: http://lkml.kernel.org/n/tip-41i888xyim9n5ceyr44jb468@git.kernel.org > Signed-off-by: Jiri Olsa > --- > 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 f2bbae38278d..4b6783ff5813 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; > } > -- > 2.17.2 -- - Arnaldo