Skip to contentSkip to conversation

dell_rbu: Select CONFIG_FW_LOADER_USER_HELPER explicitly

DISCUSSION Dave Jones 4 participants 15 messages Jul 6, 2013 – Jul 9, 2013 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Dave Jones

author
#1 lore raw
Quoted 23 lines · Linux Kernel
Gitweb:     http://git.kernel.org/linus/;a=commit;h=d05c39ea67f5786a549ac9d672d2951992b658c6
Commit:     d05c39ea67f5786a549ac9d672d2951992b658c6
Parent:     a3b2c8c7aa1ca860edcf0b0afa371d9eb2269c3c
Author:     Takashi Iwai <[email protected]>
AuthorDate: Wed May 22 18:28:37 2013 +0200
Committer:  Greg Kroah-Hartman <[email protected]>
CommitDate: Mon Jun 3 13:57:29 2013 -0700

dell_rbu: Select CONFIG_FW_LOADER_USER_HELPER explicitly

The usermode helper is mandatory for this driver.

---
 drivers/firmware/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/firmware/Kconfig +0 -0
index 9387630..0747872 100644

drivers/firmware/Kconfig config DELL_RBU · line 70

Quoted 7 lines
drivers/firmware/Kconfig +1 -0
@@ -64,6 +64,7 @@ config DELL_RBU
 	tristate "BIOS update support for DELL systems via sysfs"
 	depends on X86
 	select FW_LOADER
+	select FW_LOADER_USER_HELPER
 	help
 	 Say m if you want to have the option of updating the BIOS for your
 	 DELL system. Note you need a Dell OpenManage or Dell Update package (DUP)

This is pretty crappy. Now every distro kernel has to have that enabled, which screws up for eg, the x86 microcode driver. (It takes 1 minute per cpu when this is enabled).

Dave

maintainer
#2 lore raw
Quoted 28 lines · Dave Jones
Quoted 27 lines · Linux Kernel
Gitweb:     http://git.kernel.org/linus/;a=commit;h=d05c39ea67f5786a549ac9d672d2951992b658c6
Commit:     d05c39ea67f5786a549ac9d672d2951992b658c6
Parent:     a3b2c8c7aa1ca860edcf0b0afa371d9eb2269c3c
Author:     Takashi Iwai <[email protected]>
AuthorDate: Wed May 22 18:28:37 2013 +0200
Committer:  Greg Kroah-Hartman <[email protected]>
CommitDate: Mon Jun 3 13:57:29 2013 -0700

dell_rbu: Select CONFIG_FW_LOADER_USER_HELPER explicitly

The usermode helper is mandatory for this driver.

---
 drivers/firmware/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/firmware/Kconfig +1 -0
index 9387630..0747872 100644
@@ -64,6 +64,7 @@ config DELL_RBU
 	tristate "BIOS update support for DELL systems via sysfs"
 	depends on X86
 	select FW_LOADER
+	select FW_LOADER_USER_HELPER
Quoted 8 lines

drivers/firmware/Kconfig config DELL_RBU · line 70

Quoted 3 lines
drivers/firmware/Kconfig +0 -0
 	help
 	 Say m if you want to have the option of updating the BIOS for your
 	 DELL system. Note you need a Dell OpenManage or Dell Update package (DUP)

This is pretty crappy. Now every distro kernel has to have that enabled, which screws up for eg, the x86 microcode driver. (It takes 1 minute per cpu when this is enabled).

I'll let you and Takashi battle this one out, for some reason I thought he added it _because_ a distro kernel needed it...

Takashi?

#3 lore raw

At Sat, 6 Jul 2013 15:30:03 -0700,

Quoted 35 lines · Greg KH
Quoted 33 lines · Dave Jones
Quoted 30 lines · Linux Kernel
Gitweb:     http://git.kernel.org/linus/;a=commit;h=d05c39ea67f5786a549ac9d672d2951992b658c6
Commit:     d05c39ea67f5786a549ac9d672d2951992b658c6
Parent:     a3b2c8c7aa1ca860edcf0b0afa371d9eb2269c3c
Author:     Takashi Iwai <[email protected]>
AuthorDate: Wed May 22 18:28:37 2013 +0200
Committer:  Greg Kroah-Hartman <[email protected]>
CommitDate: Mon Jun 3 13:57:29 2013 -0700

dell_rbu: Select CONFIG_FW_LOADER_USER_HELPER explicitly

The usermode helper is mandatory for this driver.

---
 drivers/firmware/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/firmware/Kconfig +1 -0
