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=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 9F051C48BE6 for ; Tue, 8 Jun 2021 18:54:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 890146147F for ; Tue, 8 Jun 2021 18:54:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234719AbhFHS4I (ORCPT ); Tue, 8 Jun 2021 14:56:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21919 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236067AbhFHSx3 (ORCPT ); Tue, 8 Jun 2021 14:53:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623178296; 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: in-reply-to:in-reply-to:references:references; bh=AteLOuehZrKRBifQp7t2eCpFqM5PYx89clHcr7jZONw=; b=SYRC7H6s8gYPCdMgYIYEIzRutTM3CkbC2BEarWxO9ANEeztmh859tMYHHpKWQyequ33u+m jYfUhcS5X/y9okjRI7aN3ai0LkxnrlFvb3/aeAte0Rkte5NbxdiGLHYRXH30UdY9iwsHXW b6iyaMmiOgTIt1lxAeDBOYpvNzyjLyI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-3-WXdMcdbxN8eSCRpoo4FlBw-1; Tue, 08 Jun 2021 14:51:31 -0400 X-MC-Unique: WXdMcdbxN8eSCRpoo4FlBw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 93882107ACC7; Tue, 8 Jun 2021 18:51:29 +0000 (UTC) Received: from krava (unknown [10.40.192.49]) by smtp.corp.redhat.com (Postfix) with SMTP id 825C45C1C2; Tue, 8 Jun 2021 18:51:26 +0000 (UTC) Date: Tue, 8 Jun 2021 20:51:25 +0200 From: Jiri Olsa To: Andrii Nakryiko Cc: Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , "Steven Rostedt (VMware)" , Networking , bpf , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Daniel Xu , Viktor Malik Subject: Re: [PATCH 03/19] x86/ftrace: Make function graph use ftrace directly Message-ID: References: <20210605111034.1810858-1-jolsa@kernel.org> <20210605111034.1810858-4-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Tue, Jun 08, 2021 at 11:35:58AM -0700, Andrii Nakryiko wrote: SNIP > > diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c > > index b8a0d1d564fb..58e96b45e9da 100644 > > --- a/kernel/trace/fgraph.c > > +++ b/kernel/trace/fgraph.c > > @@ -115,6 +115,7 @@ int function_graph_enter(unsigned long ret, unsigned long func, > > { > > struct ftrace_graph_ent trace; > > > > +#ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS > > /* > > * Skip graph tracing if the return location is served by direct trampoline, > > * since call sequence and return addresses are unpredictable anyway. > > @@ -124,6 +125,7 @@ int function_graph_enter(unsigned long ret, unsigned long func, > > if (ftrace_direct_func_count && > > ftrace_find_rec_direct(ret - MCOUNT_INSN_SIZE)) > > return -EBUSY; > > +#endif > > trace.func = func; > > trace.depth = ++current->curr_ret_depth; > > > > @@ -333,10 +335,10 @@ unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx, > > #endif /* HAVE_FUNCTION_GRAPH_RET_ADDR_PTR */ > > > > static struct ftrace_ops graph_ops = { > > - .func = ftrace_stub, > > + .func = ftrace_graph_func, > > .flags = FTRACE_OPS_FL_INITIALIZED | > > - FTRACE_OPS_FL_PID | > > - FTRACE_OPS_FL_STUB, > > + FTRACE_OPS_FL_PID > > + FTRACE_OPS_GRAPH_STUB, > > nit: this looks so weird... Why not define FTRACE_OPS_GRAPH_STUB as > zero in case of #ifdef ftrace_graph_func? Then it will be natural and > correctly looking | FTRACE_OPS_GRAPH_STUB? ok, I can change that thanks, jirka > > > #ifdef FTRACE_GRAPH_TRAMP_ADDR > > .trampoline = FTRACE_GRAPH_TRAMP_ADDR, > > /* trampoline_size is only needed for dynamically allocated tramps */ > > -- > > 2.31.1 > > >