Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1786074ybb; Thu, 2 Apr 2020 07:21:44 -0700 (PDT) X-Google-Smtp-Source: APiQypIN6/olPaJJ55F9ZUJwmlOPDeSxMp1HFSUZA6cY1G9jrvhq5FqKEWelGsiggs478WRilOld X-Received: by 2002:aca:3b82:: with SMTP id i124mr2403075oia.61.1585837304731; Thu, 02 Apr 2020 07:21:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585837304; cv=none; d=google.com; s=arc-20160816; b=I2ZPC57OsYXe0dKYlKvJ2ZNSKOaj+d//wYO8g5lhgMW+vqISzxKlTNj7pRTca2Gvo7 pYYAWo6UnBjjGpbThbkFzi1U9BYLPYzb5zL2Sv6EI3AyZYxOPNkJVR7c0r1E/8+XBVOd ndeVrZ887p1YKanMvp9xxAyjpJN61fGl7jTTWH71e939CsP88GK26XkqNUtt2uAqGzN4 G2UkdvgjMqvU9KD7qYS25M8xW+5+JZU9qzIlna4t2ZVSMC7VuTpyx+SpFwqjldtgS1yI eUtFOoGXqGD2A59I97TTZub9i5l3LNUD9iNMgX/KcRLqJBpIMLr5vFQTFK0nPcfit4O1 NENQ== 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=CuGP7aJnDFhdZgpYgnvv0xosaA7xrwclM14mlI59qEU=; b=kYN0ZrRHx2boXFZdGVJkvMo2Kg/msPdYoYRpgC/bHNO7chE+0e/1Bdbg/wMlMx2s76 omkyayYWaWALGi0MjD1lJcJDo7t1rBCcAeElgWjEA51BPtRmfW9eJQ/Ym0wtHejcLl1D fRhfaXDLEIs9kZtYKVsge3DVvlb3Kq7jlbnB1SGFYbU0nvIaemYmGithzG4bsVmBq5tS Zn/G2hoT+O1+CpFqG8WiSAQQbPgn8Op7EIxKpJ7mQHwimzZZq2HWZIsncHvt1B2bfq7u Xeo5QXRZJQTHs6R0+/8ls3Ep++YrLaY3t2dFdlH3fpqqzLXBl+kxnzkTIXAB+pi6UiqO zNPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SIS2UUZv; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e20si2389849oti.137.2020.04.02.07.21.30; Thu, 02 Apr 2020 07:21:44 -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=@redhat.com header.s=mimecast20190719 header.b=SIS2UUZv; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732679AbgDBORs (ORCPT + 99 others); Thu, 2 Apr 2020 10:17:48 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:49430 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729213AbgDBORs (ORCPT ); Thu, 2 Apr 2020 10:17:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585837067; 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=CuGP7aJnDFhdZgpYgnvv0xosaA7xrwclM14mlI59qEU=; b=SIS2UUZvZbgf0Pa3jGgsVQYYXR+xx9f8vSAp/seBxHdzeIXscIXMU7/fGIwWqIEoagdNJG PYLN1kN1I7gJZ1iGmo1PixK3d1+KkUL4TVkSxoCtBAkWyfm4Y+aDuZAKMHPO1sZnTkIV1u /22IERFz71sucuDn0zK/Axp7XigA32U= 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-374-aZ0J-bxwOPu7RQ4y9aTC0Q-1; Thu, 02 Apr 2020 10:17:44 -0400 X-MC-Unique: aZ0J-bxwOPu7RQ4y9aTC0Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 185501922966; Thu, 2 Apr 2020 14:17:34 +0000 (UTC) Received: from krava (unknown [10.40.194.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 47F6CA63A6; Thu, 2 Apr 2020 14:17:32 +0000 (UTC) Date: Thu, 2 Apr 2020 16:17:29 +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 v1 2/8] perf evlist: implement control command handling functions Message-ID: <20200402141729.GN2518490@krava> References: <825a5132-b58d-c0b6-b050-5a6040386ec7@linux.intel.com> <1760b862-7a4a-3930-1a53-04667c71cf6f@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1760b862-7a4a-3930-1a53-04667c71cf6f@linux.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 27, 2020 at 11:46:43AM +0300, Alexey Budankov wrote: SNIP > + > +int perf_evlist__ctlfd_process(struct evlist *evlist, enum evlist_ctl_cmd *cmd) > +{ > + int err = 0; > + int ctlfd_pos = evlist->ctl_fd_pos; > + struct pollfd *entries = evlist->core.pollfd.entries; > + > + if (!entries[ctlfd_pos].revents) > + return 0; > + > + if (entries[ctlfd_pos].revents & POLLIN) { > + err = perf_evlist__ctlfd_recv(evlist, cmd); > + if (err > 0) { > + switch (*cmd) { > + case CTL_CMD_RESUME: > + evlist__enable(evlist); > + break; > + case CTL_CMD_PAUSE: > + evlist__disable(evlist); > + break; would CTL_CMD_ENABLE, CTL_CMD_DISABLE be better fit in here? especialy because we have the 'pause' ioctl for sampling, which I was thinking initialy you are using for record, and it's still might be better fit for sampling than disable, no? jirka > + case CTL_CMD_ACK: > + case CTL_CMD_UNSUPPORTED: > + default: > + pr_debug("ctlfd: unsupported %d\n", *cmd); > + break; > + } > + if (!(*cmd == CTL_CMD_ACK || *cmd == CTL_CMD_UNSUPPORTED)) > + perf_evlist__ctlfd_ack(evlist); > + } > + } > + SNIP