index 9387630..0747872 100644
@@ -64,6 +64,7 @@ config DELL_RBU
 	tristate "BIOS update support for DELL systems via sysfs"
 	depends on X86
 	select FW_LOADER
+	select FW_LOADER_USER_HELPER
 	help
 	 Say m if you want to have the option of updating the BIOS for your
 	 DELL system. Note you need a Dell OpenManage or Dell Update package (DUP)
Quoted 6 lines
Quoted 3 lines

This is pretty crappy. Now every distro kernel has to have that enabled, which screws up for eg, the x86 microcode driver. (It takes 1 minute per cpu when this is enabled).

I'll let you and Takashi battle this one out, for some reason I thought he added it _because_ a distro kernel needed it...

The reason is that dell_rbu driver requires it. Without the kconfig option, this driver won't work at all. So, it's a right fix for dell_rbu.

AFAIK, the consensus in the kernel side is that this too long fw loading time is basically a regression of user-space (udev or whatever). There is no change in the kernel behavior. The problem must exist even with the older kernels.

But, looking at the development, we can't expect that udev will be fixed soon, and this breakage persists already way too long. Maybe a better solution is to kill the fallback to udev for normal f/w loading (i.e. for distro kernels).

The patch below is an untested quick hack. It adds a new Kconfig and a new function request_firmware_via_user_helper(). Distro kernels may set CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n for avoiding 60 seconds stall for non-existing firmware file access -- as distributions know that the firmware files should be placed in the right path.

Thoughts?

Takashi

---

drivers/base/Kconfig +5 -1
index 5daa259..bfbfa75 100644
@@ -144,9 +144,13 @@ config EXTRA_FIRMWARE_DIR
 	  some other directory containing the firmware files.
 
 config FW_LOADER_USER_HELPER
+	bool
+	depends on FW_LOADER
+
+config FW_LOADER_USER_HELPER_FALLBACK
 	bool "Fallback user-helper invocation for firmware loading"
 	depends on FW_LOADER
-	default y
+	select FW_LOADER_USER_HELPER
 	help
 	  This option enables / disables the invocation of user-helper
 	  (e.g. udev) for loading firmware files as a fallback after the
drivers/base/firmware_class.c +60 -26

133 lines not on this page · raw message

