mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Christian Eggers <ceggers@arri.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [Barebox] Polling infrastructure causes reentrancy problem
Date: Wed, 10 Nov 2021 14:50:34 +0100
Message-ID: <2182678.iZASKD2KPV@n95hx1g2> (raw)
In-Reply-To: <20211108103426.GL25698@pengutronix.de>

Hi Sascha,

On Monday, 8 November 2021, 11:34:26 CET, Sascha Hauer wrote:
> Hi Christian,
> 
> On Fri, Nov 05, 2021 at 01:40:52PM +0100, Christian Eggers wrote:
> > Disclaimer: I stumbled over this on barebox 2020.01.
> > I haven't tried to reproduce this on the current version.
> 
> Please update to a recent barebox. The fastboot commands now run in a
> workqueue which itself only runs when we are outside any critical pathes
> in barebox.
thanks for the hint. I just upgraded to 2021.10.

> Particularly fastboot commands will only execute when you called
> command_slice_release() beforehand. You'll have to call
> command_slice_acquire() before entering any critical pathes like probing
> for USB devices.
I guess that more or less all commands can be critical because
is_timeout() is called from many places. As parallelism for fastboot
is not mandatory, I implemented it the following way: 

	struct usbgadget_funcs const fastboot_funcs= {
		.flags = USBGADGET_FASTBOOT,
		.fastboot_opts = "/dev/null(null)",
	};

	/*
	 *  Register fastboot gadget (will run in background)
	 */
	ret = usbgadget_register(&fastboot_funcs);
	if (ret)
		goto error_usb_gadget;

	/* fastboot runs within a work queue. Allow fastboot execution within
	 * the next 5 seconds...
	 */
	command_slice_release();
	mdelay(5000);
	command_slice_acquire();


BTW: I use a modified/stripped down version of the Android fastboot for booting
Barebox FIT images. Is there any interest integrating this into barebox/scripts/?
- more or less stand alone (about 15 files at all)
- currently USB-only
- Apache-2.0 / BSD-2-clause
- C++
- CMake (only 60 lines, so it can be ported to Kbuild)

regards
Christian




_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


      reply	other threads:[~2021-11-10 13:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 12:40 Christian Eggers
2021-11-08 10:34 ` Sascha Hauer
2021-11-10 13:50   ` Christian Eggers [this message]

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=2182678.iZASKD2KPV@n95hx1g2 \
    --to=ceggers@arri.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git