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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE570ECAAD5 for ; Wed, 7 Sep 2022 01:11:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229697AbiIGBLm (ORCPT ); Tue, 6 Sep 2022 21:11:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229686AbiIGBLj (ORCPT ); Tue, 6 Sep 2022 21:11:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A2F17CAB3 for ; Tue, 6 Sep 2022 18:11:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E7D3A6173D for ; Wed, 7 Sep 2022 01:11:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 530BFC433D6; Wed, 7 Sep 2022 01:11:36 +0000 (UTC) Date: Tue, 6 Sep 2022 21:12:15 -0400 From: Steven Rostedt To: Yipeng Zou Cc: , , , , , , , , Joel Fernandes Subject: Re: [PATCH 1/2] tracing: hold caller_addr to hardirq_{enable,disable}_ip Message-ID: <20220906211215.0fe6183a@gandalf.local.home> In-Reply-To: <20220901104515.135162-2-zouyipeng@huawei.com> References: <20220901104515.135162-1-zouyipeng@huawei.com> <20220901104515.135162-2-zouyipeng@huawei.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 1 Sep 2022 18:45:14 +0800 Yipeng Zou wrote: > Currently, The arguments passing to lockdep_hardirqs_{on,off} was fixed > in CALLER_ADDR0. > The function trace_hardirqs_on_caller should have been intended to use > caller_addr to represent the address that caller wants to be traced. > > For example, lockdep log in riscv showing the last {enabled,disabled} at > __trace_hardirqs_{on,off} all the time(if called by): > [ 57.853175] hardirqs last enabled at (2519): __trace_hardirqs_on+0xc/0x14 > [ 57.853848] hardirqs last disabled at (2520): __trace_hardirqs_off+0xc/0x14 > > After use trace_hardirqs_xx_caller, we can get more effective information: > [ 53.781428] hardirqs last enabled at (2595): restore_all+0xe/0x66 > [ 53.782185] hardirqs last disabled at (2596): ret_from_exception+0xa/0x10 I'm going to mark this as stable and send it in my next push to Linus. I'll also add: Fixes: c3bc8fd637a96 ("tracing: Centralize preemptirq tracepoints and unify their usage") The code was copied from functions that were originally called directly, but now that they are called indirectly, CALLER_ADDR0 is not the right thing to use. Thanks! -- Steve > > Signed-off-by: Yipeng Zou > --- > kernel/trace/trace_preemptirq.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/trace/trace_preemptirq.c b/kernel/trace/trace_preemptirq.c > index 95b58bd757ce..1e130da1b742 100644 > --- a/kernel/trace/trace_preemptirq.c > +++ b/kernel/trace/trace_preemptirq.c > @@ -95,14 +95,14 @@ __visible void trace_hardirqs_on_caller(unsigned long caller_addr) > } > > lockdep_hardirqs_on_prepare(); > - lockdep_hardirqs_on(CALLER_ADDR0); > + lockdep_hardirqs_on(caller_addr); > } > EXPORT_SYMBOL(trace_hardirqs_on_caller); > NOKPROBE_SYMBOL(trace_hardirqs_on_caller); > > __visible void trace_hardirqs_off_caller(unsigned long caller_addr) > { > - lockdep_hardirqs_off(CALLER_ADDR0); > + lockdep_hardirqs_off(caller_addr); > > if (!this_cpu_read(tracing_irq_cpu)) { > this_cpu_write(tracing_irq_cpu, 1);