Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules_force_load can be loaded earlier #103

Closed
ishitatsuyuki opened this issue Sep 19, 2021 · 5 comments
Closed

modules_force_load can be loaded earlier #103

ishitatsuyuki opened this issue Sep 19, 2021 · 5 comments

Comments

@ishitatsuyuki
Copy link

I'm using modules_force_load for KMS, and booster gives a little dissatisfying result because by the time the mode switch completes my display manager would already have started.

mkinitcpio loads its MODULES "before anything else is done". I think we can do the same, since module loading is performed with a syscall and does not rely on any CLI utilities.

anatol added a commit that referenced this issue Sep 20, 2021
... before switching to userland

Resolves #103
@anatol
Copy link
Owner

anatol commented Sep 20, 2021

because by the time the mode switch completes my display manager would already have started.

Could you please share more information about the issue you see? Is the problem due to booster gets into userspace before all the modules_force_load completely loaded?

Currently booster loads modules_force_load asynchronously and does not wait for the operation completion. At the time I was implementing it was not clear whether a wait is needed.

mkinitcpio loads its MODULES "before anything else is done"

The "before anything else is done" condition is quite vague and restrictive. One of the booster goals is to get into userspace as fast as possible. And to achieve it booster tries to exploit parallelism as much as possible. If loading modules needs to be done synchronously at the beginning of the booster execution then it limits parallelism a lot.

So instead of "before anything else is done" I suggest to start with "before root filesystem is mounted" condition and see if it works.

Please check wip branch. I just pushed a change that makes booster waiting for modules loading before switching to the new root filesystem. Let me know if it fixes your issue.

@ishitatsuyuki
Copy link
Author

ishitatsuyuki commented Sep 20, 2021

I was lying, I thought I regenerated the image but I actually didn't. So I didn't enable modules_force_load.

Now actually trying to boot with modules_force_load: amdgpu, the GPU driver doesn't initialize. I opened #104.

What I originally meant to say is that this line can be moved further up in boost():

_ = loadModules(config.ModulesForceLoad...)

Making a few directory probably takes no time and it can run first, but we probably should be loading the modules before setting up the console font. Not sure if this actually makes a difference as I thought though, since I mistakenly assumed when I opened this issue that modules_force_load is configured when it wasn't.

I will (dirtily) fix the symlinks, try again booting, then report back.

@anatol
Copy link
Owner

anatol commented Sep 20, 2021

Making a few directory probably takes no time and it can run first, but we probably should be loading the modules before setting up the console font.

there are few things that should be done before we load the modules. e.g. starting udev listener should start before we modules loading to avoid missing udev events.

Moving virtual console config after loading modules sounds fine to me.

anatol added a commit that referenced this issue Sep 20, 2021
... before switching to userland

Issue #103
anatol added a commit that referenced this issue Sep 20, 2021
This gives more time for loading modules and makes the boot faster.

Issue #103
@ishitatsuyuki
Copy link
Author

With 90dd03a it seems that we are already loading things as early as we can, so this can be considered resolved.

