From: Bastian Krause <bst@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [PATCH 3/3] menu: schedule pollers/workqueues while waiting for menu item selection
Date: Tue, 1 Jul 2025 11:24:14 +0200 [thread overview]
Message-ID: <04893260-d405-4711-8bed-dfd3d290fc81@pengutronix.de> (raw)
In-Reply-To: <20250701085251.148111-3-a.fatoum@pengutronix.de>
On 7/1/25 10:52 AM, Ahmad Fatoum wrote:
> Pollers are already run during the menu, because getchar() will poll the
> console driver every 100us and 100us happens to be the time at which
> is_timeout starts scheduling. Workqueus can only be run outside command
> context however, so running menutree (e.g., because shell was exited)
> will not process any fastboot packets in the workqueue.
>
> Fix this by releasing the slice for the duration of readkey. We do a
> similar thing in the readline command as well.
> Unlike the readline command, menutree can execute arbitrary scripts as
> a result of the user input, so we restrict the slice only to the console
> and rescheduling parts.
>
> Reported-by: Bastian Krause <bst@pengutronix.de>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Tested-by: Bastian Krause <bst@pengutronix.de>
Thanks!
Regards,
Bastian
> ---
> common/menu.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/common/menu.c b/common/menu.c
> index 128043c225df..c985f2987751 100644
> --- a/common/menu.c
> +++ b/common/menu.c
> @@ -9,6 +9,7 @@
> #include <init.h>
> #include <menu.h>
> #include <malloc.h>
> +#include <slice.h>
> #include <xfuncs.h>
> #include <errno.h>
> #include <readkey.h>
> @@ -290,10 +291,14 @@ int menu_show(struct menu *m)
> struct menu_entry *old_selected = m->selected;
> int repaint = 0;
>
> - if (m->auto_select >= 0)
> + if (m->auto_select >= 0) {
> ch = BB_KEY_RETURN;
> - else
> + } else {
> + /* Ensure workqueues can run during menu, e.g. for fastboot */
> + command_slice_release();
> ch = read_key();
> + command_slice_acquire();
> + }
>
> m->auto_select = -1;
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2025-07-01 9:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 8:52 [PATCH 1/3] commands: sleep: add support for running without pollers Ahmad Fatoum
2025-07-01 8:52 ` [PATCH 2/3] poller: add option to detect delayed poller activation Ahmad Fatoum
2025-07-01 8:52 ` [PATCH 3/3] menu: schedule pollers/workqueues while waiting for menu item selection Ahmad Fatoum
2025-07-01 9:24 ` Bastian Krause [this message]
2025-07-02 7:00 ` [PATCH 1/3] commands: sleep: add support for running without pollers Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=04893260-d405-4711-8bed-dfd3d290fc81@pengutronix.de \
--to=bst@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox