Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2946630ybz; Mon, 27 Apr 2020 07:24:53 -0700 (PDT) X-Google-Smtp-Source: APiQypJskjTJtXf6vznkfs4Wp43ql9/O9ksBtyxoVkqDdrq4F/NLHn68MLy9S/QoG7RhrCOC4QyW X-Received: by 2002:aa7:dacc:: with SMTP id x12mr18691367eds.363.1587997493245; Mon, 27 Apr 2020 07:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587997493; cv=none; d=google.com; s=arc-20160816; b=Oeim12g4B2axYbUxnMcx4qeqYDmXd2/qIReyWnUhes0p3nYR1QpqigX7V3AeJTuE6t QUarrWimKtZCUycHwvlar9737oLuh+5GTiwyKppKxcFFi59B6uJWg9O6OHPh5xooAKbL PX4jYgdYdkFk+PN2ST5fBmn9LkCFUKomGkBAt4IehRqV/bb8oumZvaqQWTa+V9Mky4Z6 42MdVFHthu3cBnFlqoLYrZjPZqKd5oUu/KpTkicnsBVx6uLtUGBPGVxMgrpAHp2jLq/y wsVJ5pdXNEFBINl28ueOLx3QCltX85mGbl3SHEaFC66eSCynjmwYY51LeZiD2JMLnbqY Rf1Q== 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=bee/vT9YZsF5aLuysXN53gVWnahANuP+/H4BtD8nDYA=; b=v+O/7DRrSoQ3HUvH+Be1EjE9VOwtHWASRz9gGTLiOUIztJxnStWP/3UgoU8iTu2uN0 L/XhXNAD5rBgqUJl76lTBBDGLB1rJ/WNvAvha8ER0RsyHbdL0kXRxp98AAxnwrBPHLVn vddVbCdXSmiJ5xUN2J9WsWbuYHqoOpk71o5TP6grbR+uQX+vYYVRvA2vkrVMtS5MEFcI 5Y/daf5U5Vtq5uwaUM0DL+S2UxfoFovBzOYe1enNI0PAVh0ubsmLZVBUWGyoXQmH+rTl DV8X3PHxN4KKIOq6G0E9IxisQJ5yEIo1DrsQpu4anAsxRsOxNWXGB6Er2NC3I89QW3rq p9FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fv6KdKme; 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 24si8008309ejv.109.2020.04.27.07.24.12; Mon, 27 Apr 2020 07:24:53 -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=Fv6KdKme; 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 S1728070AbgD0OT7 (ORCPT + 99 others); Mon, 27 Apr 2020 10:19:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727824AbgD0OT6 (ORCPT ); Mon, 27 Apr 2020 10:19:58 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D799C0610D5 for ; Mon, 27 Apr 2020 07:19:58 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id u127so20671097wmg.1 for ; Mon, 27 Apr 2020 07:19:58 -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=bee/vT9YZsF5aLuysXN53gVWnahANuP+/H4BtD8nDYA=; b=Fv6KdKme0P7Hd6Cv7sn90bDFGKT3FWV4huW02i2XsZ69hzzo1H3u17OS98OzaZnBTB 278KEthOnv0lxhcPsLu7SX/vgTtq4wPqX+E2pWCx23VhbpaUXDQfoVYsJbx/Kuva3O2S PJxvYmNcCpSHd+6bDJnvLSiezLzVKMsooJagwhfuXLnIQQEXEEX67MWfkbn6V0X/Zu98 UsMjjj0yyJiwg66FMZp3hMqn6vGHm7TvUasx+awqJcZjlvQewIC2DbBCYNbvd62AZtYa 0AfvcSlUzA3xn+ukScz45mTXRED9CfUSUT8dzrtuQMu+s7czphHXriJF2Q1TTHqpC6ZW LZcw== 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=bee/vT9YZsF5aLuysXN53gVWnahANuP+/H4BtD8nDYA=; b=reUCcGXZKnWdXkAw65po24HdI3r5IG4LEKugNTLHNZWHX4n0+m2JofwS36ST85ZpY8 zrJsQSiVMGEh5bSYwYNA9mNKy308uJI/ho7LRMTx54YpIgSUA0Oh4XXXAceOzTSRzZIw OpG+xO/og1/hskHp/JDrYhhF4APruhjJE4A0Xp+T2ArK63XhIdelWhjP69VZF0Ln1O0j 7lZjvDsBHdhnbdo9LRRciLAM5Ed/JcPtM2eF+SRQulho81Oo/QajP4m6PNQ1l8S4xZXU Nhoz6ErqhUjLMDRxEH1HW4WgKxeBkY6oBzouUF6WCGy/ggPWZuuNC/XkaRYMPt0ZcPMI 8UMw== X-Gm-Message-State: AGi0PuagmgWk3eYFYfcKxdlIDBWWSCxV8JObITQQDnExEwl99WWQM7h7 vjO9ja+yw2MICB6ZGkGb6v1lNA== X-Received: by 2002:a1c:9cc6:: with SMTP id f189mr25872640wme.75.1587997197302; Mon, 27 Apr 2020 07:19:57 -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 i129sm16621988wmi.20.2020.04.27.07.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 07:19:56 -0700 (PDT) Date: Mon, 27 Apr 2020 15:19:54 +0100 From: Daniel Thompson To: Douglas Anderson Cc: jason.wessel@windriver.com, gregkh@linuxfoundation.org, kgdb-bugreport@lists.sourceforge.net, mingo@redhat.com, hpa@zytor.com, bp@alien8.de, linux-serial@vger.kernel.org, agross@kernel.org, tglx@linutronix.de, frowand.list@gmail.com, bjorn.andersson@linaro.org, jslaby@suse.com, catalin.marinas@arm.com, corbet@lwn.net, will@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/9] kgdboc: Use a platform device to handle tty drivers showing up late Message-ID: <20200427141954.d55djgbq74e4dme5@holly.lan> References: <20200421211447.193860-1-dianders@chromium.org> <20200421141234.v2.3.I4a493cfb0f9f740ce8fd2ab58e62dc92d18fed30@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200421141234.v2.3.I4a493cfb0f9f740ce8fd2ab58e62dc92d18fed30@changeid> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 21, 2020 at 02:14:41PM -0700, Douglas Anderson wrote: > If you build CONFIG_KGDB_SERIAL_CONSOLE into the kernel then you > should be able to have KGDB init itself at bootup by specifying the > "kgdboc=..." kernel command line parameter. This has worked OK for me > for many years, but on a new device I switched to it stopped working. > > The problem is that on this new device the serial driver gets its > probe deferred. Now when kgdb initializes it can't find the tty > driver and when it gives up it never tries again. > > We could try to find ways to move up the initialization of the serial > driver and such a thing might be worthwhile, but it's nice to be > robust against serial drivers that load late. We could move kgdb to > init itself later but that penalizes our ability to debug early boot > code on systems where the driver inits early. We could roll our own > system of detecting when new tty drivers get loaded and then use that > to figure out when kgdb can init, but that's ugly. > > Instead, let's jump on the -EPROBE_DEFER bandwagon. We'll create a > singleton instance of a "kgdboc" platform device. If we can't find > our tty device when the singleton "kgdboc" probes we'll return > -EPROBE_DEFER which means that the system will call us back later to > try again when the tty device might be there. > > We won't fully transition all of the kgdboc to a platform device > because early kgdb initialization (via the "ekgdboc" kernel command > line parameter) still runs before the platform device has been > created. The kgdb platform device is merely used as a convenient way > to hook into the system's normal probe deferral mechanisms. > > As part of this, we'll ever-so-slightly change how the "kgdboc=..." > kernel command line parameter works. Previously if you booted up and > kgdb couldn't find the tty driver then later reading > '/sys/module/kgdboc/parameters/kgdboc' would return a blank string. > Now kgdb will keep track of the string that came as part of the > command line and give it back to you. It's expected that this should > be an OK change. > > Signed-off-by: Douglas Anderson Reviewed-by: Daniel Thompson