Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3428637pxf; Mon, 22 Mar 2021 06:20:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYg51kVNXWHfmoe5+/XJUpK37ALcVWCu/asx7mkUEAVuEoZdAz9rETyDYWxN9KUBxv0b+f X-Received: by 2002:a17:906:2e01:: with SMTP id n1mr18893751eji.537.1616419201548; Mon, 22 Mar 2021 06:20:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616419201; cv=none; d=google.com; s=arc-20160816; b=PIvARisnv8sdnN9i48ew14xGUgII6Sawim9huLzEgWQ4vhuMzk9sqT0uC1hgMHUCyl MBMRifxZAiR5njCWHkMMUICrx0yqPU2/tzhOZBuzuaAu+RlNJQ+fczCNnH/6AdH0bF52 xI1oFLbO4hdZ+0p4r9Sou+6OOg49aFQK1W7vG904M8WniFxT4KP+mbzNn/NTCYcSGrrN 9vdE/ZpotXS+TCLi3xyDG3Cwkg9I4RbfPqoiPCsCx+mYTAADi0JjY8Sp0oZCL0/70VvW V1wxi60UQC3QPXPEX+6qsibSQnv8mUEsRC4nMyPibEWsb2SL4XrVfMppT5Omml0VWws6 OeEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ZBbP8U2jU0Ml2YqiTpGHXPbX5nHM3xtQv+qFuXkCP9I=; b=pnZyaqH76NIsz0QdpWhi7YNhTRc/bcTU+K+O+sukUsqNvbZqqaGcjx+llLEN+Je05b vvEMn0G+lmYND1Y2i6jR4r8y6CofrMX7WR5daGa5QumA/wYr6dvdsa2W7/ZmSyszbKIT cnieVnwJ9JvxziUSok1aqAYtSvRmDLkMfNs/SDS1+oBeApZrVMNwesN6AfGlp34UL1fU B9rZAyx6PPBCEIc0CfyKA0Fs0AYR53wxj5WihqrTd/paNwNjbjaHXbSe7c2N7m/7UCDF pwUhl2De8CVDqB8o6T8hSHKT08npT4hyYYLpSgRsK95RQJX4dncPqAE6+C8dRxaxdMFk mURA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x4si11945136edd.118.2021.03.22.06.19.38; Mon, 22 Mar 2021 06:20:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232901AbhCVNPt (ORCPT + 99 others); Mon, 22 Mar 2021 09:15:49 -0400 Received: from foss.arm.com ([217.140.110.172]:59722 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233029AbhCVNCW (ORCPT ); Mon, 22 Mar 2021 09:02:22 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E2A531042; Mon, 22 Mar 2021 06:02:21 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.23.154]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 607AF3F719; Mon, 22 Mar 2021 06:02:20 -0700 (PDT) Date: Mon, 22 Mar 2021 13:01:58 +0000 From: Mark Rutland To: Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Chen Jun , Marco Elver , Mark Brown Subject: Re: [PATCH] arm64: stacktrace: don't trace arch_stack_walk() Message-ID: <20210322130158.GA78652@C02TD0UTHF1T.local> References: <20210319184106.5688-1-mark.rutland@arm.com> <20210319190205.GI6832@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210319190205.GI6832@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 19, 2021 at 07:02:06PM +0000, Catalin Marinas wrote: > On Fri, Mar 19, 2021 at 06:41:06PM +0000, Mark Rutland wrote: > > We recently converted arm64 to use arch_stack_walk() in commit: > > > > 5fc57df2f6fd ("arm64: stacktrace: Convert to ARCH_STACKWALK") > > > > The core stacktrace code expects that (when tracing the current task) > > arch_stack_walk() starts a trace at its caller, and does not include > > itself in the trace. However, arm64's arch_stack_walk() includes itself, > > and so traces include one more entry than callers expect. The core > > stacktrace code which calls arch_stack_walk() tries to skip a number of > > entries to prevent itself appearing in a trace, and the additional entry > > prevents skipping one of the core stacktrace functions, leaving this in > > the trace unexpectedly. > > > > We can fix this by having arm64's arch_stack_walk() begin the trace with > > its caller. The first value returned by the trace will be > > __builtin_return_address(0), i.e. the caller of arch_stack_walk(). The > > first frame record to be unwound will be __builtin_frame_address(1), > > i.e. the caller's frame record. To prevent surprises, arch_stack_walk() > > is also marked noinline. [...] > > Fixes: 5fc57df2f6fd ("arm64: stacktrace: Convert to ARCH_STACKWALK") > > Signed-off-by: Mark Rutland > > Cc: Catalin Marinas > > Cc: Chen Jun > > Cc: Marco Elver > > Cc: Mark Brown > > Cc: Will Deacon > > Thanks Mark. I think we should add a cc stable, just with Fixes doesn't > always seem to end up in a stable kernel: > > Cc: # 5.10.x Makes sense to me, sure. > With that: > > Reviewed-by: Catalin Marinas Thanks! Will, I assume you're happy to fold in the above when picking this. If you'd prefer I repost with that folded in, please let me know! Mark.