Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp219794pxb; Fri, 15 Oct 2021 04:16:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzda8BcfExn+FTp5aP5ndZduRUk/7jdIKoaj827h53Pv0ntEmy+GxhO5qM8N5G8SaB2yo15 X-Received: by 2002:a17:90b:1c82:: with SMTP id oo2mr13135323pjb.53.1634296596785; Fri, 15 Oct 2021 04:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634296596; cv=none; d=google.com; s=arc-20160816; b=YVgXBe0kMmeEz+TbPPtA9YordYt8bXVjlSjH/4LAcqbKmG+x3uVTgH2MGJC2xP3eQS L7z6mO1bLctv/AVCcYG+ytlGuVTB7khhDcs69jUMykflNg/WCI8MlsZMkWmotIDnbJl9 KFEYaB4jVQJyYMIXj/rPxMCFCn1KQu1/kFlB7Js4+ZCtLfC3w85nIgWrt/M+OCvA85Yz 830YCwKYjDIToSo6iVgeGuZU1fC+YywXlU2SBb8l0HxS0FNK8S1A0O1ldorGTzQG5mp/ QdwDHCyNXFoJXpGY396xXRKHtqriBCuJx6k8zcXC1gR08cA+nokYJy/vnj15j/8zyXIL 84xA== 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:date:subject:to:from :dkim-signature:dkim-filter; bh=AbsOg32zRR78sDGzy2GosMMSEjrzSM+M26cFHMLFAG8=; b=ViD9iMyx87omzUwj4oLqx2y/euNqqy1Vy1I7ENJ8lfeElxvUReoA1Lh7pbUvvM94rG woOFKxN80tA93U4Ajg0tGU8Mnf8lH/6VPEMptBrOPGE6ndrci9nJNqhubnpP8/r6aphG A2AJo4snntbvI8jb9atXbEQoARdW68GM+mKJ0fKo+KDY3jRZiBy+ktMuPSUBwNKfH7UG 8YNPtleBC23KElpX89KYLvkbFp/8Mvl3vQQIKZyKv3LQCdrp/zx0xFROgjpFHG26frOj k4sdD9VWxCV5r2HE4DIxoLfswN1ROmIw7I8K9OQdlJK9nuLzjqsHLHSGu2aKEaBKVRRj HYIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=W99bk7UU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gx24si15174745pjb.148.2021.10.15.04.16.25; Fri, 15 Oct 2021 04:16:36 -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; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=W99bk7UU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235238AbhJODBa (ORCPT + 99 others); Thu, 14 Oct 2021 23:01:30 -0400 Received: from linux.microsoft.com ([13.77.154.182]:58230 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235163AbhJODBP (ORCPT ); Thu, 14 Oct 2021 23:01:15 -0400 Received: from x64host.home (unknown [47.187.212.181]) by linux.microsoft.com (Postfix) with ESMTPSA id C4ADE20B9D1F; Thu, 14 Oct 2021 19:59:08 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C4ADE20B9D1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1634266749; bh=AbsOg32zRR78sDGzy2GosMMSEjrzSM+M26cFHMLFAG8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=W99bk7UUpwMSkgC1O2Zv4U0eCLxuvDIFVIigzukEQ2lODesesNjQ64Qld6Ns2vDFT GrplwDA0Vp3KBd+Yw6WvNnj2CHh5lBHCX8oKZE1aY2pF5kgMot7dhJciDNBPLCh8o1 P7w0YdslWDZVSHE0lcETyhw/5FV4PyInJLIVLkM0= From: madvenka@linux.microsoft.com To: mark.rutland@arm.com, broonie@kernel.org, jpoimboe@redhat.com, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, madvenka@linux.microsoft.com Subject: [PATCH v10 06/11] arm64: Make profile_pc() use arch_stack_walk() Date: Thu, 14 Oct 2021 21:58:42 -0500 Message-Id: <20211015025847.17694-7-madvenka@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211015025847.17694-1-madvenka@linux.microsoft.com> References: <20211015025847.17694-1-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Madhavan T. Venkataraman" Currently, profile_pc() in ARM64 code walks the stack using start_backtrace() and unwind_frame(). Make it use arch_stack_walk() instead. This makes maintenance easier. Signed-off-by: Madhavan T. Venkataraman --- arch/arm64/kernel/time.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c index eebbc8d7123e..671b3038a772 100644 --- a/arch/arm64/kernel/time.c +++ b/arch/arm64/kernel/time.c @@ -32,22 +32,26 @@ #include #include +static bool profile_pc_cb(void *arg, unsigned long pc) +{ + unsigned long *prof_pc = arg; + + if (in_lock_functions(pc)) + return true; + *prof_pc = pc; + return false; +} + unsigned long profile_pc(struct pt_regs *regs) { - struct stackframe frame; + unsigned long prof_pc = 0; if (!in_lock_functions(regs->pc)) return regs->pc; - start_backtrace(&frame, regs->regs[29], regs->pc); - - do { - int ret = unwind_frame(NULL, &frame); - if (ret < 0) - return 0; - } while (in_lock_functions(frame.pc)); + arch_stack_walk(profile_pc_cb, &prof_pc, current, regs); - return frame.pc; + return prof_pc; } EXPORT_SYMBOL(profile_pc); -- 2.25.1