I originally thought that 9337bc6 is unnecessary now, but if I revert it then a kernel null dereference happens so let's just keep that for compatibility's sake...

Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: [drm:amdgpu_dm_init.isra.0.cold [amdgpu]] *ERROR* amdgpu: failed to initialize sw for display support.
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: [drm] kiq ring mec 2 pipe 1 q 0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: [drm] VCN decode and encode initialized successfully(under DPG Mode).
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: [drm] JPEG decode initialized successfully.
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: kfd kfd: amdgpu: Allocated 3969056 bytes on gart
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: memmap_init_zone_device initialised 2097152 pages in 14ms
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: amdgpu: HMM registered 8176MB device memory
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: amdgpu: SRAT table not found
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: amdgpu: Virtual CRAT table created for GPU
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: amdgpu: Topology: Add dGPU node [0x731f:0x1002]
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: kfd kfd: amdgpu: added device 1002:731f
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: amdgpu 0000:0a:00.0: amdgpu: SE 2, SH per SE 2, CU per SH 10, active_cu_number 40
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: BUG: unable to handle page fault for address: 000000000000ecc8
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: #PF: supervisor read access in kernel mode
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: #PF: error_code(0x0000) - not-present page
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: PGD 100068067 P4D 100068067 PUD 10273f067 PMD 0 
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: Oops: 0000 [#1] PREEMPT SMP NOPTI
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: CPU: 12 PID: 252 Comm: init Not tainted 5.14.0-xanmod1-cacule-1 #1
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: Hardware name: Gigabyte Technology Co., Ltd. X570 AORUS ELITE/X570 AORUS ELITE, BIOS F33a 01/22/2021
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RIP: 0010:get_modes+0xa3/0x510 [amdgpu]
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: Code: f0 b2 ff 84 c0 75 78 ba e0 01 00 00 be 80 02 00 00 48 89 df e8 0e d9 b2 ff 89 83 c8 04 00 00 4c 8b 23 49 8b 84 24 a8 39 01 00 <48> 83 b8 c8 ec 00 00 00 74 14 48 8b 83 d8 04 00 00 81 78 38 80 00
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RSP: 0018:ffffbb690137f6f8 EFLAGS: 00010246
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RAX: 0000000000000000 RBX: ffff9b9c80f34000 RCX: 0000000000000000
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RDX: ffff9b9c8deba3c0 RSI: ffff9b9c8deba3c0 RDI: ffff9b9c8deba7c0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RBP: ffff9b9c82e3a800 R08: ffff9b9c80f340a0 R09: ffff9b9c80f340a0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: R10: 000000000000000a R11: 000000000000000a R12: ffff9b9c8de60010
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: R13: ffff9b9c80f340a0 R14: 0000000000000003 R15: ffff9b9c80f34000
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: FS:  000000c000380090(0000) GS:ffff9b9faed00000(0000) knlGS:0000000000000000
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: CR2: 000000000000ecc8 CR3: 0000000102d7c000 CR4: 0000000000350ee0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: Call Trace:
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  drm_helper_probe_single_connector_modes+0x1d0/0x860 [drm_kms_helper]
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  ? kfree+0xc3/0x3d0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  drm_client_modeset_probe+0x27f/0x13f0 [drm]
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  ? kmem_cache_alloc_trace+0x169/0x2e0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  ? amdgpu_driver_open_kms+0xd5/0x200 [amdgpu]
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  __drm_fb_helper_initial_config_and_unlock+0x44/0x4c0 [drm_kms_helper]
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  ? drm_client_init+0x131/0x160 [drm]
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  amdgpu_fbdev_init+0xb9/0xf0 [amdgpu]
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  amdgpu_device_init.cold+0x1415/0x1af5 [amdgpu]
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  amdgpu_driver_load_kms+0x67/0x300 [amdgpu]
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  amdgpu_pci_probe+0x110/0x1a0 [amdgpu]
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  local_pci_probe+0x42/0x80
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  ? pci_match_device+0xd7/0x110
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  pci_device_probe+0xfa/0x1b0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  really_probe+0x1e7/0x3e0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  __driver_probe_device+0xfe/0x180
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  driver_probe_device+0x1e/0x90
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  __driver_attach+0xc0/0x1c0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  ? __device_attach_driver+0xe0/0xe0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  ? __device_attach_driver+0xe0/0xe0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  bus_for_each_dev+0x89/0xd0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  bus_add_driver+0x12b/0x1e0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  driver_register+0x8f/0xe0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  ? 0xffffffffc0b1c000
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  do_one_initcall+0x57/0x220
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  do_init_module+0x5c/0x260
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  load_module+0x247c/0x2640
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  ? __do_sys_finit_module+0xae/0x110
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  __do_sys_finit_module+0xae/0x110
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  do_syscall_64+0x3b/0x90
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel:  entry_SYSCALL_64_after_hwframe+0x44/0xae
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RIP: 0033:0x4a1bbb
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: Code: e8 ea eb fb ff eb 88 cc cc cc cc cc cc cc cc e8 bb 2f fc ff 48 8b 7c 24 10 48 8b 74 24 18 48 8b 54 24 20 48 8b 44 24 08 0f 05 <48> 3d 01 f0 ff ff 76 20 48 c7 44 24 28 ff ff ff ff 48 c7 44 24 30
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RSP: 002b:000000c000418d70 EFLAGS: 00000202 ORIG_RAX: 0000000000000139
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RAX: ffffffffffffffda RBX: 000000c000035000 RCX: 00000000004a1bbb
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RDX: 0000000000000000 RSI: 000000c000424020 RDI: 0000000000000008
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RBP: 000000c000418dd8 R08: 00007f6e9dc32d01 R09: 0000000000000000
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: R10: 00007f6e76ea1328 R11: 0000000000000202 R12: 000000c000424020
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: R13: 0000000000000001 R14: 000000c000161d40 R15: 0000000000000002
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: Modules linked in: ext4 amdgpu(+) jbd2 mbcache crc16 aesni_intel crypto_simd ghash_clmulni_intel crct10dif_pclmul crc32c_intel cryptd crc32_pclmul igb xhci_pci xhci_pci_renesas dca drm_ttm_helper drm_kms_help>
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: CR2: 000000000000ecc8
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: fbcon: Taking over console
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: ---[ end trace 857fbdce8ddca9b5 ]---
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RIP: 0010:get_modes+0xa3/0x510 [amdgpu]
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: Code: f0 b2 ff 84 c0 75 78 ba e0 01 00 00 be 80 02 00 00 48 89 df e8 0e d9 b2 ff 89 83 c8 04 00 00 4c 8b 23 49 8b 84 24 a8 39 01 00 <48> 83 b8 c8 ec 00 00 00 74 14 48 8b 83 d8 04 00 00 81 78 38 80 00
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RSP: 0018:ffffbb690137f6f8 EFLAGS: 00010246
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RAX: 0000000000000000 RBX: ffff9b9c80f34000 RCX: 0000000000000000
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RDX: ffff9b9c8deba3c0 RSI: ffff9b9c8deba3c0 RDI: ffff9b9c8deba7c0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: RBP: ffff9b9c82e3a800 R08: ffff9b9c80f340a0 R09: ffff9b9c80f340a0
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: R10: 000000000000000a R11: 000000000000000a R12: ffff9b9c8de60010
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: R13: ffff9b9c80f340a0 R14: 0000000000000003 R15: ffff9b9c80f34000
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: FS:  000000c000380090(0000) GS:ffff9b9faed00000(0000) knlGS:0000000000000000
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Sep 21 11:33:20 ishitatsuyuki-ryzen kernel: CR2: 000000000000ecc8 CR3: 0000000102d7c000 CR4: 0000000000350ee0

anatol added a commit that referenced this issue Sep 21, 2021
... before switching to userland

Issue #103
anatol added a commit that referenced this issue Sep 21, 2021
This gives more time for loading modules and makes the boot faster.

Issue #103
anatol added a commit that referenced this issue Sep 23, 2021
... before switching to userland

Issue #103
anatol added a commit that referenced this issue Sep 23, 2021
This gives more time for loading modules and makes the boot faster.

Issue #103
@anatol
Copy link
Owner

anatol commented Sep 24, 2021

Closed by 9047c94

@anatol anatol closed this as completed Sep 24, 2021
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

No branches or pull requests

2 participants