Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp139026pxx; Wed, 28 Oct 2020 00:19:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfMxy2kczsct8saBzWddEAafAVJ7k8tAuO6LL7ioS0MjnWU/uudGHE9aaOftAVVqnHQKEz X-Received: by 2002:a17:906:abce:: with SMTP id kq14mr6522624ejb.411.1603869561780; Wed, 28 Oct 2020 00:19:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603869561; cv=none; d=google.com; s=arc-20160816; b=xy/pIPxsGxs5cnM2h3SyBQYkbNfR6KAJtwSjLH59I3Wd0DXt2p8qpC1dxFHV5gnuQO 7x5sLW+OIrIxHQn7E9kbCW6NPsQx/uXpQt3qDZiOY1QE1Tx5hi4UjOuQyOvbETPe/DBr 9aV/lM1fGyV8ibwILOpWEqmVQ9hRv6eQUlsx5YAebfz2cwUo6RXAKfOIUULre6y5E4fO Gz6rCssylvOmeLjIJyvEhPdpMdJ6nG0bIhHF7j0xsKM8CJTed7OcT71Eh81sIYOefR+e Ngtl9QmhwaaWF3mCUKlHZbeVKjCXSlRkjI1lApQObLIskypWN1Vi58N5I1b5eplKTmVp UgAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kbxs+J5sPfu6cPuS3bXcQQmO/u3bwvvK/wU+a8aqxLo=; b=0Xq96D7q5xvNwL0nWbzUEzjO3KPaBExetj35tESKRBleUMJ0k2N4/OsEtu35t1voNm Z2vKXi81CiOp4C+m1qF1uIsy+7LyBJu9Vm0t3w8iXhzaO0CHvZFs2LFo3+vWdUcJbUDS 4xcFbtK4EBBgF1xHwrvlrvS8VH13BnzvwPsc91apT3tEj+2NpszmMNTGk1YMHXWZ8PJ7 hBIRBWSZ4k26kCOmZqcMyJ/G0GMSR3Kst2mzapY6zTxsFRFDZgO3NUHpnQYlMN9ttdUY rJ+OblIM2flEymgBTjO37iM6snt4V96kfk/fjRbxXFU99mvXBfLr//HF3yhxVVZmow8Q yL3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mls1NZW7; 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 c26si2637864eds.166.2020.10.28.00.18.59; Wed, 28 Oct 2020 00:19:21 -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=mls1NZW7; 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 S1750464AbgJ0MBo (ORCPT + 99 others); Tue, 27 Oct 2020 08:01:44 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45858 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750451AbgJ0MBn (ORCPT ); Tue, 27 Oct 2020 08:01:43 -0400 Received: by mail-wr1-f65.google.com with SMTP id e17so1549814wru.12 for ; Tue, 27 Oct 2020 05:01:40 -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=kbxs+J5sPfu6cPuS3bXcQQmO/u3bwvvK/wU+a8aqxLo=; b=mls1NZW71oioqb2nuOh2F/GFo3uEwBxjMt7ybKLTnhGYCRk867h6Vi1sueXbwnZ8XK Xx52OPkrLIMWzTT/zWUO5sM6xmW8Ho/ZFaxmE4K+hob+1Wk3DuaQE1ECnJAU2wYkc1J1 X3dJ1keYQpjri19sucvQwOz82/bNiAft2DFrec8JMnyvRyy4Qgc7qJfrv82Wn41lVW7F 2Cf7lRBowjgqjejzvreQtbiwR4ah2MfD4rvCaH6doOKN6OtFX2w5lF6v8qTH76CEa+d2 haBXHCdTCnY8x0JXBCx6Fe9e+Su2BVhBndpogdL/uRxtTfOZ/aSA4dzdRbejv3rzmLjc NPkQ== 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=kbxs+J5sPfu6cPuS3bXcQQmO/u3bwvvK/wU+a8aqxLo=; b=ly0C8PX3y7QqIhIUU8CdX1JbVDZnlCg17f6zpkILICuFq8JYrf4j0NI2nHIYSsTONB 024MUmNpuHmRfFIAzjNA+EnsiTRA6s0arhjeLJSA0J5D2nxX7T2BfOm4LOoWQWLxRH5o iORROPz+o6X2psUucgdTUmAEKun+SVayex8IhKhRYTFd+RjsXHw48lMWl5OPzCxSlPeo vnNFxSgnHKj2npowNcaIsfyGEK4EnDQJxwRu06mtDoS6VDhTKAwM9Gr/R8TtzqmkIMSE XQJf2AOT+BXf7N88YRNbbyVOI1Nm0LU+dUy9HlOfEzHr08J+CHJ9CmO5/n/PPQKZLQyE uBpg== X-Gm-Message-State: AOAM530x3ZGK23oWS8EYCyeyocphtuf+xv2F9WzYl4NhabYL/A4zC6pQ 2zpZfYrAIdNjR7hQzc6IUrz3Pg== X-Received: by 2002:a05:6000:1005:: with SMTP id a5mr2593352wrx.360.1603800099305; Tue, 27 Oct 2020 05:01:39 -0700 (PDT) Received: from holly.lan (cpc141216-aztw34-2-0-cust174.18-1.cable.virginm.net. [80.7.220.175]) by smtp.gmail.com with ESMTPSA id n5sm1703378wrm.2.2020.10.27.05.01.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 05:01:37 -0700 (PDT) Date: Tue, 27 Oct 2020 12:01:34 +0000 From: Daniel Thompson To: Sasha Levin Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Douglas Anderson , kgdb-bugreport@lists.sourceforge.net Subject: Re: [PATCH AUTOSEL 5.4 31/80] kgdb: Make "kgdbcon" work properly with "kgdb_earlycon" Message-ID: <20201027120134.iq44uw6bftumkivh@holly.lan> References: <20201026235516.1025100-1-sashal@kernel.org> <20201026235516.1025100-31-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201026235516.1025100-31-sashal@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 26, 2020 at 07:54:27PM -0400, Sasha Levin wrote: > 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 kgdb[oc]_earlycon was a new feature introduced in v5.8 so, based on the summary above, this fix does not obviously apply to older kernels. However after looking closely... I think the issue described above would also occur if kgdbdbgp (an incomprehensible sequence consonants that translates to "present debugger via USB EHCI debug") were used in conjunction with kgdbcon meaning backporting does make sense. Daniel. > --- > 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 2222f3225e53d..097ab02989f92 100644 > --- a/kernel/debug/debug_core.c > +++ b/kernel/debug/debug_core.c > @@ -96,14 +96,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); > > @@ -876,6 +868,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.25.1 >