Skip to contentSkip to conversation

initrd: Remove erroneous comment

PATCH Applied Tom Rini 4 participants 12 messages Jun 19, 2020 – Jun 22, 2020 VFS

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 initrd: Remove erroneous comment

Most architectures have been passing the location of an initrd via the initrd= option since their inception. Remove the comment as it's both wrong and unrelated to the commit that introduced it.

Fixes 694cfd87b0c8 ("x86/setup: Add an initrdmem= option to specify initrd physical address")
Cc Andrew Morton <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dominik Brodowski <[email protected]>
Cc H. Peter Anvin (Intel) <[email protected]>
Cc Ronald G. Minnich <[email protected]>

---
For a bit more context, I assume there's been some confusion between "initrd" being a keyword in things like extlinux.conf and also that for quite a long time now initrd information is passed via device tree and not the command line on relevant architectures. But it's still true that it's been a valid command line option to the kernel since the 90s. It's just the case that in 2018 the code was consolidated from under arch/ and in to this file.

---
 init/do_mounts_initrd.c | 5 -----
 1 file changed, 5 deletions(-)
init/do_mounts_initrd.c +0 -5
index d72beda824aa..53314d7da4be 100644
@@ -45,11 +45,6 @@ static int __init early_initrdmem(char *p)
 }
 early_param("initrdmem", early_initrdmem);
 
-/*
- * This is here as the initrd keyword has been in use since 11/2018
- * on ARM, PowerPC, and MIPS.
- * It should not be; it is reserved for bootloaders.
- */
 static int __init early_initrd(char *p)
 {
 	return early_initrdmem(p);
Signature · 1 line
2.17.1
merge bot Applied
#1 lore raw
The following commit has been merged into the x86/cleanups branch of tip:

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     eacb0c101a0bdf14de77cc9d107493e2d8d6389c
Gitweb:        https://git.kernel.org/tip/eacb0c101a0bdf14de77cc9d107493e2d8d6389c
Author:        Tom Rini <[email protected]>
AuthorDate:    Fri, 19 Jun 2020 10:30:56 -04:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Fri, 19 Jun 2020 19:23:54 +02:00

initrd: Remove erroneous comment

Most architectures have been passing the location of an initrd via the initrd= option since their inception. Remove the comment as it's both wrong and unrelated to the commit that introduced it.

For a bit more context, I assume there's been some confusion between "initrd" being a keyword in things like extlinux.conf and also that for quite a long time now initrd information is passed via device tree and not the command line on relevant architectures. But it's still true that it's been a valid command line option to the kernel since the 90s. It's just the case that in 2018 the code was consolidated from under arch/ and in to this file.

[ bp: Move the context clarification up into the commit message proper. ]

Fixes 694cfd87b0c8 ("x86/setup: Add an initrdmem= option to specify initrd physical address")
---
 init/do_mounts_initrd.c | 5 -----
 1 file changed, 5 deletions(-)
init/do_mounts_initrd.c +0 -5
index d72beda..53314d7 100644
@@ -45,11 +45,6 @@ static int __init early_initrdmem(char *p)
 }
 early_param("initrdmem", early_initrdmem);
 
-/*
- * This is here as the initrd keyword has been in use since 11/2018
- * on ARM, PowerPC, and MIPS.
- * It should not be; it is reserved for bootloaders.
- */
 static int __init early_initrd(char *p)
 {
 	return early_initrdmem(p);
#2 lore raw
In reply to Tom Rini

It seems fine to me, but I did not initially object to the use of that name anyway. hpa, what do you think?

Quoted 43 lines · Tom Rini

Most architectures have been passing the location of an initrd via the initrd= option since their inception. Remove the comment as it's both wrong and unrelated to the commit that introduced it.

Fixes 694cfd87b0c8 ("x86/setup: Add an initrdmem= option to specify initrd physical address")
Cc Andrew Morton <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dominik Brodowski <[email protected]>
Cc H. Peter Anvin (Intel) <[email protected]>
Cc Ronald G. Minnich <[email protected]>

---
For a bit more context, I assume there's been some confusion between "initrd" being a keyword in things like extlinux.conf and also that for quite a long time now initrd information is passed via device tree and not the command line on relevant architectures. But it's still true that it's been a valid command line option to the kernel since the 90s. It's just the case that in 2018 the code was consolidated from under arch/ and in to this file.

---
 init/do_mounts_initrd.c | 5 -----
 1 file changed, 5 deletions(-)
init/do_mounts_initrd.c +0 -6
index d72beda824aa..53314d7da4be 100644
@@ -45,11 +45,6 @@ static int __init early_initrdmem(char *p)
 }
 early_param("initrdmem", early_initrdmem);
 
