Skip to content

boot: serialize downloaded image info for reload#2629

Merged
10000TB merged 2 commits into
mainfrom
davidhu-specify-kexec-name
Feb 22, 2023
Merged

boot: serialize downloaded image info for reload#2629
10000TB merged 2 commits into
mainfrom
davidhu-specify-kexec-name

Conversation

@10000TB

@10000TB 10000TB commented Feb 21, 2023

Copy link
Copy Markdown
Member

This is only triggered when we specify to not load image. Downloaded image info, together with other
configs like cmdline will be saved to a file under tmpfs, which can be reloaded via kexec cmd

@10000TB 10000TB force-pushed the davidhu-specify-kexec-name branch 6 times, most recently from 4d8975a to 0e312d3 Compare February 21, 2023 22:19
@10000TB 10000TB requested review from a team, andrewsun2898, hugelgupf and rminnich and removed request for hugelgupf February 21, 2023 22:36
@codecov

codecov Bot commented Feb 21, 2023

Copy link
Copy Markdown

Codecov Report

Base: 66.70% // Head: 74.72% // Increases project coverage by +8.02% 🎉

Coverage data is based on head (7fe8ca5) compared to base (cbbcd31).
Patch coverage: 1.29% of modified lines in pull request are covered.

❗ Current head 7fe8ca5 differs from pull request most recent head 49cbf74. Consider uploading reports for the commit 49cbf74 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2629      +/-   ##
==========================================
+ Coverage   66.70%   74.72%   +8.02%     
==========================================
  Files         111      412     +301     
  Lines        6436    41641   +35205     
==========================================
+ Hits         4293    31118   +26825     
- Misses       2143    10523    +8380     
Impacted Files Coverage Δ
pkg/boot/boot.go 7.40% <0.00%> (ø)
pkg/boot/linux.go 51.59% <0.00%> (ø)
pkg/boot/linux/opts.go 0.00% <0.00%> (ø)
pkg/vmtest/integration.go 63.85% <25.00%> (ø)
pkg/acpi/rsdp_unix.go 82.60% <0.00%> (ø)
pkg/cpio/fs_unix.go 32.17% <0.00%> (ø)
pkg/smbios/table_type.go 52.63% <0.00%> (ø)
pkg/namespace/namespace_unix.go 0.00% <0.00%> (ø)
pkg/rand/random_urandom.go 0.00% <0.00%> (ø)
pkg/ldd/ldso_linux.go 83.33% <0.00%> (ø)
... and 301 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@10000TB 10000TB force-pushed the davidhu-specify-kexec-name branch from 0e312d3 to bf044e2 Compare February 21, 2023 22:40
@10000TB

10000TB commented Feb 21, 2023

Copy link
Copy Markdown
Member Author

adding a TestKexecLoadedImageInfo to kexec_test.go -- send it for review meanwhile

Comment thread cmds/core/kexec/kexec_linux.go Outdated
Comment thread cmds/core/kexec/kexec_linux.go Outdated
Comment thread pkg/boot/boot.go Outdated
Comment thread pkg/boot/boot.go Outdated
@10000TB 10000TB force-pushed the davidhu-specify-kexec-name branch 6 times, most recently from 8f8e589 to ddd03fa Compare February 22, 2023 03:02
@10000TB 10000TB requested a review from hugelgupf February 22, 2023 03:21
@10000TB 10000TB force-pushed the davidhu-specify-kexec-name branch from ddd03fa to e0dda13 Compare February 22, 2023 03:59
Comment thread cmds/core/kexec/kexec_linux.go Outdated
Comment thread cmds/core/kexec/kexec_linux.go Outdated
Comment thread integration/generic-tests/kexec_test.go
Comment thread pkg/boot/linux.go Outdated
Comment thread pkg/boot/linux.go Outdated
Comment thread pkg/boot/linux.go Outdated
Comment thread pkg/boot/linux.go
Comment thread pkg/boot/linux.go
Comment thread pkg/vmtest/integration.go Outdated
@10000TB 10000TB force-pushed the davidhu-specify-kexec-name branch 2 times, most recently from ce957a0 to 6b00948 Compare February 22, 2023 07:14
@10000TB 10000TB requested a review from hugelgupf February 22, 2023 07:16
@10000TB 10000TB added the Awaiting reviewer Waiting for a reviewer. label Feb 22, 2023
@10000TB 10000TB requested a review from ylchenfj February 22, 2023 19:36
@10000TB 10000TB force-pushed the davidhu-specify-kexec-name branch from 7fe8ca5 to 306c053 Compare February 22, 2023 22:32
Comment thread cmds/core/kexec/kexec_linux.go Outdated
@10000TB 10000TB requested a review from rminnich February 22, 2023 22:43
@10000TB 10000TB force-pushed the davidhu-specify-kexec-name branch from 306c053 to b00f6ce Compare February 22, 2023 22:51
Comment thread integration/generic-tests/kexec_test.go Outdated
Comment thread integration/generic-tests/kexec_test.go
@hugelgupf hugelgupf added Awaiting author Waiting for new changes or feedback for author. and removed Awaiting reviewer Waiting for a reviewer. labels Feb 22, 2023
@10000TB 10000TB force-pushed the davidhu-specify-kexec-name branch 2 times, most recently from 56bf11c to c4c039f Compare February 22, 2023 23:04
Comment thread integration/generic-tests/kexec_test.go Outdated
This is only triggered when we specify to not load
image. Downloaded image info, together with other
configs like cmdline will be saved to a file under
tmpfs, which can be reloaded via kexec cmd.

