Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1230501ybj; Thu, 7 May 2020 18:32:08 -0700 (PDT) X-Google-Smtp-Source: APiQypKFXDb+IdSQm9M1LHpC3mbF/RnGGLmln548yQAHIH+XVnIvFkuufcejfOMJbWTF/OsJmGCF X-Received: by 2002:a17:906:1fd6:: with SMTP id e22mr15197136ejt.150.1588901528237; Thu, 07 May 2020 18:32:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588901528; cv=none; d=google.com; s=arc-20160816; b=d6H16cCsCLMxknOKLN+CtREK3ma0ixRBc3eYn5dGrUfHb8jrbwSjK3FPAWYAqVumJb sX90eAjc52fIH5xDf53TtM7gyCq8rYWN7drSbzCiptppHsx1EfZ6YgSSblIIdsh5gRBr Ncc2L25SQLvsQ3CgWTc6zVzVA4prvzryd55nlK/OteNWlPmxeMpKVRmS+DeNw2s+hpVg M/+SRYVZImh8HQfJQ6jbXhAM6ZYEvDWv3YnnbPtyCt9Q+MREdHwQO6Z65K3IQRMBiIGq WwchIrnDFhoJj+x/JIK2GJaB64zmN1u4Q3+CCtR+wIF75WMvqUiWl3jUPz7wFtrkFEXQ MgoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Fts5xFWyd7Do6Ow9J40xno3laJDOrJKQM3UolI/9uto=; b=ndJ6X1Y8UeQrI6SB8WDdUsPnST+rPBLZyqzOf49qYkOvAPyQIKB60o3zEQB52o7J1I QJJUR9ep1ha6KwRRm0K5YFu+7JImnjGI4qGLauVqas9BE7/Js/7sqJgrK6tIwHSI8fHf yIs8pUbrAgL/J8kk62IT1nJLEgw8eX6r4QwBnfvc5tW+bj0ZCM0Jc5Gh0AeBuULBH2Ag CIdGDgY62QHpfK5WX60OEOWxwXl74QwUMXawgZXuxpcYCGyhz+jWH/iNJBORTje+z4rx hsv2TGP2blQ5YqRRYG68NqTQ/268Z73KfA5Yrw13vueHX0wZ4rwnFrxtdzdWH+r83lLI kXtw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si97971edv.171.2020.05.07.18.31.45; Thu, 07 May 2020 18:32:08 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726843AbgEHBaZ (ORCPT + 99 others); Thu, 7 May 2020 21:30:25 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3905 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726518AbgEHBaY (ORCPT ); Thu, 7 May 2020 21:30:24 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 4002391465909247DBE8; Fri, 8 May 2020 09:29:33 +0800 (CST) Received: from [127.0.0.1] (10.166.215.237) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Fri, 8 May 2020 09:29:25 +0800 Subject: Re: [PATCH] arm64: stacktrace: Factor out some common code info on_stack() To: Will Deacon CC: , , , , <0x7f454c46@gmail.com>, , , , , , References: <10b188af-a03b-3acc-8a06-cf31a46f735a@huawei.com> <20200507135213.GA32706@willie-the-truck> From: Yunfeng Ye Message-ID: <15e31e59-3429-53f8-bb61-5f60c90fa856@huawei.com> Date: Fri, 8 May 2020 09:29:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20200507135213.GA32706@willie-the-truck> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.166.215.237] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/5/7 21:52, Will Deacon wrote: > On Thu, May 07, 2020 at 05:28:19PM +0800, Yunfeng Ye wrote: >> diff --git a/arch/arm64/include/asm/stacktrace.h b/arch/arm64/include/asm/stacktrace.h >> index fdb913cc0bcb..b92bef2fb6cd 100644 >> --- a/arch/arm64/include/asm/stacktrace.h >> +++ b/arch/arm64/include/asm/stacktrace.h >> @@ -69,27 +69,40 @@ extern void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk, >> >> DECLARE_PER_CPU(unsigned long *, irq_stack_ptr); >> >> -static inline bool on_irq_stack(unsigned long sp, >> +static inline bool on_stack(unsigned long sp, unsigned long low, >> + unsigned long high, enum stack_type type, >> struct stack_info *info) >> { >> - unsigned long low = (unsigned long)raw_cpu_read(irq_stack_ptr); >> - unsigned long high = low + IRQ_STACK_SIZE; >> - >> - if (!low) >> - return false; >> - >> if (sp < low || sp >= high) >> return false; >> >> if (info) { >> info->low = low; >> info->high = high; >> - info->type = STACK_TYPE_IRQ; >> + info->type = type; >> } >> - >> return true; >> } >> >> +static inline bool on_valid_stack(unsigned long sp, unsigned long low, >> + unsigned long high, enum stack_type type, >> + struct stack_info *info) >> +{ >> + if (!low) >> + return false; >> + >> + return on_stack(sp, low, high, type, info); >> +} > > Do we need this as distinct from on_stack()? Afaict, 'low' is never > going to be NULL for the on_stack() callers, so I suggest just having > on_stack() check 'low' and getting everybody to call that instead. > > Make sense? > ok, I will modify and send the patch v2, thanks. > Will > > . >