[PATCH v4 9/9] tests: Use @BUILD_SHEBANG@ autoconf var instead of literal shell

2021-10-12 Thread Glenn Washburn
This bring this test in line with the rest of the test scripts. Signed-off-by: Glenn Washburn --- tests/f2fs_test.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/f2fs_test.in b/tests/f2fs_test.in index 1ea77c826..8c415db61 100644 --- a/tests/f2fs_test.in +++ b/tests/

[PATCH v4 6/9] tests: Make setup errors in grub-fs-tester hard errors

2021-10-12 Thread Glenn Washburn
When a test program fails because it failed to setup the test properly, this does not indicate a failure in what is attempting to be tested because the test is never run. So exit with a hard error exit status to note this difference. This will allow easier detection of tests that are not actually b

[PATCH v4 5/9] tests: Do not occlude grub-shell return code

2021-10-12 Thread Glenn Washburn
The script grub-shell does the bulk of the testing. If it returns an error code, that means that the test failed and the test should immediately exit with that error code. When grub-shell is used as a non-terminating command in a pipeline, eg. when data needs to be extracted from its output, its er

[PATCH v4 8/9] tests: Exit with skipped exit code when test not performed

2021-10-12 Thread Glenn Washburn
These tests were not performed and therefore did not pass, nor fail. This fixes misleading test exit code where, for instance, the pseries_test will pass on i386-pc, which is not a pseries architecture. Signed-off-by: Glenn Washburn --- tests/ahci_test.in | 8 tests/cdboot_tes

[PATCH v4 3/9] tests: Add set -e to missing tests

2021-10-12 Thread Glenn Washburn
This helps to ensure that error codes do not get ignored. Signed-off-by: Glenn Washburn --- tests/grub_cmd_test.in| 1 + tests/grub_script_blockarg.in | 1 + tests/test_sha512sum.in | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/grub_cmd_test.in b/tests/grub_cmd_test.i

[PATCH v4 2/9] tests: When checking squashfs fstime, use superblock last modified time

2021-10-12 Thread Glenn Washburn
Currently, the filesystem timestamp check in grub-fs-tester uses the squashfs image file's last modified timestamp and checks to see if that time stamp is within 3 seconds of the superblock timestamp as determined by grub. The image file's timestamp could be more than 3 seconds off if mksquashfs ta

[PATCH v4 7/9] tests: A failure of mktemp should cause the test script to exit with code 99

2021-10-12 Thread Glenn Washburn
A test exiting with code 99 means that there was an error in the test itself and not a failure in the thing being tested (also known as a hard error). Signed-off-by: Glenn Washburn --- tests/ahci_test.in| 4 ++-- tests/ehci_test.in| 4 ++-- tests/gettext_strings_test.in |

[PATCH v4 4/9] tests: Do not occlude subshell error codes when used as input to the test command

2021-10-12 Thread Glenn Washburn
When using the output of a subshell as input, its error code is ignored in the context of "set -e". Many test scripts use grub-shell in a subshell with output used as an argument to the test command to test for expected output. Refactor these tests so that the subshell output goes to a shell variab

[PATCH v4 1/9] tests: Fix partmap_test for arm*-efi, disk numbering has changed

2021-10-12 Thread Glenn Washburn
Perhaps using a newer UEFI firmware is the reason for the created test disk showing up as hd2 instead of hd3. Signed-off-by: Glenn Washburn --- tests/partmap_test.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/partmap_test.in b/tests/partmap_test.in index 6ef518b0a.

[PATCH v4 0/9] Various fixes/improvements for tests

2021-10-12 Thread Glenn Washburn
Updates since v3: * Dropped iso9660_test LANG patch * Merged v3 in v2 * Rewrote commit message for #4 to hopefully be clearer * Replace `...` with $(...) These are mostly test improvement and fixes that stand on their own. Glenn Glenn Washburn (9): tests: Fix partmap_test for arm*-efi, disk nu

Re: [PATCH v3 2/4] tests: Do not occlude subshell error codes

