From patchwork Thu Jan 4 16:03:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 759856 Delivered-To: patch@linaro.org Received: by 2002:a5d:67c6:0:b0:336:6142:bf13 with SMTP id n6csp7047853wrw; Thu, 4 Jan 2024 08:04:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKnK4xGExL8Mbof9dqUfmWNbTXHu/EyALUroYpUFKArEQZsyCx9XaB/UaeZIfh8PcBBK/M X-Received: by 2002:a05:600c:4683:b0:40d:60e2:d643 with SMTP id p3-20020a05600c468300b0040d60e2d643mr302028wmo.26.1704384241338; Thu, 04 Jan 2024 08:04:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704384241; cv=none; d=google.com; s=arc-20160816; b=Le3x0Bvp9WM/gglIWnpS2e7d77cwQLB9D0VQaEjkzRTt71EV+cnT/2X972KDN3k59n sAtYiJhMZah/ALTKnwc1nUMAK+LzRiYyOqBYciLFDlrAqOJUDZ1/xIQNgTFFel5mWLa4 qTtTJsLen+4VTguNtkOJodYtsyNcszNkWGO3+G0tq8s08QPn2s81/fwYt4ExfXXOfTJd ENDCkse0mU9vj8IMTAMtVVkUnVQGxQ5KMrsKjvLVXtdVr3sOepk+/t4B45YMagLGF4o3 IhH8QueybjrnThfOb4OAq3VkKQkyBYlHHROmDnGJTw4pwJRQzB3tMx8Xh9ViB0rUCAqO sWgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=wcLivlcI9XenRvNzwqlQTpIXNUVY4cUU2pjbw+cqqhs=; fh=4QQ7RQ8/SihG0ZZVKvSyuwL0zVQarUDqlHI6Xr7Xxno=; b=a5P32HvjMHkWxQv+yrB4rVto9l2uNtS09kilBgW6bqa2qF1k/DSBsefbeONOA5s/S1 R45IdfX68Osnt8E3biXU9rx9S8fZ3p0SZv/kBsbrsSZGb4AurvRbswkxfmqtA9qAKVRq +kvRvVx6exuzbYpd/PDxOyi/1Ruof0qbjSjWsuMEXO6MlGbrFMigtq8lnB5ouVWWvi+j vhwnIWVl0pfDTn2IUBJdmQlv+H59dwZL5QIWRMCkWG6uRr6BmP8I7Ndl6btsGWXjr/dZ 1rZLsi9XnkdDqTBCIh3UmT86VPyOgYSUacNhcYyzdYRQv73FMSSLa6+VWCPeZcWUkZiB 2+lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ssx2dNYG; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id n3-20020a05600c4f8300b0040d54a45896si2027355wmq.72.2024.01.04.08.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 08:04:01 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ssx2dNYG; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 147C087938; Thu, 4 Jan 2024 17:03:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Ssx2dNYG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C37E087949; Thu, 4 Jan 2024 17:03:57 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D85EA877D5 for ; Thu, 4 Jan 2024 17:03:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3366e78d872so563405f8f.3 for ; Thu, 04 Jan 2024 08:03:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704384235; x=1704989035; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=wcLivlcI9XenRvNzwqlQTpIXNUVY4cUU2pjbw+cqqhs=; b=Ssx2dNYGU4ajLNXe5oZKv0asSFxqk39eECL+aAMaSiZR48RNyQU+yoblQvwTIKqXiR U5vteGWY0j2SWaFwRd36b6RJtePLGxZeh1aFdMRnXbLUmKMhf4a/ifidM4S49oIxxlTb EuvV8Lm5LJM5cJufVAHOzEfPrvEH2seT7XN05sjhg2GNf9VR+UdlNl+z+/VJpOn4+znL UCaylZAscfs3C5hGy8CCoZ/tMNTf4TSo1wSfXkml4BkNlg28MawkEDBkpgJ1Ryh+bL52 RalbdKBZFn5slFDxI+0q/5mmeRvvsVm/53mOxIvvqUwFmHJo4P3hEgtOC8ASdjvdmThu iOiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704384235; x=1704989035; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wcLivlcI9XenRvNzwqlQTpIXNUVY4cUU2pjbw+cqqhs=; b=auNcdlmI3w6AhBvYpwKZ4HhJWTBsBmDzIZN9U/m5/sCrRQDCInIivEtXUp0DLskRLi bwoa0fLm3t/kIyzNtmOjQB56AMdMdt7mUd0JOSpa/h4Cz2CWGe1gpm26PqY0k5QkfEzP uSq+q6Vad7mmFUDtPzB4TE57Bx0vJlYqjM2A242wj6qWlLrd6bFMKDOXs+y+wUcyBi9l QcFstSAYhL5d/k+dbSbpczNz4yeTSH8mbQg4xUkiaDSFpYuB+F+0xEiDrMckdeknPZ8K MmIpRwld94g9SazQMIzrE9l9Wa6mEyiUZSiX/obHGda5YZtNQ40PW3l62BC2fgvOtXEi fQkg== X-Gm-Message-State: AOJu0YxAzmMBytGBk8KgnPJP2vUVAXB/fIW3zi1vVsGDhlIRZiKnvZEX lzTKCfVhdj4wV6rLtNtAgTK54YoyhjYtMg== X-Received: by 2002:a05:600c:358b:b0:40e:3655:8fca with SMTP id p11-20020a05600c358b00b0040e36558fcamr4577wmq.94.1704384235276; Thu, 04 Jan 2024 08:03:55 -0800 (PST) Received: from lion.caleb.rex.connolly.tech (host-92-17-96-230.as13285.net. [92.17.96.230]) by smtp.gmail.com with ESMTPSA id r5-20020a05600c35c500b0040d88a69dccsm6116461wmq.16.2024.01.04.08.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 08:03:54 -0800 (PST) From: Caleb Connolly To: Tom Rini , Simon Glass Cc: u-boot@lists.denx.de, Caleb Connolly Subject: [resend PATCH] bootdev: avoid infinite probe loop Date: Thu, 4 Jan 2024 16:03:35 +0000 Message-ID: <20240104160346.285881-1-caleb.connolly@linaro.org> X-Mailer: git-send-email 2.42.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Sometimes, when only one bootdev is available, and it fails to probe, we end up in an infinite loop calling probe() on the same device over and over. With only debug level log output. Break the loop if we fail to probe the same device twice in a row, and promote the probe failure message to log_warning(). Signed-off-by: Caleb Connolly Reviewed-by: Simon Glass Reviewed-by: Dragan Simic --- Resend, actually change log message to WARN loglevel. --- boot/bootdev-uclass.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index d01d603700d9..cd1c2bc06774 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -636,7 +636,7 @@ int bootdev_next_label(struct bootflow_iter *iter, struct udevice **devp, int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp) { - struct udevice *dev = *devp; + struct udevice *dev = *devp, *last_dev = NULL; bool found; int ret; @@ -686,9 +686,19 @@ int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp) } } else { ret = device_probe(dev); + if (!ret) + last_dev = dev; if (ret) { - log_debug("Device '%s' failed to probe\n", + log_warning("Device '%s' failed to probe\n", dev->name); + if (last_dev == dev) { + /* + * We have already tried this device + * and it failed to probe. Give up. + */ + return log_msg_ret("probe", ret); + } + last_dev = dev; dev = NULL; } }