Message ID | 20250214140031.484344-8-jerome.forissier@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1568:b0:38f:210b:807b with SMTP id 8csp170048wrz; Fri, 14 Feb 2025 06:02:10 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVXNArbLxKpJUOBOGwPXPgAKLmPW4zsTFZKL7DGmjrMiEAL8UkA86KtHtJomNOaai+34JT4iw==@linaro.org X-Google-Smtp-Source: AGHT+IEl+jrkY+BGQkvwPuo3cTib9ruQG0LjvBzgQUmTF6evQrLTLKYVXlQBeMA/h4L9gVtuH+Nc X-Received: by 2002:a05:6000:144b:b0:38d:e0a9:7e5e with SMTP id ffacd0b85a97d-38f24ce7791mr9353920f8f.6.1739541729154; Fri, 14 Feb 2025 06:02:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1739541729; cv=none; d=google.com; s=arc-20240605; b=Mp/t8brvDTpvP4f6SUXBMhggyZ+lkMwWgKn8dr3QUoHrPxXxWWWEN0n3Of0Iy9FayD gFJff1kBrfxEKhmkiklaZ96XcqkIc4OwDQi6+Ye01LJcYNxVI+m76v14ZxpFBSklMc6H WfaWNaNGYHLuF93L6ghpwQ+ClY9AwDGFU3aROKeHCyZ/ceVsSiqdxa2Z/qxTfyOWRedM cHYpq84t9eiaz/XpPz9PiWwRE8HARuxMj1D/niQlOaxsp/rp32Sy2ypdUr5fOsRp4uql 0m3lcUTsHRCOWS9JHXsM+WWZe3NgyMJM7jNYQyKcMBVlSZbYm9iODAy3O1YRthgBjIjI t3Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WsZGwPqorEyyIVDUz+JMZwFYfCF74UByryXvgOhuuVY=; fh=WSXgq+dxaJSHadwMDVBKq11PIkESctA8ND/ZfWAV8a0=; b=StZcC5IKTd6pig43pkIm/F/Pthqo0VsHig2vptmEQqqaZfHVTD3vTzVXLoFFHD+7Qm 2udu0WSAZoawHNUUfjxXd6ajzl3LkWclXrSyKsnZeR4rKhvbC8bW04k4NyF/BnRXeb/r jJOKCxecMqZQNPPgDvb7fQFF8zoVem0T4uu9KdTz+o43wiJyV4XWOxOwy3d0Fr+d3kK7 ykNjQAWwHQArXVixrgRG12ZntKUaG4eSfpA4kiRN9hWgnCN3vQicIEXDcQjBqVjW5XNW m5dtXFyxgDqZj4tbb5O3QMdr1lOInVuAZMdjYg/bO21v0qtwpeTOgx36m0ki1+HyIfIy ZIMQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WTXmLkPG; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: <u-boot-bounces@lists.denx.de> Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id ffacd0b85a97d-38f258e10f2si4552478f8f.30.2025.02.14.06.02.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2025 06:02:09 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WTXmLkPG; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 99B4E80E94; Fri, 14 Feb 2025 15:01:09 +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="WTXmLkPG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 03B7B80F30; Fri, 14 Feb 2025 15:01:08 +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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 005ED80C83 for <u-boot@lists.denx.de>; Fri, 14 Feb 2025 15:01:05 +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=jerome.forissier@linaro.org Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4394829ef0fso20028515e9.0 for <u-boot@lists.denx.de>; Fri, 14 Feb 2025 06:01:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1739541665; x=1740146465; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WsZGwPqorEyyIVDUz+JMZwFYfCF74UByryXvgOhuuVY=; b=WTXmLkPG42pPEZI1qo+1HFc9MjIzyO+rciND4+SI1Ev4iZZC8vIZaxTBOW2r1oAFhd gzWUfzyF2W8eD34qntVOon1uk8piSCQ0Zr2GTBCFuc789MKp3xjt+hkkTDFtNs7dK+h+ iBUfYIETjx3jv9ywPQuA67km2aZW5KjwEcdP/ShNH6TQ7UmkaLf8JnETuS+ZEsfSGyBh wNjEAsZ11sNLhKLUUecs1fomnkukYob+LJloyQScSmstZu/NmJ8Eu8sASoUgkqFeKnr6 hg4mL5OoDGtkse4t/p3M7SgmL0Ce76WkGKdGZdhS4qsAaEKjcb/OVsw15m+YAe7me3ZG tTIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739541665; x=1740146465; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WsZGwPqorEyyIVDUz+JMZwFYfCF74UByryXvgOhuuVY=; b=cVRMBbImYNtyizQfx6UxU8xL+14CV7nX+uqGcwrA7tGxamhrv2TakPBHBdUw3bUnqr Vs3O/auMabMtBYN238qmf5MnFiISXD+MphOYcQAX5/1ApGSS0LF1yRPInZ4jwA3f7cQU i1IeH4HubD/qhBBjEjzwGwYJULJrjCuV0YxnzyIkLcwEo/xcsBHNeTYSY17iztpy3SIa GEyov5DqTlceDkDLxMYV+lIgPiLR1632nTb2QdbwNuElsiv6fmmWiCgK3mkYv4Jabk71 ezbS/WuCpk73Xqj/nr15TstbiPSRggVRvuEyUm+CYywU9I0BDRRjSiY96qpID2NirqCO ra5A== X-Gm-Message-State: AOJu0YyF07pDS39BkA+IiiFH7v64ywb+MygUiG8BZQzvG0pnkEBnppak BGkDljeEghDzMMRXJEfJ64owTDOimirdqUqLd1Ek0rozKPw5b8ozBNRBizRt2Hdt3CVmpvyHylF UWtC9MA== X-Gm-Gg: ASbGncsGgeDvCChZyE2QkPvBUSM75t7G4/V2a4He394L9oZNZpY5Y/4IR4lovWG9Y8n sspuz/w/9WWxN5//lDEojcqHNOzwjhDs1hGwIN2KHn39kMnFMNUt9oi5Jh4cQ4Nfy1p81MXVLwl 322j6wfIbFo/pdnt4sgRaFgSSLbCD7cLrjSUITCyc2Jnmj3tKI2I0Nrx6dUSpZnzDhoWUID437R pUf5a5Aj9G3VF9yLnKqr5rcsW638oepe3VYwGB2NsK3epGlaniN5qaNCRtNDScGMd/blVDoE9Cc rgaWpV4887W4scDEn4082+mQ X-Received: by 2002:a5d:6d09:0:b0:38d:d414:124d with SMTP id ffacd0b85a97d-38f24d74196mr9250091f8f.19.1739541665009; Fri, 14 Feb 2025 06:01:05 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:65ac:d875:2c3e:607f]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f258fc7e0sm4666391f8f.48.2025.02.14.06.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2025 06:01:04 -0800 (PST) From: Jerome Forissier <jerome.forissier@linaro.org> To: u-boot@lists.denx.de Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>, Jerome Forissier <jerome.forissier@linaro.org>, Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org> Subject: [RFC PATCH 07/10] lib: time: hook uthread_schedule() into udelay() Date: Fri, 14 Feb 2025 15:00:22 +0100 Message-ID: <20250214140031.484344-8-jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250214140031.484344-1-jerome.forissier@linaro.org> References: <20250214140031.484344-1-jerome.forissier@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <https://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean |
Series |
Uthreads
|
expand
|
diff --git a/lib/time.c b/lib/time.c index d88edafb196..55e41c92210 100644 --- a/lib/time.c +++ b/lib/time.c @@ -17,6 +17,7 @@ #include <asm/global_data.h> #include <asm/io.h> #include <linux/delay.h> +#include <uthread.h> #ifndef CFG_WD_PERIOD # define CFG_WD_PERIOD (10 * 1000 * 1000) /* 10 seconds default */ @@ -190,6 +191,10 @@ void __weak __udelay(unsigned long usec) /* ------------------------------------------------------------------------- */ +#if CONFIG_IS_ENABLED(UTHREAD) +int udelay_yield; +#endif + void udelay(unsigned long usec) { ulong kv; @@ -197,7 +202,17 @@ void udelay(unsigned long usec) do { schedule(); kv = usec > CFG_WD_PERIOD ? CFG_WD_PERIOD : usec; - __udelay(kv); +#if CONFIG_IS_ENABLED(UTHREAD) + if (udelay_yield == 0xCAFEDECA) { + ulong t0 = timer_get_us(); + while (timer_get_us() < t0 + kv) + uthread_schedule(); + } else { +#endif + __udelay(kv); +#if CONFIG_IS_ENABLED(UTHREAD) + } +#endif usec -= kv; } while(usec); }
Introduce a uthread scheduling call into udelay() when CONFIG_UTHREAD is enabled. This means that any uthread calling into udelay() may yield to uthread and be scheduled again later. TBD: check if udelay_yield is really necessary. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> --- lib/time.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)