Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp520753ybk; Wed, 20 May 2020 05:40:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJWJ396EHDgE99J16Be/5z6NaetE34RpelcgOh8hcmwjf2U00LE2BMeWJBmm/RwmF9x6R3 X-Received: by 2002:a17:906:4009:: with SMTP id v9mr3361299ejj.63.1589978449632; Wed, 20 May 2020 05:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589978449; cv=none; d=google.com; s=arc-20160816; b=Ifgc/wFK9LT7OZ5q8pSUvFy9jk+YiovML11Vg6OdpxOTS+2ASCaGMFs6mknW7YMpKL jeALmVJ1GzfaFg4bHzioHcD0I0FS39DU1HQZrzatEViRm3mjgwklEP+gePZnnBIMzS3r hrzgCLCazPHtEyBx9w/fTA2/AAp94N+o5eiEbXfSqwlRVuV75gruCTGKoyp+7G7cCgFa CnoD4VIuREqpyu3SP9Saba3bWUb+0cg/cBHm+IP8RgoGZohfJUvijGYJWeaVzLNnNPHA eXUnB7oZY2N0CAnnmeznPNDnTNG94XCWb+3zBnndq+ZbtqmAB2Zy231mSMu24ZIKoyvN GtkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=2MlUtTBM258JSDDScGhdzvcXFtXQzEpZxJXvQGtScek=; b=UFJdSpWJ6xv4AqRn1ny40Su3Ab/Qxoi8AXSovvTZf9SwmgO3DhaE7WWMyfLra1QLwk D+J/1KeuYRlj9kWD5mhUNMYsa5onvu0RBd4kc69Izjh7KhX2DLloxD/dqZs8Iz0by8wS b0yx3csx8tmdVuuFSNYJ2cK/2xmQ8X9UDNTaK+gVjcTS5UkoSQwHMYXnJ5bl5Bx44olL UzeEZha4hVC9wrqeRRozHm2RJxHoH1ujB3AzL33G5f0Us48UOXkNMaP01j0Jd1v5b5SI KrhpY8M2wZWMd0YL0TIN/AjTq8EWNsWTcT7FJ4Lq5L2SaHtoixZ7QeYrkrSwvnjQswMS yaUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gi2Xic4m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q26si1606245edc.130.2020.05.20.05.40.27; Wed, 20 May 2020 05:40:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gi2Xic4m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727037AbgETMin (ORCPT + 99 others); Wed, 20 May 2020 08:38:43 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:48740 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726224AbgETMim (ORCPT ); Wed, 20 May 2020 08:38:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589978321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2MlUtTBM258JSDDScGhdzvcXFtXQzEpZxJXvQGtScek=; b=gi2Xic4mAnjdzlQS/I4KPxcE4EXcatPFloV4t/YTzqAFIXrMxdfnsR0wylIA4L3SSrLUQA mmP4Y663vx4OYry8TBvcI7uHGKWjrmn5sLcPcpsAE2wApFVRj/r2x586jMINml7bXdZH7c t/JAVB4guafdJLC2tM5Fy2RUsChfACk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-329-UzLicTX9PmODLDdEQI7HYg-1; Wed, 20 May 2020 08:38:37 -0400 X-MC-Unique: UzLicTX9PmODLDdEQI7HYg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1EA9C8064D9; Wed, 20 May 2020 12:38:36 +0000 (UTC) Received: from krava (unknown [10.40.193.10]) by smtp.corp.redhat.com (Postfix) with SMTP id 5454560C84; Wed, 20 May 2020 12:38:34 +0000 (UTC) Date: Wed, 20 May 2020 14:38:33 +0200 From: Jiri Olsa To: Alexey Budankov Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel Subject: Re: [PATCH v3 8/9] perf record: implement control commands handling Message-ID: <20200520123833.GG157452@krava> References: <25f98682-5ef2-4257-f302-93b29da707a9@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <25f98682-5ef2-4257-f302-93b29da707a9@linux.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 13, 2020 at 11:04:25AM +0300, Alexey Budankov wrote: > > Implement handling of 'enable' and 'disable' control commands > coming from control file descriptor. > > Signed-off-by: Alexey Budankov > --- > tools/perf/builtin-record.c | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c > index 50dc2fe626e5..72f388623364 100644 > --- a/tools/perf/builtin-record.c > +++ b/tools/perf/builtin-record.c > @@ -1505,6 +1505,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) > bool disabled = false, draining = false; > int fd; > float ratio = 0; > + enum evlist_ctl_cmd cmd = EVLIST_CTL_CMD_UNSUPPORTED; > > atexit(record__sig_exit); > signal(SIGCHLD, sig_handler); > @@ -1802,8 +1803,23 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) > * Propagate error, only if there's any. Ignore positive > * number of returned events and interrupt error. > */ > - if (err > 0 || (err < 0 && errno == EINTR)) > + if (err > 0 || (err < 0 && errno == EINTR)) { > err = 0; > + if (evlist__ctlfd_process(rec->evlist, &cmd) > 0) { > + switch (cmd) { > + case EVLIST_CTL_CMD_ENABLE: > + pr_info(EVLIST_ENABLED_MSG); > + break; > + case EVLIST_CTL_CMD_DISABLE: > + pr_info(EVLIST_DISABLED_MSG); > + break; > + case EVLIST_CTL_CMD_ACK: > + case EVLIST_CTL_CMD_UNSUPPORTED: > + default: > + break; > + } > + } > + } so this will be processed only when: if (hits == rec->samples) { what if there's always somethign in the buffer? will this stall? > waking++; > > if (evlist__filter_pollfd(rec->evlist, POLLERR | POLLHUP) == 0) evlist__filter_pollfd will trigger draining if all the maps are closed, but there's one more fd in pollfd now, will this prevent draining? I wonder this would fit better to the sideband thread (util/sideband_evlist.c) so we don't disturb the main thread with another check jirka > -- > 2.24.1 > >