Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp718372lqb; Fri, 24 May 2024 10:58:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUq8ZMse6sHtolnuAdBdTVwZax2WmBB34BeOpaLZEbrE7s4ZVF76cFxP9S30oR6zoYx0BaImB1jEdLhTC5TISPKEnEoYDplMNy7ZbR7Lg== X-Google-Smtp-Source: AGHT+IEG1HIffidFFCXB6VReuh5UNyL/Lnm6Hf1YKpOVOI92+R+aqC9DUvQH63HYv2FFasxNHWYb X-Received: by 2002:a50:d555:0:b0:578:676e:324 with SMTP id 4fb4d7f45d1cf-578676e0855mr54904a12.17.1716573497982; Fri, 24 May 2024 10:58:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716573497; cv=pass; d=google.com; s=arc-20160816; b=ZQA+/0FkFqr6K3Vcc52zH34kUinqHTZFEzme2vOVEwNXoVjHVAtsldiYdAhTcYWwtA ulkRVIhvQj1L3wDgqCxwqh3o0a6dymmmMDb1Ekcu3ZdPGlUExQnmyQ57hOz/l6j3u2m2 KPbKxdzbI7dqgDUpnm+wbK0fBFKr7+yygE7XnVOuLq7h4ojmY7xQvs0FCTO/opLd+f8X GCM7ji+gWcInV6dpJ8V8cKa4DwWoRfjQh2zZ6ZmYWXiHMox+eevY45KPN70nADLhB4EK JxKZiDab/3ZgtmbHkDVCsMcYx1a2u+BcpcOXrVQBGfsVDhjuyYysTxlcjhy5V8T/UfSn fcZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1TxvAumauNIvIj/6YVVKAAXWO2kwp0K5jAs9CcYlbsE=; fh=BExUT45XMFIXHFhuCoeSVrYUMNjM5OSbRCqBNooWV2Q=; b=YwpuFYjK3hBZbMw/bDuEjRR7njUcjA8pEZqzTRBXpI4BzEOHZowuUcIgK/3DZ18XtE mcCuBiRSIhye6K/fG5sLtli8keg4XhuyQRBZU6/cujQ9NX5liBjcYZAG+Nm7yx4P1CNV acef1XdWYIrgW9V+QhMkHG357C/QCVA5Hkf/reIgNjEkQYcEUR8plNJ38B6TN+MpKq5R xy50KKMa92LHeVeWWMeP+/U9HK1PBpWVA/Rjsatw6m1pZ+PIlrRHV9nMu7NXt5ymESmu tAEGATr3Ty1m0TJk+oqmB2dmlbVT0q7lOtt0UXiZeUNWWE9Ou8CA7kJFgCMdZCorWUEe ueEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ie3ViNa4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-188986-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5785245fed2si1062702a12.216.2024.05.24.10.58.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 10:58:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188986-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ie3ViNa4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-188986-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B306E1F214C8 for ; Fri, 24 May 2024 17:58:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B6D183B1A3; Fri, 24 May 2024 17:58:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ie3ViNa4" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9680374DD; Fri, 24 May 2024 17:58:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716573487; cv=none; b=I/a1IvEphUrqNg2TASjgIClKmsn9FtJw7jzqvsoUJaQ1RI59y1E9hGxH8HA3gfcF8RrVfuKmfwrAV+fHV/6pMFkrEkYdmkpDYUpydmWBUcfdoAvmHjo8K+I6aW0+XjxQKYkhif7GvOHGhvP+B5m3+OIrcbRUOexapMlBI34m3qQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716573487; c=relaxed/simple; bh=HCXERw4pdnyMzF91TcKDft8+ZQRzC4QNfKVaaHOPAWc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aJUpNNyeEaMvyCNoAYBD7hrasWJWIaZCYQZgCuliEupXB69QhnpvFO7r23EZZCWYDDc8cbrMRhHxm0n3bA1LqBD1H7r7bwJJMCea5Lgqb+9D86jmuQkK+/Ou0R0JfBK2nG0kKpVtHWAeBdk1EVqDRGcHQdG4z9WYJFK1P3YP7c0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ie3ViNa4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB0E0C2BBFC; Fri, 24 May 2024 17:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716573486; bh=HCXERw4pdnyMzF91TcKDft8+ZQRzC4QNfKVaaHOPAWc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ie3ViNa4P79QdvdC7wgE9jttccQ+QDyCHJPuf0AGgFHTLp+nnTlLqOeTHIy+hCtlE qOGr7wpsb9iQ82vNRTgSUaXO+H9jLosH4i96Yyj1CQzWVhltjrPw2SZ1FngzATJZjE sY6/EzZduSt/vCG2wcPsD3TnV6BTGIeCGbCnav8Vr22wgi5aos+g3dfPsn1TfxR+w8 x0hfruxD27vQY2XutYwyUHDfEWAinkX0323lgz8/Y8m4p55fgQ/AcznYsxHwDXBCmv UVbP2qoqHXauLGsAP21fP+skBky5EmTEkFCJ3oQF9ES0ewzq1Edlfmt/BSpJaDMiF4 C/WhQBUeZVqig== Date: Fri, 24 May 2024 10:58:04 -0700 From: Namhyung Kim To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Kan Liang , Changbin Du , John Fastabend , Andrii Nakryiko , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH v2 0/3] Use BPF filters for a "perf top -u" workaround Message-ID: References: <20240521010439.321264-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, May 22, 2024 at 09:38:57PM -0700, Namhyung Kim wrote: > On Mon, May 20, 2024 at 6:04 PM Ian Rogers wrote: > > > > Allow uid and gid to be terms in BPF filters by first breaking the > > connection between filter terms and PERF_SAMPLE_xx values. Calculate > > the uid and gid using the bpf_get_current_uid_gid helper, rather than > > from a value in the sample. Allow filters to be passed to perf top, this allows: > > > > $ perf top -e cycles:P --filter "uid == $(id -u)" > > > > to work as a "perf top -u" workaround, as "perf top -u" usually fails > > due to processes/threads terminating between the /proc scan and the > > perf_event_open. > > > > v2. Allow PERF_SAMPLE_xx to be computed from the PBF_TERM_xx value > > using a shift as requested by Namhyung. > > > > Ian Rogers (3): > > perf bpf filter: Give terms their own enum > > perf bpf filter: Add uid and gid terms > > perf top: Allow filters on events Hmm.. I'm seeing this. $ make build-test ... cd . && make GEN_VMLINUX_H=1 FEATURES_DUMP=/home/namhyung/project/linux/tools/perf/BUILD_TEST_FEATURE_DUMP -j64 O=/tmp/tmp.EeXFOfLPt5 DESTDIR=/tmp/tmp.Y0eiZKvc9D ... CLANG /tmp/tmp.EeXFOfLPt5/util/bpf_skel/.tmp/sample_filter.bpf.o In file included from util/bpf_skel/sample_filter.bpf.c:8: In file included from util/bpf_skel/sample-filter.h:4: /home/namhyung/project/linux/tools/include/uapi/linux/perf_event.h:29:6: error: redefinition of 'perf_type_id' enum perf_type_id { ^ /tmp/tmp.EeXFOfLPt5/util/bpf_skel/.tmp/../vmlinux.h:54086:6: note: previous definition is here enum perf_type_id { ^ In file included from util/bpf_skel/sample_filter.bpf.c:8: In file included from util/bpf_skel/sample-filter.h:4: /home/namhyung/project/linux/tools/include/uapi/linux/perf_event.h:30:2: error: redefinition of enumerator 'PERF_TYPE_HARDWARE' PERF_TYPE_HARDWARE = 0, ^ /tmp/tmp.EeXFOfLPt5/util/bpf_skel/.tmp/../vmlinux.h:54087:2: note: previous definition is here PERF_TYPE_HARDWARE = 0, ^ ... make[3]: *** [Makefile.perf:264: sub-make] Error 2 make[2]: *** [Makefile:70: all] Error 2 make[1]: *** [tests/make:340: make_gen_vmlinux_h_O] Error 1 make: *** [Makefile:103: build-test] Error 2 Thanks, Namhyung