-/*
- * This is here as the initrd keyword has been in use since 11/2018
- * on ARM, PowerPC, and MIPS.
- * It should not be; it is reserved for bootloaders.
- */
 static int __init early_initrd(char *p)
 {
        return early_initrdmem(p);
--

2.17.1

#3 lore raw
Quoted 42 lines · ron minnich

It seems fine to me, but I did not initially object to the use of that name anyway. hpa, what do you think?

Quoted 2 lines · Tom Rini

Most architectures have been passing the location of an initrd via

the

Quoted 1 line

initrd= option since their inception. Remove the comment as it's

both

Quoted 3 lines

wrong and unrelated to the commit that introduced it.

Fixes 694cfd87b0c8 ("x86/setup: Add an initrdmem= option to specify

initrd physical address")

Quoted 9 lines
Cc Andrew Morton <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dominik Brodowski <[email protected]>
Cc H. Peter Anvin (Intel) <[email protected]>
Cc Ronald G. Minnich <[email protected]>

---
For a bit more context, I assume there's been some confusion between "initrd" being a keyword in things like extlinux.conf and also that

for

Quoted 1 line

quite a long time now initrd information is passed via device tree

and

Quoted 2 lines

not the command line on relevant architectures. But it's still true that it's been a valid command line option to the kernel since the

90s.

Quoted 14 lines

It's just the case that in 2018 the code was consolidated from under arch/ and in to this file.

---
 init/do_mounts_initrd.c | 5 -----
 1 file changed, 5 deletions(-)
init/do_mounts_initrd.c +0 -0
index d72beda824aa..53314d7da4be 100644
@@ -45,11 +45,6 @@ static int __init early_initrdmem(char *p)
 }
 early_param("initrdmem", early_initrdmem);
 
Quoted 11 lines
Quoted 11 lines
init/do_mounts_initrd.c +0 -6
-/*
- * This is here as the initrd keyword has been in use since 11/2018
- * on ARM, PowerPC, and MIPS.
- * It should not be; it is reserved for bootloaders.
- */
 static int __init early_initrd(char *p)
 {
        return early_initrdmem(p);
--

2.17.1

Well, I observe that it was documented as reserved for bootloaders since the mid-90s at least.

Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
#4 lore raw
In reply to Tom Rini

The other thing you ought to consider fixing:
initrd is documented as follows:

initrd= [BOOT] Specify the location of the initial ramdisk

for bootloaders only.

UEFI consumes initrd from the command line as well. As ARM servers increasingly use UEFI, there may be situations in which the initrd option doesn't make its way to the kernel? I don't know, UEFI is such a black box to me. But I've seen this "initrd consumption" happen.

Based on docs, and the growing use of bootloaders that are happy to consume initrd= and not pass it to the kernel, you might be better off trying to move to the new command line option anyway.

IOW, this comment may not be what people want to see, but ... it might also be right. Or possibly changed to:

/*
* The initrd keyword is in use today on ARM, PowerPC, and MIPS.
* It is also reserved for use by bootloaders such as UEFI and may
* be consumed by them and not passed on to the kernel.
* The documentation also shows it as reserved for bootloaders.
* It is advised to move to the initrdmem= option whereever possible. */

Quoted 43 lines · Tom Rini

Most architectures have been passing the location of an initrd via the initrd= option since their inception. Remove the comment as it's both wrong and unrelated to the commit that introduced it.

Fixes 694cfd87b0c8 ("x86/setup: Add an initrdmem= option to specify initrd physical address")
Cc Andrew Morton <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dominik Brodowski <[email protected]>
Cc H. Peter Anvin (Intel) <[email protected]>
Cc Ronald G. Minnich <[email protected]>

---
For a bit more context, I assume there's been some confusion between "initrd" being a keyword in things like extlinux.conf and also that for quite a long time now initrd information is passed via device tree and not the command line on relevant architectures. But it's still true that it's been a valid command line option to the kernel since the 90s. It's just the case that in 2018 the code was consolidated from under arch/ and in to this file.

---
 init/do_mounts_initrd.c | 5 -----
 1 file changed, 5 deletions(-)
init/do_mounts_initrd.c +0 -6
index d72beda824aa..53314d7da4be 100644
@@ -45,11 +45,6 @@ static int __init early_initrdmem(char *p)
 }
 early_param("initrdmem", early_initrdmem);
 
-/*
- * This is here as the initrd keyword has been in use since 11/2018
- * on ARM, PowerPC, and MIPS.
- * It should not be; it is reserved for bootloaders.
- */
 static int __init early_initrd(char *p)
 {
        return early_initrdmem(p);
--

2.17.1

author
#5 lore raw
Quoted 19 lines · ron minnich

The other thing you ought to consider fixing:
initrd is documented as follows:

initrd= [BOOT] Specify the location of the initial ramdisk

for bootloaders only.

UEFI consumes initrd from the command line as well. As ARM servers increasingly use UEFI, there may be situations in which the initrd option doesn't make its way to the kernel? I don't know, UEFI is such a black box to me. But I've seen this "initrd consumption" happen.

Based on docs, and the growing use of bootloaders that are happy to consume initrd= and not pass it to the kernel, you might be better off trying to move to the new command line option anyway.

IOW, this comment may not be what people want to see, but ... it might also be right. Or possibly changed to:

Quoted 7 lines

/*
* The initrd keyword is in use today on ARM, PowerPC, and MIPS.
* It is also reserved for use by bootloaders such as UEFI and may
* be consumed by them and not passed on to the kernel.
* The documentation also shows it as reserved for bootloaders.
* It is advised to move to the initrdmem= option whereever possible. */

Fair warning, one of the other hats I wear is the chief custodian of the U-Boot project.

Note that on most architectures in modern times the device tree is used to pass in initrd type information and "initrd=" on the command line is quite legacy.

But what do you mean UEFI "consumes" initrd= ? It's quite expected that when you configure grub/syslinux/systemd-boot/whatever via extlinux.conf or similar with "initrd /some/file" something reasonable happens to read that in to memory and pass along the location to Linux (which can vary from arch to arch, when not using device tree). I guess looking at Documentation/x86/boot.rst is where treating initrd= as a file that should be handled and ramdisk_image / ramdisk_size set came from. I do wonder what happens in the case of ARM/ARM64 + UEFI without device tree.

That said, no the comment is wrong. It's not "since 11/2018" but "since the 1990s". And it doesn't provide any sort of link / context to the boot loader specification project or similar that explains the cases when a non-filename "initrd=" would reasonably (or unreasonably but happens in reality) be removed.

I would go so far as to suggest that adding special handling for some x86 setups is the wrong to place to start / further deprecate how other architectures and firmwares handle a given situation. I'm only chiming in here as I saw this commit go by on LWN and wanted to see how this was different from the traditional usage of initrd= in the rest of the kernel (it's not) and then saw the otherwise unrelated new comment being added.

Signature · 1 line
Tom
#6 lore raw
Quoted 36 lines · Tom Rini
Quoted 19 lines · ron minnich

The other thing you ought to consider fixing:
initrd is documented as follows:

initrd= [BOOT] Specify the location of the initial ramdisk

for bootloaders only.

UEFI consumes initrd from the command line as well. As ARM servers increasingly use UEFI, there may be situations in which the initrd option doesn't make its way to the kernel? I don't know, UEFI is such a black box to me. But I've seen this "initrd consumption" happen.

Based on docs, and the growing use of bootloaders that are happy to consume initrd= and not pass it to the kernel, you might be better off trying to move to the new command line option anyway.

IOW, this comment may not be what people want to see, but ... it might also be right. Or possibly changed to:

Quoted 7 lines

/*
* The initrd keyword is in use today on ARM, PowerPC, and MIPS.
* It is also reserved for use by bootloaders such as UEFI and may
* be consumed by them and not passed on to the kernel.
* The documentation also shows it as reserved for bootloaders.
* It is advised to move to the initrdmem= option whereever possible. */

Fair warning, one of the other hats I wear is the chief custodian of the U-Boot project.

Note that on most architectures in modern times the device tree is used to pass in initrd type information and "initrd=" on the command line is quite legacy.

Quoted 9 lines

But what do you mean UEFI "consumes" initrd= ? It's quite expected that when you configure grub/syslinux/systemd-boot/whatever via extlinux.conf or similar with "initrd /some/file" something reasonable happens to read that in to memory and pass along the location to Linux (which can vary from arch to arch, when not using device tree). I guess looking at Documentation/x86/boot.rst is where treating initrd= as a file that should be handled and ramdisk_image / ramdisk_size set came from. I do wonder what happens in the case of ARM/ARM64 + UEFI without device tree.

UEFI plus the in-kernel UEFI stub is, in some ways, a "bootloader" in the traditional sense. It is totally fair that we should update the documentation with this as a different case, though, because it is part of the kernel tree and so the kernel now has partial ownership of the namespace.

I suggest "STUB" for "in-kernel firmware stub" for this purpose; no need to restrict it to a specific firmware for the purpose of namespace reservation.

-hpa

author
#7 lore raw
Quoted 53 lines · H. Peter Anvin
Quoted 36 lines · Tom Rini
Quoted 19 lines · ron minnich

The other thing you ought to consider fixing:
initrd is documented as follows:

initrd= [BOOT] Specify the location of the initial ramdisk

for bootloaders only.

UEFI consumes initrd from the command line as well. As ARM servers increasingly use UEFI, there may be situations in which the initrd option doesn't make its way to the kernel? I don't know, UEFI is such a black box to me. But I've seen this "initrd consumption" happen.

Based on docs, and the growing use of bootloaders that are happy to consume initrd= and not pass it to the kernel, you might be better off trying to move to the new command line option anyway.

IOW, this comment may not be what people want to see, but ... it might also be right. Or possibly changed to:

Quoted 7 lines

/*
* The initrd keyword is in use today on ARM, PowerPC, and MIPS.
* It is also reserved for use by bootloaders such as UEFI and may
* be consumed by them and not passed on to the kernel.
* The documentation also shows it as reserved for bootloaders.
* It is advised to move to the initrdmem= option whereever possible. */

Fair warning, one of the other hats I wear is the chief custodian of the U-Boot project.

Note that on most architectures in modern times the device tree is used to pass in initrd type information and "initrd=" on the command line is quite legacy.

Quoted 9 lines

But what do you mean UEFI "consumes" initrd= ? It's quite expected that when you configure grub/syslinux/systemd-boot/whatever via extlinux.conf or similar with "initrd /some/file" something reasonable happens to read that in to memory and pass along the location to Linux (which can vary from arch to arch, when not using device tree). I guess looking at Documentation/x86/boot.rst is where treating initrd= as a file that should be handled and ramdisk_image / ramdisk_size set came from. I do wonder what happens in the case of ARM/ARM64 + UEFI without device tree.

UEFI plus the in-kernel UEFI stub is, in some ways, a "bootloader" in the traditional sense. It is totally fair that we should update the documentation with this as a different case, though, because it is part of the kernel tree and so the kernel now has partial ownership of the namespace.

Quoted 3 lines

I suggest "STUB" for "in-kernel firmware stub" for this purpose; no need to restrict it to a specific firmware for the purpose of namespace reservation.

With a little bit of quick digging, yes, it would be good to document and be very clear which things are reserved for (and how are treated by) the in-kernel firmware stub or "kernel EFI stub" or whatever name is best for drivers/firmware/efi/libstub/. I forget the last time we tried booting a linux kernel EFI stub rather than grub/etc over in U-Boot under our EFI loader support but it's reasonable to expect that it work. Thanks!

Signature · 1 line
Tom
#8 lore raw
In reply to Tom Rini

So, let me first add, the comment can be removed as needed. Comments offered only for clarification.

Quoted 1 line · Tom Rini

But what do you mean UEFI "consumes" initrd= ?

What I mean is, there are bootloaders that will, if they see initrd= in the command line, remove it: the kernel will never see it.

Quoted 4 lines

I guess looking at
Documentation/x86/boot.rst is where treating initrd= as a file that should be handled and ramdisk_image / ramdisk_size set came from. I do wonder what happens in the case of ARM/ARM64 + UEFI without device tree.

it is possible that the initrd= argument will not be seen by the kernel. That's my understanding. Will this be a problem if so? It would be for me :-)

Quoted 4 lines

And it doesn't provide any sort of link / context to the
boot loader specification project or similar that explains the cases when a non-filename "initrd=" would reasonably (or unreasonably but happens in reality) be removed.

But it unreasonably happens as I learned the hard way :-)

