Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp153664lqs; Thu, 13 Jun 2024 06:42:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWGX1HSuZI5g8tUMB+MQj3n7pIfN2qhp5/i1+2OCCGMOqlk8w9ijhcK6R8Dheb6Sh6D3Za0sessVOBQtGktZrA0zZRE/3sXfU+30E70Lg== X-Google-Smtp-Source: AGHT+IFZ4burFHJYunXqzEKiZKaI/8RSybN5HNbPK6E3DUi4QlJajX0pliJwNlgROStEXH+neQ0b X-Received: by 2002:a05:6358:63a3:b0:19f:5cb4:cf92 with SMTP id e5c5f4694b2df-19f69dbb1c2mr502064155d.32.1718286175035; Thu, 13 Jun 2024 06:42:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718286174; cv=pass; d=google.com; s=arc-20160816; b=YOD3y7SO0iw2ChspFgF6j8EuItXe6x84+ByYChg6RsmlgTBU4vSUrd9nvZcUEZ3HJz O0FJuo9G2bpQuLf8Bx19aXTClpPCelITRzYxEVguXNio4VWIHTRddu6zq9z562K4upTW CGXd4vTNqXpyjBIgRMQ62fbEidVElMIuaJP4XHG63/9WV18BawI6hS2GpW+MVTtzmy5q fI3hOoSPW76YnUO+wzuOnsPwm78i1BEdDrd6/tglupvWMpHXX22Ao0rHWGLVLVyLcQD4 w4CEUB2Vts9U9zl3rpVdIspj+cUJDF9apqi+LpMcldDooXPwyaEtAlsh8x9bBf8+5iGJ ukrw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=vY0y/xmxPt5tkKd4urXyX9g4WUsrktUWcTy00ogZOUE=; fh=+n9OsoH8J/DUrDcBifB9EAFqjx9pnkyLLGRU9c7h8BM=; b=EZpVT1CQ/HDEshjWFcM2RFvwWxV5JY7W/gMxChmgI8lNM/11sYIzdgHjJMh0oJg9cD 3puZl2HGx77XGmU5q1tjWgfuN8NBDvZkQegSJEUv4UwLPNh4ueHHWwWnhy6q+OcQRRVm 5Fhr+0NX1zeY9MFAGzhCaQ1Uit+34qZB844nl18BLCw55EbxqM9cyPK1AKHT9U1en0uK EuGrZOdOAQsOo2rWVo7bMCLUqEfDSQNmiuXqBHrPlLgzdxcXhTEsU5CxPJH235sAyyYN zBiD5wFEdbd+z/Pun6BXZxCMukRCgHyMQ5HMa30ybz95YKtjCPYmpXND7FNOQysePgKt mIEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-213351-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213351-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fee6c816f6si779990a12.873.2024.06.13.06.42.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 06:42:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213351-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-213351-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213351-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2460428E1E2 for ; Thu, 13 Jun 2024 13:42:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D49C3144D28; Thu, 13 Jun 2024 13:42:44 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F5711448E4; Thu, 13 Jun 2024 13:42:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718286164; cv=none; b=DxXqKSZWOku/j18lZ0IYxwb+hTfJv2pL/53ImdE/HotUYG7J9EmJlngl3T+WIx2Rf6k2W6UXMEcjZIGdgqtK1KJfsUBtGVOHE2kip9RRTB7nj4xhUIo4LLXe17I7StwUI/4nSdXEMTEHjcqaxqu/LlMI6M8ENOiREwVoFj/bvDU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718286164; c=relaxed/simple; bh=BYkU2H0S4zNO8fR5V5JXw4c7o2fqGO6rVne/z+EvD1s=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qCIP/QZXRjGKnwiowSF8LAAxhKLRRYTUKjmphwZI3LAINKYg0EPXNfAiUnoNQo5lRzV/PmvbFyUamirgJPv3iLdR5aSf3qkqduh6s70+T8ejfTHMhl0BwQ0ECK6PmobyKj03HQlrS9n2JXpUhYnbfdn4NidHDEKcgptbzZJDVlo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D36EC2BBFC; Thu, 13 Jun 2024 13:42:42 +0000 (UTC) Date: Thu, 13 Jun 2024 09:42:41 -0400 From: Steven Rostedt To: Naresh Kamboju Cc: open list , lkft-triage@lists.linaro.org, Linux Regressions , Dan Carpenter , Arnd Bergmann , Masami Hiramatsu , Mark Rutland Subject: Re: LTP tracing crashed on arm64 rk3399-rock-pi-4 - pc : ftrace_ops_test Message-ID: <20240613094241.549038df@rorschach.local.home> In-Reply-To: References: <20240612125130.2c1d6d2d@rorschach.local.home> <20240612171748.0bc6d9cb@rorschach.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 13 Jun 2024 13:29:58 +0530 Naresh Kamboju wrote: > > --- a/kernel/trace/fgraph.c > > +++ b/kernel/trace/fgraph.c > > @@ -641,7 +641,7 @@ int function_graph_enter(unsigned long ret, unsigned long func, > > { > > for_each_set_bit(i, &fgraph_array_bitmask, > > sizeof(fgraph_array_bitmask) * BITS_PER_BYTE) { > > - struct fgraph_ops *gops = fgraph_array[i]; > > + struct fgraph_ops *gops = READ_ONCE(fgraph_array[i]); > > int save_curr_ret_stack; > > > > if (gops == &fgraph_stub) > > > > > > Because if the compiler decides to re-read gops from fgraph_array[i] after the > > above check for the following line that does: > > > > save_curr_ret_stack = current->curr_ret_stack; > > if (ftrace_ops_test(&gops->ops, func, NULL) && > > gops->entryfunc(&trace, gops)) > > bitmap |= BIT(i); > > > > > > and gops now points to fgraph_stub, it will trigger this bug. > > > > Can you apply the above change and see if the bug goes away? > > I will apply this patch and run the test in a loop. > Since it is only seen once. Not sure I could validate this and confirm. We could just look at the code that clang produced and see if it accesses the fgraph_array[] again. If this was the cause, it would show up it in the code. But regardless, I think I'm going to add that READ_ONCE() anyway, because it is legitimate for the compiler to do the above without it. Thanks, -- Steve