drivers/firmware/dell_rbu.c +1 -1
index 2f452f1..e511a96 100644
@@ -619,7 +619,7 @@ static ssize_t write_rbu_image_type(struct file *filp, struct kobject *kobj,
 		 */
 		if (!rbu_data.entry_created) {
 			spin_unlock(&rbu_data.lock);
-			req_firm_rc = request_firmware_nowait(THIS_MODULE,
+			req_firm_rc = request_firmware_via_user_helper(THIS_MODULE,
 				FW_ACTION_NOHOTPLUG, "dell_rbu",
 				&rbu_device->dev, GFP_KERNEL, &context,
 				callbackfn_rbu);
include/linux/firmware.h +7 -0
index e154c10..d507122 100644
@@ -46,6 +46,13 @@ int request_firmware_nowait(
 	const char *name, struct device *device, gfp_t gfp, void *context,
 	void (*cont)(const struct firmware *fw, void *context));
 
+#ifdef CONFIG_FW_LOADER_USER_HELPER
+int request_firmware_via_user_helper(
+	struct module *module, bool uevent,
+	const char *name, struct device *device, gfp_t gfp, void *context,
+	void (*cont)(const struct firmware *fw, void *context));
+#endif
+
 void release_firmware(const struct firmware *fw);
 #else
 static inline int request_firmware(const struct firmware **fw,
maintainer
#4 lore raw
Quoted 9 lines · Takashi Iwai

The reason is that dell_rbu driver requires it. Without the kconfig option, this driver won't work at all. So, it's a right fix for dell_rbu.

AFAIK, the consensus in the kernel side is that this too long fw loading time is basically a regression of user-space (udev or whatever). There is no change in the kernel behavior. The problem must exist even with the older kernels.

Quoted 4 lines

But, looking at the development, we can't expect that udev will be fixed soon, and this breakage persists already way too long. Maybe a better solution is to kill the fallback to udev for normal f/w loading (i.e. for distro kernels).

I thought udev was already fixed for this issue, so why would a "modern" distro need to worry about this?

Quoted 7 lines

The patch below is an untested quick hack. It adds a new Kconfig and a new function request_firmware_via_user_helper(). Distro kernels may set CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n for avoiding 60 seconds stall for non-existing firmware file access -- as distributions know that the firmware files should be placed in the right path.

Thoughts?

There's no way we can just fix up the driver instead of doing this in the firmware core?

thanks,

greg k-h

#5 lore raw

At Mon, 8 Jul 2013 09:49:33 -0700,

Quoted 11 lines · Greg KH
Quoted 9 lines · Takashi Iwai

The reason is that dell_rbu driver requires it. Without the kconfig option, this driver won't work at all. So, it's a right fix for dell_rbu.

AFAIK, the consensus in the kernel side is that this too long fw loading time is basically a regression of user-space (udev or whatever). There is no change in the kernel behavior. The problem must exist even with the older kernels.

Quoted 7 lines
Quoted 4 lines

But, looking at the development, we can't expect that udev will be fixed soon, and this breakage persists already way too long. Maybe a better solution is to kill the fallback to udev for normal f/w loading (i.e. for distro kernels).

I thought udev was already fixed for this issue, so why would a "modern" distro need to worry about this?

Hm, I expected Dave is using the udev "modern" enough. If it's about an old udev behavior, we don't have to care so much...

Quoted 10 lines
Quoted 7 lines

The patch below is an untested quick hack. It adds a new Kconfig and a new function request_firmware_via_user_helper(). Distro kernels may set CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n for avoiding 60 seconds stall for non-existing firmware file access -- as distributions know that the firmware files should be placed in the right path.

Thoughts?

There's no way we can just fix up the driver instead of doing this in the firmware core?

The problem is that this non-udev-hotplug firmware loading mechanism was introduced exactly for this driver. Thus, we can't change the driver (thus ABI) without breaking user-space.

Though, there are only two users of this interface. So, once when the user-space side is fixed, we can easily fix the kernel side, too, e.g. rewrite these drivers without abusing firmware interface.

Takashi

#6 lore raw
In reply to Takashi Iwai
Quoted 53 lines · Takashi Iwai

At Sat, 6 Jul 2013 15:30:03 -0700,

Quoted 35 lines · Greg KH
Quoted 33 lines · Dave Jones
Quoted 30 lines · Linux Kernel
Gitweb:     http://git.kernel.org/linus/;a=commit;h=d05c39ea67f5786a549ac9d672d2951992b658c6
Commit:     d05c39ea67f5786a549ac9d672d2951992b658c6
Parent:     a3b2c8c7aa1ca860edcf0b0afa371d9eb2269c3c
Author:     Takashi Iwai <[email protected]>
AuthorDate: Wed May 22 18:28:37 2013 +0200
Committer:  Greg Kroah-Hartman <[email protected]>
CommitDate: Mon Jun 3 13:57:29 2013 -0700

dell_rbu: Select CONFIG_FW_LOADER_USER_HELPER explicitly

The usermode helper is mandatory for this driver.

---
 drivers/firmware/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/firmware/Kconfig +1 -0
index 9387630..0747872 100644
@@ -64,6 +64,7 @@ config DELL_RBU
         tristate "BIOS update support for DELL systems via sysfs"
         depends on X86
         select FW_LOADER
+        select FW_LOADER_USER_HELPER
         help
          Say m if you want to have the option of updating the BIOS for your
          DELL system. Note you need a Dell OpenManage or Dell Update package (DUP)
Quoted 6 lines
Quoted 3 lines

This is pretty crappy. Now every distro kernel has to have that enabled, which screws up for eg, the x86 microcode driver. (It takes 1 minute per cpu when this is enabled).

I'll let you and Takashi battle this one out, for some reason I thought he added it _because_ a distro kernel needed it...

The reason is that dell_rbu driver requires it. Without the kconfig option, this driver won't work at all. So, it's a right fix for dell_rbu.

AFAIK, the consensus in the kernel side is that this too long fw loading time is basically a regression of user-space (udev or whatever). There is no change in the kernel behavior. The problem must exist even with the older kernels.

Quoted 8 lines

But, looking at the development, we can't expect that udev will be fixed soon, and this breakage persists already way too long. Maybe a better solution is to kill the fallback to udev for normal f/w loading (i.e. for distro kernels).

The patch below is an untested quick hack. It adds a new Kconfig and a new function request_firmware_via_user_helper(). Distro kernels may set CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n for avoiding 60 seconds

I understand your proposed approach is basically equal to unset DELL_RBU, don't I?

Actually if DELL_RBU is set, FW_LOADER_USER_HELPER is still set, and it won't avoid the fallback to loading from userspace.

Quoted 4 lines

stall for non-existing firmware file access -- as distributions know that the firmware files should be placed in the right path.

Thoughts?

I suggest not to introduce new config options in firmware loader any more, and the current options are too many already and it is very easy to trigger build problem, and introduce extra complexity to users at the same time.

About Dave's problem, I think distribution may not trigger it since cpu microcode
should exist, so I am wondering if Dave can disable DELL_RBU to work around the problem in his system? Or fake a one byte microcode file to fool the driver?

Also looks the problem should be handled inside x86 microcode driver because the usage is unique in x86 microcode driver. Other drivers either need one firmware or stop to work without a firmware, but this driver can work well no matter
the firmware loading is satisfied or not.

Or could we force dell rbu to use uevent based loading now?

thanks
--
Ming Lei

#7 lore raw

At Tue, 9 Jul 2013 11:15:20 +0800,

Quoted 64 lines · Ming Lei
Quoted 53 lines · Takashi Iwai

At Sat, 6 Jul 2013 15:30:03 -0700,

Quoted 35 lines · Greg KH
Quoted 33 lines · Dave Jones
Quoted 30 lines · Linux Kernel
Gitweb:     http://git.kernel.org/linus/;a=commit;h=d05c39ea67f5786a549ac9d672d2951992b658c6
Commit:     d05c39ea67f5786a549ac9d672d2951992b658c6
Parent:     a3b2c8c7aa1ca860edcf0b0afa371d9eb2269c3c
Author:     Takashi Iwai <[email protected]>
AuthorDate: Wed May 22 18:28:37 2013 +0200
Committer:  Greg Kroah-Hartman <[email protected]>
CommitDate: Mon Jun 3 13:57:29 2013 -0700

dell_rbu: Select CONFIG_FW_LOADER_USER_HELPER explicitly

The usermode helper is mandatory for this driver.

---
 drivers/firmware/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/firmware/Kconfig +1 -0
index 9387630..0747872 100644
@@ -64,6 +64,7 @@ config DELL_RBU
         tristate "BIOS update support for DELL systems via sysfs"
         depends on X86
         select FW_LOADER
+        select FW_LOADER_USER_HELPER
         help
          Say m if you want to have the option of updating the BIOS for your
          DELL system. Note you need a Dell OpenManage or Dell Update package (DUP)
Quoted 6 lines
Quoted 3 lines

This is pretty crappy. Now every distro kernel has to have that enabled, which screws up for eg, the x86 microcode driver. (It takes 1 minute per cpu when this is enabled).

I'll let you and Takashi battle this one out, for some reason I thought he added it _because_ a distro kernel needed it...

The reason is that dell_rbu driver requires it. Without the kconfig option, this driver won't work at all. So, it's a right fix for dell_rbu.

AFAIK, the consensus in the kernel side is that this too long fw loading time is basically a regression of user-space (udev or whatever). There is no change in the kernel behavior. The problem must exist even with the older kernels.

Quoted 8 lines

But, looking at the development, we can't expect that udev will be fixed soon, and this breakage persists already way too long. Maybe a better solution is to kill the fallback to udev for normal f/w loading (i.e. for distro kernels).

The patch below is an untested quick hack. It adds a new Kconfig and a new function request_firmware_via_user_helper(). Distro kernels may set CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n for avoiding 60 seconds

Quoted 5 lines

I understand your proposed approach is basically equal to unset DELL_RBU, don't I?

Actually if DELL_RBU is set, FW_LOADER_USER_HELPER is still set, and it won't avoid the fallback to loading from userspace.

No, it changes the behavior. The fallback is now checked explicitly via #ifdef CONFIG_FW_LOADER_USER_HELPER_FALLBACK (this is the only place where this kconfig is referred to). The patch isn't great and can be rewritten better, but the idea is to split the fallback behavior (for normal drivers) and the firmware loading that mandates the user-mode helper (for dell_rbu).

Quoted 8 lines
Quoted 4 lines

stall for non-existing firmware file access -- as distributions know that the firmware files should be placed in the right path.

Thoughts?

I suggest not to introduce new config options in firmware loader any more, and the current options are too many already and it is very easy to trigger build problem, and introduce extra complexity to users at the same time.

Yeah, I hate adding a new kconfig, too. But, in this case, I couldn't have other idea for solving in a reasonable amount of change.

Quoted 3 lines

About Dave's problem, I think distribution may not trigger it since cpu microcode
should exist,

It doesn't have to exist -- imagine a brand new CPU that is shipped without errata (I guess it's the case Dave hit).

Quoted 2 lines

so I am wondering if Dave can disable DELL_RBU to work around
the problem in his system? Or fake a one byte microcode file to fool the driver?

Well, the kernel cannot know whether the microcode f/w exists or not beforehand. It needs to probe. And the probing itself stalls for 60 seconds...

Quoted 5 lines

Also looks the problem should be handled inside x86 microcode driver because the usage is unique in x86 microcode driver. Other drivers either need one firmware or stop to work without a firmware, but this driver can work well no matter
the firmware loading is satisfied or not.

Not really specific to microcode driver. Other drivers work without the inquired firmware file. For example, iwlwifi has a fallback mechanism to fetch the old version of firmware. If each probe of non-existing firmware file stalls for 60 seconds, it may take really long.

Quoted 1 line

Or could we force dell rbu to use uevent based loading now?

.... only if we break dell_rbu user-space behavior.

So, our options are:

A. Ignore, with a hope that udev is/will be fixed.

B. Break dell_rbu, rewrite dell_rbu driver code and user-space at the
same time

C. Split the user-space fallback and the mandatory user-space loading
(as my patch does)

Takashi

#8 lore raw
Quoted 72 lines · Takashi Iwai

At Tue, 9 Jul 2013 11:15:20 +0800,

Quoted 64 lines · Ming Lei
Quoted 53 lines · Takashi Iwai

At Sat, 6 Jul 2013 15:30:03 -0700,

Quoted 35 lines · Greg KH
Quoted 33 lines · Dave Jones
Quoted 30 lines · Linux Kernel
Gitweb:     http://git.kernel.org/linus/;a=commit;h=d05c39ea67f5786a549ac9d672d2951992b658c6
Commit:     d05c39ea67f5786a549ac9d672d2951992b658c6
Parent:     a3b2c8c7aa1ca860edcf0b0afa371d9eb2269c3c
Author:     Takashi Iwai <[email protected]>
AuthorDate: Wed May 22 18:28:37 2013 +0200
Committer:  Greg Kroah-Hartman <[email protected]>
CommitDate: Mon Jun 3 13:57:29 2013 -0700

dell_rbu: Select CONFIG_FW_LOADER_USER_HELPER explicitly

The usermode helper is mandatory for this driver.

---
 drivers/firmware/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/firmware/Kconfig +1 -0
index 9387630..0747872 100644
@@ -64,6 +64,7 @@ config DELL_RBU
         tristate "BIOS update support for DELL systems via sysfs"
         depends on X86
         select FW_LOADER
+        select FW_LOADER_USER_HELPER
         help
          Say m if you want to have the option of updating the BIOS for your
          DELL system. Note you need a Dell OpenManage or Dell Update package (DUP)
Quoted 6 lines
Quoted 3 lines

This is pretty crappy. Now every distro kernel has to have that enabled, which screws up for eg, the x86 microcode driver. (It takes 1 minute per cpu when this is enabled).

I'll let you and Takashi battle this one out, for some reason I thought he added it _because_ a distro kernel needed it...

The reason is that dell_rbu driver requires it. Without the kconfig option, this driver won't work at all. So, it's a right fix for dell_rbu.

AFAIK, the consensus in the kernel side is that this too long fw loading time is basically a regression of user-space (udev or whatever). There is no change in the kernel behavior. The problem must exist even with the older kernels.

Quoted 8 lines

But, looking at the development, we can't expect that udev will be fixed soon, and this breakage persists already way too long. Maybe a better solution is to kill the fallback to udev for normal f/w loading (i.e. for distro kernels).

The patch below is an untested quick hack. It adds a new Kconfig and a new function request_firmware_via_user_helper(). Distro kernels may set CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n for avoiding 60 seconds

Quoted 5 lines

I understand your proposed approach is basically equal to unset DELL_RBU, don't I?

Actually if DELL_RBU is set, FW_LOADER_USER_HELPER is still set, and it won't avoid the fallback to loading from userspace.

Quoted 6 lines

No, it changes the behavior. The fallback is now checked explicitly via #ifdef CONFIG_FW_LOADER_USER_HELPER_FALLBACK (this is the only place where this kconfig is referred to). The patch isn't great and can be rewritten better, but the idea is to split the fallback behavior (for normal drivers) and the firmware loading that mandates the user-mode helper (for dell_rbu).

Right, sorry for missing that.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

stall for non-existing firmware file access -- as distributions know that the firmware files should be placed in the right path.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Thoughts?

I suggest not to introduce new config options in firmware loader any more, and the current options are too many already and it is very easy to trigger build problem, and introduce extra complexity to users at the same time.

Yeah, I hate adding a new kconfig, too. But, in this case, I couldn't have other idea for solving in a reasonable amount of change.

One approach I thought of is to introduce request_firmware_user() which should be used only in FW_ACTION_NOHOTPLUG situation, but allows CONFIG_FW_LOADER_USER_HELPER disabled.

Actually from view of distribution, dell rbu has to be compiled in, then no code size can be saved any more, which means looks the introduced option in this patch isn't necessary.

Quoted 7 lines
Quoted 4 lines

About Dave's problem, I think distribution may not trigger it since cpu microcode
should exist,

It doesn't have to exist -- imagine a brand new CPU that is shipped without errata (I guess it's the case Dave hit).

Yes, I mean other drivers(or most of drivers) may have not the situation to be afraid of.

Quoted 7 lines
Quoted 3 lines

so I am wondering if Dave can disable DELL_RBU to work around
the problem in his system? Or fake a one byte microcode file to fool the driver?

Well, the kernel cannot know whether the microcode f/w exists or not beforehand. It needs to probe. And the probing itself stalls for 60 seconds...

The driver can use request_firmware_no_wait() to work around it too...

Quoted 7 lines
Quoted 6 lines

Also looks the problem should be handled inside x86 microcode driver because the usage is unique in x86 microcode driver. Other drivers either need one firmware or stop to work without a firmware, but this driver can work well no matter
the firmware loading is satisfied or not.

Quoted 5 lines

Not really specific to microcode driver. Other drivers work without the inquired firmware file. For example, iwlwifi has a fallback mechanism to fetch the old version of firmware. If each probe of non-existing firmware file stalls for 60 seconds, it may take really long.

I am wondering why people didn't complain the loading in iwlwifi, :-)

Quoted 7 lines
Quoted 2 lines

Or could we force dell rbu to use uevent based loading now?

.... only if we break dell_rbu user-space behavior.

So, our options are:

Quoted 7 lines

A. Ignore, with a hope that udev is/will be fixed.

B. Break dell_rbu, rewrite dell_rbu driver code and user-space at the
same time

C. Split the user-space fallback and the mandatory user-space loading
(as my patch does)

Thanks,
--
Ming Lei

#9 lore raw

At Tue, 9 Jul 2013 16:43:30 +0800,

Quoted 97 lines · Ming Lei
Quoted 72 lines · Takashi Iwai

At Tue, 9 Jul 2013 11:15:20 +0800,

Quoted 64 lines · Ming Lei
Quoted 53 lines · Takashi Iwai

At Sat, 6 Jul 2013 15:30:03 -0700,

Quoted 35 lines · Greg KH
Quoted 33 lines · Dave Jones
Quoted 30 lines · Linux Kernel
Gitweb:     http://git.kernel.org/linus/;a=commit;h=d05c39ea67f5786a549ac9d672d2951992b658c6
Commit:     d05c39ea67f5786a549ac9d672d2951992b658c6
Parent:     a3b2c8c7aa1ca860edcf0b0afa371d9eb2269c3c
Author:     Takashi Iwai <[email protected]>
AuthorDate: Wed May 22 18:28:37 2013 +0200
Committer:  Greg Kroah-Hartman <[email protected]>
CommitDate: Mon Jun 3 13:57:29 2013 -0700

dell_rbu: Select CONFIG_FW_LOADER_USER_HELPER explicitly

The usermode helper is mandatory for this driver.

---
 drivers/firmware/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/firmware/Kconfig +1 -0
index 9387630..0747872 100644
@@ -64,6 +64,7 @@ config DELL_RBU
         tristate "BIOS update support for DELL systems via sysfs"
         depends on X86
         select FW_LOADER
+        select FW_LOADER_USER_HELPER
         help
          Say m if you want to have the option of updating the BIOS for your
          DELL system. Note you need a Dell OpenManage or Dell Update package (DUP)
Quoted 6 lines
Quoted 3 lines

This is pretty crappy. Now every distro kernel has to have that enabled, which screws up for eg, the x86 microcode driver. (It takes 1 minute per cpu when this is enabled).

I'll let you and Takashi battle this one out, for some reason I thought he added it _because_ a distro kernel needed it...

The reason is that dell_rbu driver requires it. Without the kconfig option, this driver won't work at all. So, it's a right fix for dell_rbu.

AFAIK, the consensus in the kernel side is that this too long fw loading time is basically a regression of user-space (udev or whatever). There is no change in the kernel behavior. The problem must exist even with the older kernels.

Quoted 8 lines

But, looking at the development, we can't expect that udev will be fixed soon, and this breakage persists already way too long. Maybe a better solution is to kill the fallback to udev for normal f/w loading (i.e. for distro kernels).

The patch below is an untested quick hack. It adds a new Kconfig and a new function request_firmware_via_user_helper(). Distro kernels may set CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n for avoiding 60 seconds

Quoted 5 lines

I understand your proposed approach is basically equal to unset DELL_RBU, don't I?

Actually if DELL_RBU is set, FW_LOADER_USER_HELPER is still set, and it won't avoid the fallback to loading from userspace.

Quoted 6 lines

No, it changes the behavior. The fallback is now checked explicitly via #ifdef CONFIG_FW_LOADER_USER_HELPER_FALLBACK (this is the only place where this kconfig is referred to). The patch isn't great and can be rewritten better, but the idea is to split the fallback behavior (for normal drivers) and the firmware loading that mandates the user-mode helper (for dell_rbu).

Right, sorry for missing that.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

stall for non-existing firmware file access -- as distributions know that the firmware files should be placed in the right path.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Thoughts?

I suggest not to introduce new config options in firmware loader any more, and the current options are too many already and it is very easy to trigger build problem, and introduce extra complexity to users at the same time.

Yeah, I hate adding a new kconfig, too. But, in this case, I couldn't have other idea for solving in a reasonable amount of change.

Quoted 7 lines

One approach I thought of is to introduce request_firmware_user() which should be used only in FW_ACTION_NOHOTPLUG situation, but allows CONFIG_FW_LOADER_USER_HELPER disabled.

Actually from view of distribution, dell rbu has to be compiled in, then no code size can be saved any more, which means looks the introduced option in this patch isn't necessary.

Well, but it means that there is no way not to compile user-helper mode code in firmware_class.c. In other words, in which condition, request_firmware_user() will be compiled?

Quoted 11 lines
Quoted 6 lines
Quoted 3 lines

About Dave's problem, I think distribution may not trigger it since cpu microcode
should exist,

It doesn't have to exist -- imagine a brand new CPU that is shipped without errata (I guess it's the case Dave hit).

Yes, I mean other drivers(or most of drivers) may have not the situation to be afraid of.

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

so I am wondering if Dave can disable DELL_RBU to work around
the problem in his system? Or fake a one byte microcode file to fool the driver?

Well, the kernel cannot know whether the microcode f/w exists or not beforehand. It needs to probe. And the probing itself stalls for 60 seconds...

The driver can use request_firmware_no_wait() to work around it too...

Yes, but it sucks :)

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Also looks the problem should be handled inside x86 microcode driver because the usage is unique in x86 microcode driver. Other drivers either need one firmware or stop to work without a firmware, but this driver can work well no matter
the firmware loading is satisfied or not.

