Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFB91C64EC7 for ; Wed, 22 Feb 2023 19:48:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232574AbjBVTs6 (ORCPT ); Wed, 22 Feb 2023 14:48:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231897AbjBVTs4 (ORCPT ); Wed, 22 Feb 2023 14:48:56 -0500 Received: from mail-vs1-f52.google.com (mail-vs1-f52.google.com [209.85.217.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A2AB27D7F; Wed, 22 Feb 2023 11:48:55 -0800 (PST) Received: by mail-vs1-f52.google.com with SMTP id v3so10764566vse.0; Wed, 22 Feb 2023 11:48:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XM/lQi5N/iiNMtRIy5H0b7ls2dpYLYTqiw3Gl5EGGP8=; b=3DLr0kLc5pVMx2L5ETn0W75sSNp5V8ejVqbJb1VTNUNbMyu7ohRz8fk2g1lOGVjmyO SQrJ2Ni6W0sNcBdofx1hW4APGtVeBoICQVm2Nc+9IW5AGPXpthQ3up+DKia9GU4cav6c FcqvgpC2tsD9HIMB3w7OV5OLVgm/5OtHqREVZq6oHDxSzBk20MSCC1fgsoTht2fSC+NK Ex7eT9pVXZ26+WFNL9geVozn26yDnkjvzscLZvDK3uvS5YziSv+4KpcVYE7XqEP0wjpt Uxj22+ox3sbigPJb/2HwS/DtTx6vvRI1UjWgCS0gd7COvzN60ojjyHEK6VfVngwTzeuR 4C1g== X-Gm-Message-State: AO0yUKUr/PbRGV2SA8BOPMlt6yGU1kzvCVsqKYouWxWGlLrx1BAgQY4d QcCum6sorjLauFmgR+2iHo3yGLCY5XxsJgfjm64= X-Google-Smtp-Source: AK7set/JOuNdH1Xqx90bNX1Aqnfcv1+F2m1Exkm49i1plXuAeh7llPRwlEUfRRIxFP8Elkp8A+malkHf1PZvkQv5kB0= X-Received: by 2002:ab0:54da:0:b0:687:afc8:ffb9 with SMTP id q26-20020ab054da000000b00687afc8ffb9mr1587192uaa.2.1677095334627; Wed, 22 Feb 2023 11:48:54 -0800 (PST) MIME-Version: 1.0 References: <20230219061329.1001079-1-namhyung@kernel.org> <20230219061329.1001079-3-namhyung@kernel.org> In-Reply-To: From: Namhyung Kim Date: Wed, 22 Feb 2023 11:48:43 -0800 Message-ID: Subject: Re: [PATCH 2/8] perf bpf filter: Implement event sample filtering To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Peter Zijlstra , Ingo Molnar , Ian Rogers , Adrian Hunter , Andi Kleen , Kan Liang , Song Liu , Stephane Eranian , Ravi Bangoria , Leo Yan , James Clark , Hao Luo , LKML , linux-perf-users@vger.kernel.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 19, 2023 at 8:48 AM Namhyung Kim wrote: > > On Sun, Feb 19, 2023 at 3:14 AM Arnaldo Carvalho de Melo > wrote: > > > > Em Sat, Feb 18, 2023 at 10:13:23PM -0800, Namhyung Kim escreveu: > > > The BPF program will be attached to a perf_event and be triggered when > > > it overflows. It'd iterate the filters map and compare the sample > > > value according to the expression. If any of them fails, the sample > > > would be dropped. > > > > > > Also it needs to have the corresponding sample data for the expression > > > so it compares data->sample_flags with the given value. To access the > > > sample data, it uses the bpf_cast_to_kern_ctx() kfunc which was added > > > in v6.2 kernel. > > > > CLANG /tmp/build/perf/util/bpf_skel/.tmp/sample_filter.bpf.o > > util/bpf_skel/sample_filter.bpf.c:26:19: error: no member named 'sample_flags' in 'struct perf_sample_data' > > if ((kctx->data->sample_flags & entry->flags) == 0) > > ~~~~~~~~~~ ^ > > 1 error generated. > > make[2]: *** [Makefile.perf:1078: /tmp/build/perf/util/bpf_skel/.tmp/sample_filter.bpf.o] Error 1 > > make[1]: *** [Makefile.perf:236: sub-make] Error 2 > > make: *** [Makefile:113: install-bin] Error 2 > > make: Leaving directory '/var/home/acme/git/perf/tools/perf' > > > > Performance counter stats for 'make -k BUILD_BPF_SKEL=1 CORESIGHT=1 O=/tmp/build/perf -C tools/perf install-bin': > > Hmm.. strange. In the include/linux/perf_event.h, the > perf_sample_data has sample_flags, but vmlinux.h doesn't. It looks like the vmlinux.h came from the old kernel image (before v6.1). Please try again after building the kernel. I'll add a check to prevent such a build error in v3. Thanks, Namhyung