Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2240344ybk; Mon, 11 May 2020 15:56:18 -0700 (PDT) X-Google-Smtp-Source: APiQypK4BQ2MZ8CutkBFZCxi9ZuAYzv8qi0rpqkfUopCTR0KOMfaXxeXAhc27QNYEvTY+eNmwkd3 X-Received: by 2002:a05:6402:311c:: with SMTP id dc28mr14907620edb.323.1589237778566; Mon, 11 May 2020 15:56:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589237778; cv=none; d=google.com; s=arc-20160816; b=vnZyt0MVwNopvXki7Rt9ee4TsuY8U+BWht4AQol9F+iv93mRtJA3dHLvuvN9G98hND 7vyIdxrrg9S3X6p85/BKSrNr23FujeDq4fWqlJx/0n8q6DoVTGKVgFjrrr+6+9b+WOCp RaNGtYvOBE3fR+oKBLPILM719Q0il1utuDjcCvRQBmFgOdEK3E0Gd7BFLz///NNUzcz/ 0uixPk/33gYq709nbS1CeW4aVankoMVtXiaaFubc240bbhWl+JOeh9pDFWvEq0aWz6hM xYBFMkb31RHrPQu64VuZPmwM38ve8TeaaFYbZUuMzhRdECowealRDXnJ2FbDq7T6NqsS pNbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6oQAHkHCTjdXQutqjFpnQFKkQXPKWu36loMHxr/U/Bw=; b=W/NLqvDXxtp0cF3suwdZQDSLZw9Xb9Zo+qrvboCD7JQm3Gk0Apq5z5kaTLFXlFibpT p/M87cQ9+iCkQ/2eeg3RM1LzkUk5GW2FX5RlDSq9W1D0Pb4R7ztHO7UkcDjsGoFa8goD CXp+jusIM5YorBzNfReQb6VUJxKO6l5MypWxU5EDt60EkWbo/NKFbJGqwjabr37m6DXR uwUzC8kJ3JQ3GdpchcFk5FWYAGFswyfmuyW2IM7oe411MjeuABk+QLmUHrYDdMDTq2TE J6RFggYOB+Lip9n64J3Yz3nyXzjTiGaqReavgxfm9tY1++hV3nx9sdtoAOF8dbqiTigT xWdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ABJ9An36; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d11si4160018edt.573.2020.05.11.15.55.55; Mon, 11 May 2020 15:56:18 -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=@chromium.org header.s=google header.b=ABJ9An36; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727801AbgEKWxf (ORCPT + 99 others); Mon, 11 May 2020 18:53:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725836AbgEKWxe (ORCPT ); Mon, 11 May 2020 18:53:34 -0400 Received: from mail-vs1-xe44.google.com (mail-vs1-xe44.google.com [IPv6:2607:f8b0:4864:20::e44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3282EC061A0C for ; Mon, 11 May 2020 15:53:34 -0700 (PDT) Received: by mail-vs1-xe44.google.com with SMTP id g2so6709850vsb.4 for ; Mon, 11 May 2020 15:53:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6oQAHkHCTjdXQutqjFpnQFKkQXPKWu36loMHxr/U/Bw=; b=ABJ9An36QqvDTKUmlo81w3VPI+NywC5sRr3Udf1h5mkJQruw2r+/d0TK5KCxAvQnkM AnX6dF0ESk/0FMYf94bsuWf7TyAgd59x096hAtrjjgg+oqFcAzxb3dsZhEMl1OgQwajx UeNlEyLzrUVksn8Oh25g81dOCnaTLldN7BPyA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6oQAHkHCTjdXQutqjFpnQFKkQXPKWu36loMHxr/U/Bw=; b=MxuX1m3+AhEU23h16xcxfxM2VYYaZ8Ys2ZH9k+9M0bmPcTpvNx3RVkxXq1Q3ep++xu 2RJDlwliDxl/Mn3AcbtlttZCUU38sYQmmSgHS58oh2PvmkjwdmUJ/xhCHMtfyhkIyutZ VfhJWAL9aFlfL8eyMabkyWAOMrOp+7srJJF3t1uBO5o7iWCFrm624cQ9fAOloZ9dBOWH /TEBoCbNSxKd6ApN8zecaLF8TMn2itxFWykALMkRMbN/AAhzmKHwHkvS2AFAV3SfyzCq xMgs87s0NnLexi4txFjSNTr+GOPs1ZYTdG659R0Q1NBiXV/uHozLyrHQhrmT2nE/GdBC nuXQ== X-Gm-Message-State: AGi0PubuaccLqeclyz5DA3uTU9kPd1TGBhTCIuRtA6Hpdwo/CU+haLRV c6NvThjJz1PeYyPG9lr/Or5mFTVMUsM= X-Received: by 2002:a67:e3b9:: with SMTP id j25mr12522134vsm.110.1589237612795; Mon, 11 May 2020 15:53:32 -0700 (PDT) Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com. [209.85.217.53]) by smtp.gmail.com with ESMTPSA id r137sm8939688vke.49.2020.05.11.15.53.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 May 2020 15:53:32 -0700 (PDT) Received: by mail-vs1-f53.google.com with SMTP id m24so6687035vsq.10 for ; Mon, 11 May 2020 15:53:32 -0700 (PDT) X-Received: by 2002:a67:c40c:: with SMTP id c12mr13653102vsk.106.1589237114125; Mon, 11 May 2020 15:45:14 -0700 (PDT) MIME-Version: 1.0 References: <20200428211351.85055-1-dianders@chromium.org> <20200428141218.v3.5.I22067ad43e77ddfd4b64c2d49030628480f9e8d9@changeid> <20200511145908.GA22040@willie-the-truck> In-Reply-To: <20200511145908.GA22040@willie-the-truck> From: Doug Anderson Date: Mon, 11 May 2020 15:45:02 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 05/11] arm64: Add call_break_hook() to early_brk64() for early kgdb To: Will Deacon Cc: Jason Wessel , Daniel Thompson , Greg Kroah-Hartman , Andy Gross , kgdb-bugreport@lists.sourceforge.net, Catalin Marinas , linux-serial@vger.kernel.org, Sumit Garg , Jonathan Corbet , Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Frank Rowand , bp@alien8.de, Bjorn Andersson , Jiri Slaby , Alexios Zavras , Allison Randal , Dave Martin , "Eric W. Biederman" , James Morse , Mark Rutland , Masami Hiramatsu , jinho lim , Linux ARM , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Mon, May 11, 2020 at 7:59 AM Will Deacon wrote: > > 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? It seems to work in my testing. ...but the worry I have is the comment right before trap_init(). It says: /* This registration must happen early, before debug_traps_init(). */ By moving debug_traps_init() early we're violating that comment. Do I just remove that comment, or was there a good reason for it? ...or am I reading it wrong and I should have read it as if it said: /* NOTE: this registration happens early, before debug_traps_init(). */ ...then removing it is fine. Maybe that's right? I coded this up and put it on the Chrome OS gerrit at . I'm happy to post this on the list as a loner patch to replace this one or spin the whole series depending on what people want. -Doug