Quoted 7 lines
Quoted 5 lines

Not really specific to microcode driver. Other drivers work without the inquired firmware file. For example, iwlwifi has a fallback mechanism to fetch the old version of firmware. If each probe of non-existing firmware file stalls for 60 seconds, it may take really long.

I am wondering why people didn't complain the loading in iwlwifi, :-)

Maybe just because people update kernel-firmware together with the kernel itself. Or, it happens with a certain udev like Fedora. I haven't seen 60 seconds delay on openSUSE, for example.

Takashi

Quoted 21 lines
Quoted 7 lines
Quoted 2 lines

Or could we force dell rbu to use uevent based loading now?

.... only if we break dell_rbu user-space behavior.

So, our options are:

Quoted 7 lines

A. Ignore, with a hope that udev is/will be fixed.

B. Break dell_rbu, rewrite dell_rbu driver code and user-space at the
same time

C. Split the user-space fallback and the mandatory user-space loading
(as my patch does)

Thanks,
--
Ming Lei

#10 lore raw
Quoted 8 lines · Takashi Iwai

At Tue, 9 Jul 2013 16:43:30 +0800,

Quoted 3 lines

Actually from view of distribution, dell rbu has to be compiled in, then no code size can be saved any more, which means looks the introduced option in this patch isn't necessary.

