From patchwork Wed Dec 21 22:44:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 9483863 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 67B1A601D2 for ; Wed, 21 Dec 2016 22:46:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 577632848C for ; Wed, 21 Dec 2016 22:46:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 490622849D; Wed, 21 Dec 2016 22:46:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 094F12848C for ; Wed, 21 Dec 2016 22:46:46 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cJpdV-00076R-1L; Wed, 21 Dec 2016 22:45:25 +0000 Received: from mail-pg0-x229.google.com ([2607:f8b0:400e:c05::229]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cJpdR-0006FM-BW for linux-arm-kernel@lists.infradead.org; Wed, 21 Dec 2016 22:45:22 +0000 Received: by mail-pg0-x229.google.com with SMTP id i5so24936186pgh.2 for ; Wed, 21 Dec 2016 14:45:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=EJ7mkMvRwzKmZltAJHLZVCI8HF2RUn5U7FLRrhkO1o4=; b=Vik2lu1xCgxlLjAf9lFXGYE7f0yERHfDxU1MESfRi9cwB2p2IZ5KBKOdFwhWly+C6n QbbXGa2GaGGm2wUfhvpc5mjyl4pvdVAvvOIcpE5pxZh6rjkxsNg/28Mj4Hdoe8aFtMGi 8e0xjqQCnAC7fNxzKogDaAcm7EkKKBtYuDGgt5ISL4ANhvMQueUTXAeVroSBb852eFo/ P25nLnk7A5UQT+gJzGj50GeUO2fdeKPfviNZLGS/f2S8RN9IYcvVTQdJ/ranufCcM6es K6QpyZrsh19j6flv7rseMqbxyt6heVc/d3rKXli4bAyQ2EBRxSuc15b3ZsYOLoFMMLay kUqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EJ7mkMvRwzKmZltAJHLZVCI8HF2RUn5U7FLRrhkO1o4=; b=fH2tayOBCBBGhPsgJqUraJqAQtvuQ+tC5gkKEPyxOcvagjEDIxcnIOVkxu6zUFD9Ry OlWWyL8eqBI4mwgGv4jXnKPnlk2ffRr2RxfG6ik2NZceM8T1QiVGXki1mkVdw7zMwYWE FZnIdZ+AqkvV59FdSba2ft+L8dMwTkcR32DAhcovAbxEjvmqqjhtURUG/uG+lTuZyHNO +YQYaq1hLNpknsaPNGz8WZql+cxE/sW2b5jOhbDrrg8+nglFmxU6byBAbYBnPcnOw+YK j5oUczc4fxx1wsCLf3mGBXwsnFU8OF7+rg/P7xEiI0Un1xDlw30YUEwz7Q/iDofTUo/T OKSg== X-Gm-Message-State: AIkVDXJYkIHYl9NshJszXXrinOp9cCN4N6ExMTEqbib53r/16EiRYGQTqaeThwaTl36IT+k0 X-Received: by 10.84.218.77 with SMTP id f13mr8535966plm.141.1482360300121; Wed, 21 Dec 2016 14:45:00 -0800 (PST) Received: from joelaf.mtv.corp.google.com ([172.22.121.121]) by smtp.gmail.com with ESMTPSA id j130sm24561201pgc.2.2016.12.21.14.44.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Dec 2016 14:44:59 -0800 (PST) From: Joel Fernandes To: linux-kernel@vger.kernel.org Subject: [PATCH] arm64: Don't trace __switch_to if function graph tracer is enabled Date: Wed, 21 Dec 2016 14:44:46 -0800 Message-Id: <1482360288-124624-1-git-send-email-joelaf@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161221_144521_501292_0369E40B X-CRM114-Status: GOOD ( 11.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joel Fernandes , Mark Rutland , Kees Cook , Catalin Marinas , Will Deacon , Steven Rostedt , James Morse , "moderated list:ARM64 PORT AARCH64 ARCHITECTURE" , Andrew Morton , Jiri Slaby , Jason Cooper , Todd Kjos MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Function graph tracer shows negative time (wrap around) when tracing __switch_to if the nosleep-time trace option is enabled. Time compensation for nosleep-time is done by an ftrace probe on sched_switch. This doesn't work well for the following events (with letters representing timestamps): A - sched switch probe called for task T switch out B - __switch_to calltime is recorded C - sched_switch probe called for task T switch in D - __switch_to rettime is recorded If C - A > D - B, then we end up over compensating for the time spent in __switch_to giving rise to negative times in the trace output. On x86, __switch_to is not traced if function graph tracer is enabled. Do the same for arm64 as well. Cc: Todd Kjos Cc: Steven Rostedt Cc: Will Deacon Cc: Mark Rutland Signed-off-by: Joel Fernandes --- arch/arm64/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 01753cd..e84ee27 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -324,7 +324,7 @@ void uao_thread_switch(struct task_struct *next) /* * Thread switching. */ -struct task_struct *__switch_to(struct task_struct *prev, +__notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *next) { struct task_struct *last;