Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1673944 > unrolled thread
| Started by | Jakub Kicinski <jakub.kicinski@netronome.com> |
|---|---|
| First post | 2017-06-24 01:40 +0200 |
| Last post | 2017-06-30 18:40 +0200 |
| Articles | 20 on this page of 30 — 7 participants |
Back to article view | Back to linux.kernel
[PATCH] firmware: wake all waiters Jakub Kicinski <jakub.kicinski@netronome.com> - 2017-06-24 01:40 +0200
Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-26 23:30 +0200
Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-27 01:50 +0200
Re: [PATCH] firmware: wake all waiters Jakub Kicinski <jakub.kicinski@netronome.com> - 2017-06-27 04:20 +0200
Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-27 18:40 +0200
Re: [PATCH] firmware: wake all waiters Jakub Kicinski <jakub.kicinski@netronome.com> - 2017-06-27 23:30 +0200
Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-28 00:30 +0200
Re: [PATCH] firmware: wake all waiters Jakub Kicinski <jakub.kicinski@netronome.com> - 2017-06-28 00:50 +0200
Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-28 02:00 +0200
Re: [systemd-devel] [PATCH] firmware: wake all waiters Lennart Poettering <mzxreary@0pointer.de> - 2017-06-28 09:10 +0200
Re: [systemd-devel] [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-28 18:10 +0200
Re: [systemd-devel] [PATCH] firmware: wake all waiters Lennart Poettering <mzxreary@0pointer.de> - 2017-06-28 20:00 +0200
Re: [systemd-devel] [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-28 20:00 +0200
Re: [systemd-devel] [PATCH] firmware: wake all waiters Daniel Wagner <wagi@monom.org> - 2017-06-29 22:10 +0200
Re: [PATCH] firmware: wake all waiters Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-06-27 20:00 +0200
Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-27 20:10 +0200
Re: [PATCH] firmware: wake all waiters Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-06-27 21:00 +0200
Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-27 21:10 +0200
Re: [PATCH] firmware: wake all waiters Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-06-27 22:00 +0200
Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-27 22:30 +0200
Re: [PATCH] firmware: wake all waiters Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-26 23:50 +0200
Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-27 01:40 +0200
Re: [PATCH] firmware: wake all waiters Linus Torvalds <torvalds@linux-foundation.org> - 2017-06-27 01:50 +0200
Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-27 02:20 +0200
Re: [PATCH] firmware: wake all waiters Davidlohr Bueso <dave@stgolabs.net> - 2017-06-28 15:50 +0200
Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-28 18:00 +0200
Re: [PATCH] firmware: wake all waiters Davidlohr Bueso <dave@stgolabs.net> - 2017-06-28 21:10 +0200
Re: [PATCH] firmware: wake all waiters Davidlohr Bueso <dave@stgolabs.net> - 2017-06-29 21:10 +0200
Re: [PATCH] firmware: wake all waiters "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-06-29 21:50 +0200
Re: [PATCH] firmware: wake all waiters Davidlohr Bueso <dave@stgolabs.net> - 2017-06-30 18:40 +0200
Page 1 of 2 [1] 2 Next page →
| From | Jakub Kicinski <jakub.kicinski@netronome.com> |
|---|---|
| Date | 2017-06-24 01:40 +0200 |
| Subject | [PATCH] firmware: wake all waiters |
| Message-ID | <tVGlc-9V-17@gated-at.bofh.it> |
Multiple devices may be waiting for firmware with the same name. In that case we will make them all use the same struct firmware_buf. When wake up happens make sure it's propagated to all of them. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> --- drivers/base/firmware_class.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index ac350c518e0c..c23b58e64b33 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -148,7 +148,7 @@ static void __fw_state_set(struct fw_state *fw_st, WRITE_ONCE(fw_st->status, status); if (status == FW_STATUS_DONE || status == FW_STATUS_ABORTED) - swake_up(&fw_st->wq); + swake_up_all(&fw_st->wq); } #define fw_state_start(fw_st) \ -- 2.11.0
[toc] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2017-06-26 23:30 +0200 |
| Message-ID | <tWJK1-7Am-13@gated-at.bofh.it> |
| In reply to | #1673944 |
Thank you for your patch!
On Fri, Jun 23, 2017 at 04:37:02PM -0700, Jakub Kicinski wrote:
> Multiple devices may be waiting for firmware with the same name.
This is due to a hidden and not-well understood feature of the firmware API. I
can trace commit logs loosely documenting this as an intended feature by Ming
Lei since commit 1f2b79599ee8f5f ("firmware loader: always let firmware_buf own
the pages buffer") so at least it would seems this is intended functionality.
Unfortunately this feature also has quite a big of bugs which will need to be
addressed after you patch. I'll address first your patch, and then explain the
rest of the issues lingering.
To expedite things I'll re-submit your patch with a different commit log
describing this mechanism a bit better otherwise this fix will would be hard to
understand. Understanding the impact is also key as we want this to be
evaluated for for stable as well! I'd prefer your patch to go in after the
pending stable signal fixes as well.
Proposed alternative commit log:
******
Subject: [PATCH] firmware: fix batched requests - wake all waiters
The firmware cache mechanism serves two purposes, the secondary purpose is
not well documented nor understood. This fixes a regression with the secondary
purpose of the firmware cache mechanism: batched requests.
The firmware cache is used for:
1) Addressing races with file lookups during the suspend/resume cycle
by keeping firmware in memory during the cycle
2) Batched requests for the same file rely only on work from the first file
lookup, which keeps the firmware in memory until the last release_firmware()
is called
Batched requests *only* take effect if secondary requests come in prior to the
first user calling release_firmware(). The devres name used for the internal
firmware cache is used as a hint other pending requests are ongoing, the
firmware buffer data is kept in memory until the last user of the buffer
calls release_firmware(), therefore serializing requests and delaying the
release until all requests are done.
Batched requests wait for a wakup or signal (we only accept SIGKILL now) so we
can rely on the first file fetch to write to the pending secondary requests.
Commit 5b029624948d ("firmware: do not use fw_lock for fw_state protection")
ported the firmware API to use swait, and in doing so failed to convert
complete_all() to swake_up_all() -- it used swake_up(), loosing the ability
for *some* batched requests to take effect.
Without this fix it has been reported plugging in two Intel 6260 Wifi cards
on a system will end up enumerating the two devices only 50% of the time
[0]. The ported swake_up() should have actually two devices, however,
*if more than two cards are used* the swake_up() would not suffice. This
change is only part of the required fixes for batched requests. Subsequent
fixes will follow.
This particular change should fix the cases where more than three requests
with the same firmware name is used, otherwise batched requests will wait for
MAX_SCHEDULE_TIMEOUT and just timeout eventually.
[0] https://bugzilla.kernel.org/show_bug.cgi?id=195477
Fixes: 5b029624948d ("firmware: do not use fw_lock for fw_state protection")
CC: <stable@vger.kernel.org> [4.10+]
******
This was merged on v4.10 and complete_all() was used before older kernels,
so older kernels should not be affected by this particular regression.
> In that case we will make them all use the same struct firmware_buf.
> When wake up happens make sure it's propagated to all of them.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
There's a slew of bugs lurking here though!
As noted the reported Intel driver issues still need other fixes, one was the
fw_state_done() on the direct filesystem lookup mechanism [1], and that may be
a regression since direct filesystem loading was added, and even secondary
requests would seem to just wait forever (MAX_SCHEDULE_TIMEOUT); the combination
of both fixes should fix your reported issue.
Do you intend on submitting those changes as well ? There's still *other* bugs
with this feature though... Knowing if you will follow up with further fixes
will be appreciated.
After this patch things we need then:
0) addressing the remainder of the delta from kernel.org bug 195477 [1]
1) addressing error paths on the 1st request to wake up waiters
2) documenting this hidden feature
3) a test case for this feature
This feature takes effect effect when fw_lookup_and_allocate_buf() returns 1,
when __fw_lookup_buf() finds the firmware requested on the firmware cache list
already. This was designed to only take effect if release_firmware() was not
called before the secondary lookups, as otherwise kref_put() would be called with
the respective freeing of the buffer used for waiting and data.
If the 1st request did not free the buf with kref_put() and __fw_free_buf(),
that means its up to the batched requests to address the release. This should
be OK today if the 2nd request was successful, but on failure we have nothing
freeing the old buf currently. This fix is lower priority due to how rare it
could be, but given we currently always fail even if we were successful on
load on direct fs lookup this issue should have been more common on systems
with more than 2 cards then.
Yet another stable fix.
Also consider the case of the 1st request is still being processed, and batched
requests are in queue. As noted since fw_state_wait() is used we'll wait for
MAX_SCHEDULE_TIMEOUT, but if a failure on the 1st request happens there are
a slew of cases where we do not issue a wake up! So we're missing some sprinkled
fw_state_aborted() on error paths. Because of these issues a failed request
with batched requets pending will just wait for MAX_SCHEDULE_TIMEOUT.
Yet another stable fix.
[1] https://bugzilla.kernel.org/attachment.cgi?id=256493
Luis
> ---
> drivers/base/firmware_class.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> index ac350c518e0c..c23b58e64b33 100644
> --- a/drivers/base/firmware_class.c
> +++ b/drivers/base/firmware_class.c
> @@ -148,7 +148,7 @@ static void __fw_state_set(struct fw_state *fw_st,
> WRITE_ONCE(fw_st->status, status);
>
> if (status == FW_STATUS_DONE || status == FW_STATUS_ABORTED)
> - swake_up(&fw_st->wq);
> + swake_up_all(&fw_st->wq);
> }
>
> #define fw_state_start(fw_st) \
[toc] | [prev] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2017-06-27 01:50 +0200 |
| Message-ID | <tWLVv-AA-3@gated-at.bofh.it> |
| In reply to | #1675115 |
On Mon, Jun 26, 2017 at 11:20:36PM +0200, Luis R. Rodriguez wrote: > On Fri, Jun 23, 2017 at 04:37:02PM -0700, Jakub Kicinski wrote: > There's a slew of bugs lurking here though! > > As noted the reported Intel driver issues still need other fixes, one was the > fw_state_done() on the direct filesystem lookup mechanism [1], and that may be > a regression since direct filesystem loading was added, and even secondary > requests would seem to just wait forever (MAX_SCHEDULE_TIMEOUT); the combination > of both fixes should fix your reported issue. Actually fw_state_done() is already called on success on direct filesystem loading, so that should be fine. The bug report proposed change only adds a fw_state_aborted() in case of a failure on direct fs lookups. That in turn, needs consideration of the fallback mechanism, ie, only in case of *real* final falure should fw_state_aborte() be issued. Distros that have enabled the fallback mechanism (seems like andoid now) have no other option but to wait for the fallback mechanism or timeout to complete. Its one reason why the firmwared thing is a good thing to review which has the best-effort mode and final-mode [0]. [0] https://github.com/teg/firmwared.git Luis
[toc] | [prev] | [next] | [standalone]
| From | Jakub Kicinski <jakub.kicinski@netronome.com> |
|---|---|
| Date | 2017-06-27 04:20 +0200 |
| Message-ID | <tWOgG-2mL-35@gated-at.bofh.it> |
| In reply to | #1675115 |
On Mon, 26 Jun 2017 23:20:36 +0200, Luis R. Rodriguez wrote: > > In that case we will make them all use the same struct firmware_buf. > > When wake up happens make sure it's propagated to all of them. > > > > Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> > > There's a slew of bugs lurking here though! > > As noted the reported Intel driver issues still need other fixes, one was the > fw_state_done() on the direct filesystem lookup mechanism [1], and that may be > a regression since direct filesystem loading was added, and even secondary > requests would seem to just wait forever (MAX_SCHEDULE_TIMEOUT); the combination > of both fixes should fix your reported issue. > > Do you intend on submitting those changes as well ? There's still *other* bugs > with this feature though... Knowing if you will follow up with further fixes > will be appreciated. No, I don't have any more fixes in my tree right now :) What I'm looking towards implementing is actually a ability for NICs to load default FW but then enable users to load different FW on their request. The problem is that advanced NICs are quite programmable [1] and depending on use case one may want to load different firmware files. It's slightly close to the FPGA use case, only with FPGA people don't expect much plug and play, and with NICs the default mode after boot must be "look as much as a standard NIC as possible". Then loading "advanced"/hand crafted firmware can turn more interesting features on. The FW loading we have now in drivers/net/ethernet/netronome/nfp is requesting default FW and returning -EPROBE_DEFER if not found. Now I need to find a way to allow users to "push" whatever advanced FW they have into the NIC after/during boot. Current firmware subsystem doesn't seem to cater to this use case to well. I have to look at the FPGA-related code. The three main problems to solve are: - how to stay bound and retry the direct default FW load until rootfs is mounted (equivalent to when -EPROBE_DEFER would give up); - how to expose permanent FW loading sysfs interface which won't disappear after the first -1/1 is written to .../loading; - how to make sure different cards, which request the same file name can be served different default firmwares... Thanks for the improved commit message! [1] HW links: https://www.hotchips.org/wp-content/uploads/hc_archives/hc25/HC25.60-Networking-epub/HC25.27.620-22nm-Flow-Proc-Stark-Netronome.pdf https://www.netronome.com/media/pdfs/NFP_Programming_Model_h6vxM7Y.pdf http://open-nfp.org/resources/
[toc] | [prev] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2017-06-27 18:40 +0200 |
| Message-ID | <tX1GW-35M-23@gated-at.bofh.it> |
| In reply to | #1675254 |
On Mon, Jun 26, 2017 at 07:10:09PM -0700, Jakub Kicinski wrote: > On Mon, 26 Jun 2017 23:20:36 +0200, Luis R. Rodriguez wrote: > > > In that case we will make them all use the same struct firmware_buf. > > > When wake up happens make sure it's propagated to all of them. > > > > > > Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> > > > > There's a slew of bugs lurking here though! > > > > As noted the reported Intel driver issues still need other fixes, one was the > > fw_state_done() on the direct filesystem lookup mechanism [1], and that may be > > a regression since direct filesystem loading was added, and even secondary > > requests would seem to just wait forever (MAX_SCHEDULE_TIMEOUT); the combination > > of both fixes should fix your reported issue. > > > > Do you intend on submitting those changes as well ? There's still *other* bugs > > with this feature though... Knowing if you will follow up with further fixes > > will be appreciated. > > No, I don't have any more fixes in my tree right now :) Ok I can take on the other bits. > What I'm > looking towards implementing is actually a ability for NICs to load > default FW but then enable users to load different FW on their request. request_firmware_direct() loads optional firmware but this is a sync call. We don't currently have a similar API for async, we would have gotten this with the driver data API I wrote, but am now looking forward to Greg advising how to implement this. But it seems you need more actually, comments below. > The problem is that advanced NICs are quite programmable [1] and > depending on use case one may want to load different firmware files. Right, so in the 802.11 world some devices might use different firmware for different modes of operation, STA, AP, Mesh, but this is all very protocol specific, so userspace could tickle the kernel about a mode. Do your use cases have protocol definitions which can be exposed in userspace? Or are these just fw variants with different bells and whistles? How man different use cases are we talking about? > It's slightly close to the FPGA use case, only with FPGA people don't > expect much plug and play, and with NICs the default mode after boot > must be "look as much as a standard NIC as possible". Then loading > "advanced"/hand crafted firmware can turn more interesting features on. Makes sense. > The FW loading we have now in drivers/net/ethernet/netronome/nfp is > requesting default FW and returning -EPROBE_DEFER if not found. Oh I see -- right now nfp_nsp_init() is the path that will call the firmware load via request_firmware() on nfp_net_fw_find(), and if this fails it fails to find firmware it still returns 0, and the nfp_net_pci_probe() does the -EPROBE_DEFER handling. Ugh. This is super hacky, and I realize -EPROBE_DEFER is used for these hacks folks should stop doing this, specially for this use case given we thought about it and I believe we have a solution now. Tom Gundersen and Daniel Wagner worked on a userspace solution to help with this, it works with two simple modes: best-effort and final-mode. The idea is the firmwared daemon will be kicked into final-mode once userspace knows the real rootfs is ready, and this in turn can be used to signal a final notification that the optional or required firmware is *definitely* not there. Arend was going to start toying with it, so it would be good to wait for his feedback. > Now I > need to find a way to allow users to "push" whatever advanced FW they > have into the NIC after/during boot. Be careful how you do this as you'll have to support it in the driver forever if you use something like sysfs I think, otherwise you will break some userspace. However if you use debugfs I think its understood that's loose API. I'd recommend instead to first see if you can get a mapping of the modes as specific knobs / tunables through the networking stack, if so then those can be used as triggers. If not, consider the *features* that are exposed by the different firmwares and consider their need as triggers for a reload. How many other devices do the same you do? In what modes? > Current firmware subsystem doesn't seem to cater to this use case to > well. Its a matter of asking and talking. I've provided references of things to try to address the hacky -EPROBE_DEFER. It does however require a userspace daemon used, so it does require use of the uevent fallback mechanism. > I have to look at the FPGA-related code. Not sure how that would help. Is it huge firmware? > The three main > problems to solve are: > - how to stay bound and retry the direct default FW load until rootfs > is mounted (equivalent to when -EPROBE_DEFER would give up); I've thrown a bone for that. > - how to expose permanent FW loading sysfs interface which won't > disappear after the first -1/1 is written to .../loading; The lib/test_firmware.c driver has an example sysfs know a driver could use on its own to load firmware. This is not as dynamic as you'd want, so I had implemented an alternative interface which lets you customize hooks in userspace first and then you just have a sync or async trigger for the test driver data. It would seem this will not go upstream but you can look at it as an example of what could be done: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/log/?h=20170605-driver-data https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/commit/?h=20170605-driver-data&id=3696afe8d4aba5606dc8f3c562aeae1687f3b53e But take the warning above about using sysfs serious, you don't want to break userspace for users, and you want to see if you can first work towards something more generic with the networking folks. > - how to make sure different cards, which request the same file name > can be served different default firmwares... I believe your patch + the error path fix will handle this now, no? Luis > > Thanks for the improved commit message! > > [1] HW links: > https://www.hotchips.org/wp-content/uploads/hc_archives/hc25/HC25.60-Networking-epub/HC25.27.620-22nm-Flow-Proc-Stark-Netronome.pdf > https://www.netronome.com/media/pdfs/NFP_Programming_Model_h6vxM7Y.pdf > http://open-nfp.org/resources/ > -- Luis Rodriguez, SUSE LINUX GmbH Maxfeldstrasse 5; D-90409 Nuernberg
[toc] | [prev] | [next] | [standalone]
| From | Jakub Kicinski <jakub.kicinski@netronome.com> |
|---|---|
| Date | 2017-06-27 23:30 +0200 |
| Message-ID | <tX6dz-6fU-5@gated-at.bofh.it> |
| In reply to | #1675995 |
On Tue, 27 Jun 2017 18:39:42 +0200, Luis R. Rodriguez wrote: > On Mon, Jun 26, 2017 at 07:10:09PM -0700, Jakub Kicinski wrote: > > On Mon, 26 Jun 2017 23:20:36 +0200, Luis R. Rodriguez wrote: > > > > In that case we will make them all use the same struct firmware_buf. > > > > When wake up happens make sure it's propagated to all of them. > > > > > > > > Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> > > > > > > There's a slew of bugs lurking here though! > > > > > > As noted the reported Intel driver issues still need other fixes, one was the > > > fw_state_done() on the direct filesystem lookup mechanism [1], and that may be > > > a regression since direct filesystem loading was added, and even secondary > > > requests would seem to just wait forever (MAX_SCHEDULE_TIMEOUT); the combination > > > of both fixes should fix your reported issue. > > > > > > Do you intend on submitting those changes as well ? There's still *other* bugs > > > with this feature though... Knowing if you will follow up with further fixes > > > will be appreciated. > > > > No, I don't have any more fixes in my tree right now :) > > Ok I can take on the other bits. > > > What I'm > > looking towards implementing is actually a ability for NICs to load > > default FW but then enable users to load different FW on their request. > > request_firmware_direct() loads optional firmware but this is a sync call. We > don't currently have a similar API for async, we would have gotten this with > the driver data API I wrote, but am now looking forward to Greg advising how to > implement this. But it seems you need more actually, comments below. > > > The problem is that advanced NICs are quite programmable [1] and > > depending on use case one may want to load different firmware files. > > Right, so in the 802.11 world some devices might use different firmware for > different modes of operation, STA, AP, Mesh, but this is all very protocol > specific, so userspace could tickle the kernel about a mode. > > Do your use cases have protocol definitions which can be exposed in userspace? > Or are these just fw variants with different bells and whistles? How man > different use cases are we talking about? Right now we have three modes that come from Netronome itself, a "basic NIC" one, and two advanced for TC flower/Open vSwitch acceleration and for eBPF offload. I was hoping some enumeration scheme could work here, but I really can't come up with one. People can download the SDK and write a FW with their own offloads, bells and whistles, I feel like they should be able to load that with the upstream kernel and minimal effort :( > > It's slightly close to the FPGA use case, only with FPGA people don't > > expect much plug and play, and with NICs the default mode after boot > > must be "look as much as a standard NIC as possible". Then loading > > "advanced"/hand crafted firmware can turn more interesting features on. > > Makes sense. > > > The FW loading we have now in drivers/net/ethernet/netronome/nfp is > > requesting default FW and returning -EPROBE_DEFER if not found. > > Oh I see -- right now nfp_nsp_init() is the path that will call the firmware > load via request_firmware() on nfp_net_fw_find(), and if this fails it fails to > find firmware it still returns 0, and the nfp_net_pci_probe() does the > -EPROBE_DEFER handling. > > Ugh. This is super hacky, and I realize -EPROBE_DEFER is used for these hacks > folks should stop doing this, specially for this use case given we thought > about it and I believe we have a solution now. > > Tom Gundersen and Daniel Wagner worked on a userspace solution to help with > this, it works with two simple modes: best-effort and final-mode. The idea is > the firmwared daemon will be kicked into final-mode once userspace knows the > real rootfs is ready, and this in turn can be used to signal a final > notification that the optional or required firmware is *definitely* not there. > > Arend was going to start toying with it, so it would be good to wait for his > feedback. Haha, yes the -EPROBE_DEFER is definitely a hack. I was trying to do the right thing, but then I found out that systemd dropped the support for FW uevents and major distributions don't even build the fallback in. To be honest waiting for rootfs to be available is lower on my list of priorities, but it's definitely nice to have. I also don't care about supporting more complex rootfs setups, simply trying whatever comes after initramfs covers 99.9% use cases. 0.1% can load the FW manually/ rebind the driver IMHO. > > Now I > > need to find a way to allow users to "push" whatever advanced FW they > > have into the NIC after/during boot. > > Be careful how you do this as you'll have to support it in the driver forever > if you use something like sysfs I think, otherwise you will break some > userspace. However if you use debugfs I think its understood that's loose API. Unfortunately the netdev community does not like debugfs. I would prefer to extend the firmware subsystem if possible and use the existing sysfs interface, just in a new "mode". > I'd recommend instead to first see if you can get a mapping of the modes as > specific knobs / tunables through the networking stack, if so then those can > be used as triggers. If not, consider the *features* that are exposed by > the different firmwares and consider their need as triggers for a reload. > How many other devices do the same you do? In what modes? There are a number of NPU-like products. Also the ability to parse packets in arbitrary ways and look things up in TCAMs is expanding in simpler hardware. It's hard to express parsing graph as a set of features, especially that nowadays crafting custom protocols seems to be in vogue. > > Current firmware subsystem doesn't seem to cater to this use case to > > well. > > Its a matter of asking and talking. I've provided references of things to > try to address the hacky -EPROBE_DEFER. It does however require a userspace > daemon used, so it does require use of the uevent fallback mechanism. Do you know how systemd developers feel about the issue (CCed)? Given that it seems to dominate in data center OSes now I'm slightly worried having to push Big Linux Vendors to package some seemingly embedded-centric software just to make advanced NICs run :( > > I have to look at the FPGA-related code. > > Not sure how that would help. Is it huge firmware? Up to a few megabytes. You are right, the major feature of FPGA API doesn't interest us... > > The three main > > problems to solve are: > > - how to stay bound and retry the direct default FW load until rootfs > > is mounted (equivalent to when -EPROBE_DEFER would give up); > > I've thrown a bone for that. Thanks. > > - how to expose permanent FW loading sysfs interface which won't > > disappear after the first -1/1 is written to .../loading; > > The lib/test_firmware.c driver has an example sysfs know a driver could use > on its own to load firmware. This is not as dynamic as you'd want, so I had > implemented an alternative interface which lets you customize hooks in userspace > first and then you just have a sync or async trigger for the test driver > data. It would seem this will not go upstream but you can look at it as an > example of what could be done: > > https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/log/?h=20170605-driver-data > https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/commit/?h=20170605-driver-data&id=3696afe8d4aba5606dc8f3c562aeae1687f3b53e > > But take the warning above about using sysfs serious, you don't want to break > userspace for users, and you want to see if you can first work towards something > more generic with the networking folks. Thanks for the pointers! > > - how to make sure different cards, which request the same file name > > can be served different default firmwares... > > I believe your patch + the error path fix will handle this now, no? I'm not sure. I think it would work if I set FW_OPT_NOCACHE, though. I need to test that. Thanks a lot for the comments!
[toc] | [prev] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2017-06-28 00:30 +0200 |
| Message-ID | <tX79E-6RF-15@gated-at.bofh.it> |
| In reply to | #1676191 |
On Tue, Jun 27, 2017 at 02:25:53PM -0700, Jakub Kicinski wrote: > On Tue, 27 Jun 2017 18:39:42 +0200, Luis R. Rodriguez wrote: > > > > > The problem is that advanced NICs are quite programmable [1] and > > > depending on use case one may want to load different firmware files. > > > > Right, so in the 802.11 world some devices might use different firmware for > > different modes of operation, STA, AP, Mesh, but this is all very protocol > > specific, so userspace could tickle the kernel about a mode. > > > > Do your use cases have protocol definitions which can be exposed in userspace? > > Or are these just fw variants with different bells and whistles? How man > > different use cases are we talking about? > > Right now we have three modes that come from Netronome itself, a "basic > NIC" one, and two advanced for TC flower/Open vSwitch acceleration and > for eBPF offload. I was hoping some enumeration scheme could work here, > but I really can't come up with one. How about just supporting 3 firmware names, with the first two being optional, but if found one of those two is found it would use that one. Then only if both of these are not present would a default be looked for and used? In terms of interface, a simple symlink / renaming scheme would suffice to support this. No custom hooks at all. > To be honest waiting for rootfs to be available is lower on my list of > priorities, but it's definitely nice to have. I also don't care about > supporting more complex rootfs setups, simply trying whatever comes > after initramfs covers 99.9% use cases. 0.1% can load the FW manually/ > rebind the driver IMHO. Right, the only issue with firmwared is you'd expect folks would have it deployed, and that's not the case today, but when you do control the ecosystem you can certainly use it as an option. Let me know if you do try it out. > > Be careful how you do this as you'll have to support it in the driver forever > > if you use something like sysfs I think, otherwise you will break some > > userspace. However if you use debugfs I think its understood that's loose API. > > Unfortunately the netdev community does not like debugfs. I would > prefer to extend the firmware subsystem if possible and use the > existing sysfs interface, just in a new "mode". I don't think this is required, you can simply use different filenames as noted above. > > > Current firmware subsystem doesn't seem to cater to this use case to > > > well. > > > > Its a matter of asking and talking. I've provided references of things to > > try to address the hacky -EPROBE_DEFER. It does however require a userspace > > daemon used, so it does require use of the uevent fallback mechanism. > > Do you know how systemd developers feel about the issue (CCed)? Given > that it seems to dominate in data center OSes now I'm slightly worried > having to push Big Linux Vendors to package some seemingly > embedded-centric software just to make advanced NICs run :( firmwared was written by a systemd developer :) I think it was first packaged into systemd, and then it was split out to help those who want it external. > > > - how to make sure different cards, which request the same file name > > > can be served different default firmwares... > > > > I believe your patch + the error path fix will handle this now, no? > > I'm not sure. I think it would work if I set FW_OPT_NOCACHE, though. > I need to test that. Why do you need FW_OPT_NOCACHE? Luis
[toc] | [prev] | [next] | [standalone]
| From | Jakub Kicinski <jakub.kicinski@netronome.com> |
|---|---|
| Date | 2017-06-28 00:50 +0200 |
| Message-ID | <tX7t0-6Yu-15@gated-at.bofh.it> |
| In reply to | #1676220 |
On Wed, 28 Jun 2017 00:24:19 +0200, Luis R. Rodriguez wrote: > On Tue, Jun 27, 2017 at 02:25:53PM -0700, Jakub Kicinski wrote: > > On Tue, 27 Jun 2017 18:39:42 +0200, Luis R. Rodriguez wrote: > > > > > > > The problem is that advanced NICs are quite programmable [1] and > > > > depending on use case one may want to load different firmware files. > > > > > > Right, so in the 802.11 world some devices might use different firmware for > > > different modes of operation, STA, AP, Mesh, but this is all very protocol > > > specific, so userspace could tickle the kernel about a mode. > > > > > > Do your use cases have protocol definitions which can be exposed in userspace? > > > Or are these just fw variants with different bells and whistles? How man > > > different use cases are we talking about? > > > > Right now we have three modes that come from Netronome itself, a "basic > > NIC" one, and two advanced for TC flower/Open vSwitch acceleration and > > for eBPF offload. I was hoping some enumeration scheme could work here, > > but I really can't come up with one. > > How about just supporting 3 firmware names, with the first two being optional, > but if found one of those two is found it would use that one. Then only if > both of these are not present would a default be looked for and used? > > In terms of interface, a simple symlink / renaming scheme would suffice to > support this. No custom hooks at all. That's what we do today as a stop-gap solution :) (BTW mkinitrd doesn't seem to like symlinks so I use hard links.) The issue is if you have two identical cards, how to load different FW on them? We would have to encode the serial number into the firmware name or the pci_name() at least. The nice thing about this solution is that it requires almost zero code on the kernel size... hm...
[toc] | [prev] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2017-06-28 02:00 +0200 |
| Message-ID | <tX8yJ-7Ck-3@gated-at.bofh.it> |
| In reply to | #1676231 |
On Tue, Jun 27, 2017 at 3:39 PM, Jakub Kicinski <jakub.kicinski@netronome.com> wrote: > On Wed, 28 Jun 2017 00:24:19 +0200, Luis R. Rodriguez wrote: >> On Tue, Jun 27, 2017 at 02:25:53PM -0700, Jakub Kicinski wrote: >> > On Tue, 27 Jun 2017 18:39:42 +0200, Luis R. Rodriguez wrote: >> > > >> > > > The problem is that advanced NICs are quite programmable [1] and >> > > > depending on use case one may want to load different firmware files. >> > > >> > > Right, so in the 802.11 world some devices might use different firmware for >> > > different modes of operation, STA, AP, Mesh, but this is all very protocol >> > > specific, so userspace could tickle the kernel about a mode. >> > > >> > > Do your use cases have protocol definitions which can be exposed in userspace? >> > > Or are these just fw variants with different bells and whistles? How man >> > > different use cases are we talking about? >> > >> > Right now we have three modes that come from Netronome itself, a "basic >> > NIC" one, and two advanced for TC flower/Open vSwitch acceleration and >> > for eBPF offload. I was hoping some enumeration scheme could work here, >> > but I really can't come up with one. >> >> How about just supporting 3 firmware names, with the first two being optional, >> but if found one of those two is found it would use that one. Then only if >> both of these are not present would a default be looked for and used? >> >> In terms of interface, a simple symlink / renaming scheme would suffice to >> support this. No custom hooks at all. > > That's what we do today as a stop-gap solution :) (BTW mkinitrd > doesn't seem to like symlinks so I use hard links.) I see only 1 request_firmware() request on your driver and its not optional? What I was suggesting was have 3 separate requests. Two optional files which you hunt for first, and if either of them are present you use them. If both are missing you go with the default. > The issue is if you have two identical cards, how to load different FW > on them? We would have to encode the serial number into the firmware > name or the pci_name() at least. The nice thing about this solution is > that it requires almost zero code on the kernel size... hm... Yeah, that could work -- ie, for each of the 3 mode firmware you actually *first* look for the pci_name() derivative first, if any of them is found use that. Otherwise you then move on to the non pci_name() varaints with the same logic. The last one would be the default Fisher-Price® one. Anyway -- I still think *long term* this is best ironed out by identifying the modes and seeing if perhaps networking folks might come to some agreement on these as different modes, then your driver can have respective hooks for the different modes based on some user specified mode flip or requirement. If this is not possible... a sysfs know interface is always possible. Luis
[toc] | [prev] | [next] | [standalone]
| From | Lennart Poettering <mzxreary@0pointer.de> |
|---|---|
| Date | 2017-06-28 09:10 +0200 |
| Subject | Re: [systemd-devel] [PATCH] firmware: wake all waiters |
| Message-ID | <tXfgR-3Jw-1@gated-at.bofh.it> |
| In reply to | #1676220 |
On Wed, 28.06.17 00:24, Luis R. Rodriguez (mcgrof@kernel.org) wrote: > > Do you know how systemd developers feel about the issue (CCed)? Given > > that it seems to dominate in data center OSes now I'm slightly worried > > having to push Big Linux Vendors to package some seemingly > > embedded-centric software just to make advanced NICs run :( > > firmwared was written by a systemd developer :) No it wasn't. I don't know what firmwared is really. Sorry. > I think it was first packaged into systemd, and then it was split out to > help those who want it external. Certainly not. I'd sure know about that. ;-) Lennart -- Lennart Poettering, Red Hat
[toc] | [prev] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2017-06-28 18:10 +0200 |
| Subject | Re: [systemd-devel] [PATCH] firmware: wake all waiters |
| Message-ID | <tXnHt-AC-51@gated-at.bofh.it> |
| In reply to | #1676410 |
On Wed, Jun 28, 2017 at 12:06 AM, Lennart Poettering <mzxreary@0pointer.de> wrote: > On Wed, 28.06.17 00:24, Luis R. Rodriguez (mcgrof@kernel.org) wrote: > >> > Do you know how systemd developers feel about the issue (CCed)? Given >> > that it seems to dominate in data center OSes now I'm slightly worried >> > having to push Big Linux Vendors to package some seemingly >> > embedded-centric software just to make advanced NICs run :( >> >> firmwared was written by a systemd developer :) > > No it wasn't. I don't know what firmwared is really. Sorry. Is Tom Gundersen not a systemd developer? >> I think it was first packaged into systemd, and then it was split out to >> help those who want it external. > > Certainly not. I'd sure know about that. ;-) Sorry I may have confused 'intended to be at first'. Tom and Daniel can elaborate. Luis
[toc] | [prev] | [next] | [standalone]
| From | Lennart Poettering <mzxreary@0pointer.de> |
|---|---|
| Date | 2017-06-28 20:00 +0200 |
| Subject | Re: [systemd-devel] [PATCH] firmware: wake all waiters |
| Message-ID | <tXppU-t5-5@gated-at.bofh.it> |
| In reply to | #1676902 |
On Wed, 28.06.17 09:06, Luis R. Rodriguez (mcgrof@kernel.org) wrote: > On Wed, Jun 28, 2017 at 12:06 AM, Lennart Poettering > <mzxreary@0pointer.de> wrote: > > On Wed, 28.06.17 00:24, Luis R. Rodriguez (mcgrof@kernel.org) wrote: > > > >> > Do you know how systemd developers feel about the issue (CCed)? Given > >> > that it seems to dominate in data center OSes now I'm slightly worried > >> > having to push Big Linux Vendors to package some seemingly > >> > embedded-centric software just to make advanced NICs run :( > >> > >> firmwared was written by a systemd developer :) > > > > No it wasn't. I don't know what firmwared is really. Sorry. > > Is Tom Gundersen not a systemd developer? Not really anymore, and "firmwared" is an effort independent of systemd, never was part of it, and while I heard Tom was working on this I was not aware of the project's naming or anything else... Lennart -- Lennart Poettering, Red Hat
[toc] | [prev] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2017-06-28 20:00 +0200 |
| Subject | Re: [systemd-devel] [PATCH] firmware: wake all waiters |
| Message-ID | <tXpq4-t5-207@gated-at.bofh.it> |
| In reply to | #1676906 |
On Wed, Jun 28, 2017 at 06:21:09PM +0200, Lennart Poettering wrote: > On Wed, 28.06.17 09:06, Luis R. Rodriguez (mcgrof@kernel.org) wrote: > > > On Wed, Jun 28, 2017 at 12:06 AM, Lennart Poettering > > <mzxreary@0pointer.de> wrote: > > > On Wed, 28.06.17 00:24, Luis R. Rodriguez (mcgrof@kernel.org) wrote: > > > > > >> > Do you know how systemd developers feel about the issue (CCed)? Given > > >> > that it seems to dominate in data center OSes now I'm slightly worried > > >> > having to push Big Linux Vendors to package some seemingly > > >> > embedded-centric software just to make advanced NICs run :( > > >> > > >> firmwared was written by a systemd developer :) > > > > > > No it wasn't. I don't know what firmwared is really. Sorry. > > > > Is Tom Gundersen not a systemd developer? > > Not really anymore, and "firmwared" is an effort independent of > systemd, never was part of it, and while I heard Tom was working on > this I was not aware of the project's naming or anything else... Alright, thanks for the clarifications and sorry for the confusion! In that case firmwared remains *just* an architecture example of an alternative to the problem of looking for firmware through a *fallback mechanism* and addressing "is my real rootfs mounted yet" problem some folks have struggled to resolve, "are we sure we're ready to look for all firmware?". Lennart, if you have a better architectural suggestion let us know. I realize that the firmware fallback mechanism was ripped out of systemd long ago, specifically as of systemd commit be2ea723b1d0 (“udev: remove userspace firmware loading support”) as of v217 on August, 2014. This means most Linux distributions today are not using or taking advantage of the firmware fallback mechanism provided by kobject uevents. This is specially exacerbated due to the fact that most distributions today disable CONFIG_FW_LOADER_USER_HELPER_FALLBACK which *means* only the custom fallback mechanism (no uevents are issued) can be used on those distributions, and we actually want to *avoid* having more drivers use that mechanism. Only 2 drivers remain upstream now which explicitly require the custom fallback mechanism. We don't to add any more. This leaves distributions that want a fallback mechanism today only with the option to enable CONFIG_FW_LOADER_USER_HELPER_FALLBACK and rely on uevents, and firmwared was an architectural example of how to address the rootfs problem. Android is enabling CONFIG_FW_LOADER_USER_HELPER_FALLBACK these days it seems. If it helps the fallback mechanism is now documented here: https://www.kernel.org/doc/html/latest/driver-api/firmware/fallback-mechanisms.html The concept of firmwared was simple: it had best-effort mode and final-mode. It relies on CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y and relies on uevents. You boot with it on best-effort mode where firmware is hunted for in a best effort way, but it does not fail a load through the kernel's sysfs interface used for the fallback mechanism. Then once userspace knows we have reached the real rootfs (since only it knows when this happens) it kicks firmwared into final-mode, which in turn can now iterate over pending firmware and send a "not found" with certainty. So the focus for now is ironing out something that we know works *very well* for the CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y folks. It'd be great if we had a solution that could work for CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n folks but its unclear if that's possible, so it may be best to only revisit this if and when we know for sure CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y and the rootfs issue is properly ironed out with the uevents fallback mechanism. Luis
[toc] | [prev] | [next] | [standalone]
| From | Daniel Wagner <wagi@monom.org> |
|---|---|
| Date | 2017-06-29 22:10 +0200 |
| Subject | Re: [systemd-devel] [PATCH] firmware: wake all waiters |
| Message-ID | <tXNVg-3KB-11@gated-at.bofh.it> |
| In reply to | #1676902 |
On 06/28/2017 06:06 PM, Luis R. Rodriguez wrote: > On Wed, Jun 28, 2017 at 12:06 AM, Lennart Poettering > <mzxreary@0pointer.de> wrote: >> On Wed, 28.06.17 00:24, Luis R. Rodriguez (mcgrof@kernel.org) wrote: >>> I think it was first packaged into systemd, and then it was split out to >>> help those who want it external. >> >> Certainly not. I'd sure know about that. ;-) > > Sorry I may have confused 'intended to be at first'. Tom and Daniel > can elaborate. Tom helped out building the daemon as standalone project. There is no real reason that it needs to be part of the systemd code base. Thanks, Daniel
[toc] | [prev] | [next] | [standalone]
| From | Bjorn Andersson <bjorn.andersson@linaro.org> |
|---|---|
| Date | 2017-06-27 20:00 +0200 |
| Message-ID | <tX2Wm-3Sd-21@gated-at.bofh.it> |
| In reply to | #1675254 |
On Mon, Jun 26, 2017 at 7:10 PM, Jakub Kicinski <jakub.kicinski@netronome.com> wrote: > On Mon, 26 Jun 2017 23:20:36 +0200, Luis R. Rodriguez wrote: [..] > - how to stay bound and retry the direct default FW load until rootfs > is mounted (equivalent to when -EPROBE_DEFER would give up); If you constrain this problem to only await the mounting of a root file system you miss the various cases where rootfs is later pivoted or the firmware isn't stored in the root file system (e.g. every Android device out there). Regards, Bjorn
[toc] | [prev] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2017-06-27 20:10 +0200 |
| Message-ID | <tX362-4be-11@gated-at.bofh.it> |
| In reply to | #1676047 |
On Tue, Jun 27, 2017 at 10:48:25AM -0700, Bjorn Andersson wrote: > On Mon, Jun 26, 2017 at 7:10 PM, Jakub Kicinski > <jakub.kicinski@netronome.com> wrote: > > On Mon, 26 Jun 2017 23:20:36 +0200, Luis R. Rodriguez wrote: > [..] > > - how to stay bound and retry the direct default FW load until rootfs > > is mounted (equivalent to when -EPROBE_DEFER would give up); > > If you constrain this problem to only await the mounting of a root > file system you miss the various cases where rootfs is later pivoted I do believe the firmwared case can work with pivot root, I can't see why not. In fact it was a case considered from what I can tell > or the firmware isn't stored in the root file system (e.g. every > Android device out there). This was also considered as part of the design. I had particular mentioned to Tom and Daniel the case of an NVRAM sitting somewhere custom and this needed to be tossed laster somehow thorugh some custom mechanism. Let's consider a crazy case where the uevent gets triggered, and userspace goes and signals Elon Musk somehow to transmit the needed firmware from Mars through a serial satellite link to earth, and somehow someday the device is finally ready to upload firmware from userspace. Once Elon's firmware lands home, we know all needed firmware has arrived so anything missing we can acknowledge now as missing, so we upload what we can and kick firmward into final-mode to tell the kernel we know we're really ready and any pending things will have to be given up. This would prove the custom fallback crap was also never needed. I think perhaps one enhancement consideration here may be having the option for best-effort mode and final-mode be per file, but that's all daemon specific code. Luis
[toc] | [prev] | [next] | [standalone]
| From | Bjorn Andersson <bjorn.andersson@linaro.org> |
|---|---|
| Date | 2017-06-27 21:00 +0200 |
| Message-ID | <tX3Sq-4wL-23@gated-at.bofh.it> |
| In reply to | #1676049 |
On Tue 27 Jun 11:03 PDT 2017, Luis R. Rodriguez wrote: [..] > Let's consider a crazy case where the uevent gets triggered, and userspace goes > and signals Elon Musk somehow to transmit the needed firmware from Mars through > a serial satellite link to earth, and somehow someday the device is finally > ready to upload firmware from userspace. Once Elon's firmware lands home, we > know all needed firmware has arrived so anything missing we can acknowledge now > as missing, so we upload what we can and kick firmward into final-mode to tell > the kernel we know we're really ready and any pending things will have to be > given up. > > This would prove the custom fallback crap was also never needed. > Are you saying that each kernel driver should be written so that it will either do direct loading or use firmwared? From the previous discussion Linus made it very clear that he expect this driver to be compiled as a kernel module and Elon to issue a modprobe once he lands. But IMHO, Elon's decision of using modprobe vs firmwared should be his to make and not mine as a kernel developer. Regards, Bjorn
[toc] | [prev] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2017-06-27 21:10 +0200 |
| Message-ID | <tX425-4PK-7@gated-at.bofh.it> |
| In reply to | #1676083 |
On Tue, Jun 27, 2017 at 11:59:15AM -0700, Bjorn Andersson wrote: > On Tue 27 Jun 11:03 PDT 2017, Luis R. Rodriguez wrote: > [..] > > Let's consider a crazy case where the uevent gets triggered, and userspace goes > > and signals Elon Musk somehow to transmit the needed firmware from Mars through > > a serial satellite link to earth, and somehow someday the device is finally > > ready to upload firmware from userspace. Once Elon's firmware lands home, we > > know all needed firmware has arrived so anything missing we can acknowledge now > > as missing, so we upload what we can and kick firmward into final-mode to tell > > the kernel we know we're really ready and any pending things will have to be > > given up. > > > > This would prove the custom fallback crap was also never needed. > > > > Are you saying that each kernel driver should be written so that it will > either do direct loading or use firmwared? Hell No! You can fork firmwared or use whatever the hell bin-foo you want. Even if its proprietary and glued with evil rainbow unicorns on it. The dual mode, best-effort mode and final-mode devices it implemented are key to what you want to mimic as an example to achieve the goal in question. Please give that thought / architecture solution a spin and let me know if it suffices for your needs. Luis
[toc] | [prev] | [next] | [standalone]
| From | Bjorn Andersson <bjorn.andersson@linaro.org> |
|---|---|
| Date | 2017-06-27 22:00 +0200 |
| Message-ID | <tX4Ou-5bs-21@gated-at.bofh.it> |
| In reply to | #1676087 |
On Tue 27 Jun 12:08 PDT 2017, Luis R. Rodriguez wrote: > On Tue, Jun 27, 2017 at 11:59:15AM -0700, Bjorn Andersson wrote: > > On Tue 27 Jun 11:03 PDT 2017, Luis R. Rodriguez wrote: > > [..] > > > Let's consider a crazy case where the uevent gets triggered, and userspace goes > > > and signals Elon Musk somehow to transmit the needed firmware from Mars through > > > a serial satellite link to earth, and somehow someday the device is finally > > > ready to upload firmware from userspace. Once Elon's firmware lands home, we > > > know all needed firmware has arrived so anything missing we can acknowledge now > > > as missing, so we upload what we can and kick firmward into final-mode to tell > > > the kernel we know we're really ready and any pending things will have to be > > > given up. > > > > > > This would prove the custom fallback crap was also never needed. > > > > > > > Are you saying that each kernel driver should be written so that it will > > either do direct loading or use firmwared? > > Hell No! You can fork firmwared or use whatever the hell bin-foo you want. > Even if its proprietary and glued with evil rainbow unicorns on it. The dual > mode, best-effort mode and final-mode devices it implemented are key to what > you want to mimic as an example to achieve the goal in question. > I'm sorry but your language is totally inappropriate and the reason why I tend to stay away from firmware-related discussions. > Please give that thought / architecture solution a spin and let me know if > it suffices for your needs. > Which solution do you refer to here? But as I said, in my view, the decision of making the kernel depend on a user space firmware loading mechanism or direct loading should be that of the system designer - not the kernel. Regards, Bjorn
[toc] | [prev] | [next] | [standalone]
| From | "Luis R. Rodriguez" <mcgrof@kernel.org> |
|---|---|
| Date | 2017-06-27 22:30 +0200 |
| Message-ID | <tX5hw-5C4-13@gated-at.bofh.it> |
| In reply to | #1676135 |
On Tue, Jun 27, 2017 at 12:52 PM, Bjorn Andersson <bjorn.andersson@linaro.org> wrote: > On Tue 27 Jun 12:08 PDT 2017, Luis R. Rodriguez wrote: >> On Tue, Jun 27, 2017 at 11:59:15AM -0700, Bjorn Andersson wrote: >> > Are you saying that each kernel driver should be written so that it will >> > either do direct loading or use firmwared? >> >> Hell No! You can fork firmwared or use whatever the hell bin-foo you want. >> Even if its proprietary and glued with evil rainbow unicorns on it. The dual >> mode, best-effort mode and final-mode devices it implemented are key to what >> you want to mimic as an example to achieve the goal in question. >> > > I'm sorry but your language is totally inappropriate and the reason why > I tend to stay away from firmware-related discussions. I'm sorry if I offended you, the goal here was to use an exaggerated example of what anyone could use to draw in firmware into the kernel. >> Please give that thought / architecture solution a spin and let me know if >> it suffices for your needs. >> > > Which solution do you refer to here? The model of a best-effort and final-mode. > But as I said, in my view, the decision of making the kernel depend on a > user space firmware loading mechanism or direct loading should be that > of the system designer - not the kernel. You get that freedom today. The fallback mechanism *allows* files to be fetched in whatever way possible, by issuing a uevent, its up to userspace to figure out how to gather that and toss it back into the kernel using the sysfs interface. The firemward daemon is nothing but an example *new* daemon which uses a model to address the rootfs / pivot root dilema, as only userspace can know when userspace *is ready*. So its not clear to me yet what your grudge with using firmwared with this new model is exactly. Are you saying you want to *require* the fallback mechanism from the start, so just skipping the direct FS lookup ? That would be a new feature request, and we can certainly consider it, but I'll need Greg to clue me in first on how he'd prefer an API evolution for new features. Luis
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | linux.kernel
csiph-web