Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3213807pxb; Mon, 9 Nov 2020 05:46:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJw42gyHFm1v8jk1+tBx1pUZW2xSLEirvfGWYtH8EnBKg06leFhFJc2SiaSMJ8tLVWzP7Aqs X-Received: by 2002:a17:906:30ca:: with SMTP id b10mr15657627ejb.390.1604929565441; Mon, 09 Nov 2020 05:46:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604929565; cv=none; d=google.com; s=arc-20160816; b=Cp7qUPUxm3VniezShLhxQhmK8JWZZ+BQaTErZEGgZ0O0NFM0yrCj9ztqflDKv850Va KWUqURJAnAQaArovuYs7dWMeEAQPJfF1WRtgRNa5MYnDfs9q7tc23kmFm4gAFJ4t/zMp jv412mIG0ip+H/AqPsCVtOh063Jx9AEyziCWPbcQM/vBpuQPrWWk+bZSWdImbaOYLmKV wn7PfwbPo62JIsqbJjheLVxUU462AjhxD/KAAuxA5aXNS2c39iA4bJw9tZ12om2IxJnu yhhe2EDuKnWH1ila9CMZRtoMZxQ76ija92NPpq96uNoHnABB61fM20V3+2V5aCBPt+Y+ 1fTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2q1XtkUy5kduiKjJGy/8lKS8wQ5pky/jIUae7Y/Hxws=; b=1KW3q8+K7GdgjgnN3p0e0rnrlrrIbaVhb9yMYjaUSHSpGaD6VeLFpzHX3EiQZA6+ai c9DahGGqsXVwtYuetirTtWCqP0R7uvnemXyPg/6EpxmFEkVJc1lhwcpQfWTH9sVu/Fh6 eX4iw1jDFsee+BamDswJSc+aGR1kwOGpHSLKtjjU0bojAAqfdp3aX/EuuvgALfh5ETv0 7ncfisIhnpVdhqMEVZFPylhNDfffJxldrsJ73Msq2Y24fzo4Zm+ohWsWOko8nsxfDxD3 WJFJ9V62jkxbbQEXynq9gRMXoCrSvsTcClvjNDTB5c6P17mDtJ4HlwcL2f6k5Ng2hBnK bQbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eU0vBIHQ; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t8si2886538edj.6.2020.11.09.05.45.42; Mon, 09 Nov 2020 05:46:05 -0800 (PST) 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=eU0vBIHQ; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387701AbgKINmS (ORCPT + 99 others); Mon, 9 Nov 2020 08:42:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:55034 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730538AbgKINA4 (ORCPT ); Mon, 9 Nov 2020 08:00:56 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 364DC20684; Mon, 9 Nov 2020 13:00:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604926855; bh=LR6TJwTFeV/7ptm/etcGeH6qT/PUkytplgnA/IRB8NY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eU0vBIHQvygJ1yiwTCWTSQQ9+UnAnG0+d7V/pkf64O9eMvsWhzKQE4fs2JHyI3vTs lim+OOuMcPcPNJY4achWXWDpZMc7v4DEf/gEFmT67CsXYpnxODEpNqoZJXxfbVtUE5 qLRv0chmkQy6J1qZSHGDu9IEWGxS2vQNaDoZU6Jo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Daniel Thompson , Sasha Levin Subject: [PATCH 4.9 028/117] kgdb: Make "kgdbcon" work properly with "kgdb_earlycon" Date: Mon, 9 Nov 2020 13:54:14 +0100 Message-Id: <20201109125026.984670452@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125025.630721781@linuxfoundation.org> References: <20201109125025.630721781@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Douglas Anderson [ Upstream commit b18b099e04f450cdc77bec72acefcde7042bd1f3 ] On my system the kernel processes the "kgdb_earlycon" parameter before the "kgdbcon" parameter. When we setup "kgdb_earlycon" we'll end up in kgdb_register_callbacks() and "kgdb_use_con" won't have been set yet so we'll never get around to starting "kgdbcon". Let's remedy this by detecting that the IO module was already registered when setting "kgdb_use_con" and registering the console then. As part of this, to avoid pre-declaring things, move the handling of the "kgdbcon" further down in the file. Signed-off-by: Douglas Anderson Link: https://lore.kernel.org/r/20200630151422.1.I4aa062751ff5e281f5116655c976dff545c09a46@changeid Signed-off-by: Daniel Thompson Signed-off-by: Sasha Levin --- kernel/debug/debug_core.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 321ccdbb73649..bc791cec58e63 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c @@ -94,14 +94,6 @@ int dbg_switch_cpu; /* Use kdb or gdbserver mode */ int dbg_kdb_mode = 1; -static int __init opt_kgdb_con(char *str) -{ - kgdb_use_con = 1; - return 0; -} - -early_param("kgdbcon", opt_kgdb_con); - module_param(kgdb_use_con, int, 0644); module_param(kgdbreboot, int, 0644); @@ -811,6 +803,20 @@ static struct console kgdbcons = { .index = -1, }; +static int __init opt_kgdb_con(char *str) +{ + kgdb_use_con = 1; + + if (kgdb_io_module_registered && !kgdb_con_registered) { + register_console(&kgdbcons); + kgdb_con_registered = 1; + } + + return 0; +} + +early_param("kgdbcon", opt_kgdb_con); + #ifdef CONFIG_MAGIC_SYSRQ static void sysrq_handle_dbg(int key) { -- 2.27.0