Skip to content

kexec: memory map improvements (incl dumpmemmap command)#2864

Merged
hugelgupf merged 12 commits intou-root:mainfrom
hugelgupf:iomem
Jan 29, 2024
Merged

kexec: memory map improvements (incl dumpmemmap command)#2864
hugelgupf merged 12 commits intou-root:mainfrom
hugelgupf:iomem

Conversation

@hugelgupf
Copy link
Copy Markdown
Member

@hugelgupf hugelgupf commented Jan 22, 2024

It's a large PR, but the individual commits should be easy to review if going in order.

  • Rename ParseMemoryMap to MemoryMapFromEFI to clarify origin of data (and that it only works on EFI systems)
  • Small code reorg
  • Add reading memory map from /proc/iomem (available on every system) and /sys/kernel/debug/memblock (only on CONFIG_ARCH_KEEP_MEMBLOCK systems, in particular, arm64)
  • Add dumpmemmap command to show all possible interpretations of physical memory on a system

This is working toward a place where every kexec parser uses a valid memory map for the host system. Just improving the primitives and their readability / usability here.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 22, 2024

Codecov Report

Attention: 34 lines in your changes are missing coverage. Please review.

Comparison is base (c27e9c3) 77.45% compared to head (1614f8c) 77.32%.

❗ Current head 1614f8c differs from pull request most recent head b6d069c. Consider uploading reports for the commit b6d069c to get more accurate results

Files Patch % Lines
pkg/boot/kexec/memory_map_linux.go 87.20% 33 Missing ⚠️
pkg/boot/linux/load_linux_arm64.go 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2864      +/-   ##
==========================================
- Coverage   77.45%   77.32%   -0.14%     
==========================================
  Files         427      428       +1     
  Lines       42954    43060     +106     
==========================================
+ Hits        33272    33296      +24     
- Misses       9682     9764      +82     
Flag Coverage Δ
.-amd64 67.87% <ø> (ø)
cmds/...-amd64 71.47% <ø> (ø)
integration/generic-tests/...-amd64 18.21% <38.66%> (-0.21%) ⬇️
integration/generic-tests/...-arm 0.00% <ø> (ø)
integration/generic-tests/...-arm64 21.80% <21.26%> (-0.33%) ⬇️
integration/gotests/...-amd64 74.16% <80.29%> (-0.20%) ⬇️
integration/gotests/...-arm 75.39% <40.00%> (-0.01%) ⬇️
integration/gotests/...-arm64 75.11% <80.00%> (-0.01%) ⬇️
pkg/...-amd64 76.12% <80.29%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hugelgupf hugelgupf force-pushed the iomem branch 2 times, most recently from 06efc02 to 2dea5f5 Compare January 26, 2024 23:28
@hugelgupf hugelgupf changed the title kexec: parse memory map from /proc/iomem kexec: memory map improvements (incl dumpmemmap command) Jan 27, 2024
}
m.Insert(TypedRange{
// end is inclusive.
Range: RangeFromInterval(uintptr(start), uintptr(end+1)),

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types

Incorrect conversion of an unsigned 64-bit integer from [strconv.ParseUint](1) to a lower bit size type uintptr without an upper bound check.
return nil
}
// end is inclusive.
r := RangeFromInterval(uintptr(start), uintptr(end+1))

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types

Incorrect conversion of an unsigned 64-bit integer from [strconv.ParseUint](1) to a lower bit size type uintptr without an upper bound check.
@hugelgupf hugelgupf marked this pull request as ready for review January 27, 2024 19:38
@hugelgupf hugelgupf requested a review from a team January 27, 2024 19:39
@hugelgupf hugelgupf force-pushed the iomem branch 3 times, most recently from 71abebd to 2dd188d Compare January 27, 2024 20:03
@hugelgupf hugelgupf force-pushed the iomem branch 2 times, most recently from c07c3b0 to 621aee0 Compare January 27, 2024 20:33
Clarifies what this type is used for.

Signed-off-by: Chris Koch <[email protected]>
Signed-off-by: Chris Koch <[email protected]>
Signed-off-by: Chris Koch <[email protected]>
@hugelgupf hugelgupf enabled auto-merge (rebase) January 29, 2024 16:58
@hugelgupf hugelgupf merged commit 5c5df9a into u-root:main Jan 29, 2024
@hugelgupf hugelgupf deleted the iomem branch January 29, 2024 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Awaiting reviewer Waiting for a reviewer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants