Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp628899ybk; Fri, 15 May 2020 09:25:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnzJTNUrsu7mtgdN9KHGAtVAAEjU+Qqjyj4GWhqWXl38Cy3huljKK/vccHwxC+jFKP0k7T X-Received: by 2002:aa7:c5c8:: with SMTP id h8mr3516272eds.222.1589559939875; Fri, 15 May 2020 09:25:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589559939; cv=none; d=google.com; s=arc-20160816; b=YoNHZOi0zi6Dm3ndCbAyTj7DTB8gQormKGL/tCDeO3ZE1b8iOH1XNMX0L8veZG1az0 Vjce2ozqP0McYjjt4rCcQVvGQUA82GcaAWQ6CG9UThKiH+a1nhN2qO0b0Eg4EUsXHizX 3xP9UuCbWZFM7NGir+uoGR5Vqw5gnBQgN7U2jk6/4cqfAIKj384tGqlLcMsqhoCiXClZ iKxlsFRNuUC2RNNVZli4ejZM/W+QMnT/n3xP5rRQ13JjNb2/Xlh3LdKxQUxyArY0MQGP lYTzYtCbNmyRiMMwq8cwsAgghuiFkrvHt1orImzYb7NqJUim6NCkYhHa4s3sUs/r8lsq E8Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=xKQU5g/myR4cFhRPR5I3RICWDDh/vqRDkAmABLv2+FI=; b=vrHVmOTLYBrHRgXT7ox3ZU+wLbOipcg53kNmKkoI1+r0RjwqCA8RCMe2nHhQeaNU+N tPM5VU8ZhKF2GtWfjDiIs9enlti9cPFfA0iJyQ54VNJIh3tdMwA3guskizfCHdE+RlYe EgxihBBqhscCGRCD5W4UwOYtq1XAiCtCENPGvJmRLHKkl7321sfzO/lqOZSa3b8MxpW7 zCejtOkbYHpQnCuuH3p/KjHwgjEWOqhz0lfIn5vZBMtUo0LiwNGjFh2Yi0EzjDcDi4BR X2QJWEAtEMLNHRGW6aV2si4pcn3f8LFXAN74ZX4XyhhduqgItlLOeW0pmc7xkNma8z1l M89Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wemOiVm6; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t10si1459349edw.408.2020.05.15.09.25.16; Fri, 15 May 2020 09:25:39 -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=@kernel.org header.s=default header.b=wemOiVm6; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726367AbgEOQXZ (ORCPT + 99 others); Fri, 15 May 2020 12:23:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:50554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbgEOQXY (ORCPT ); Fri, 15 May 2020 12:23:24 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 81D412078C; Fri, 15 May 2020 16:23:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589559803; bh=HbqBHaV+XIZkFuflJY0Eucc7SercKD8lt8QIg3OGxhA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wemOiVm650T9QrpdqKpxsDYHLEdSK+CH1Ch20VwgfPR+Wr0MpSbf7XU+dxi/rFHj9 rG92FNQGEworcfIAggrP2zo+/fwzxkNU6/nvba2DypmY6d9iI3lRyNmlfNrJrLtLDZ ZPS2stFk5fi2bPosg1Q7nmOMROrJX53BiKMTbiDk= Date: Fri, 15 May 2020 17:23:17 +0100 From: Will Deacon To: Douglas Anderson Cc: Jason Wessel , Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, liwei391@huawei.com, Catalin Marinas , sumit.garg@linaro.org, Alexios Zavras , Allison Randal , Dave Martin , Enrico Weigelt , "Eric W. Biederman" , Greg Kroah-Hartman , James Morse , Mark Rutland , Masami Hiramatsu , "Paul E. McKenney" , Thomas Gleixner , Zenghui Yu , jinho lim , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: Call debug_traps_init() from trap_init() to help early kgdb Message-ID: <20200515162316.GB23334@willie-the-truck> References: <20200513160501.1.I0b5edf030cc6ebef6ab4829f8867cdaea42485d8@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200513160501.1.I0b5edf030cc6ebef6ab4829f8867cdaea42485d8@changeid> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 13, 2020 at 04:06:37PM -0700, Douglas Anderson wrote: > A new kgdb feature will soon land (kgdb_earlycon) that lets us run > kgdb much earlier. In order for everything to work properly it's > important that the break hook is setup by the time we process > "kgdbwait". > > Right now the break hook is setup in debug_traps_init() and that's > called from arch_initcall(). That's a bit too late since > kgdb_earlycon really needs things to be setup by the time the system > calls dbg_late_init(). > > We could fix this by adding call_break_hook() into early_brk64() and > that works fine. However, it's a little ugly. Instead, let's just > add a call to debug_traps_init() straight from trap_init(). There's > already a documented dependency between trap_init() and > debug_traps_init() and this makes the dependency more obvious rather > than just relying on a comment. > > NOTE: this solution isn't early enough to let us select the > "ARCH_HAS_EARLY_DEBUG" KConfig option that is introduced by the > kgdb_earlycon patch series. That would only be set if we could do > breakpoints when early params are parsed. This patch only enables > "late early" breakpoints, AKA breakpoints when dbg_late_init() is > called. It's expected that this should be fine for most people. > > It should also be noted that if you crash you can still end up in kgdb > earlier than debug_traps_init(). Since you don't need breakpoints to > debug a crash that's fine. > > Suggested-by: Will Deacon > Signed-off-by: Douglas Anderson > Cc: Catalin Marinas > Cc: Will Deacon > --- > This replaces the patch ("arm64: Add call_break_hook() to > early_brk64() for early kgdb") in my recent kgdb series [1]. If I end > up re-posting that series again I'll include this patch as a > replacement, but I'm sending it separately to avoid spamming a pile of > people another time with a 12-patch series. > > Note that, because it doesn't select the "ARCH_HAS_EARLY_DEBUG" > KConfig option it could be landed standalone. However, it's still > probably better to land together with that patch series. > > If the kgdb_earlycon patch series lands without this patch then > kgdbwait + kgdb_earlycon won't work well on arm64, but there would be > no other bad side effects. > > If this patch lands without the kgdb_earlycon patch series then there > will be no known problems. > > [1] https://lore.kernel.org/r/20200507130644.v4.5.I22067ad43e77ddfd4b64c2d49030628480f9e8d9@changeid > > arch/arm64/include/asm/debug-monitors.h | 2 ++ > arch/arm64/kernel/debug-monitors.c | 4 +--- > arch/arm64/kernel/traps.c | 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) [...] Acked-by: Will Deacon I would prefer to take this via arm64, if possible, since we have quite lot going in for 5.8, although I don't think this conflicts at the moment. Daniel -- what do you want to do? Will