Anyway, thanks Tom, I have no objections to whatever you all feel is best to do with that comment. It was a failed attempt on my part to explain the state of things :-)

ron

author
#9 lore raw
Quoted 2 lines · ron minnich

So, let me first add, the comment can be removed as needed. Comments offered only for clarification.

Noted, thanks.

Quoted 6 lines · Tom Rini
Quoted 2 lines

But what do you mean UEFI "consumes" initrd= ?

What I mean is, there are bootloaders that will, if they see initrd= in the command line, remove it: the kernel will never see it.

I'm picky here because, well, there's a whole lot of moving parts in the pre-kernel world. In a strict sense, "UEFI" doesn't do anything with the kernel but based on hpa's comments I assume that at least the in-kernel UEFI stub does what Documentation/x86/booting.rst suggests to do and consumes initrd=/file just like "initrd /file" in extlinux.conf, etc do. And since the EFI stub is cross-platform, it's worth noting this too.

Quoted 14 lines
Quoted 4 lines

I guess looking at
Documentation/x86/boot.rst is where treating initrd= as a file that should be handled and ramdisk_image / ramdisk_size set came from. I do wonder what happens in the case of ARM/ARM64 + UEFI without device tree.

it is possible that the initrd= argument will not be seen by the kernel. That's my understanding. Will this be a problem if so? It would be for me :-)

