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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A7ED3C3ABB2 for ; Mon, 16 Sep 2024 10:49:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TFuK5S8ppIHmZYG3Axev2zHBowrYvgWSkbnTKV3dF9s=; b=NbSE8sBKt06/fnLy0yQBU1H0sy bGK3C8pZORggsSWAQGkaAikqd3TGmSU0FYtpFKTWZtoP1B2kQ5v505EEf2a1aOudepCYP7aQqdaGs dZfS3GO13bQDh9oRGsYnKP1FWJQvUFapKyH7SFMxzMn5d5ZeNbRpXzPFgiWz04+u5xtLdMCjBs4cT CFcl2/vhp5h5kuaol5M8dciYoUlwK8Aby0I7rV5OHsTaPvEaOJJ8ywYMsq91ls0GZgOnkEnz99JOl ReCEZ+EAI6VUEp4f1F1n+KG/5ZxD89G3h7NxsMTHz1YKKQQinIfkQrA4Df0FsyilFeS+bRyghgQHE SDe7bVyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sq9Hy-00000003mE4-0mfo; Mon, 16 Sep 2024 10:49:02 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sq97u-00000003kDs-1BGC for linux-arm-kernel@lists.infradead.org; Mon, 16 Sep 2024 10:38:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726483117; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TFuK5S8ppIHmZYG3Axev2zHBowrYvgWSkbnTKV3dF9s=; b=BAaj1WBwRTpJ0ufNgJjTbCZ90oPiTVmVfiZCmXE4Zf3E/KNA6Ak21Z6g9agy623CGPV4dW /Y3TH7TJBhdbOdaV1EIwxRaMRCAuGR8waNCK6ujEyQB6QZxXEEHSuO3vkJ3H3tiJn5yAqc dqSpPaMM8YctbwGH04zLbAEes7Akhnk= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-lhl6jNH1ORazlwaAqRgEWg-1; Mon, 16 Sep 2024 06:38:31 -0400 X-MC-Unique: lhl6jNH1ORazlwaAqRgEWg-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4A4DE19560AB; Mon, 16 Sep 2024 10:38:29 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.225.82]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id EE06D195605A; Mon, 16 Sep 2024 10:38:24 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 16 Sep 2024 12:38:16 +0200 (CEST) Date: Mon, 16 Sep 2024 12:38:11 +0200 From: Oleg Nesterov To: Steven Rostedt , Masami Hiramatsu , Catalin Marinas , Will Deacon , Puranjay Mohan , Mark Rutland , Mark Brown , Kalesh Singh , chenqiwu Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: arm64: stacktrace: WARN_ON(state->common.pc == orig_pc) in kunwind_recover_return_address() Message-ID: <20240916103811.GA14111@redhat.com> References: <20240916102741.GA13899@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240916102741.GA13899@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240916_033838_566418_3EBF2E92 X-CRM114-Status: GOOD ( 17.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Ah, sorry for the noise, I looked into the wrong tree, missed the recent c060f93253ca ("arm64: stacktrace: fix the usage of ftrace_graph_ret_addr()") On 09/16, Oleg Nesterov wrote: > > I don't know the details but people report that > kunwind_recover_return_address() hits this warning. > > I know absolutely nothing about arm64 or kernel/trace/fgraph.c, but at > first glance this code looks broken: > > kunwind_recover_return_address: > > ... > > orig_pc = ftrace_graph_ret_addr(state->task, NULL, > state->common.pc, > (void *)state->common.fp); > if (WARN_ON_ONCE(state->common.pc == orig_pc)) > > ftrace_graph_ret_addr: > > ... > > if (!idx) > return ret; > > > given that kunwind_recover_return_address() passes idx == NULL to > ftrace_graph_ret_addr(), it should always return ret == state->common.pc ? > > > Perhaps this connects to 29c1c24a27 ("function_graph: Fix up ftrace_graph_ret_addr()") > and I have no idea if something like the patch below makes any sense. > > Oleg. > > --- a/arch/arm64/kernel/stacktrace.c > +++ b/arch/arm64/kernel/stacktrace.c > @@ -106,7 +106,8 @@ kunwind_recover_return_address(struct kunwind_state *state) > if (state->task->ret_stack && > (state->common.pc == (unsigned long)return_to_handler)) { > unsigned long orig_pc; > - orig_pc = ftrace_graph_ret_addr(state->task, NULL, > + orig_pc = ftrace_graph_ret_addr(state->task, > + &state->task->curr_ret_stack, > state->common.pc, > (void *)state->common.fp); > if (WARN_ON_ONCE(state->common.pc == orig_pc))