2021-10-12 Thread Glenn Washburn
On Tue, 12 Oct 2021 21:40:45 +0200 Daniel Kiper wrote: > On Mon, Oct 11, 2021 at 01:06:17PM -0500, Glenn Washburn wrote: > > On Mon, 11 Oct 2021 16:20:46 +0200 > > Daniel Kiper wrote: > > > > > On Thu, Oct 07, 2021 at 03:33:25PM -0500, Glenn Washburn wrote: > > > > When a subshell's output is us

[PATCH v3 2/4] cryptodisk: Refactor password input out of crypto dev modules into cryptodisk

2021-10-12 Thread Glenn Washburn
The crypto device modules should only be setting up the crypto devices and not getting user input. This has the added benefit of simplifying the code such that three essentially duplicate pieces of code are merged into one. Signed-off-by: Glenn Washburn --- grub-core/disk/cryptodisk.c | 52 +

[PATCH v3 4/4] cryptodisk: Remove unneeded found_uuid from cryptomount args

2021-10-12 Thread Glenn Washburn
The member found_uuid was never used by the crypto-backends, but was used to determine if a crypto-backend successfully mounted a cryptodisk with a given uuid. This is not needed however, because grub_device_iterate will return 1 iff grub_cryptodisk_scan_device returns 1. And grub_cryptodisk_scan_d

[PATCH v3 3/4] cryptodisk: Move global variables into grub_cryptomount_args struct

2021-10-12 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/disk/cryptodisk.c | 26 +- grub-core/disk/geli.c | 9 - grub-core/disk/luks.c | 11 +-- grub-core/disk/luks2.c | 6 +++--- include/grub/cryptodisk.h | 10 -- 5 files changed, 29 insert

[PATCH v3 1/4] cryptodisk: Add infrastructure to pass data from cryptomount to cryptodisk modules

2021-10-12 Thread Glenn Washburn
As an example, passing a password as a cryptomount argument is implemented. However, the backends are not implemented, so testing this will return a not implemented error. Signed-off-by: Glenn Washburn --- grub-core/disk/cryptodisk.c | 31 +-- grub-core/disk/geli.c

[PATCH v3 0/4] Refactor/improve cryptomount data passing to crypto modules

2021-10-12 Thread Glenn Washburn
Updates since v2: * Add space after function name in function calls * Add comments for members of struct grub_cryptomount_args * Correct commit message for patch #4 --- This patch series refactors the way cryptomount passes data to the crypto modules. Currently, the method has been by global varia

[PATCH v3] docs: Add fuller accounting of make check prerequisites

2021-10-12 Thread Glenn Washburn
Many of the prerequisites for exercising the full "make check" test suite have not been documented. This adds them along with a note that some tests require elevated privileges to run. Add an incomplete list of cross compiling toolchain packages for Debian and trusted sources for other distro. Ad

Re: [PATCH v2] docs: Add fuller accounting of make check prerequisites

2021-10-12 Thread Glenn Washburn
On Mon, 11 Oct 2021 17:27:19 +0200 Daniel Kiper wrote: > On Fri, Oct 08, 2021 at 01:10:07PM -0500, Glenn Washburn wrote: > > On Tue, 5 Oct 2021 18:08:10 +0200 > > Daniel Kiper wrote: > > > > > On Tue, Oct 05, 2021 at 12:45:04AM -0500, Glenn Washburn wrote: > > > > Many of the prerequisites for e

Re: [PATCH v3 2/4] tests: Do not occlude subshell error codes

2021-10-12 Thread Daniel Kiper
On Mon, Oct 11, 2021 at 01:06:17PM -0500, Glenn Washburn wrote: > On Mon, 11 Oct 2021 16:20:46 +0200 > Daniel Kiper wrote: > > > On Thu, Oct 07, 2021 at 03:33:25PM -0500, Glenn Washburn wrote: > > > When a subshell's output is used as input to a "simple command", its > > > return I think you sho

Re: [PATCH 03/19] mm: document grub internal memory management structures

2021-10-12 Thread Glenn Washburn
On Tue, 12 Oct 2021 18:29:52 +1100 Daniel Axtens wrote: > I spent more than a trivial quantity of time figuring out pre_size and > whether a memory region's size contains the header cell or not. > > Document the meanings of all the properties. Hopefully now no-one else > has to figure it out! >

Re: [PATCH 02/19] grub-shell: pseries: don't pass fw_opt to qemu

2021-10-12 Thread Glenn Washburn
On Tue, 12 Oct 2021 18:29:51 +1100 Daniel Axtens wrote: > At some point this started to break the test - qemu just rejects the > command line. Just don't pass it in, it's seabios specific. > > Signed-off-by: Daniel Axtens > --- > tests/util/grub-shell.in | 6 +- > 1 file changed, 5 inserti

Re: [PATCH 01/19] grub-shell: Boot PowerPC using PMU instead of CUDA for power management

2021-10-12 Thread Glenn Washburn
On Tue, 12 Oct 2021 18:29:50 +1100 Daniel Axtens wrote: > From: Glenn Washburn > > A recent refactoring of CUDA command code has exposed a bug in OpenBIOS[1] > which was causing system powerdown and system reset to fail, thus causing > the Qemu instance to hang. This in turn caused the grub-she

[PATCH 14/19] ieee1275: request memory with ibm, client-architecture-support

2021-10-12 Thread Daniel Axtens
On PowerVM, the first time we boot a Linux partition, we may only get 256MB of real memory area, even if the partition has more memory. This isn't really enough. Fortunately, the Power Architecture Platform Reference (PAPR) defines a method we can call to ask for more memory. This is part of the b

[PATCH 18/19] [not for merge] ieee1275 debugging info

2021-10-12 Thread Daniel Axtens
This is also handy for debugging. Signed-off-by: Daniel Axtens --- grub-core/kern/ieee1275/init.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c index 0fb7bae280df..f70cb134178b 100644 --- a/grub-cor

[PATCH 12/19] efi: mm: Pass up errors from `add_memory_regions ()`

2021-10-12 Thread Daniel Axtens
From: Patrick Steinhardt The function `add_memory_regions ()` is currently only called on system initialization to allocate a fixed amount of pages. As such, it didn't need to return any errors: in case it failed, we cannot proceed anyway. This will change with the upcoming support for requesting

[PATCH 11/19] efi: mm: Extract function to add memory regions

2021-10-12 Thread Daniel Axtens
From: Patrick Steinhardt In preparation of support for runtime-allocating additional memory region, this patch extracts the function to retrieve the EFI memory map and add a subset of it to GRUB's own memory regions. Signed-off-by: Patrick Steinhardt --- grub-core/kern/efi/mm.c | 23 ++

[PATCH 17/19] [not for merge] print more debug info in mm

2021-10-12 Thread Daniel Axtens
This is handy for debugging - I'm including it in case anyone else hacking on this area finds it helpful. Signed-off-by: Daniel Axtens --- grub-core/kern/mm.c | 8 1 file changed, 8 insertions(+) diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c index 58d5b89e8860..811df1ab5ebb 10

[PATCH 19/19] RFC: Ignore REGION_CONSECUTIVE

2021-10-12 Thread Daniel Axtens
Looking into the region merging stuff, I started to wonder if we actually want to just try adding as much memory as we can (up to the limit requested), even if we cannot satisfy the full allocation (i.e. we are not CONSECUTIVE). On powerpc-ieee1275 this actually allows me to satisfy bigger allocat

[PATCH 06/19] configure: properly pass through MM_DEBUG

2021-10-12 Thread Daniel Axtens
I noticed that compiling with --enable-mm-debug didn't cause the functions in #ifdef MM_DEBUG to be compiled in. Somehow the variable wasn't actually being substituted into anything that was built. Change configure.ac to do AC_SUBST(), and put a substitution into config.h.in. This makes MM_DEBUG a

[PATCH 13/19] efi: mm: Implement runtime addition of pages

2021-10-12 Thread Daniel Axtens
From: Patrick Steinhardt Adjust the interface of `grub_efi_mm_add_regions ()` to take a set of `GRUB_MM_ADD_REGION_*` flags, which most notably is currently only the `CONSECUTVE` flag. This allows us to set the function up as callback for the memory subsystem and have it call out to us in case th

[PATCH 16/19] ieee1275: support runtime memory claiming

2021-10-12 Thread Daniel Axtens
On powerpc-ieee1275, we are running out of memory trying to verify anything. This is because: - we have to load an entire file into memory to verify it. This is extremely difficult to change with appended signatures. - We only have 32MB of heap. - Distro kernels are now often around 30MB. S