Well, but it means that there is no way not to compile user-helper mode code in firmware_class.c. In other words, in which condition, request_firmware_user() will be compiled?

It can be always compiled in. Basically dell rbu is always enabled in distributions, which means the user helper code has to be compiled in.

Thanks,
--
Ming Lei

#11 lore raw

At Tue, 9 Jul 2013 22:39:36 +0800,

Quoted 7 lines · Ming Lei
Quoted 5 lines · Takashi Iwai

At Tue, 9 Jul 2013 16:43:30 +0800,

Quoted 3 lines

Actually from view of distribution, dell rbu has to be compiled in, then no code size can be saved any more, which means looks the introduced option in this patch isn't necessary.

Quoted 6 lines
Quoted 3 lines

Well, but it means that there is no way not to compile user-helper mode code in firmware_class.c. In other words, in which condition, request_firmware_user() will be compiled?

It can be always compiled in. Basically dell rbu is always enabled in distributions, which means the user helper code has to be compiled in.

But how non-distro kernel disables this being built-in...? Or do you suggest to enable the user-helper codes always built, no matter whether it's used or not?

Takashi

#12 lore raw
Quoted 13 lines · Takashi Iwai

At Tue, 9 Jul 2013 22:39:36 +0800,

Quoted 11 lines · Ming Lei
Quoted 8 lines · Takashi Iwai

At Tue, 9 Jul 2013 16:43:30 +0800,

Quoted 3 lines

Actually from view of distribution, dell rbu has to be compiled in, then no code size can be saved any more, which means looks the introduced option in this patch isn't necessary.

Well, but it means that there is no way not to compile user-helper mode code in firmware_class.c. In other words, in which condition, request_firmware_user() will be compiled?

Quoted 6 lines
Quoted 2 lines

It can be always compiled in. Basically dell rbu is always enabled in distributions, which means the user helper code has to be compiled in.

But how non-distro kernel disables this being built-in...? Or do you suggest to enable the user-helper codes always built, no matter whether it's used or not?

The only cost of built-in user helper code is ~6Kbytes code on my armv7 box.

If the 6KB memory does mater for this non-distro kernel, we can introduce more options.

Thanks,
--
Ming Lei

#13 lore raw

At Tue, 9 Jul 2013 23:06:05 +0800,

Quoted 22 lines · Ming Lei
Quoted 13 lines · Takashi Iwai

At Tue, 9 Jul 2013 22:39:36 +0800,

Quoted 11 lines · Ming Lei
Quoted 8 lines · Takashi Iwai

At Tue, 9 Jul 2013 16:43:30 +0800,

Quoted 3 lines

Actually from view of distribution, dell rbu has to be compiled in, then no code size can be saved any more, which means looks the introduced option in this patch isn't necessary.

