Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2635129pxa; Mon, 17 Aug 2020 15:03:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYH0KHQiCwKwlVecJ5mZHe/bVWpFYarGOSZk2LwMlkOHKunJSXO+P99jVnDx7Zzutzw/xa X-Received: by 2002:a17:906:a219:: with SMTP id r25mr17478448ejy.201.1597701827066; Mon, 17 Aug 2020 15:03:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597701827; cv=none; d=google.com; s=arc-20160816; b=aP1OtecQiD6MpwhyRSB24T47rsqyK+3S1xsPAOS3EN3xD8sxbnmMjoOgSn1RDClmud fYZeSb3b7DZ3hLgLIkDWg5hm+5NrFW3/ksXGbcLica3MnP+5qtjnYIK7sSf3XHGdb+z9 NtHu6p4pzNc7lfiMMaVILJK4dbQfxENbI/AO8FIOkxPymLnbQa6zthy+JmV//F1sv0p9 G7o+9uv9y+Q7sC5CnGqjU9aEaQlkXOuHsJ0E2XH8OWyo3gHiTZlkFtXMUGT7G6/faiWE aEqQx+1Nxl18F8S1214BRUWtNd0Bb+egAmIKHE7CVTT9zCPZGrrHrYrf820ByRyJlM2u N1RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GIinGiKUx8r+YYm2/159RJaglkv0qMXdg+L7fkJWq4Q=; b=qUkdGyV+7n+AgC9m+F+1a+M0nFy8yqt0CC8nyPYpb16aE/4ohMDsTb1RgNu2aAWmLr D90eaqFN3aR3dJbjIO9g+yXWU5lNd0rinJxj9hLDS6vRknWNMgJ3IjiiTwFn5HPUOhNv vry7+Cz4fob22HLgDqFs4lbCZ1Lx+ToJNCJ1xqtx7bkQ7uhUdPNf8S+hPFZwsBOGfEOn pjtKNMvHc/V7qpgJOXXLa+vIf1PifCzDs8HMA9dvFTUJgriy9YLj5wRWnrJ6kRMxcF+q t4xCEe5jaew3CnxKVE/Q5aiv4WCQQQ1wCIo3TZmTKoeEajWjItbRIPp7Uizo17nIBzVt +kNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EVIojPJO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ov30si11593156ejb.181.2020.08.17.15.03.23; Mon, 17 Aug 2020 15:03:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EVIojPJO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387581AbgHQPmr (ORCPT + 99 others); Mon, 17 Aug 2020 11:42:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:43660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730004AbgHQPgY (ORCPT ); Mon, 17 Aug 2020 11:36:24 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CE2DA22E02; Mon, 17 Aug 2020 15:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597678583; bh=S77HsE32xw75YMJY8MhWSvUCv7M5y/Urn5gHgTo7HQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EVIojPJOTebDzIBOS1FuX9YOhnNqAZESCRES/5r0REjt8RadArzmE/k7kLsonTYDR YO68/WfoHaE2eU5DmSZQzCpUstuTZ0fw++4SXnP26E5A5P2UH5n9tsdO4SF5EZ89+i du5/wBHZJ8A9GFCY8BJYq6CfGOomn/w/fgCOWrq0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , "Steven Rostedt (VMware)" , Sasha Levin Subject: [PATCH 5.8 354/464] ftrace: Fix ftrace_trace_task return value Date: Mon, 17 Aug 2020 17:15:07 +0200 Message-Id: <20200817143850.724302013@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josef Bacik [ Upstream commit c58b6b0372de0d4cd0536d6585addd1b36b151ae ] I was attempting to use pid filtering with function_graph, but it wasn't allowing anything to make it through. Turns out ftrace_trace_task returns false if ftrace_ignore_pid is not-empty, which isn't correct anymore. We're now setting it to FTRACE_PID_IGNORE if we need to ignore that pid, otherwise it's set to the pid (which is weird considering the name) or to FTRACE_PID_TRACE. Fix the check to check for != FTRACE_PID_IGNORE. With this we can now use function_graph with pid filtering. Link: https://lkml.kernel.org/r/20200725005048.1790-1-josef@toxicpanda.com Fixes: 717e3f5ebc82 ("ftrace: Make function trace pid filtering a bit more exact") Signed-off-by: Josef Bacik Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Sasha Levin --- kernel/trace/ftrace.c | 3 --- kernel/trace/trace.h | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 1903b80db6ebc..7d879fae3777f 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -139,9 +139,6 @@ static inline void ftrace_ops_init(struct ftrace_ops *ops) #endif } -#define FTRACE_PID_IGNORE -1 -#define FTRACE_PID_TRACE -2 - static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip, struct ftrace_ops *op, struct pt_regs *regs) { diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index f21607f871891..610d21355526d 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -1103,6 +1103,10 @@ print_graph_function_flags(struct trace_iterator *iter, u32 flags) extern struct list_head ftrace_pids; #ifdef CONFIG_FUNCTION_TRACER + +#define FTRACE_PID_IGNORE -1 +#define FTRACE_PID_TRACE -2 + struct ftrace_func_command { struct list_head list; char *name; @@ -1114,7 +1118,8 @@ struct ftrace_func_command { extern bool ftrace_filter_param __initdata; static inline int ftrace_trace_task(struct trace_array *tr) { - return !this_cpu_read(tr->array_buffer.data->ftrace_ignore_pid); + return this_cpu_read(tr->array_buffer.data->ftrace_ignore_pid) != + FTRACE_PID_IGNORE; } extern int ftrace_is_dead(void); int ftrace_create_function_files(struct trace_array *tr, -- 2.25.1