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 X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 148C5C43381 for ; Fri, 19 Mar 2021 14:42:24 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A877764F4D for ; Fri, 19 Mar 2021 14:42:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A877764F4D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mZu2JnuTeiSRRWth5IfZWg5LkCP/qdREk6RBSpOADsE=; b=N9XIc1OsX/POw+GHLWDuNb0T6 18+cdX+YMiY5vKUv73t49hVCe3eX598DFvPmozAjNgv6Vs47D9eWezALdzvAelzTK3BLNmiXIdqwy YA54ObtuznHKdwj/z2alYHbyv45rNfrqYA3xrD8wkCifU3DhvlWZXBWlA+R+0KzzMV9fLNm1g7Qb7 Auk5rmzzvXnvNQCYmCSOfVUTfAmBtprdcTL7OuHDmet2A/GfnaYyhe9BIt0klLBfrO+SnJiEi45WL VRmaT2pifembP3EacvyU+R/w5f0B0PCF+LaXNJLJC066UDjMQ+dLt5An0TsK5wYW/thf0T0B1aOTi UHu5jJWig==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNGJ2-007YcG-EV; Fri, 19 Mar 2021 14:40:52 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNGIz-007Ybq-1P for linux-arm-kernel@lists.infradead.org; Fri, 19 Mar 2021 14:40:51 +0000 Received: from [192.168.254.32] (unknown [47.187.194.202]) by linux.microsoft.com (Postfix) with ESMTPSA id 590E9209C398; Fri, 19 Mar 2021 07:40:47 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 590E9209C398 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1616164847; bh=1zQaqS/XbK07XWlK6cwo3q5bC7o/WeaNHXa0xXx1Uh4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=ZX8aqmUc05ndJQXno8dUB7gDV7LXoR7hrDnVhjLGeuSRcxQvspUMtnr7Bnpl1CqHZ RDn3Pp4u79tMqZYjFJhqTR6L0nUh8o61Xq5rM2z29rcmae23mNpTCh4Q8kLcGGNNJS B9/owhj8huMaPL8OhCK0tZTv9AHW/IWtOsRUSpCE= Subject: Re: [RFC PATCH v2 2/8] arm64: Implement frame types To: Mark Brown Cc: mark.rutland@arm.com, jpoimboe@redhat.com, jthierry@redhat.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org References: <5997dfe8d261a3a543667b83c902883c1e4bd270> <20210315165800.5948-1-madvenka@linux.microsoft.com> <20210315165800.5948-3-madvenka@linux.microsoft.com> <20210318174029.GM5469@sirena.org.uk> <6474b609-b624-f439-7bf7-61ce78ff7b83@linux.microsoft.com> <20210319132208.GD5619@sirena.org.uk> From: "Madhavan T. Venkataraman" Message-ID: Date: Fri, 19 Mar 2021 09:40:46 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210319132208.GD5619@sirena.org.uk> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210319_144049_485496_928F71E9 X-CRM114-Status: GOOD ( 37.10 ) 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 3/19/21 8:22 AM, Mark Brown wrote: > On Thu, Mar 18, 2021 at 05:22:49PM -0500, Madhavan T. Venkataraman wrote: >> On 3/18/21 12:40 PM, Mark Brown wrote: > >>> Unless I'm misreading what's going on here this is more trying to set a >>> type for the stack as a whole than for a specific stack frame. I'm also >>> finding this a bit confusing as the unwinder already tracks things it >>> calls frame types and it handles types that aren't covered here like >>> SDEI. At the very least there's a naming issue here. > >> Both these frames are on the task stack. So, it is not a stack type. > > OTOH it's also not something that applies to every frame but only to the > base frame from each stack which I think was more where I was coming > from there. In any case, the issue is also that there's already another > thing that the unwinder calls a frame type so there's at least that > collision which needs to be resolved if nothing else. > The base frame from each stack as well as intermediate marker frames such as the EL1 frame and the Ftrace frame. As for the frame type, I will try to come up with a better name. >>> Taking a step back though do we want to be tracking this via pt_regs? >>> It's reliant on us robustly finding the correct pt_regs and on having >>> the things that make the stack unreliable explicitly go in and set the >>> appropriate type. That seems like it will be error prone, I'd been >>> expecting to do something more like using sections to filter code for >>> unreliable features based on the addresses of the functions we find on >>> the stack or similar. This could still go wrong of course but there's >>> fewer moving pieces, and especially fewer moving pieces specific to >>> reliable stack trace. > >> In that case, I suggest doing both. That is, check the type as well >> as specific functions. For instance, in the EL1 pt_regs, in addition >> to the above checks, check the PC against el1_sync(), el1_irq() and >> el1_error(). I have suggested this in the cover letter. > >> If this is OK with you, we could do that. We want to make really sure that >> nothing goes wrong with detecting the exception frame. > > ... > >> If you dislike the frame type, I could remove it and just do the >> following checks: > >> FP == pt_regs->regs[29] >> PC == pt_regs->pc >> and the address check against el1_*() functions > >> and similar changes for EL0 as well. > >> I still think that the frame type check makes it more robust. > > Yeah, we know the entry points so they can serve the same role as > checking an explicitly written value. It does mean one less operation > on exception entry, though I'm not sure that's that a big enough > overhead to actually worry about. I don't have *super* strong opinons > against adding the explicitly written value other than it being one more > thing we don't otherwise use which we have to get right for reliable > stack trace, there's a greater risk of bitrot if it's not something that > we ever look at outside of the reliable stack trace code. > So, I will add the address checks for robustness. I will think some more about the frame type. >>>> EL1_FRAME >>>> EL1 exception frame. > >>> We do trap into EL2 as well, the patch will track EL2 frames as EL1 >>> frames. Even if we can treat them the same the naming ought to be >>> clear. > >> Are you referring to ARMv8.1 VHE extension where the kernel can run >> at EL2? Could you elaborate? I thought that EL2 was basically for >> Hypervisors. > > KVM is the main case, yes - IIRC otherwise it's mainly error handlers > but I might be missing something. We do recommend that the kernel is > started at EL2 where possible. > > Actually now I look again it's just not adding anything on EL2 entries > at all, they use a separate set of macros which aren't updated - this > will only update things for EL0 and EL1 entries so my comment above > about this tracking EL2 as EL1 isn't accurate. > OK. Madhavan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel