From: Tom Rini <trini@konsulko.com>
To: Simon Glass <sjg@chromium.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>,
Caleb Connolly <caleb.connolly@linaro.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Masahisa Kojima <kojima.masahisa@socionext.com>,
Raymond Mao <raymond.mao@linaro.org>,
U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH v2 37/39] efi: Avoid using sandbox virtio devices
Date: Thu, 15 Aug 2024 16:56:26 -0600 [thread overview]
Message-ID: <20240815225626.GW1626301@bill-the-cat> (raw)
In-Reply-To: <CAFLszThU+vLUm_fveWUgV3Qt3J+F3=Sr1aBgbc4T5z8zJJz5sw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 7614 bytes --]
On Thu, Aug 15, 2024 at 09:33:18PM +0100, Simon Glass wrote:
> Hi Tom,
>
> On Wed, 14 Aug 2024 at 11:56, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Sun, Aug 11, 2024 at 08:50:21AM -0600, Simon Glass wrote:
> > > Hi Tom,
> > >
> > > On Thu, 8 Aug 2024 at 14:06, Tom Rini <trini@konsulko.com> wrote:
> > > >
> > > > On Thu, Aug 08, 2024 at 12:44:05PM -0600, Simon Glass wrote:
> > > > > Hi Heinrick, Tom,
> > > > >
> > > > > On Tue, 6 Aug 2024 at 19:56, Tom Rini <trini@konsulko.com> wrote:
> > > > > >
> > > > > > On Wed, Aug 07, 2024 at 03:47:21AM +0200, Heinrich Schuchardt wrote:
> > > > > > > On 06.08.24 14:58, Simon Glass wrote:
> > > > > > > > While sandbox supports virtio it cannot support actually using the block
> > > > > > > > devices to read files, since there is nothing on the other end of the
> > > > > > > > 'virtqueue'.
> > > > > > > >
> > > > > > > > A recent change makes EFI probe all block devices, whether used or not.
> > > > > > > > This is apparently required by EFI, although it violates U-Boot's
> > > > > > > > lazy-init principle.
> > > > > > > >
> > > > > > > > We cannot just drop the virtio devices as they are used in sandbox tests.
> > > > > > > >
> > > > > > > > So for now just add a special case to work around this.
> > > > > > > >
> > > > > > > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > > > > > > ---
> > > > > > > >
> > > > > > > > (no changes since v1)
> > > > > > > >
> > > > > > > > lib/efi_loader/efi_disk.c | 14 +++++++++++++-
> > > > > > > > 1 file changed, 13 insertions(+), 1 deletion(-)
> > > > > > > >
> > > > > > > > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> > > > > > > > index 93a9a5ac025..2e1d37848fc 100644
> > > > > > > > --- a/lib/efi_loader/efi_disk.c
> > > > > > > > +++ b/lib/efi_loader/efi_disk.c
> > > > > > > > @@ -838,8 +838,20 @@ efi_status_t efi_disk_get_device_name(const efi_handle_t handle, char *buf, int
> > > > > > > > efi_status_t efi_disks_register(void)
> > > > > > > > {
> > > > > > > > struct udevice *dev;
> > > > > > > > + struct uclass *uc;
> > > > > > > >
> > > > > > > > - uclass_foreach_dev_probe(UCLASS_BLK, dev) {
> > > > > > > > + uclass_id_foreach_dev(UCLASS_BLK, dev, uc) {
> > > > > > > > + /*
> > > > > > > > + * The virtio block-device hangs on sandbox when accessed since
> > > > > > > > + * there is nothing listening to the mailbox
> > > > > > > > + */
> > > > > > > > + if (IS_ENABLED(CONFIG_SANDBOX)) {
> > > > > > > > + struct blk_desc *desc = dev_get_uclass_plat(dev);
> > > > > > > > +
> > > > > > > > + if (desc->uclass_id == UCLASS_VIRTIO)
> > > > > > > > + continue;
> > > > > > >
> > > > > > > We should avoid depending on the sandbox everywhere.
> > > > > > >
> > > > > > > Please, fix the problem in the sandbox driver.
> > > > > > >
> > > > > > > If you cannot fix it, run the tests involving virtio on QEMU instead of
> > > > > > > the sandbox.
> > > > >
> > > > > Which test? All of the EFI tests fail due to this problem. The test
> > > > > actually has nothing to do with virtio, it is just that EFI goes and
> > > > > probes every single block device, since [1].
> > > >
> > > > Aren't we running "the tests" on other platforms such as QEMU today?
> > > >
> > > > > > This is an area we go back-and-forth on but, yes, IMHO, if we can't
> > > > > > easily provide a virtio device for sandbox, QEMU is right there and what
> > > > > > this is for, so I see sandbox as more useful as build rather than
> > > > > > runtime checking in this case.
> > > > >
> > > > > The best solution would be to implement a simple emulator, like we do
> > > > > in other places for sandbox. At present virtio_sandbox_notify() is
> > > > > empty.
> > > > >
> > > > > I don't mind working on that, but would like to get a temporary
> > > > > solution here so this test can land.
> > > > >
> > > > > Talking about virtio for QEMU is missing the point of this test, which
> > > > > is after all a test of booting an EFI app. I do wish more people would
> > > > > see the value in these unit tests. There is a talk at [2] which shows
> > > > > how emulators are used in Zephyr.
> > > >
> > > > So that talk is interesting, yes. So, yes, implement the bus driver for
> > > > sandbox for virtio, and until then we shouldn't have the tests running
> > > > on sandbox? Or am I still missing something?
> > >
> > > Sure, but perhaps there is a way to get this test landed without doing
> > > that work right away?
> >
> > Maybe? I guess I'm missing how the problem isn't a problem with the
> > sandbox emulation of it.
>
> Basically the virtio block device is probed by EFI (for no useful
> purpose), but doesn't actually work.
>
> >
> > > I'm not sure if we actually need d5391bf02b9 ("efi_loader: ensure all
> > > block devices are probed"). It seems to fix a real problem, though.
> >
> > That commit seems fairly intentional and I kinda recall that being one
> > of those challenge points, conceptually. In order for the EFI_LOADER to
> > do what it needs to do correctly, it needs to know what all exists. This
> > is contrary to the usual U-Boot practice of not probing something until
> > it's specifically needed.
>
> Indeed, but we have to live with it.
Which gets back to the question I was asking, is the sandbox virtio
driver deficient here? It sounds like that doesn't work, and that's the
problem.
> > > > But I also still say that given that we as a project are more resource
> > > > constrained than Zephyr, for things that are QEMU-centric, there's
> > > > already a wealth of information on debugging QEMU since it too is
> > > > software. There's only so many hours in the day after all.
> > >
> > > One of Zephyr's challenges is that it relied on QEMU for almost all
> > > testing for a long time. As a result it takes a huge amount of CPU
> > > power to run tests - last I checked it was something like an hour on a
> > > 64-core machine. U-Boot's unit tests ('ut all') run in about 12
> > > seconds on my machine. I could go on for hours about the different
> > > types of tests and the benefits of one versus the other, but the
> > > cheapest answer is not necessarily just to do a 'happy path' test and
> > > call it good.
> >
> > Everything has it's place, yes. For us, sandbox tests take 15-20 minutes
> > per run in CI and most QEMU platforms finish up in about a minute. And
> > of course, it would be real nice if we could easily build those
> > platforms in CI with CONFIG_UNIT_TEST enabled, but I don't think that
> > would cause the run time to balloon up (nor are they the cause of the
> > overall time on sandbox, that would be filesystem tests).
>
> Right, I normally use 'make qcheck' which skips the FS test and some
> other slow ones
>
> Some notes from a little bit of digging: There are almost 1000 sandbox
> tests (17-20mins), but qemu_arm only runs 62 (2mins). With 'make
> qcheck' it runs about 2500 tests in about 4 minutes. I just got 'make
> pcheck' going again and that is a little faster (2.5 mins). Binman
> tests run in parallel if you use 'pip install concurrencytest'
Yes, I find it frustrating that I only tend to run ~50 tests on real
hardware each iteration and skip ~400. Of course, 250 of them are skips
because they only support sandbox. I guess I need to find time to dig in
to UNIT_TEST compiling on more platforms again.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
next prev parent reply other threads:[~2024-08-15 22:56 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 12:58 [PATCH v2 00/39] efi: Add a test for EFI bootmeth Simon Glass
2024-08-06 12:58 ` [PATCH v2 01/39] nvmxip: Drop the message on probe Simon Glass
2024-08-06 12:58 ` [PATCH v2 02/39] nvmxip: Avoid probing on boot Simon Glass
2024-08-06 12:58 ` [PATCH v2 03/39] bootstd: Add UT_TESTF_CONSOLE_REC to bootflow tests Simon Glass
2024-08-06 12:58 ` [PATCH v2 04/39] test/py: Fix some pylint warnings in test_ut.py Simon Glass
2024-08-06 12:58 ` [PATCH v2 05/39] scripts: Update pylint.base Simon Glass
2024-08-06 12:58 ` [PATCH v2 06/39] bootstd: Create a function to reset USB Simon Glass
2024-08-07 1:56 ` Heinrich Schuchardt
2024-08-07 14:36 ` Simon Glass
2024-08-08 21:07 ` Heinrich Schuchardt
2024-08-11 14:50 ` Simon Glass
2024-08-06 12:58 ` [PATCH v2 07/39] usb: Drop old non-DM code Simon Glass
2024-08-06 12:58 ` [PATCH v2 08/39] log: Add a new log category for the console Simon Glass
2024-08-06 12:58 ` [PATCH v2 09/39] usb: Add DEV_FLAGS_DM to stdio for USB keyboard Simon Glass
2024-08-06 12:58 ` [PATCH v2 10/39] dm: usb: Deal with USB keyboard persisting across tests Simon Glass
2024-08-06 12:58 ` [PATCH v2 11/39] test: mbr: Adjust test to use lower-case hex Simon Glass
2024-08-06 12:58 ` [PATCH v2 12/39] test: mbr: Adjust test to drop 0x Simon Glass
2024-08-06 12:58 ` [PATCH v2 13/39] sandbox: Change the range used for memory-mapping tags Simon Glass
2024-08-06 12:58 ` [PATCH v2 14/39] sandbox: Update cpu to use logging Simon Glass
2024-08-06 12:58 ` [PATCH v2 15/39] sandbox: Unmap old tags Simon Glass
2024-08-06 12:58 ` [PATCH v2 16/39] sandbox: Add some debugging to pci_io Simon Glass
2024-08-06 12:58 ` [PATCH v2 17/39] sandbox: Implement reference counting for address mapping Simon Glass
2024-08-06 12:58 ` [PATCH v2 18/39] mmc: Use map_sysmem() with buffers in the mmc command Simon Glass
2024-08-06 12:58 ` [PATCH v2 19/39] read: Use map_sysmem() with buffers in the read command Simon Glass
2024-08-08 10:20 ` Ilias Apalodimas
2024-08-06 12:58 ` [PATCH v2 20/39] cmd: Fix memory-mapping in cmp command Simon Glass
2024-08-06 12:58 ` [PATCH v2 21/39] test: mbr: Unmap the buffers after use Simon Glass
2024-08-08 10:13 ` Ilias Apalodimas
2024-08-06 12:58 ` [PATCH v2 22/39] test: mbr: Use a constant for the block size Simon Glass
2024-08-08 10:15 ` Ilias Apalodimas
2024-08-06 12:58 ` [PATCH v2 23/39] test: mbr: Use RAM for the buffers Simon Glass
2024-08-06 12:58 ` [PATCH v2 24/39] test: mbr: Drop a duplicate test Simon Glass
2024-08-06 12:58 ` [PATCH v2 25/39] efi: Use puts() in cout so that console recording works Simon Glass
2024-08-07 0:37 ` Heinrich Schuchardt
2024-08-06 12:58 ` [PATCH v2 26/39] efi_loader: Put back copyright message Simon Glass
2024-08-06 12:58 ` [PATCH v2 27/39] efi_loader: Rename and move CMD_BOOTEFI_HELLO_COMPILE Simon Glass
2024-08-07 1:01 ` Heinrich Schuchardt
2024-08-06 12:58 ` [PATCH v2 28/39] efi_loader: Shorten the app rules Simon Glass
2024-08-07 1:04 ` Heinrich Schuchardt
2024-08-06 12:58 ` [PATCH v2 29/39] efi_loader: Shorten the app rules further Simon Glass
2024-08-07 1:05 ` Heinrich Schuchardt
2024-08-07 7:00 ` Ilias Apalodimas
2024-08-06 12:58 ` [PATCH v2 30/39] efi: Show the vendor in helloworld Simon Glass
2024-08-07 1:22 ` Heinrich Schuchardt
2024-08-06 12:58 ` [PATCH v2 31/39] Revert "bootdev: avoid infinite probe loop" Simon Glass
2024-08-07 1:27 ` Heinrich Schuchardt
2024-08-06 12:58 ` [PATCH v2 32/39] bootstd: Make bootdev_next_prio() continue after failure Simon Glass
2024-08-06 12:58 ` [PATCH v2 33/39] efi: Use the same filename for all sandbox builds Simon Glass
2024-08-08 10:18 ` Ilias Apalodimas
2024-08-06 12:58 ` [PATCH v2 34/39] bootstd: Add debugging for efi bootmeth Simon Glass
2024-08-06 12:58 ` [PATCH v2 35/39] efi: Disable ANSI output for tests Simon Glass
2024-08-06 12:58 ` [PATCH v2 36/39] efi: Add a test app Simon Glass
2024-08-07 1:42 ` Heinrich Schuchardt
2024-08-07 14:36 ` Simon Glass
2024-08-08 21:17 ` Heinrich Schuchardt
2024-08-11 14:50 ` Simon Glass
2024-08-06 12:58 ` [PATCH v2 37/39] efi: Avoid using sandbox virtio devices Simon Glass
2024-08-07 1:47 ` Heinrich Schuchardt
2024-08-07 1:56 ` Tom Rini
2024-08-08 18:44 ` Simon Glass
2024-08-08 20:06 ` Tom Rini
2024-08-11 14:50 ` Simon Glass
2024-08-14 17:56 ` Tom Rini
2024-08-15 20:33 ` Simon Glass
2024-08-15 22:56 ` Tom Rini [this message]
2024-08-16 1:34 ` Simon Glass
2024-08-16 23:53 ` Simon Glass
2024-08-22 15:13 ` Tom Rini
2024-08-22 17:11 ` Simon Glass
2024-08-06 12:58 ` [PATCH v2 38/39] test: Set up an image suitable for EFI testing Simon Glass
2024-08-06 12:58 ` [PATCH v2 39/39] efi: Add a test for the efi bootmeth Simon Glass
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=20240815225626.GW1626301@bill-the-cat \
--to=trini@konsulko.com \
--cc=caleb.connolly@linaro.org \
--cc=ilias.apalodimas@linaro.org \
--cc=kojima.masahisa@socionext.com \
--cc=raymond.mao@linaro.org \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.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
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