Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp884302pxb; Wed, 27 Oct 2021 14:26:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxN61LoDmbEsz6IBaz+B76xogagxGp/L245FWfWLkmiP3wuYR0vJgDZ3qwd3sWnznuZTl5H X-Received: by 2002:a05:6a00:2343:b0:44d:2e13:3edf with SMTP id j3-20020a056a00234300b0044d2e133edfmr268033pfj.72.1635369994601; Wed, 27 Oct 2021 14:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635369994; cv=none; d=google.com; s=arc-20160816; b=mjJTDxUUaQC7joDgJCFyjo6JeNE/gtiprdROxgPG53dtxokqeUF4D9T6Vex1VhmbCi +wjMoUdFUv/sfL3EmQ+bG8Vj0Mvjp3GXoa5a/l8ml5SHEoSsCYRZmPqOhuhdhw4A47BG pFm3gBkVnmS+0fjWN+lmYW7zuV0TVY1sad96/9aOgfkO2NMA56FUNRD+UqZgIcLvKOiT 2/AcUGpSFDL0CE1OKY+hWN7IgyY1QmzO6O8L1l3bDHgb5m2iLNdH8E6SmJFjMnjCuAvZ IruiYZ9l5GRJrrn5FhJOQEDTF+CgQC8AnYETrrYLYlVzQhqe1J9sCyLpTnogi8ZexlVj XUNg== 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=FZi5bKui4buUzYVQcT2HWWMvMOfXFFBKZ80POF0sxNg=; b=gvIrRPwbwEmv06zxii7ADD2yfuEZnI/gg0LOH4AhP3tEkhD+RYs0KI0C0ISIJfNK5g XRk+OstMPRpwR0v2zLp1OMGyQXIqujPv9rCE7L57P/SvTykp9py3N3O+pbM+bDjnY8s/ CFRK6CHMYtPZ8TcQPzEzuvgSPD9NfBaJaqwBdZx+JOwLdS8SdoE5Adpqt6RU4J4bOwXl OGKAsEvr+tCLZC3Ubz0vnK+IdaeZMsZ3KdvbaKCAU3ImJEkof5PNBL8UdM3w1qFWV7Gj qZMgiTkqs6pbl3vBC10vYrHqdBP6XCHfKZV8wH/2a4O3mrh26RcYW9h8DQGkTs9qJIlv WpKg== 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 nl3si2164555pjb.37.2021.10.27.14.26.22; Wed, 27 Oct 2021 14:26:34 -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 S236301AbhJ0Neo (ORCPT + 97 others); Wed, 27 Oct 2021 09:34:44 -0400 Received: from foss.arm.com ([217.140.110.172]:43394 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230500AbhJ0Nen (ORCPT ); Wed, 27 Oct 2021 09:34:43 -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 94F7D1FB; Wed, 27 Oct 2021 06:32:17 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.72.240]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F18073F73D; Wed, 27 Oct 2021 06:32:14 -0700 (PDT) Date: Wed, 27 Oct 2021 14:32:12 +0100 From: Mark Rutland To: madvenka@linux.microsoft.com Cc: 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 Subject: Re: [PATCH v10 06/11] arm64: Make profile_pc() use arch_stack_walk() Message-ID: <20211027133212.GG54628@C02TD0UTHF1T.local> References: <20211015025847.17694-1-madvenka@linux.microsoft.com> <20211015025847.17694-7-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211015025847.17694-7-madvenka@linux.microsoft.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 14, 2021 at 09:58:42PM -0500, madvenka@linux.microsoft.com wrote: > 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; This can go -- the first call to profile_pc_cb() will use regs->pc. With that gone, and the include updates to use : Reviewed-by: Mark Rutland Mark. > - 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 >