An example flow looks like

Run /init as init process
1970/01/01 00:00:03 Welcome to u-root!
                              _
   _   _      _ __ ___   ___ | |_
  | | | |____| '__/ _ \ / _ \| __|
  | |_| |____| | | (_) | (_) | |_
   \__,_|    |_|  \___/ \___/ \__|

/# echo '{ "InitrdPath": "/testdata/initramfs.cpio", "KernelPath": "/testdata/ke
   rnel", "Cmdline": "/proc/cmdline", "Name": "testloadconfig" }' > /tmp/linux_i
   mage_cfg.json
/# cat /tmp/linux_image_cfg.json
{ "InitrdPath": "/testdata/initramfs.cpio", "KernelPath": "/testdata/kernel", "Cmdline": "/proc/cmdline", "Name": "testloadconfig" }
/# ls /testdata
initramfs.cpio
kernel
/# kexec -d -I /tmp/linux_image_cfg.json
1970/01/01 00:01:25 Load image info from /tmp/linux_image_cfg.json
1970/01/01 00:01:25 read: { "InitrdPath": "/testdata/initramfs.cpio", "KernelPath": "/testdata/kernel", "Cmdline": "/proc/cmdline", "Name": "testloadconfig" }
1970/01/01 00:01:25 Call json.Unmarshal ...
1970/01/01 00:01:25 Start unmarshal
1970/01/01 00:01:25 lliJSON: {Name:testloadconfig KernelPath:/testdata/kernel InitrdPath:/testdata/initramfs.cpio Cmdline:/proc/cmdline LoadSyscall:false KexecOpts:{DTB:<nil> MmapKernel:false MmapRamfs:false}}
1970/01/01 00:01:25 Check lliJSON
1970/01/01 00:01:25 Done json.Marshal...
.
..
1970/01/01 00:01:26 Kernel: /tmp/kexec-image1468578633
1970/01/01 00:01:26 Initrd: /tmp/kexec-image3979801582
1970/01/01 00:01:26 Command line: /proc/cmdline
1970/01/01 00:01:26 KexecOpts: linux.KexecOptions{DTB:io.ReaderAt(nil), MmapKernel:false, MmapRamfs:false}
Booting Linux on physical CPU 0x0000000000 [0x000f0510]
Linux version 5.15.0 (xuehaohu@worldpeace.svl.corp.google.com) (aarch64-linux-gnu-gcc (Debian 12.2.0-3) 12.2.0, GNU ld (GNU Binutils for Debian) 2.39.50.20221208) #2 SMP Tue Feb 21 15:13:11 PST 2023
Machine model: linux,dummy-virt
efi: UEFI not found.
Zone ranges:
  DMA      [mem 0x0000000040000000-0x00000000ffffffff]
  DMA32    empty
  Normal   [mem 0x0000000100000000-0x000000013fffffff]
NET: Registered PF_INET6 protocol family
...
... (linux booting)
...
Segment Routing with IPv6
In-situ OAM (IOAM) with IPv6
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
NET: Registered PF_PACKET protocol family
9pnet: Installing 9P2000 support
Freeing initrd memory: 12748K
Freeing unused kernel memory: 960K
Run /init as init process
1970/01/01 00:00:03 Welcome to u-root!
                              _
   _   _      _ __ ___   ___ | |_
  | | | |____| '__/ _ \ / _ \| __|
  | |_| |____| | | (_) | (_) | |_
   \__,_|    |_|  \___/ \___/ \__|

/# uname -a
Linux (none) 5.15.0 #2 SMP Tue Feb 21 15:13:11 PST 2023 aarch64 (none)
/#

Signed-off-by: David Hu <xuehaohu@google.com>
@10000TB 10000TB force-pushed the davidhu-specify-kexec-name branch from 49cbf74 to af9065c Compare February 22, 2023 23:17
@10000TB 10000TB requested a review from hugelgupf February 22, 2023 23:17
@10000TB 10000TB merged commit e66ab08 into main Feb 22, 2023
@10000TB 10000TB removed the Awaiting author Waiting for new changes or feedback for author. label Feb 22, 2023
@hugelgupf hugelgupf deleted the davidhu-specify-kexec-name branch February 23, 2023 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants