Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp7879ybl; Tue, 13 Aug 2019 14:48:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxcI3VsU8TW/1Y/ebjJxh07l6dWiXKjFak300/XFy0H/Ar48gkgVL2f+5Qwa/UUls0nhohF X-Received: by 2002:a63:2252:: with SMTP id t18mr36151311pgm.5.1565732917860; Tue, 13 Aug 2019 14:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565732917; cv=none; d=google.com; s=arc-20160816; b=wEgE4byRQT9ES/NXUErir0df6SMBvUt0ytxpuD1D2VutnVk9QZX15og+aLQIJLq+R7 8VWdOT5wQsTKLEPSYeLZXYElL5Dc4Me2AcdbPoCZdxp+vNY8njufOVlXssWZlh71+lV1 v9AfEHyl1nA1feK+JU+kM3AXne3Ya1MF92MgpRu/qGTARSnsorhDj0t5pQPhdfUwXbmX stIdaX8SswchDQkNsz7v+dikSBBgwRR3XJTFLWEKJNieSjdBrNdJEXVuKTathtF0IKFH sTg0oRZzyPspwbgDOgHQs31hNrkd/KUYdE5hxeBEXUnwxdr22Az8QoGbywT1QVxBd9Kx Ys6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=S9dA/GdI5tmEIRRtpA3TOEAi+50PTMGECKOeEqJEGQ8=; b=o+ArbNXZOvO2eQQ0cEw1zKjeI/ll2tdgp+DTukzAIYkIr/iCFkGOUt4FOE/m0OQCuB Obfz5tsH39ABUksm75i+SXXXhdq3olrdMfyB8D5gNoCcfbzCRDPPpDk5lDs4QsD3lPId Egl6eSjtrRm3Gx0kcJS6ruztxIP+mbTnzbBtPFUaiII3Ua3h942F2coB/5O+pGPyaWwn xNkVsAkKeklQAL91oDMwnblCqzc9v46nTEF4Js8oNFnZ1a+2Pu2yZHVI+Fqsbj+mEIAW w8agor+zWLAL0BARTzcfFRkOA1oQUZ5zV8VccPGYhY3mpWGyerSiRiAIuq6aU6tMIXRR Asaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rIrJa7O3; 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 u6si17183325pgp.194.2019.08.13.14.48.22; Tue, 13 Aug 2019 14:48:37 -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=rIrJa7O3; 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 S1727049AbfHMVrg (ORCPT + 99 others); Tue, 13 Aug 2019 17:47:36 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:46350 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726712AbfHMVrg (ORCPT ); Tue, 13 Aug 2019 17:47:36 -0400 Received: by mail-qt1-f196.google.com with SMTP id j15so14401549qtl.13 for ; Tue, 13 Aug 2019 14:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=S9dA/GdI5tmEIRRtpA3TOEAi+50PTMGECKOeEqJEGQ8=; b=rIrJa7O3sl+7svW2q/Lf7oNp+GNn7v+Rw6uSyvyF2VPOmPF+nRVFgjyFOmqqTs79tZ ka5t2oVJjFP8cIURcRCZix756S7tobGUniGigrIrBEx9sB/GPq0oSqWRj9mNTC+n2fOW Ixv2Crv+e0upytWnk3dBIMvNJN2HCRJ452f+B/g1sHOP3RwNfD6rTPYLl4fGfpjTYKvg lij4mT0PxBXSV2CWXVjPQ5g8uZSO4vsVXHNGUaB7/BQYECLh0hmxTJgMfjHCvaaSB0sI 7Fx9u8JIZSqILw91IWSw1kY2T3sp2+8a8wW1NwUXwy/vliEDC8CwzuKhzK34QX9zZcQe vfFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=S9dA/GdI5tmEIRRtpA3TOEAi+50PTMGECKOeEqJEGQ8=; b=ZFNcxH/Lbg8LwEdGxng0k/F5VzjiUm7wkY1aS8vpyNlYmQSOPEb7MbBTXT3tkQeVpL 5E2Wf6eLb+H4j57Hefi+QkVcPKU/4HIFn/tge0F8lty4n0GEwrIJiOVOpduI3bnijVAR fKtdd7uHb5ZGbovOKp/zfD2JSSA9BixMOlWB1A0zYMtrSRs2UNLmyXQUAwkgW3K8VTGy BHM+f0lBhri6GkgZVl0kR3jylGq6H7mCFpGv8b0eCHklLXqEDRNiIC+GgWU/QT2oUVlL zo5CN4WmtcN9cuEp2ggBbOGBlDSV2KvwZYo0Edfm71dJxATfjnfC7idMb20XUyJkt/Yt MhtQ== X-Gm-Message-State: APjAAAUdWUQgHdhWlwGIEVKmefYjtb+UgUcX5YdUr2ULQE++ex9CB9gt IeBOrZ2tSLekbSK0q2rIj3Tw9DYnsZJHUxJe/Ao= X-Received: by 2002:aed:38c2:: with SMTP id k60mr33330692qte.83.1565732855091; Tue, 13 Aug 2019 14:47:35 -0700 (PDT) MIME-Version: 1.0 References: <20190809214642.12078-1-dxu@dxuuu.xyz> <20190809214642.12078-2-dxu@dxuuu.xyz> In-Reply-To: <20190809214642.12078-2-dxu@dxuuu.xyz> From: Song Liu Date: Tue, 13 Aug 2019 14:47:24 -0700 Message-ID: Subject: Re: [PATCH v2 bpf-next 1/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl To: Daniel Xu Cc: Song Liu , Yonghong Song , Andrii Nakryiko , peterz@infraded.org, Ingo Molnar , Arnaldo Carvalho de Melo , Alexei Starovoitov , Alexander Shishkin , Jiri Olsa , Namhyung Kim , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 9, 2019 at 2:48 PM Daniel Xu wrote: > > It's useful to know [uk]probe's nmissed and nhit stats. For example with > tracing tools, it's important to know when events may have been lost. > debugfs currently exposes a control file to get this information, but > it is not compatible with probes registered with the perf API. > > While bpf programs may be able to manually count nhit, there is no way > to gather nmissed. In other words, it is currently not possible to > retrieve information about FD-based probes. > > This patch adds a new ioctl that lets users query nmissed (as well as > nhit for completeness). We currently only add support for [uk]probes > but leave the possibility open for other probes like tracepoint. > > Signed-off-by: Daniel Xu > --- [...] > +int perf_uprobe_event_query(struct perf_event *event, void __user *info) > +{ > + struct perf_event_query_probe __user *uquery = info; > + struct perf_event_query_probe query = {}; > + struct trace_event_call *call = event->tp_event; > + struct trace_uprobe *tu = (struct trace_uprobe *)call->data; > + u64 nmissed, nhit; > + > + if (!capable(CAP_SYS_ADMIN)) > + return -EPERM; > + if (copy_from_user(&query, uquery, sizeof(query))) > + return -EFAULT; > + > + nhit = tu->nhit; > + nmissed = 0; Blindly return 0 is a little weird. Maybe return 0xffffffffffffffff so that the user can tell this is not a valid 0. Or some other idea? Thanks, Song