Well, but it means that there is no way not to compile user-helper mode code in firmware_class.c. In other words, in which condition, request_firmware_user() will be compiled?

Quoted 6 lines
Quoted 2 lines

It can be always compiled in. Basically dell rbu is always enabled in distributions, which means the user helper code has to be compiled in.

But how non-distro kernel disables this being built-in...? Or do you suggest to enable the user-helper codes always built, no matter whether it's used or not?

Quoted 5 lines

The only cost of built-in user helper code is ~6Kbytes code on my armv7 box.

If the 6KB memory does mater for this non-distro kernel, we can introduce more options.

Well, if it doesn't matter, we don't need CONFIG_FW_LOADER_USER_HELPER either. The goal of this option is to kill the user helper code, not intended as a workaround for 60 seconds stall.

Takashi

#14 lore raw
Quoted 10 lines · Takashi Iwai
Quoted 6 lines

The only cost of built-in user helper code is ~6Kbytes code on my armv7 box.

If the 6KB memory does mater for this non-distro kernel, we can introduce more options.

Well, if it doesn't matter, we don't need CONFIG_FW_LOADER_USER_HELPER either. The goal of this option is to kill the user helper code, not intended as a workaround for 60 seconds stall.

Actually, the Kconfig help is "Fallback user-helper invocation for firmware loading",
so looks the description in help doc isn't consistent with what you wanted, :-)

Thanks,
--
Ming Lei

#15 lore raw

At Tue, 9 Jul 2013 23:22:33 +0800,

Quoted 9 lines · Ming Lei
Quoted 7 lines · Takashi Iwai
Quoted 6 lines

The only cost of built-in user helper code is ~6Kbytes code on my armv7 box.

If the 6KB memory does mater for this non-distro kernel, we can introduce more options.

Quoted 7 lines
Quoted 3 lines

Well, if it doesn't matter, we don't need CONFIG_FW_LOADER_USER_HELPER either. The goal of this option is to kill the user helper code, not intended as a workaround for 60 seconds stall.

Actually, the Kconfig help is "Fallback user-helper invocation for firmware loading",
so looks the description in help doc isn't consistent with what you wanted, :-)

There is always a secret plan for world conquer :)

Takashi