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 8CF0BC001DE for ; Thu, 3 Aug 2023 02:48:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233725AbjHCCs6 (ORCPT ); Wed, 2 Aug 2023 22:48:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233738AbjHCCs4 (ORCPT ); Wed, 2 Aug 2023 22:48:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1387D198B; Wed, 2 Aug 2023 19:48:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A5A4361BBD; Thu, 3 Aug 2023 02:48:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50875C433C8; Thu, 3 Aug 2023 02:48:51 +0000 (UTC) Date: Wed, 2 Aug 2023 22:48:49 -0400 From: Steven Rostedt To: Ze Gao Cc: Adrian Hunter , Alexander Shishkin , Arnaldo Carvalho de Melo , Ian Rogers , Ingo Molnar , Jiri Olsa , Mark Rutland , Masami Hiramatsu , Namhyung Kim , Peter Zijlstra , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org, Ze Gao Subject: Re: [RFC PATCH v4 5/7] sched, tracing: add to report task state in symbolic chars Message-ID: <20230802224849.215b96b0@gandalf.local.home> In-Reply-To: References: <20230802121116.324604-1-zegao@tencent.com> <20230802121116.324604-6-zegao@tencent.com> <20230802110701.5227346d@gandalf.local.home> X-Mailer: Claws Mail 3.19.1 (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-perf-users@vger.kernel.org On Thu, 3 Aug 2023 10:38:43 +0800 Ze Gao wrote: > > > +static inline char __trace_sched_switch_state_char(bool preempt, > > > + unsigned int prev_state, > > > + struct task_struct *p) > > > +{ > > > + long state; > > > + > > > +#ifdef CONFIG_SCHED_DEBUG > > > + BUG_ON(p != current); > > > > BUG? Why not WARN_ON()? > > I directly copied it from __trace_sched_switch_state since they > are very similar. I had doubt on this too but decided to keep it in > case people want to be 100% sure that the current task is exactly > the one that is being switched, otherwise it's a fatal problem for > scheduler at the point where trace_sched_switch is called. > > If you think WARN_ON_ONCE is more appropriate, I can fix both > in v6. > > Thoughts? Yeah, that BUG_ON is from 2014, and really should not BUG. I'd fix both. Thanks! -- Steve