Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3761803ybk; Tue, 19 May 2020 12:19:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZN6z8epzA/E47RqgzwVo0euURumRj3S1rNJfF3UyDsz8BmiT2bKRNp5Mg3aBsUo+4VI6X X-Received: by 2002:aa7:c1c5:: with SMTP id d5mr346212edp.183.1589915951067; Tue, 19 May 2020 12:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589915951; cv=none; d=google.com; s=arc-20160816; b=ew0Vy4fqt9EBMb/FeVYhLOrvP+0kxbOnhdvibcMS1/hkIUseEgvxMqSCSScjBxe7xD 4RoBIgc+eboe5xEnK8O6ETHSxfGm43G4swjqEWKS3AXWXRqnIv1c0H4EsJ7ewfA/LI+C O5jccE8SoR7aT7ByLvcLsLteKPJ0xXmuxoLezSXJOUthlILbRHaWUCsNnMTN+1R20P0h NOSF455MhS85kCP0mrz3Zg+MetvcBs3iqwcw+YJKSeLdD7bGzMm4YkxSHYOuPxRWRkDu tyn21Wpg0FCQhiXifdRHgx3RFu/6MqKyEEK8HvwDD2e7Gj8ocwpWraNuVrCiIqioyCCh 281A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=wEq9P5HnCfUm9vk24Pjpsrg932s/fp+shOA9bBHZRYI=; b=cP6QGQq12glErZyPctiQEqzrp4S3JzIxvGitKf69bcOlJe56NJwDEW0LnjjzonX3dn Vs3YJTZWU1DyiD43qgZNCsEVGN28MbDMFJB7Oof62paM634kZvO4nf3zoc/GYKwZf3hv j/O3YSgWIUFevHgixhenIEN86n52E0pnQG4ZYXGTK/eUlnWXGcuTI3Pd0JGNCguN06HQ +7DJyqJ4M+wfn5GdRulwueVtso5JFdl8dlS4nFoE9tPhO+Acthr0QodgQVKiDlP+trno VTQkxHADfbhcUV1aJy0YNiYHuXhvykRXVVD7q3jTfOIBTvVAlmCvQqEMutkMjT0CfgCN jOaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U1v22pjd; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si368492ejz.730.2020.05.19.12.18.45; Tue, 19 May 2020 12:19:11 -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=@linaro.org header.s=google header.b=U1v22pjd; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726940AbgESTOv (ORCPT + 99 others); Tue, 19 May 2020 15:14:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726161AbgESTOv (ORCPT ); Tue, 19 May 2020 15:14:51 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0528C08C5C0 for ; Tue, 19 May 2020 12:14:50 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id s8so614828wrt.9 for ; Tue, 19 May 2020 12:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wEq9P5HnCfUm9vk24Pjpsrg932s/fp+shOA9bBHZRYI=; b=U1v22pjdFEgh26Q4N8u+nq5aSkSji6AanM9ZXmU8FbY4MF7bqry7qJkOOpyirOvWAf T76R5DNl7HninB1H8gou4BB4vUBhGEHAGqrc9OL9Uxks65TuU54aRzTe3ytKGOTYYlGN YQE8z18HTvOBDcHd0uDpHEn92X6ru2QZ7rzpGMTWCSFGkzCl36SK/HWZmTDSniGdytln RzGeu8z3GlkkGyH+cypz1adDeSJf8AypJD6L+o/pgFDEQIKyDJAJk8kqxVB1ieD5v7cj G7O+SBYIbU6cee0ZUV9VZR+sOr5RfteCzNmOlDOaxyyxJU2BJAlyyFn73ZoodsFsce6z h9CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wEq9P5HnCfUm9vk24Pjpsrg932s/fp+shOA9bBHZRYI=; b=t2oOPwdf7kfRq5Dt3PG/1XyL1EB0Bsk+8QKvlLqjOvcKFA3jfaFcfX/RFewhn7zMFL 8RF2mtVKq6HJUrNvSf8nUJ6ZnOA5pGqbWPmJaibi+qcn0sJmkF9Fb/TRXR229nSyDxHb +Db0sJnk7ivzh5EdzmSjewei2KOpD6ToQUuzMBisSwJQrjSK8XYFPQxt6apl0XFX2vtH QaMlLoaEfy7oQVqFXcjrznxTT8LsYlC1r97Gko9bKO4/KQXclcep2458M9X3oR/R+r2P E8vmfNNg2dedHwkDlrcG3f9bVBsO7WLf4bRqkjSdba18WLb8Tgydyw1ZWzT0ygY8j09a no9A== X-Gm-Message-State: AOAM530QR8jc+sdYheE4KFyM9uZUfrbdYilq41MyfdbmFEIN0vby25kC fPtVQdLrHOqQR5OITp8md9uRfw== X-Received: by 2002:a05:6000:11ca:: with SMTP id i10mr453589wrx.10.1589915689318; Tue, 19 May 2020 12:14:49 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id v2sm464710wrn.21.2020.05.19.12.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 12:14:48 -0700 (PDT) Date: Tue, 19 May 2020 20:14:46 +0100 From: Daniel Thompson To: Douglas Anderson Cc: Stephen Rothwell , Jason Wessel , linux-next@vger.kernel.org, sumit.garg@linaro.org, Greg Kroah-Hartman , Jiri Slaby , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH] kgdboc: Disable all the early code when kgdboc is a module Message-ID: <20200519191446.ybe2phdzac6vxyzx@holly.lan> References: <20200519084345.1.I91670accc8a5ddabab227eb63bb4ad3e2e9d2b58@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200519084345.1.I91670accc8a5ddabab227eb63bb4ad3e2e9d2b58@changeid> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 19, 2020 at 08:44:02AM -0700, Douglas Anderson wrote: > When kgdboc is compiled as a module all of the "ekgdboc" and > "kgdb_earlycon" code isn't useful and, in fact, breaks compilation. > This is because early_param() isn't defined for modules and that's how > this code gets configured. > > It turns out that this was broken by commit eae3e19ca930 ("kgdboc: > Remove useless #ifdef CONFIG_KGDB_SERIAL_CONSOLE in kgdboc") and then > made worse by commit 220995622da5 ("kgdboc: Add kgdboc_earlycon to > support early kgdb using boot consoles"). I guess the #ifdef wasn't > so useless, even if it wasn't obvious why it was useful. When kgdboc > was compiled as a module only "CONFIG_KGDB_SERIAL_CONSOLE_MODULE" was > defined, not "CONFIG_KGDB_SERIAL_CONSOLE". That meant that the old > module. > > Let's basically do the same thing that the old code (pre-removal of > the #ifdef) did but use "IS_BUILTIN(CONFIG_KGDB_SERIAL_CONSOLE)" to > make it more obvious what the point of the check is. We'll fix > kgdboc_earlycon in a similar way. > > Fixes: 220995622da5 ("kgdboc: Add kgdboc_earlycon to support early kgdb using boot consoles") > Fixes: eae3e19ca930 ("kgdboc: Remove useless #ifdef CONFIG_KGDB_SERIAL_CONSOLE in kgdboc") > Reported-by: Stephen Rothwell > Signed-off-by: Douglas Anderson Thanks Doug. I've got this running though my build checks now (which I have just noted an improvement for ;-) ) and will get it into kgdb/for-next as soon as possible. Daniel. > --- > > drivers/tty/serial/kgdboc.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c > index 34b5e91dd245..fa6f7a3e73b9 100644 > --- a/drivers/tty/serial/kgdboc.c > +++ b/drivers/tty/serial/kgdboc.c > @@ -43,9 +43,11 @@ static int kgdb_tty_line; > > static struct platform_device *kgdboc_pdev; > > +#if IS_BUILTIN(CONFIG_KGDB_SERIAL_CONSOLE) > static struct kgdb_io kgdboc_earlycon_io_ops; > static struct console *earlycon; > static int (*earlycon_orig_exit)(struct console *con); > +#endif /* IS_BUILTIN(CONFIG_KGDB_SERIAL_CONSOLE) */ > > #ifdef CONFIG_KDB_KEYBOARD > static int kgdboc_reset_connect(struct input_handler *handler, > @@ -140,10 +142,19 @@ static void kgdboc_unregister_kbd(void) > #define kgdboc_restore_input() > #endif /* ! CONFIG_KDB_KEYBOARD */ > > -static void cleanup_kgdboc(void) > +#if IS_BUILTIN(CONFIG_KGDB_SERIAL_CONSOLE) > +static void cleanup_earlycon(void) > { > if (earlycon) > kgdb_unregister_io_module(&kgdboc_earlycon_io_ops); > +} > +#else /* !IS_BUILTIN(CONFIG_KGDB_SERIAL_CONSOLE) */ > +static inline void cleanup_earlycon(void) { } > +#endif /* !IS_BUILTIN(CONFIG_KGDB_SERIAL_CONSOLE) */ > + > +static void cleanup_kgdboc(void) > +{ > + cleanup_earlycon(); > > if (configured != 1) > return; > @@ -388,6 +399,7 @@ static struct kgdb_io kgdboc_io_ops = { > .post_exception = kgdboc_post_exp_handler, > }; > > +#if IS_BUILTIN(CONFIG_KGDB_SERIAL_CONSOLE) > static int kgdboc_option_setup(char *opt) > { > if (!opt) { > @@ -544,6 +556,7 @@ static int __init kgdboc_earlycon_init(char *opt) > } > > early_param("kgdboc_earlycon", kgdboc_earlycon_init); > +#endif /* IS_BUILTIN(CONFIG_KGDB_SERIAL_CONSOLE) */ > > module_init(init_kgdboc); > module_exit(exit_kgdboc); > -- > 2.26.2.761.g0e0b3e54be-goog >