run_qemu icon indicating copy to clipboard operation
run_qemu copied to clipboard

remove no longer supported efi_fake_mem= kernel cmdline option

Open AlisonSchofield opened this issue 10 months ago • 5 comments

Kernel support for efi_fake_mem was removed in 6.11. 37aee82c213d ("x86/efi: Drop support for fake EFI memory maps")

The ndctl tests stopped depending on it since ndctl v80: dfa937e2eb26 ("test/daxctl-create.sh: use CXL DAX regions instead of efi_fake_mem")

Remove it from run_qemu.sh

AlisonSchofield avatar Feb 12 '25 04:02 AlisonSchofield

git grep efi_mem shows that this feature is unfortunately quite "invasive" :-(

I'm afraid removing it requires some minimal understanding of it (which I don't have now).

The good news though: --efi-mems 0 has precedence over --preset and drops efi_fake_mem most of the time! Except when using --nfit-test, this last one has even more precedence.

Questions:

  • How does it hurt? I mean, isn't efi_fake_mem simply ignored by v6.11 and above?
  • Should it be just dropped or replaced by something newer and better? (Which means not replacing it could "hurt" somehow?)

Some code reviews / context :

  • https://lkml.org/lkml/2015/10/12/348 (2015)
  • https://lore.kernel.org/all/157309100651.1579826.4018037842830501297.stgit@dwillia2-desk3.amr.corp.intel.com/ (2019)
  • https://lore.kernel.org/linux-efi/[email protected]/t/#u (2024 drop)

marc-hb avatar Feb 12 '25 18:02 marc-hb

If it is harmless, might also be worth keeping it around a little bit longer in case anyone wants to run (or bisect) with slightly older kernels.

stellarhopper avatar Feb 12 '25 22:02 stellarhopper

If it is harmless, might also be worth keeping it around a little bit longer in case anyone wants to run (or bisect) with slightly older kernels.

That was my typical reaction but then I thought: how come passing the test suite after v6.11 needs nothing instead? What was the point of the efi_fake_mem values before v6.11 if they can just be ignored after?

For some manual testing that is not in the test suite(s) maybe?

https://lore.kernel.org/linux-efi/[email protected]/t/#u seems to recommend memmap as a replacement?

marc-hb avatar Feb 12 '25 23:02 marc-hb

That was my typical reaction but then I thought: how come passing the test suite after v6.11 needs nothing instead? What was the point of the efi_fake_mem values before v6.11 if they can just be ignored after?

The test suite passes post 6.11 because of this change Alison referred to: https://lore.kernel.org/all/519161e23a43e530dbcffac203ecbbb897aa5342.1724813664.git.alison.schofield@intel.com/

..which uses a cxl_test device instead of an efi_fake_mem device for the one test that was using it (daxctl-create.sh).

Maybe it makes sense to remove it from a default run_qemu run, either via the default preset, or via --nfit-test.

Also thinking about the above patch a bit more, this introduces a dependency on cxl_test for nfit_test usage - I'm not sure if this is the first time that's happened, but with the above patch, --nfit-test might need to imply --cxl-test?

stellarhopper avatar Feb 13 '25 00:02 stellarhopper

another option, if the nfit-test dependency on cxl is problematic, is to perhaps use memmap= to replace what efi_fake_mem was doing:

memmap=<size>%<offset>-<oldtype>+<newtype>

Just need to be careful that unlike efi_fake_mem which is safer in that it only adjust attributes without touching the memory type, memmap= is not so careful. However, I have not tried this "type change" syntax, only the the pmem syntax which is a large foot-gun if you get it wrong:

`memmap=nn[KMG]!ss[KMG,EARLY]`

djbw avatar Feb 13 '25 01:02 djbw