Received: by 2002:a05:6622:f08:0:0:0:0 with SMTP id l8csp4488664ivc; Tue, 3 Nov 2020 13:22:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+vMeTt67V+0CdxSOJGWDm+SFpURcn8w7ZOb9MLuMNhw1cEP0xJHDWR7WqlodjfH9YHB9L X-Received: by 2002:a50:9993:: with SMTP id m19mr17486163edb.99.1604438551189; Tue, 03 Nov 2020 13:22:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604438551; cv=none; d=google.com; s=arc-20160816; b=hWZw/fSmXxmFlcSe1HN8qF6KPD6MwZO5S8Kn5rkiJpYsg66EEN+1UNwqZ1KUXYKN6V T6OheyIdR0Gc1/JQH7stVUHdofIJVV2iUYjAZ501LT1sgqvvXRMe5LqUYH69nn5moiId O/xgQPbclUJ712W6NRUEj7YRqcchws1mw3MmXLyLFTc2KtVpCtSQ81O8RiIXAk3tivwh lguUf+J9Bbi7MiFbdHMN1hXrvMvScbL/qzJb4cgLerp8cca5txmSmVw3NX/H3dvSq41s ee/7AEh2t4UXCizO942bBsjDAH5c7C9DPNnTtOcMYVce0QMnYaCl57Q9NSAmmUO04edT EVkQ== 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=fLWUwra8PyEIYoSwGeukU3yeRQGUCEZ4U4JPs7S4+xg=; b=RpDuUdq/yseM7xHUaO+6hRrF0RtbU/5PQBDEmqyJQRZHTHUj6xZuD59x7p1B5bJZhV qIFhBATrAKZTEElArLUSuKtTx5mVPeELWHKYDJS5c0ugkovTrAHeElaEPxEt6j0sAN16 JFKBtzuwelMHIlH2PGe1Z+RU8uIGXTgFoQRTjw8UeWAXQobPpTmjPdqMFa7URfZgPYJK gDGF7GYA3/Slzl0YZEYJIoYsGm+sOetFjmkuzUuL9jBHLE1zdU9Mb5Z1Qe0R92hf59aw dNXRzg8wK3t41JBHqxCHI2Xsdo1sRC2IL0PmU1dGlCESOD431vvK5Bl8nkwO27iFVVSi fR1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gwzQftWd; 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 qc1si199ejb.315.2020.11.03.13.22.08; Tue, 03 Nov 2020 13:22:31 -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=gwzQftWd; 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 S2388203AbgKCVJ5 (ORCPT + 99 others); Tue, 3 Nov 2020 16:09:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:50316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733291AbgKCVJz (ORCPT ); Tue, 3 Nov 2020 16:09:55 -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 4699B206B5; Tue, 3 Nov 2020 21:09:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437794; bh=PR+rXQevfbFRv1UC0Qz0pM7Gh7ravOUuE0AYZlaS/Rw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gwzQftWdRIbbwVilLqhWsraJYb47gUCyHhzUrG78XHc/py9qoSkTvPC0BgauYFYgG VkFdwLomw2D18HLf4Q8pMAnGXYDKnkYhwC5U5hM2oMj6C7L43WIIDc4TqCRJuD2xot VRU+9yq5eIE7LzS2sK2DGxWDure74lxTe7ZpmPXw= 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.14 036/125] kgdb: Make "kgdbcon" work properly with "kgdb_earlycon" Date: Tue, 3 Nov 2020 21:36:53 +0100 Message-Id: <20201103203202.255424975@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203156.372184213@linuxfoundation.org> References: <20201103203156.372184213@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 694fcd0492827..4cf5697e72b18 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c @@ -95,14 +95,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); @@ -816,6 +808,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