Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8101330imu; Tue, 4 Dec 2018 03:02:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/Uq+n9KfZjrArZl81V+nKlaaTaS0u1NWcPC0ZM6Zyh4zRDI0Tk0fBqzkmqimDrOYlDgHtJC X-Received: by 2002:a17:902:6bc4:: with SMTP id m4mr18670502plt.93.1543921338491; Tue, 04 Dec 2018 03:02:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543921338; cv=none; d=google.com; s=arc-20160816; b=hspTNZccQ74H9UbVFn/P3GV1xGPYO2g7J9Xd9+g/XlukXPcdBp7j2osFXiGS50ycto nTasX0b0uM/XTpIOVHs86+EhSC9dAmkAOEI6R6NsbCLDK5kF2TMjxdktFhpJOhhKlyWS V8/c6hZ9K5hy6AU+QaCbLVTsejVEmXh48pPKf7Vwz/UqZfBoxiQpELPYKJ19o/Q0juKL 9yPfxnxFuezTsIJlF0MWRukvkWBinThzahoEL87H+sYgoXA37w3DkMF5BKyLqZtb2uYd vqLZ0LsDL9/drlTgkWZRf4m3C5C6dY6Vv/wCAv8jBU+A+rE+3rkImWVaOHmPLYe9EEZV 9lCA== 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=ulPknRMI7kftqOvF89V8f+vUWW99AtTQ2GzZrxGi3og=; b=mgN338WUVXxwxj8Jb6GLbcylgIEZN69lZbwIRcayHrjQlnq+TQyRduNQh2d4uoYJi6 osPuHnr3IMH3akf3Jk5xnOpUperr6fJxbay9ilXPfGnNt9VhrVFpCbm7Wz6vKgxcyxL2 w4HV+Tgj8oKAyLmQFC8nicbwZWY4Cx+YXnxWhfJdreRKl/naR/ol/nsuq5DIEgkgstNk sp/i5cftWUClAjk9Y0YbLGcDXV4MaAPbDLIkW3hKFNTJvEzf9FzxQBe1yJWdyaJz+F3/ fy48tI2aQ6QCmqrXWomM+OQmgNHmb60UYj38eYOMRYC50nr1HTzDicbRQ8InoWXjgf/d 0DWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="uhe1/Yag"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si16858821pfn.26.2018.12.04.03.02.02; Tue, 04 Dec 2018 03:02:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="uhe1/Yag"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727332AbeLDLAd (ORCPT + 99 others); Tue, 4 Dec 2018 06:00:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:45744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727335AbeLDLA3 (ORCPT ); Tue, 4 Dec 2018 06:00:29 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 0054F2087F; Tue, 4 Dec 2018 11:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543921228; bh=SD8ewxyqnCW6QSTI3FRkwJKErbc1Px5MPs+uoV8V6hc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uhe1/YagMR8Z1M/laXvvlfh4pbpSgyA1AJ3XrF8I5jnVl8j4KaWGxky5Bg0xmm4qO TDsRAU82JTEzL6lSJ/rT7cMbpAhda+bTZ4cgiRAzGTyscgpxmP42qIDmbcOXF+nEIc dxM7BwfeHpEfwFcy3XRsEqBzaAzfU7YriaKm/2OQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Masami Hiramatsu , "Steven Rostedt (VMware)" Subject: [PATCH 4.19 113/139] function_graph: Have profiler use curr_ret_stack and not depth Date: Tue, 4 Dec 2018 11:49:54 +0100 Message-Id: <20181204103655.266906477@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181204103649.950154335@linuxfoundation.org> References: <20181204103649.950154335@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Steven Rostedt (VMware) commit b1b35f2e218a5b57d03bbc3b0667d5064570dc60 upstream. The profiler uses trace->depth to find its entry on the ret_stack, but the depth may not match the actual location of where its entry is (if an interrupt were to preempt the processing of the profiler for another function, the depth and the curr_ret_stack will be different). Have it use the curr_ret_stack as the index to find its ret_stack entry instead of using the depth variable, as that is no longer guaranteed to be the same. Cc: stable@kernel.org Fixes: 03274a3ffb449 ("tracing/fgraph: Adjust fgraph depth before calling trace return callback") Reviewed-by: Masami Hiramatsu Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ftrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -817,7 +817,7 @@ function_profile_call(unsigned long ip, #ifdef CONFIG_FUNCTION_GRAPH_TRACER static int profile_graph_entry(struct ftrace_graph_ent *trace) { - int index = trace->depth; + int index = current->curr_ret_stack; function_profile_call(trace->func, 0, NULL, NULL); @@ -852,7 +852,7 @@ static void profile_graph_return(struct if (!fgraph_graph_time) { int index; - index = trace->depth; + index = current->curr_ret_stack; /* Append this call time to the parent time to subtract */ if (index)