From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796036197; b=5SR7qLWS13hxwJY3BPVzKqk/wJJEKPUGo/2BVD1+x5eH+icUa336M24w2PVNt1DWErXb 4G8s1rKr+xUYpmIkZrA2h+GUvlqYLqSsDYmnUq3UrLrFb/bBBGW4t7gbVt5RvjwMHZ+M9 T7t3vmLzharPFnfYxcuGjRVmzeb93iDtDeyNIj43LENK9IYMnqZZK+4+Y2LvaZ5ASPLac sY1M41eA77I3Ie07wWYNBP6LbkG83JgcmvUgX8NjIK4tTyoNsaWCw28ntX6V4Z7MS2c+k 0kh5SwM1jex/GXg3So3xhbCcSVpByWKdCIxF0ZooFUvB0M/VpGCkvJKPOsELkxzmFVg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796036197; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received: X-Received:Received:Message-ID:Subject:From:To:Cc:Date:In-Reply-To: References:Autocrypt:Content-Type:Content-Transfer-Encoding: User-Agent:MIME-Version; bh=e3+LzxCptEJ0YSEFaGEkWo7h2gGICOn9BNBijF0fe40=; b=FZR7QmXN9fva/EiBvHQ3DWsWcZ3PNc14P4FStC9WrRRI0Rf/Gv5MKO5X4FFeVsaL6eM9 B7upzfei+5ekb566EoGpgJQaohGLeZWWYjqo6pCTP+FFztxDU/r2zS0rJn08Malp0JDy7 ThOhkB5xHrLPXeIp9NYC9M1iqPd1Ia4QYF4tZSW+IJZ1QzhVaux/L2AsoIJS2Qv/Yo9TK IxNbXKQurPznROOpUBNd1EnAHczltb7Lp8S6/nrM5ELaBmPWQ/jjGCCnkvoUNIH0QK6CW EyxoEueZinOvcEK7ZdpU6X1aoF/BCinaLdWQ4qy2ldRXJ5UoXQpX9Fbi23E4W8M95Sw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ND2hot8a; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=irW6+qq+; arc=none smtp.remote-ip=170.10.129.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 738F2606A32D for ; Mon, 30 Nov 2026 10:56:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 738F2606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ND2hot8a; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=irW6+qq+ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796036195; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=e3+LzxCptEJ0YSEFaGEkWo7h2gGICOn9BNBijF0fe40=; b=ND2hot8aQHNtwviI439tBCyDoHfp8KUyYtj3H4B5AD982T8hsmnsDdmcqOrO2tuOlbiLN3 DxFKfDbGysPc1zAWNq4jbgko5SZu05zAEOggmdIskMhnbMClj1oXtq5IcowOFXBpE9nIiN MS7QpA9UW0TOK79pbezGgDk5eaoA0nc= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-8WJyw4AMP9653eC49D7b2g-1; Mon, 30 Nov 2026 10:56:33 +0000 X-MC-Unique: 8WJyw4AMP9653eC49D7b2g-1 X-Mimecast-MFC-AGG-ID: 8WJyw4AMP9653eC49D7b2g_1796036192 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4a1f03f2e8aso90384055e9.1 for ; Mon, 30 Nov 2026 02:56:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1796036192; x=1796640992; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:content-type :autocrypt:references:in-reply-to:date:cc:to:from:subject:message-id :from:to:cc:subject:date:message-id:reply-to:content-type; bh=e3+LzxCptEJ0YSEFaGEkWo7h2gGICOn9BNBijF0fe40=; b=irW6+qq+JbFUUqEBMpWQ9f1FeIED/DXO1PGrf9x3DBTl1isOrDV1PzGKXuKcmQw3Lr 8CuXJH/Rhmn4m1V5H/V9NvP0L/PiDy9mCkRhgv5GYkMxDNKE2s/FRdK3XgGsL4K5j5v3 EQrZLqU7NouEZqXCGu/4R+Kjw7fpPbqARQOhbvgup6zDeNPDJZcY7YGxt2rvZI0wb6Nk exDzVsMZa+k6jhgfOl31cckicM8BGgDxodgoeFnlYL7T8ZNiE3XryDtKfAfWPjwg7dC5 y9RFbG0ueVJBpzlsqPa5Kr/dVyVu+F2PBFYcjTFx3IBUoR4vz/Jhtp/o/6DGYuWEe+ZI seGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796036192; x=1796640992; h=mime-version:user-agent:content-transfer-encoding:content-type :autocrypt:references:in-reply-to:date:cc:to:from:subject:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=e3+LzxCptEJ0YSEFaGEkWo7h2gGICOn9BNBijF0fe40=; b=a+b2nIDlH7jQiaOkWHSeyhPj7h4u55MkcZNyMGMS+lEL2bw0w5BxhveWxe52R1JsMv GLIAsXXic0ClZsYV07L7UX/ZtWcGpi5yH8fojePJnCR/rADfOgqLUI5AoKqwlOPYZH2w gSre1Ea8Z/SJFu9PzvIlk0oOUs/Sp1nW6+Wx/EfFd8PuxO/gXn3zKhiMIcqVu0TzBYB3 vA59rs0YldVH/sdXayyd2hIk+B7+OvRXHZl5uEJ1kU/NbGwd3o5Sazvmr4vjIyyUkAwn bJVrK5ZrqWo3nmPJ4oNt8uJz9MemeJrfVsnFP5bVnIH2wzFINVaotLExqb0D8D3OhRVD VpFg== X-Forwarded-Encrypted: i=1; AL+hErEwM4oNYqiLfZ8rPtTNBe2rFKrW/rzMlxdm25+0VP1WXNo/926vevfyIbgkTrRTLDfZ+mYxS2tGP95ZRV8=@vger.kernel.org X-Gm-Message-State: APuU4Z9EtYepTKZChNmvZ4MDpSBobnwV5EZ8kLzFiUQQ+7Pp5Y0iOOaz Qm5/wZNC0i9gkPAzGf2Nh66PpuuBSVj/oJrNgI3DXw1AgPAtcwZU0V2I9Jc8/C9CjLc0+TSjxyq +4N/YVBUeyBeXc+sHTDzheN0ndVaHy3jDVNUUIvX2JYO7+w7aSEg1t3e5ZYPYvI+7+A== X-Gm-Gg: AZFdTZdQgDWUywfKk37n5NUr0WsMBSyo1M7PNPzN29bSykgf3JOgLLuGIt/gIs8sOAH 2Lgnn44HlGmSzOTx87LUWMIAZq7robS8Jw7NimqsqNmVID/fWu9x1lBKroY16vnihzci3c+qf+U QMMupMF8V5tyWDAR2fdMOQlt24inUUNHF2kqk22At4MFvtRsbDU4BZWaYCkrF5XfJB6WSsbcRRq GvC86pem4/n+sjxEOgnxkHuwvVcX1Jnkg6o1sesQHN7rJgCtRTQyxDn7olzY1YGbGITBV2lVf+e vndpip+Ef+GFapNGR3MYdwwLNyd30dH9v8TUSX7MRC7+vCZXG0m2rVxqB0ifqbt6aObsJ5ELCx4 h29UyzzR01DByr2qr1l+ouqd65mSCr4OkZC3xvQmTWpbF52/7qrctQiwHIPaua5vAH+7ljC8VQF +GqQ== X-Received: by 2002:a05:600c:3b99:b0:4a1:777b:8a12 with SMTP id 5b1f17b1804b1-4bb8880b984mr752910815e9.14.1796036192241; Mon, 30 Nov 2026 02:56:32 -0800 (PST) X-Received: by 2002:a05:600c:3b99:b0:4a1:777b:8a12 with SMTP id 5b1f17b1804b1-4bb8880b984mr752910275e9.14.1796036191792; Mon, 30 Nov 2026 02:56:31 -0800 (PST) Received: from gmonaco-thinkpadt14gen3.rmtit.csb ([195.174.134.236]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb884a3a3dsm914267595e9.10.2026.11.30.02.56.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 02:56:31 -0800 (PST) Message-ID: <091bc888a43c8b690df49bdc2292dbbd967bdd91.camel@redhat.com> Subject: Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs From: Gabriele Monaco To: Alexei Starovoitov , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org, Steven Rostedt , Masami Hiramatsu Cc: Nam Cao , Wen Yang , Tobias Schaffner , Viktor Malik , Peter Zijlstra , John Ogness Date: Mon, 30 Nov 2026 11:56:29 +0100 In-Reply-To: References: <20261126130004.127155-1-gmonaco@redhat.com> <20261126130004.127155-6-gmonaco@redhat.com> Autocrypt: addr=gmonaco@redhat.com; prefer-encrypt=mutual; keydata=mDMEZuK5YxYJKwYBBAHaRw8BAQdAmJ3dM9Sz6/Hodu33Qrf8QH2bNeNbOikqYtxWFLVm0 1a0JEdhYnJpZWxlIE1vbmFjbyA8Z21vbmFjb0BrZXJuZWwub3JnPoiZBBMWCgBBFiEEysoR+AuB3R Zwp6j270psSVh4TfIFAmjKX2MCGwMFCQWjmoAFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgk Q70psSVh4TfIQuAD+JulczTN6l7oJjyroySU55Fbjdvo52xiYYlMjPG7dCTsBAMFI7dSL5zg98I+8 cXY1J7kyNsY6/dcipqBM4RMaxXsOtCRHYWJyaWVsZSBNb25hY28gPGdtb25hY29AcmVkaGF0LmNvb T6InAQTFgoARAIbAwUJBaOagAULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgBYhBMrKEfgLgd0WcK eo9u9KbElYeE3yBQJoymCyAhkBAAoJEO9KbElYeE3yjX4BAJ/ETNnlHn8OjZPT77xGmal9kbT1bC1 7DfrYVISWV2Y1AP9HdAMhWNAvtCtN2S1beYjNybuK6IzWYcFfeOV+OBWRDQ== Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.62.1 (3.62.1-1.fc45) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 On Fri, 2026-11-27 at 23:33 +0000, Alexei Starovoitov wrote: > On Thu, Nov 26, 2026 at 04:59 AM Gabriele Monaco wro= te: > > Add also bpf_rv_event_monitor() / bpf_rv_error_monitor() kfuncs wrappin= g > > them, so BPF monitors can emit similar events to in-kernel monitors. > >=20 > > Userspace callers need now to use ftrace filters to get the right event= s > > but events and errors are separate channels to ease the most common > > filtering and account for dramatically different volume (errors are > > rare). >=20 > I thought we agreed that plain bpf_printk() works with glob filtering on = top. > Why do you need these new kfuncs? > See below diff that illustrates the point. Thanks for the diff. I tried this alternative as it offers separate channels for events, errors = and standard bpf_printk users. Especially the events channel has the potential to flood other bpf_printk readers, I'm not sure whether that's acceptable. We can apply filters for rv, but then any other user interested in bpf_prin= tk would need to filter rv out. Other ergonomics advantages are actually minor, though. I would have liked structured fields but it gets unnecessarily complicated. If the amount of messages isn't an issue on the standard bpf_printk, we can= just use that, users are going to need to parse strings either ways. Thanks, Gabriele >=20 > > +=09if (strnlen(msg, msg__sz) =3D=3D msg__sz) > > +=09=09return -EINVAL; > > + > > +=09trace_event_monitor(mon__str, id__nullable, msg); >=20 > This will read out of bounds. msg can point to a map value. > Take a BPF_F_MMAPABLE array with one page size value. NUL is the last byt= e: >=20 > =C2=A0 prog=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 user space > =C2=A0 strnlen(msg, msg__sz) finds the NUL > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 writes 'x' over the NUL > =C2=A0 __string(msg, msg) -> strlen(msg) > =C2=A0 runs into the vmalloc guard page >=20 > There is no limit on msg__sz either. > When perf is on the event, a msg above 8192 bytes hits WARN_ONCE() in > perf_trace_buf_alloc(). >=20 >=20 > diff --git a/tools/verification/rv/bpf_monitors/da_monitor_bpf.h > b/tools/verification/rv/bpf_monitors/da_monitor_bpf.h > index e9e673c..6996c01 100644 > --- a/tools/verification/rv/bpf_monitors/da_monitor_bpf.h > +++ b/tools/verification/rv/bpf_monitors/da_monitor_bpf.h > @@ -24,8 +24,6 @@ > =C2=A0#define da_implicit_guard() > =C2=A0#define IS_ENABLED(conf) 0 > =C2=A0 > -#define DA_TRACE_MSG_MAX 128 > - > =C2=A0/* > =C2=A0 * Also used to filter out events higher values imply lower ones. > =C2=A0 * Userspace will parse this enum but expects EVENT to imply ERROR(= s) and > ERROR > @@ -328,10 +326,9 @@ static inline void da_reset_bpf(da_id_type id, > monitor_target_bpf target) > =C2=A0 > =C2=A0#endif /* RV_MON_TYPE */ > =C2=A0 > -extern int bpf_rv_event_monitor(const char *mon, const int *id__nullable= , > -=09=09=09=09const char *msg, u32 msg__sz) __ksym; > -extern int bpf_rv_error_monitor(const char *mon, const int *id__nullable= , > -=09=09=09=09const char *msg, u32 msg__sz) __ksym; > +/* "rv: : : " in bpf_trace:bpf_trace_printk */ > +#define rv_printk(type, fmt, ...) \ > +=09bpf_printk("rv: " type ": " __stringify(MONITOR_NAME) ": " fmt, > __VA_ARGS__) > =C2=A0 > =C2=A0#if RV_MON_TYPE =3D=3D RV_MON_GLOBAL || RV_MON_TYPE =3D=3D RV_MON_P= ER_CPU > =C2=A0/* > @@ -345,28 +342,22 @@ static inline void da_trace_event(struct da_monitor > *da_mon, > =C2=A0=09=09=09=09=C2=A0 const char *next_state, bool is_final, > =C2=A0=09=09=09=09=C2=A0 da_id_type id) > =C2=A0{ > -=09char msg[DA_TRACE_MSG_MAX]; > - > =C2=A0=09if (trace_level < RV_TRACE_EVENT) > =C2=A0=09=09return; > =C2=A0 > -=09BPF_SNPRINTF(msg, sizeof(msg), "%s x %s -> %s%s", > -=09=09curr_state, event, next_state, is_final ? " (final)" : ""); > -=09bpf_rv_event_monitor(__stringify(MONITOR_NAME), NULL, msg, > sizeof(msg)); > +=09rv_printk("event", "%s x %s -> %s%s", > +=09=09=C2=A0 curr_state, event, next_state, is_final ? " (final)" : ""); > =C2=A0} > =C2=A0 > =C2=A0static inline void da_trace_error(struct da_monitor *da_mon, > =C2=A0=09=09=09=09=C2=A0 const char *curr_state, const char *event, > =C2=A0=09=09=09=09=C2=A0 da_id_type id) > =C2=A0{ > -=09char msg[DA_TRACE_MSG_MAX]; > - > =C2=A0=09if (trace_level < RV_TRACE_ERROR) > =C2=A0=09=09return; > =C2=A0 > -=09BPF_SNPRINTF(msg, sizeof(msg), "event %s not expected in the state > %s", > -=09=09 event, curr_state); > -=09bpf_rv_error_monitor(__stringify(MONITOR_NAME), NULL, msg, > sizeof(msg)); > +=09rv_printk("error", "event %s not expected in the state %s", > +=09=09=C2=A0 event, curr_state); > =C2=A0} > =C2=A0 > =C2=A0#elif RV_MON_TYPE =3D=3D RV_MON_PER_TASK || RV_MON_TYPE =3D=3D RV_M= ON_PER_OBJ > @@ -379,28 +370,22 @@ static inline void da_trace_event(struct da_monitor > *da_mon, > =C2=A0=09=09=09=09=C2=A0 const char *next_state, bool is_final, > =C2=A0=09=09=09=09=C2=A0 da_id_type id) > =C2=A0{ > -=09char msg[DA_TRACE_MSG_MAX]; > - > =C2=A0=09if (trace_level < RV_TRACE_EVENT) > =C2=A0=09=09return; > =C2=A0 > -=09BPF_SNPRINTF(msg, sizeof(msg), "%d: %s x %s -> %s%s", id, > -=09=09curr_state, event, next_state, is_final ? " (final)" : ""); > -=09bpf_rv_event_monitor(__stringify(MONITOR_NAME), &id, msg, > sizeof(msg)); > +=09rv_printk("event", "%d: %s x %s -> %s%s", id, > +=09=09=C2=A0 curr_state, event, next_state, is_final ? " (final)" : ""); > =C2=A0} > =C2=A0 > =C2=A0static inline void da_trace_error(struct da_monitor *da_mon, > =C2=A0=09=09=09=09=C2=A0 const char *curr_state, const char *event, > =C2=A0=09=09=09=09=C2=A0 da_id_type id) > =C2=A0{ > -=09char msg[DA_TRACE_MSG_MAX]; > - > =C2=A0=09if (trace_level < RV_TRACE_ERROR) > =C2=A0=09=09return; > =C2=A0 > -=09BPF_SNPRINTF(msg, sizeof(msg), "%d: event %s not expected in the > state %s", > -=09=09 id, event, curr_state); > -=09bpf_rv_error_monitor(__stringify(MONITOR_NAME), &id, msg, > sizeof(msg)); > +=09rv_printk("error", "%d: event %s not expected in the state %s", > +=09=09=C2=A0 id, event, curr_state); > =C2=A0} > =C2=A0#endif /* RV_MON_TYPE */ > =C2=A0 > diff --git a/tools/verification/rv/src/trace.c > b/tools/verification/rv/src/trace.c > index 629b4f6..91f86bf 100644 > --- a/tools/verification/rv/src/trace.c > +++ b/tools/verification/rv/src/trace.c > @@ -15,7 +15,7 @@ > =C2=A0#include > =C2=A0#include > =C2=A0 > -#define FILTER_MAX 128 > +#define FILTER_MAX 256 > =C2=A0 > =C2=A0/** > =C2=A0 * collect_registered_events - print an event collected from the tr= ace buffer > @@ -176,20 +176,25 @@ static int enable_specific_event(struct trace_insta= nce > *inst, const char *event_ > =C2=A0} > =C2=A0 > =C2=A0/* > - * enable_generic_event - enable a generic event with filters > + * enable_bpf_events - collect the messages of a BPF monitor > + * > + * BPF monitors report via bpf_printk("rv: : : ...= "). > + * > + * Returns 0 on success, -1 otherwise. > =C2=A0 */ > -static int enable_generic_event(struct trace_instance *inst, const char > *event_name, char *name) > +static int enable_bpf_events(struct trace_instance *inst, char *name) > =C2=A0{ > -=09struct tep_event *tevent =3D tep_find_event_by_name(inst->tep, "rv", > event_name); > +=09struct tep_event *tevent; > =C2=A0=09char filter[FILTER_MAX] =3D ""; > =C2=A0=09size_t len; > =C2=A0 > +=09tevent =3D tep_find_event_by_name(inst->tep, "bpf_trace", > "bpf_trace_printk"); > =C2=A0=09if (!tevent) { > -=09=09err_msg("trace: fail finding the rv:%s event\n", event_name); > +=09=09err_msg("trace: fail finding the bpf_trace_printk event\n"); > =C2=A0=09=09return -1; > =C2=A0=09} > =C2=A0 > -=09len =3D snprintf(filter, sizeof(filter), "mon =3D=3D \"%s\"", name); > +=09len =3D snprintf(filter, sizeof(filter), "bpf_string ~ \"rv: *: %s: > *\"", name); > =C2=A0=09if (len >=3D sizeof(filter)) { > =C2=A0=09=09err_msg("trace: monitor name %s too long\n", name); > =C2=A0=09=09return -1; > @@ -197,31 +202,12 @@ static int enable_generic_event(struct trace_instan= ce > *inst, const char *event_n > =C2=A0 > =C2=A0=09if (config.my_pid > 0) > =C2=A0=09=09snprintf(filter + len, sizeof(filter) - len, > -=09=09=09 " && common_pid !=3D %d && !(has_id =3D=3D 1 && id =3D=3D > %d)", > -=09=09=09 config.my_pid, config.my_pid); > +=09=09=09 " && common_pid !=3D %d && !(bpf_string ~ \"rv: *: %s: > %d: *\")", > +=09=09=09 config.my_pid, name, config.my_pid); > =C2=A0 > =C2=A0=09return apply_filter_enable(inst, tevent, filter); > =C2=A0} > =C2=A0 > -/* > - * enable_bpf_events - enable rv:event_monitor and rv:error_monitor for = a > monitor > - * > - * BPF monitors report via generic rv:event_monitor and rv:error_monitor > events. > - * Enable the events and filter them to only collect the messages of the > given monitor. > - * > - * Returns 0 on success, -1 otherwise. > - */ > -static int enable_bpf_events(struct trace_instance *inst, char *name) > -{ > -=09if (!config.trace_errors_only && enable_generic_event(inst, > "event_monitor", name)) > -=09=09return -1; > - > -=09if (enable_generic_event(inst, "error_monitor", name)) > -=09=09return -1; > - > -=09return 0; > -} > - > =C2=A0/** > =C2=A0 * trace_enable_monitor_events - enable a monitor's events in a tra= ce > instance > =C2=A0 * > diff --git a/tools/verification/rv/tests/rv_mon.t > b/tools/verification/rv/tests/rv_mon.t > index 30d1dda..f51f194 100644 > --- a/tools/verification/rv/tests/rv_mon.t > +++ b/tools/verification/rv/tests/rv_mon.t > @@ -104,16 +104,16 @@ cpu=3D"\[[0-9]\{3\}\][[:space:]]\+" > =C2=A0state=3D"[a-z_]\+ " > =C2=A0id=3D"[0-9]\+" > =C2=A0selfid=3D"\$pid" > -# BPF monitors report via the common rv:event_monitor/rv:error_monitor > -# events, which add a ": " prefix to the message. > +# BPF monitors report via bpf_printk() > +type_bpf=3D"bpf_trace_printk: rv: \(event\|error\)" > =C2=A0trace_task=3D"${genpid}${cpu}${type}: ${id}: ${state}" > =C2=A0trace_task_self=3D"${genpid}${cpu}${type}: ${selfid}: ${state}" > =C2=A0trace_cpu=3D"${genpid}${cpu}${type}: ${state}" > =C2=A0trace_cpu_self=3D"${selfpid}${cpu}${type}: ${state}" > -trace_task_bpf=3D"${genpid}${cpu}${type}: ${mon}: ${id}: ${state}" > -trace_task_bpf_self=3D"${genpid}${cpu}${type}: ${mon}: ${selfid}: ${stat= e}" > -trace_cpu_bpf=3D"${genpid}${cpu}${type}: ${mon}: ${state}" > -trace_cpu_bpf_self=3D"${selfpid}${cpu}${type}: ${mon}: ${state}" > +trace_task_bpf=3D"${genpid}${cpu}${type_bpf}: ${mon}: ${id}: ${state}" > +trace_task_bpf_self=3D"${genpid}${cpu}${type_bpf}: ${mon}: ${selfid}: ${= state}" > +trace_cpu_bpf=3D"${genpid}${cpu}${type_bpf}: ${mon}: ${state}" > +trace_cpu_bpf_self=3D"${selfpid}${cpu}${type_bpf}: ${mon}: ${state}" > =C2=A0 > =C2=A0check_if_exists "run per-task monitor with tracing" \ > =C2=A0=09"$RV mon sssw -t" "$RVDIR/monitors/sched/sssw" \ > @@ -154,10 +154,10 @@ check_if_exists "run per-task monitor tracing only > errors" \ > =C2=A0 > =C2=A0check_if_exists "run per-task BPF monitor tracing only errors" \ > =C2=A0=09"$RV mon tqueue -t -E" "$RVTOOL/bpf_monitors/tqueue.o" \ > -=09"$header" "event_monitor" > +=09"$header" "rv: event" > =C2=A0 > =C2=A0check_if_exists "run per-cpu BPF monitor tracing only errors" \ > =C2=A0=09"$RV mon nohz -t -E" "$RVTOOL/bpf_monitors/nohz.o" \ > -=09"error_monitor" "event_monitor" > +=09"rv: error" "rv: event" > =C2=A0 > =C2=A0test_end >=20