Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp505617rwb; Thu, 18 Aug 2022 07:32:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR4VeChIX3vQr3y/gyRKnVYkQ90IQnIrd8TupaFNKHhjtS0LZ7Tz9uXBzRMuBBNUSLnUa0Bl X-Received: by 2002:a05:6402:3687:b0:43c:e5d3:d50d with SMTP id ej7-20020a056402368700b0043ce5d3d50dmr2618259edb.174.1660833147074; Thu, 18 Aug 2022 07:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660833147; cv=none; d=google.com; s=arc-20160816; b=Jcr1TQxfhgNJc1zR38YofnFVDY0Ja6Mn4SCLMTdwglGCmDA8smYJv7zKVGGx4k2tXb Cqb0hxnMIklRD8VyCEknitN2rAihyA5/KYzD8nPSfTbQa9Ib6aEkd7cf4yBrzYsRxGSM oiLLr1JU1BzE+8/bPvl/DTgIuwpTpovHoaSnObELFUDZuI1VyffGEnhjVK1YAWwRbnpB cE7o/oV1p7IBUmmeWUPzJQvDGs7A/3x6ms5RlnM+AB9sPX0TaSBEJaXRL9TycyBp6ETN jqpzO0RpXRVKS7whEDdEjsWwpw82aonijasR8/xd/V+aB2yI+ywzgaPka7TIjbVmjMPl f4kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=SegO/NOYZRSeQQIzvU3mVUuCFwX21ClYgWYkHbmFQx4=; b=nMlgjjM9cWx6Jf/MY92+Duv6qL0Xx9rg3nPibZsTcppjGek3TBaepscR4t2QnHv3rX gn87DxW+/D/H6eyfQ4EKQ7P9fjQxW9HVkB/t3QvqNZbr1f23olh1CPcsKkSD6XaszkkH GkXTRpDj2qPbu05IsO9YPjs2+Z+Uwt2rzdEcyEJsFvO5P2RoJtiXnlywTNisYgl81ZST bEB3AHd5QU4eMTE39X713l+xUirYb/XTTGeV4DS9rTgFh149a9kFEsZsw6257Z9EpuPn /riJK/VoSWe1nc0OAoyRPXzIwNH0Hmj/5YjDisMwbAzmaJV0zo0ZuE8BLbiMToM5BIth 67BA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x22-20020a170906711600b0072b67a5560fsi1017062ejj.1005.2022.08.18.07.32.00; Thu, 18 Aug 2022 07:32:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245613AbiHROAI (ORCPT + 99 others); Thu, 18 Aug 2022 10:00:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245478AbiHRN7s (ORCPT ); Thu, 18 Aug 2022 09:59:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55BFA65573 for ; Thu, 18 Aug 2022 06:59: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 ams.source.kernel.org (Postfix) with ESMTPS id C27ADB82175 for ; Thu, 18 Aug 2022 13:59:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E13AC433D6; Thu, 18 Aug 2022 13:59:34 +0000 (UTC) Date: Thu, 18 Aug 2022 09:59:44 -0400 From: Steven Rostedt To: Chen Zhongjin Cc: , , , , , , , , Subject: Re: [PATCH] x86/unwind/orc: unwind ftrace trampolines with correct orc Message-ID: <20220818095944.5fbe3e8e@gandalf.local.home> In-Reply-To: <24556707-99b3-ec3c-c176-cb73e1d030d8@huawei.com> References: <20220818015525.222053-1-chenzhongjin@huawei.com> <20220817222836.72aa77bd@gandalf.local.home> <24556707-99b3-ec3c-c176-cb73e1d030d8@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 X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 18 Aug 2022 11:42:17 +0800 Chen Zhongjin wrote: > Thanks for review! > > > On 2022/8/18 10:28, Steven Rostedt wrote: > > On Thu, 18 Aug 2022 09:55:25 +0800 > > Chen Zhongjin wrote: > > > > > >> arch/x86/kernel/unwind_orc.c | 13 ++++++++----- > >> 1 file changed, 8 insertions(+), 5 deletions(-) > >> > >> diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c > >> index 38185aedf7d1..a938c5d0ed6f 100644 > >> --- a/arch/x86/kernel/unwind_orc.c > >> +++ b/arch/x86/kernel/unwind_orc.c > >> @@ -93,22 +93,25 @@ static struct orc_entry *orc_find(unsigned long ip); > >> static struct orc_entry *orc_ftrace_find(unsigned long ip) > >> { > >> struct ftrace_ops *ops; > >> - unsigned long caller; > >> + unsigned long tramp_addr, offset; > >> > >> ops = ftrace_ops_trampoline(ip); > >> if (!ops) > >> return NULL; > >> > > Now if this is that unlikely recursion mentioned below then ops->trampoline > > will be NULL, and if we do that offset addition, it will be incorrect. > > > > Perhaps we should add here: > > > > if (!ops->trampoline) > > return NULL; > > I think when this will return NULL and then stop at orc_find:`if (ip == > 0)` and return null_orc_entry. > Duh, you're correct. I wasn't paying attention to how we acquired ops. Yes, if ops->trampoline is NULL, then it will never be returned by ftrace_ops_trampoline(). > > > > Let's add some comments. > > Makes sense. > > If the above explanation logic is fine, I'll add this comment and send v2. > Yes, just add the comments for v2. Thanks, -- Steve