Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1939491ybk; Mon, 11 May 2020 08:01:10 -0700 (PDT) X-Google-Smtp-Source: APiQypLRuYDKwl5gxzXoJaj7kX8K5GcB+5bDD2+3FRcR4TpCeXIs7ZTQDvQSzzxrqjLv+zQuQoXZ X-Received: by 2002:a17:907:9489:: with SMTP id dm9mr14290091ejc.9.1589209270263; Mon, 11 May 2020 08:01:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589209270; cv=none; d=google.com; s=arc-20160816; b=lgX3oETWRhwkXvwrf/C7WVzSinGGUJ/+i2n2xu54CxmRMzOhId8pnPAgyZyI/zkkrz nlmFgXYfehkxGEnLmASMlFc0LSkFQFNUHjvlqvQvbzzNoPxuDJM05M+JQpJe9xJT7nid PMwUrD9snXBbjloxKWabic/A+VcEpHi1JQ8pZeTjvIx0c0X/Z26f38II2CBpnq9URV3d lvyIzSXYzAM5zXoy70fFgNu0pzqZPZHGDyXvGfDLxogoEe/qg1g9qxZzzTtqVrllAaRe cycb1a4MywYgnHcWzJxJhUPixNrOpxAQfwVje8fTZe+dhGtU03R+tu27QtfIa/cQjWxD gJ5Q== 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=wBjI6H3dpi9kVpVrZ65OufTBdZNABS94Y5SG1FJqpGU=; b=ogBQ9CFlp4SjDDBuarp6ZjE1M7RdxE7gWOlo0s/5p9h3s9hbhhJQ5AAQ9P2VxkpZAB IBTPGPP/Os7sGPa9z5RF0yDuF5xbNkpDgPFRqDJBLCUbCxM1oH/4RsdCUlCV6UsFZCjv 6/4g87NAhvFDoYMmZkpCSg85Z9z284B5YHAbcwDFb2hB6X4QFwoutXeZE4ofc5twkz0o /zClGkTvGlmgbnEyrQceYZe2tU1Xl3Qi49TuSXz80+aq8KUoPO/UyuIV+lctoisphn1Q ElZ7LDFMKvYOjxwkBT87e3UW6LfY37reFpWywYegXyLqNWMuJ1SHxtgsspQpF7ZyTwqi wsBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wKZwMCRG; 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 q10si6571020eju.123.2020.05.11.08.00.45; Mon, 11 May 2020 08:01:10 -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=wKZwMCRG; 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 S1729670AbgEKO7R (ORCPT + 99 others); Mon, 11 May 2020 10:59:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:43956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727019AbgEKO7R (ORCPT ); Mon, 11 May 2020 10:59:17 -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 B959420643; Mon, 11 May 2020 14:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589209157; bh=h6Ea4lLoHxX7Auk/jUvpA6sDRTJxI89bcfhFCCCylgg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wKZwMCRGb/qPVQrXagi72UbQrDDDpUCfscELhKXUCYWtWz/96oJ3TsTAVuOo9hq3N OTup9e3bn90dJWWmHxlKrSdmxAXWW+8b1fClhGGt1d9f8pbz6odwWVeOYY4PQ/tUpC Fx64l5wovGXZdTUhdEqOyQyid+5J32xaXo4AOdek= Date: Mon, 11 May 2020 15:59:09 +0100 From: Will Deacon To: Douglas Anderson Cc: jason.wessel@windriver.com, daniel.thompson@linaro.org, gregkh@linuxfoundation.org, agross@kernel.org, kgdb-bugreport@lists.sourceforge.net, catalin.marinas@arm.com, linux-serial@vger.kernel.org, sumit.garg@linaro.org, corbet@lwn.net, mingo@redhat.com, hpa@zytor.com, tglx@linutronix.de, frowand.list@gmail.com, bp@alien8.de, bjorn.andersson@linaro.org, jslaby@suse.com, Alexios Zavras , Allison Randal , Dave Martin , "Eric W. Biederman" , James Morse , Mark Rutland , Masami Hiramatsu , jinho lim , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 05/11] arm64: Add call_break_hook() to early_brk64() for early kgdb Message-ID: <20200511145908.GA22040@willie-the-truck> References: <20200428211351.85055-1-dianders@chromium.org> <20200428141218.v3.5.I22067ad43e77ddfd4b64c2d49030628480f9e8d9@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200428141218.v3.5.I22067ad43e77ddfd4b64c2d49030628480f9e8d9@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 Hi Doug, On Tue, Apr 28, 2020 at 02:13:45PM -0700, Douglas Anderson wrote: > diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c > index 48222a4760c2..59c353dfc8e9 100644 > --- a/arch/arm64/kernel/debug-monitors.c > +++ b/arch/arm64/kernel/debug-monitors.c > @@ -297,7 +297,7 @@ void unregister_kernel_break_hook(struct break_hook *hook) > unregister_debug_hook(&hook->node); > } > > -static int call_break_hook(struct pt_regs *regs, unsigned int esr) > +int call_break_hook(struct pt_regs *regs, unsigned int esr) > { > struct break_hook *hook; > struct list_head *list; > diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c > index cf402be5c573..a8173f0c1774 100644 > --- a/arch/arm64/kernel/traps.c > +++ b/arch/arm64/kernel/traps.c > @@ -1044,6 +1044,9 @@ int __init early_brk64(unsigned long addr, unsigned int esr, > if ((comment & ~KASAN_BRK_MASK) == KASAN_BRK_IMM) > return kasan_handler(regs, esr) != DBG_HOOK_HANDLED; > #endif > + if (call_break_hook(regs, esr) == DBG_HOOK_HANDLED) > + return 0; I think this just means we're not running debug_traps_init() early enough, and actually the KASAN early handler is unnecessary too. If we call debug_traps_init() directly from setup_arch() and drop the arch_initcall(), can we then drop early_brk64 entirely? Will