Quoted 4 lines

And it doesn't provide any sort of link / context to the
boot loader specification project or similar that explains the cases when a non-filename "initrd=" would reasonably (or unreasonably but happens in reality) be removed.

Quoted 5 lines

But it unreasonably happens as I learned the hard way :-)

Anyway, thanks Tom, I have no objections to whatever you all feel is best to do with that comment. It was a failed attempt on my part to explain the state of things :-)

Booting up the kernel is quite the "fun" area indeed.

Signature · 1 line
Tom
#10 lore raw
Quoted 9 lines · Tom Rini

I'm picky here because, well, there's a whole lot of moving parts in the pre-kernel world. In a strict sense, "UEFI" doesn't do anything with the kernel but based on hpa's comments I assume that at least the in-kernel UEFI stub does what Documentation/x86/booting.rst suggests to do and consumes initrd=/file just like "initrd /file" in extlinux.conf, etc do. And since the EFI stub is cross-platform, it's worth noting this too.

For what it's worth, normally boot loaders don't strip this from the kernel command line passed to the kernel, although there might be ones which do so. In general this is bad practice; it is better to let the initrd show in /proc/cmdline.

-hpa

author
#11 lore raw
Quoted 10 lines · H. Peter Anvin
Quoted 8 lines · Tom Rini

I'm picky here because, well, there's a whole lot of moving parts in the pre-kernel world. In a strict sense, "UEFI" doesn't do anything with the kernel but based on hpa's comments I assume that at least the in-kernel UEFI stub does what Documentation/x86/booting.rst suggests to do and consumes initrd=/file just like "initrd /file" in extlinux.conf, etc do. And since the EFI stub is cross-platform, it's worth noting this too.

Quoted 4 lines

For what it's worth, normally boot loaders don't strip this from the kernel command line passed to the kernel, although there might be ones which do so. In general this is bad practice; it is better to let the initrd show in /proc/cmdline.

Strongly agree.

Signature · 1 line
Tom