From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70939C63798 for ; Sat, 14 Nov 2020 18:51:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4705F22252 for ; Sat, 14 Nov 2020 18:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726353AbgKNSuz (ORCPT ); Sat, 14 Nov 2020 13:50:55 -0500 Received: from mx.der-flo.net ([193.160.39.236]:51822 "EHLO mx.der-flo.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbgKNSuy (ORCPT ); Sat, 14 Nov 2020 13:50:54 -0500 Received: by mx.der-flo.net (Postfix, from userid 110) id 884C8439A7; Sat, 14 Nov 2020 19:50:49 +0100 (CET) Received: from localhost (unknown [IPv6:2a02:1203:ecb0:3930:1751:4157:4d75:a5e2]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.der-flo.net (Postfix) with ESMTPSA id B7D00413E7; Sat, 14 Nov 2020 19:49:36 +0100 (CET) Date: Sat, 14 Nov 2020 19:49:31 +0100 From: Florian Lehner To: Alexei Starovoitov Cc: acme@kernel.org, andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com, linux-kernel@vger.kernel.org, mingo@redhat.com, netdev@vger.kernel.org, peterz@infradead.org Subject: Re: [PATCH bpf,perf]] bpf,perf: return EOPNOTSUPP for attaching bpf handler on PERF_COUNT_SW_DUMMY Message-ID: <20201114184931.GA2747@der-flo.net> References: <20201114135126.29462-1-dev@der-flo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 14, 2020 at 08:07:29AM -0800, Alexei Starovoitov wrote: > On Sat, Nov 14, 2020 at 5:53 AM Florian Lehner wrote: > > > > At the moment it is not possible to attach a bpf handler to a perf event > > of type PERF_TYPE_SOFTWARE with a configuration of PERF_COUNT_SW_DUMMY. > > It is possible or it is not possible? > > Such "commit log as an abstract statement" patches are a mystery to a reader. > Please explain what problem you're trying to solve and how it's being addressed. Perf events of type software/dummy are just placeholder events and don't require a counting event. So attaching the bpf handler to the overflow_handler of this event does not trigger the execution of the bpf handler. So the idea of this fix was to indicate to the user that attaching a bpf handler to such a perf event is not (yet) supported. > > Signed-off-by: Florian Lehner > > --- > > kernel/events/core.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/kernel/events/core.c b/kernel/events/core.c > > index da467e1dd49a..4e8846b7ceda 100644 > > --- a/kernel/events/core.c > > +++ b/kernel/events/core.c > > @@ -9668,6 +9668,10 @@ static int perf_event_set_bpf_handler(struct perf_event *event, u32 prog_fd) > > if (event->prog) > > return -EEXIST; > > > > + if (event->attr.type == PERF_TYPE_SOFTWARE && > > + event->attr.config == PERF_COUNT_SW_DUMMY) > > + return -EOPNOTSUPP; > > Is it a fix or a feature? > If it is a fix please add 'Fixes:' tag. I was not sure how to address it and so I have chosen PATCH. As bpf handlers are still not executed on such events, I also would not call it a feature.