From patchwork Thu Jul 21 05:57:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalesh Singh X-Patchwork-Id: 12924739 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 9800FC43334 for ; Thu, 21 Jul 2022 06:00:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=g8qzYjNkpOlH7dUvBDdvs6e/Nfu/MqBtOVp1JV2csw0=; b=OD7EUW7h+c24w+fRJfmZ4DzJJy fpCeUsjO0JBTiIhNKWfw3f0HmQa0okKMTvsC2yxRo4tiGGp1MoPOVTknrxFqBzrjo2jkomGx5H0y+ sLUEQNP/e34FQdU6C9N2Q4KPXa4P+Cq6lgo2RaNPQFvPma3ZP5G3RxQItly7XJvARDFeedXZg+dn9 uRoWus2kf4WGXb37x4w9VScSFd22ttc33pradK+OkT5GTFNxnLqysYR+R2FZTwaAsfCK2V7Jhvcdx c352PJqbt9uU7q1TzHE/kSbxaZhf5U8NptMQTlVXSc/VrY9wixyZ87dStZG6rCnuY20vErXSTW1MN dGo1XCog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEPDj-000Y3O-D4; Thu, 21 Jul 2022 05:59:35 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEPC1-000WiF-L0 for linux-arm-kernel@lists.infradead.org; Thu, 21 Jul 2022 05:57:50 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-31cd7ade3d6so6794297b3.3 for ; Wed, 20 Jul 2022 22:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=iLoEKCBMnlFKYYYcN0OANFAEglV5FtD84V5LcwTvHwg=; b=iOS+USjx9NgCbUY4yL44SP1DEiSpvV4mn2X29qjPNJNxKeAXL+qsxjnw4XKuHrWeBy QD0Wm6fBKb8nu9zx4zo5TptOXWfccSlTjHBGDDSGFcaD8PPGK+TGhkHKPtLrzs/KbRJb H1SNm2km8Suv1iEJCtBPfDgjv+umAyAcBIe7aADByBmfws/QIkHBnZGLBs2FyCKyknys Gtc+j9+p2a6y9rCrUFts1wK/l0PmmdJjS5v5wA2EQwS66QfFDOyrTjSXddAEmXiHYdcB AeG3gM/Zw1g5oLlyQyCa7GCwb20o7b95xy2/Spd817zI5klqXWnSZI3hO3OG78CFY969 RoKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=iLoEKCBMnlFKYYYcN0OANFAEglV5FtD84V5LcwTvHwg=; b=uIjwxkQZslaO3SDvTzpL8yPGEBUz2IFhLaQUDIhI1nRbtr+qRKRfjF9eBlA7IX1+mh g5ZQx4rs1e30q9oBqp4zF3vHVz6OwbEIEtvtHKN3Zp8lGYbaM1RcXNDqCZJZe+il6FIt sXNvpxYcBq9miYZpuJgEgbefgSzlFvOynSSm1ft7s8yWuzqZkwCC9VqL+wHvHXiAa7kr VjzFh6iV4qJzeQhFYx21pE3I6OKKaIfr3KCDO0YNpMtwct8uJhjVzdjsL2JR/GFzbjdl IEYrClZVlOOMuLToxrMWMqb5IQNCUuvX5V0hlmwS18zBPxNP+zu1LSSxFgcLOaPoT3bk OOSQ== X-Gm-Message-State: AJIora/77ZqJhQd3wzN3HdTdnWFaRd+GyOl/eOIn5DYyn8oIDN9XHZFE fjzpwsgesFwPk6A1BQnspkt/eVBj8XNoreDgOw== X-Google-Smtp-Source: AGRyM1vQM1i7bebcbDD5BeZRxIvCI5qJDGD+svsXThCao0+6CLL/xgSSD/QNovAdrA91Ct+RzSbDrGrdlDrjB3F5wA== X-Received: from kaleshsingh.mtv.corp.google.com ([2620:15c:211:200:5a87:b61e:76b5:d1e0]) (user=kaleshsingh job=sendgmr) by 2002:a81:57c3:0:b0:31d:e2dd:116 with SMTP id l186-20020a8157c3000000b0031de2dd0116mr34878043ywb.5.1658383068317; Wed, 20 Jul 2022 22:57:48 -0700 (PDT) Date: Wed, 20 Jul 2022 22:57:17 -0700 In-Reply-To: <20220721055728.718573-1-kaleshsingh@google.com> Message-Id: <20220721055728.718573-7-kaleshsingh@google.com> Mime-Version: 1.0 References: <20220721055728.718573-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.37.0.170.g444d1eabd0-goog Subject: [PATCH v5 06/17] arm64: stacktrace: Add description of stacktrace/common.h From: Kalesh Singh To: maz@kernel.org, mark.rutland@arm.com, broonie@kernel.org, madvenka@linux.microsoft.com, tabba@google.com Cc: will@kernel.org, qperret@google.com, kaleshsingh@google.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, andreyknvl@gmail.com, vincenzo.frascino@arm.com, mhiramat@kernel.org, ast@kernel.org, drjones@redhat.com, wangkefeng.wang@huawei.com, elver@google.com, keirf@google.com, yuzenghui@huawei.com, ardb@kernel.org, oupton@google.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, android-mm@google.com, kernel-team@android.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220720_225749_713262_6907F7C4 X-CRM114-Status: GOOD ( 10.31 ) 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 Add brief description on how to use stacktrace/common.h to implement a stack unwinder. Signed-off-by: Kalesh Singh Reviewed-by: Fuad Tabba --- Changes in v5: - Add short description of each required function, per Fuad and Marc - Add Reviewed-by tag from Fuad arch/arm64/include/asm/stacktrace/common.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/arm64/include/asm/stacktrace/common.h b/arch/arm64/include/asm/stacktrace/common.h index 7807752aaab1..be7920ba70b0 100644 --- a/arch/arm64/include/asm/stacktrace/common.h +++ b/arch/arm64/include/asm/stacktrace/common.h @@ -2,6 +2,21 @@ /* * Common arm64 stack unwinder code. * + * To implement a new arm64 stack unwinder: + * 1) Include this header + * + * 2) Provide implementations for the following functions: + * on_overflow_stack(): Returns true if SP is on the overflow + * stack. + * on_accessible_stack(): Returns true is SP is on any accessible + * stack. + * unwind_next(): Performs validation checks on the frame + * pointer, and transitions unwind_state + * to the next frame. + * + * See: arch/arm64/include/asm/stacktrace.h for reference + * implementations. + * * Copyright (C) 2012 ARM Ltd. */ #ifndef __ASM_STACKTRACE_COMMON_H