[PATCH 15/19] ieee1275: drop len -= 1 quirk in heap_init

2021-10-12 Thread Daniel Axtens
This was apparently 'required by some firmware': commit dc9468500919 ("2007-02-12 Hollis Blanchard "). It's not clear what firmware that was, and what platform from 14 years ago which exhibited the bug then is still both in use and buggy now. It doesn't cause issues on qemu (mac99 or pseries) o

[PATCH 07/19] Add memtool module with memory allocation stress-test

2021-10-12 Thread Daniel Axtens
When working on memory, it's nice to be able to test your work. Add a memtest module. When compiled with --enable-mm-debug, it exposes 3 commands: * lsmem - print all allocations and free space in all regions * lsfreemem - print free space in all regions * stress_big_allocs - stress test larg

[PATCH 02/19] grub-shell: pseries: don't pass fw_opt to qemu

2021-10-12 Thread Daniel Axtens
At some point this started to break the test - qemu just rejects the command line. Just don't pass it in, it's seabios specific. Signed-off-by: Daniel Axtens --- tests/util/grub-shell.in | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/util/grub-shell.in b/tests/uti

[PATCH 09/19] mm: Allow dynamically requesting additional memory regions

2021-10-12 Thread Daniel Axtens
From: Patrick Steinhardt Currently, all platforms will set up their heap on initialization of the platform code. While this works mostly fine, it poses some limitations on memory management on us. Most notably, allocating big chunks of memory in the gigabyte range would require us to pre-request

[PATCH 10/19] efi: mm: Always request a fixed number of pages on init

2021-10-12 Thread Daniel Axtens
From: Patrick Steinhardt When initializing the EFI memory subsytem, we will by default request a quarter of the available memory, bounded by a minimum/maximum value. Given that we're about to extend the EFI memory system to dynamically request additional pages from the firmware as required, this

[PATCH 05/19] mm: when adding a region, merge with region after as well as before

2021-10-12 Thread Daniel Axtens
On x86_64-efi (at least) regions seem to be added from top down. The mm code will merge a new region with an existing region that comes immediately before the new region. This allows larger allocations to be satisfied that would otherwise be the case. On powerpc-ieee1275, however, regions are adde

[PATCH 03/19] mm: document grub internal memory management structures

2021-10-12 Thread Daniel Axtens
I spent more than a trivial quantity of time figuring out pre_size and whether a memory region's size contains the header cell or not. Document the meanings of all the properties. Hopefully now no-one else has to figure it out! Signed-off-by: Daniel Axtens --- include/grub/mm_private.h | 21 +++

[PATCH 08/19] mm: Drop unused unloading of modules on OOM

2021-10-12 Thread Daniel Axtens
From: Patrick Steinhardt In `grub_memalign ()`, there's a commented section which would allow for unloading of unneeded modules in case where there is not enough free memory available to satisfy a request. Given that this code is never compiled in, let's remove it together with `grub_dl_unload_un

[PATCH 04/19] mm: assert that we preserve header vs region alignment

2021-10-12 Thread Daniel Axtens
grub_mm_region_init() does: h = (grub_mm_header_t) (r + 1); where h is a grub_mm_header_t and r is a grub_mm_region_t. Cells are supposed to be GRUB_MM_ALIGN aligned, but while grub_mm_dump ensures this vs the region header, grub_mm_region_init() does not. It's better to be explicit than impl

[PATCH 01/19] grub-shell: Boot PowerPC using PMU instead of CUDA for power management

2021-10-12 Thread Daniel Axtens
From: Glenn Washburn A recent refactoring of CUDA command code has exposed a bug in OpenBIOS[1] which was causing system powerdown and system reset to fail, thus causing the Qemu instance to hang. This in turn caused the grub-shell command to timeout causing it to return an error code when the te

[PATCH 00/19] Requesting more memory from firmware

2021-10-12 Thread Daniel Axtens
Hi, This extends Patrick's work on adding the ability to dynamically request more memory from firmware. It now supports powerpc-ieee1275 - I can allocate pretty large chunks of memory and still successfully boot under both SLOF and Power8 PFW. Structure of the series: - Patches 1 & 2: little p