From mboxrd@z Thu Jan 1 00:00:00 1970 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 97F51C00140 for ; Mon, 8 Aug 2022 12:32:06 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jjbrBghgojN98PSAy2X5hB0pZiUZozb9jyCV1WgqfGM=; b=Jy9uKn+qQIZqSs LQ7UUh+lo7z7ZRuxFZtv5ojORNtmSqLovOuAENdq8tnmrqn1tiVAXVRIEAwtMtrw+9M8kMdZuR+kQ xvRpAPIjzHTTKUjVCEmtx53LJqZirkMhIaloYNiu/t/yNBkgCHheliDVHSqsAOPkv4dND5bnreR5Z zYNljgalZxHSeqy4MEBTAyRNE0TJ3iBhX6D8WyVOfQs+KjK+R+98eY1yrgW/JkQ7rqpLfBgJx28Z6 rJ2YnvdyPyefTlLABLjaqnr9iYPErytTkfaNgdkGKCYIOm4DHNniQF+Ki9YfRkapiS1pfragjdimo 1l803pmzS6R9hBsAo+OA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oL1uW-00Dhs1-8W; Mon, 08 Aug 2022 12:31:08 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oL1uS-00Dhn9-JJ for linux-arm-kernel@lists.infradead.org; Mon, 08 Aug 2022 12:31:06 +0000 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 E9E6BED1; Mon, 8 Aug 2022 05:31:01 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.44.193]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 052153F5A1; Mon, 8 Aug 2022 05:30:58 -0700 (PDT) Date: Mon, 8 Aug 2022 13:30:55 +0100 From: Mark Rutland To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, broonie@kernel.org, catalin.marinas@arm.com, james.morse@arm.com, kaleshsingh@google.com, madvenka@linux.microsoft.com, maz@kernel.org, tabba@google.com Subject: Re: [PATCH v2 6/8] arm64: stacktrace: remove stack type from fp translator Message-ID: References: <20220805124522.706457-1-mark.rutland@arm.com> <20220805124522.706457-7-mark.rutland@arm.com> <20220808115534.GB32107@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220808_053104_710525_244DECE9 X-CRM114-Status: GOOD ( 19.75 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Aug 08, 2022 at 01:08:42PM +0100, Mark Rutland wrote: > On Mon, Aug 08, 2022 at 12:55:35PM +0100, Will Deacon wrote: > > On Fri, Aug 05, 2022 at 01:45:20PM +0100, Mark Rutland wrote: > > > > /* > > > * kvm_nvhe_stack_kern_va - Convert KVM nVHE HYP stack addresses to a kernel VAs > > > * > > > @@ -34,27 +62,31 @@ > > > * Returns true on success and updates @addr to its corresponding kernel VA; > > > * otherwise returns false. > > > */ > > > -static bool kvm_nvhe_stack_kern_va(unsigned long *addr, > > > - enum stack_type type) > > > +static bool kvm_nvhe_stack_kern_va(unsigned long *addr) > > > { > > > struct kvm_nvhe_stacktrace_info *stacktrace_info; > > > unsigned long hyp_base, kern_base, hyp_offset; > > > + struct stack_info stack; > > > > > > stacktrace_info = this_cpu_ptr_nvhe_sym(kvm_stacktrace_info); > > > > > > - switch (type) { > > > - case STACK_TYPE_HYP: > > > + stack = stackinfo_get_hyp(); > > > + if (stackinfo_on_stack(&stack, *addr, 1)) { > > > kern_base = (unsigned long)*this_cpu_ptr(&kvm_arm_hyp_stack_page); > > > hyp_base = (unsigned long)stacktrace_info->stack_base; > > > - break; > > > - case STACK_TYPE_OVERFLOW: > > > + goto found; > > > + } > > > + > > > + stack = stackinfo_get_overflow(); > > > + if (stackinfo_on_stack(&stack, *addr, 1)) { > > > > Why is '1' the appropriate size for these two checks, given that addr points > > at an unsigned long? > > That's a fair point. > > My original rationale was that this was equivalent to the existing bheaviour, > since the range has arleady been checked, but I agree it's not nice, and won't > be right later in the series. > > I'll adjust this to take an explicit size argument; the existing caller can > pass in sizeof(unsigned long), and it can be reused for other sized objects in > future. FWIW, I've locally refactored this to take a size, and wrapped it with: static bool kvm_nvhe_stack_kern_record_va(unsigned long *addr) { return kvm_nvhe_stack_kern_va(addr, 16); } ... since the frame record is actually two 8-byte values, and that matches what unwind_next_frame_record() checks. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel