2022-11-29 03:35:18

by Zhou, Jie2X

[permalink] [raw]
Subject: fw_fallback.sh test failed in Debian 11

hi,

fw_fallback.sh test failed.
The error may caused by failed to write /sys/devices/virtual/misc/test_firmware/trigger_request.

diff firmware/fw_fallback.sh_org firmware/fw_fallback.sh
165c164,165
< echo -n "nope-$NAME" >"$DIR"/trigger_request 2>/dev/null &
---
> echo "echo -n \"nope-$NAME\" >\"$DIR\"/trigger_request &"
> echo -n "nope-$NAME" >"$DIR"/trigger_request &

# Test request_partial_firmware_into_buf() off=1 size=6 nofile: OK
# Test request_partial_firmware_into_buf() off=2 size=10 nofile: OK
# echo -n "nope-test-firmware.bin" >"/sys/devices/virtual/misc/test_firmware"/trigger_request &
# ./fw_fallback.sh: line 165: echo: write error: No such file or directory
# ./fw_fallback.sh: fallback mechanism immediately cancelled

$ echo -n "nope-test-firmware.bin" >/sys/devices/virtual/misc/test_firmware/trigger_request
-bash: echo: write error: No such file or directory

test OS: Debian 11
test kernel: v6.1-rc6

test output:
# ./fw_fallback.sh: fallback mechanism immediately cancelled
#
# The file never appeared: /sys/devices/virtual/misc/test_firmware/nope-test-firmware.bin/loading
#
# This might be a distribution udev rule setup by your distribution
# to immediately cancel all fallback requests, this must be
# removed before running these tests. To confirm look for
# a firmware rule like /lib/udev/rules.d/50-firmware.rules
# and see if you have something like this:
#
# SUBSYSTEM=="firmware", ACTION=="add", ATTR{loading}="-1"
#
# If you do remove this file or comment out this line before
# proceeding with these tests.
not ok 1 selftests: firmware: fw_run_tests.sh # exit=1

There is not /lib/udev/rules.d/50-firmware.rules in Debian 11.
How can fw_run_tests.sh run successfully in Debian 11?

best regards,


2022-11-29 09:43:09

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: fw_fallback.sh test failed in Debian 11

On Tue, Nov 29, 2022 at 02:35:12AM +0000, Zhou, Jie2X wrote:
> hi,
>
> fw_fallback.sh test failed.
> The error may caused by failed to write /sys/devices/virtual/misc/test_firmware/trigger_request.

Are you sure you have the proper kernel code loaded with the test
firmware code that creates this sysfs file? Without that, this test
will not work.

thanks,

greg k-h

2022-11-30 06:08:38

by Zhou, Jie2X

[permalink] [raw]
Subject: Re: fw_fallback.sh test failed in Debian 11

hi,

>Are you sure you have the proper kernel code loaded with the test
>firmware code that creates this sysfs file? Without that, this test
>will not work.

I checked following config options, and they all enabled.

tools/testing/selftests/firmware/config
CONFIG_TEST_FIRMWARE=y
CONFIG_FW_LOADER=y
CONFIG_FW_LOADER_USER_HELPER=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_FW_UPLOAD=y

best regards,

2022-11-30 18:11:11

by Russ Weight

[permalink] [raw]
Subject: Re: fw_fallback.sh test failed in Debian 11



On 11/29/22 21:59, Zhou, Jie2X wrote:
> hi,
>
>> Are you sure you have the proper kernel code loaded with the test
>> firmware code that creates this sysfs file? Without that, this test
>> will not work.
> I checked following config options, and they all enabled.
>
> tools/testing/selftests/firmware/config
> CONFIG_TEST_FIRMWARE=y
> CONFIG_FW_LOADER=y
> CONFIG_FW_LOADER_USER_HELPER=y
> CONFIG_IKCONFIG=y
> CONFIG_IKCONFIG_PROC=y
> CONFIG_FW_UPLOAD=y
>
> best regards,

Nevertheless, the error message you reported in your first email indicates
that the test_firmware device may not be present. Did you verify that the running
system reports the expected configs? What does the following command show?

zgrep CONFIG_TEST_FIRMWARE /proc/config.gz

- Russ

2022-12-01 01:31:47

by Zhou, Jie2X

[permalink] [raw]
Subject: Re: fw_fallback.sh test failed in Debian 11

hi Russ,

>> Are you sure you have the proper kernel code loaded with the test
>> firmware code that creates this sysfs file? Without that, this test
>> will not work.
>Nevertheless, the error message you reported in your first email indicates
>that the test_firmware device may not be present. Did you verify that the running
>system reports the expected configs? What does the following command show?
~# zgrep CONFIG_TEST_FIRMWARE /proc/config.gz
CONFIG_TEST_FIRMWARE=y

best regards,

2022-12-01 01:52:36

by Zhou, Jie2X

[permalink] [raw]
Subject: Re: fw_fallback.sh test failed in Debian 11

>How much of this path exists on your machine?
>/sys/devices/virtual/misc/test_firmware/trigger_request
This path exists.

>And is there anything in the dmesg output that indicates a failure associated with
>the test_firmware device?
Yes.

kern :info : [ 77.858068] test_firmware: loading 'test-firmware.bin'
kern :info : [ 77.864705] test_firmware: loaded: 8
kern :info : [ 77.874250] test_firmware: loading 'test-firmware.bin'
kern :warn : [ 77.880672] misc test_firmware: Direct firmware load for test-firmware.bin failed with error -2
kern :info : [ 77.890106] test_firmware: load of 'test-firmware.bin' failed: -2
kern :info : [ 78.896662] test_firmware: loading ''
kern :info : [ 78.901059] test_firmware: load of '' failed: -22
kern :info : [ 78.907422] test_firmware: loading ''
kern :err : [ 78.912278] test_firmware: failed to async load firmware
kern :info : [ 78.918594] test_firmware: loading 'nope-test-firmware.bin'
kern :warn : [ 78.925405] misc test_firmware: Direct firmware load for nope-test-firmware.bin failed with error -2
kern :info : [ 78.935260] Ignoring firmware sysfs fallback due to sysctl knob
kern :info : [ 78.941934] test_firmware: load of 'nope-test-firmware.bin' failed: -2
kern :info : [ 78.962155] test_firmware: loading 'test-firmware.bin'
kern :info : [ 78.968232] test_firmware: loaded: 9
kern :info : [ 78.986063] test_firmware: loading 'test-firmware.bin'
kern :info : [ 78.992269] test_firmware: loaded: 9
kern :info : [ 79.023611] test_firmware: reset
kern :info : [ 79.028466] test_firmware: batched sync firmware loading 'test-firmware.bin' 4 times

best regards,

2022-12-01 02:30:20

by Russ Weight

[permalink] [raw]
Subject: Re: fw_fallback.sh test failed in Debian 11



On 11/30/22 16:42, Zhou, Jie2X wrote:
> hi Russ,
>
>>> Are you sure you have the proper kernel code loaded with the test
>>> firmware code that creates this sysfs file? Without that, this test
>>> will not work.
>> Nevertheless, the error message you reported in your first email indicates
>> that the test_firmware device may not be present. Did you verify that the running
>> system reports the expected configs? What does the following command show?
> ~# zgrep CONFIG_TEST_FIRMWARE /proc/config.gz
> CONFIG_TEST_FIRMWARE=y

How much of this path exists on your machine?

/sys/devices/virtual/misc/test_firmware/trigger_request

And is there anything in the dmesg output that indicates a failure associated with
the test_firmware device?

- Russ

>
> best regards,

2022-12-01 03:05:56

by Russ Weight

[permalink] [raw]
Subject: Re: fw_fallback.sh test failed in Debian 11



On 11/30/22 17:28, Zhou, Jie2X wrote:
>> How much of this path exists on your machine?
>> /sys/devices/virtual/misc/test_firmware/trigger_request
> This path exists.
>
>> And is there anything in the dmesg output that indicates a failure associated with
>> the test_firmware device?
> Yes.
>
> kern :info : [ 77.858068] test_firmware: loading 'test-firmware.bin'
> kern :info : [ 77.864705] test_firmware: loaded: 8
> kern :info : [ 77.874250] test_firmware: loading 'test-firmware.bin'
> kern :warn : [ 77.880672] misc test_firmware: Direct firmware load for test-firmware.bin failed with error -2
> kern :info : [ 77.890106] test_firmware: load of 'test-firmware.bin' failed: -2
> kern :info : [ 78.896662] test_firmware: loading ''
> kern :info : [ 78.901059] test_firmware: load of '' failed: -22
> kern :info : [ 78.907422] test_firmware: loading ''
> kern :err : [ 78.912278] test_firmware: failed to async load firmware
> kern :info : [ 78.918594] test_firmware: loading 'nope-test-firmware.bin'
> kern :warn : [ 78.925405] misc test_firmware: Direct firmware load for nope-test-firmware.bin failed with error -2
> kern :info : [ 78.935260] Ignoring firmware sysfs fallback due to sysctl knob

The above message looks like the problem. Firmware sysfs fallback has been turned off
on this system using sysctl. Can you try turning it on and rerunning the test?

Thanks,
- Russ

> kern :info : [ 78.941934] test_firmware: load of 'nope-test-firmware.bin' failed: -2
> kern :info : [ 78.962155] test_firmware: loading 'test-firmware.bin'
> kern :info : [ 78.968232] test_firmware: loaded: 9
> kern :info : [ 78.986063] test_firmware: loading 'test-firmware.bin'
> kern :info : [ 78.992269] test_firmware: loaded: 9
> kern :info : [ 79.023611] test_firmware: reset
> kern :info : [ 79.028466] test_firmware: batched sync firmware loading 'test-firmware.bin' 4 times
>
> best regards,

2022-12-02 06:18:04

by Zhou, Jie2X

[permalink] [raw]
Subject: Re: fw_fallback.sh test failed in Debian 11

>The above message looks like the problem. Firmware sysfs fallback has been turned off
>on this system using sysctl. Can you try turning it on and rerunning the test?
Sorry, I don't know how to turn on firmware sysfs fallback.
Could you tell me?

I search the firmware fallback options in kernel config.
CONFIG_FW_LOADER_USER_HELPER=y
# CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set

best regards,

________________________________________
From: Weight, Russell H <[email protected]>
Sent: Thursday, December 1, 2022 10:37 AM
To: Zhou, Jie2X; [email protected]
Cc: [email protected]; [email protected]; Zhang, Tianfei; [email protected]; [email protected]; Li, Philip
Subject: Re: fw_fallback.sh test failed in Debian 11



On 11/30/22 17:28, Zhou, Jie2X wrote:
>> How much of this path exists on your machine?
>> /sys/devices/virtual/misc/test_firmware/trigger_request
> This path exists.
>
>> And is there anything in the dmesg output that indicates a failure associated with
>> the test_firmware device?
> Yes.
>
> kern :info : [ 77.858068] test_firmware: loading 'test-firmware.bin'
> kern :info : [ 77.864705] test_firmware: loaded: 8
> kern :info : [ 77.874250] test_firmware: loading 'test-firmware.bin'
> kern :warn : [ 77.880672] misc test_firmware: Direct firmware load for test-firmware.bin failed with error -2
> kern :info : [ 77.890106] test_firmware: load of 'test-firmware.bin' failed: -2
> kern :info : [ 78.896662] test_firmware: loading ''
> kern :info : [ 78.901059] test_firmware: load of '' failed: -22
> kern :info : [ 78.907422] test_firmware: loading ''
> kern :err : [ 78.912278] test_firmware: failed to async load firmware
> kern :info : [ 78.918594] test_firmware: loading 'nope-test-firmware.bin'
> kern :warn : [ 78.925405] misc test_firmware: Direct firmware load for nope-test-firmware.bin failed with error -2
> kern :info : [ 78.935260] Ignoring firmware sysfs fallback due to sysctl knob

The above message looks like the problem. Firmware sysfs fallback has been turned off
on this system using sysctl. Can you try turning it on and rerunning the test?

Thanks,
- Russ

> kern :info : [ 78.941934] test_firmware: load of 'nope-test-firmware.bin' failed: -2
> kern :info : [ 78.962155] test_firmware: loading 'test-firmware.bin'
> kern :info : [ 78.968232] test_firmware: loaded: 9
> kern :info : [ 78.986063] test_firmware: loading 'test-firmware.bin'
> kern :info : [ 78.992269] test_firmware: loaded: 9
> kern :info : [ 79.023611] test_firmware: reset
> kern :info : [ 79.028466] test_firmware: batched sync firmware loading 'test-firmware.bin' 4 times
>
> best regards,

2022-12-02 16:47:44

by Russ Weight

[permalink] [raw]
Subject: Re: fw_fallback.sh test failed in Debian 11


On 12/1/22 22:02, Zhou, Jie2X wrote:
>> The above message looks like the problem. Firmware sysfs fallback has been turned off
>> on this system using sysctl. Can you try turning it on and rerunning the test?
> Sorry, I don't know how to turn on firmware sysfs fallback.
> Could you tell me?

Take a look at the kernel documentation (https://www.kernel.org/doc/html/v5.0/driver-api/firmware/fallback-mechanisms.html) which says, "This syfs fallback mechanism may be disabled completely on a system by setting the proc sysctl value ignore_sysfs_fallback to true."

Also refer to the sysctl man page: https://manpages.debian.org/testing/procps/sysctl.8.en.html.

- Russ

>
> I search the firmware fallback options in kernel config.
> CONFIG_FW_LOADER_USER_HELPER=y
> # CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set
>
> best regards,
>
> ________________________________________
> From: Weight, Russell H <[email protected]>
> Sent: Thursday, December 1, 2022 10:37 AM
> To: Zhou, Jie2X; [email protected]
> Cc: [email protected]; [email protected]; Zhang, Tianfei; [email protected]; [email protected]; Li, Philip
> Subject: Re: fw_fallback.sh test failed in Debian 11
>
>
>
> On 11/30/22 17:28, Zhou, Jie2X wrote:
>>> How much of this path exists on your machine?
>>> /sys/devices/virtual/misc/test_firmware/trigger_request
>> This path exists.
>>
>>> And is there anything in the dmesg output that indicates a failure associated with
>>> the test_firmware device?
>> Yes.
>>
>> kern :info : [ 77.858068] test_firmware: loading 'test-firmware.bin'
>> kern :info : [ 77.864705] test_firmware: loaded: 8
>> kern :info : [ 77.874250] test_firmware: loading 'test-firmware.bin'
>> kern :warn : [ 77.880672] misc test_firmware: Direct firmware load for test-firmware.bin failed with error -2
>> kern :info : [ 77.890106] test_firmware: load of 'test-firmware.bin' failed: -2
>> kern :info : [ 78.896662] test_firmware: loading ''
>> kern :info : [ 78.901059] test_firmware: load of '' failed: -22
>> kern :info : [ 78.907422] test_firmware: loading ''
>> kern :err : [ 78.912278] test_firmware: failed to async load firmware
>> kern :info : [ 78.918594] test_firmware: loading 'nope-test-firmware.bin'
>> kern :warn : [ 78.925405] misc test_firmware: Direct firmware load for nope-test-firmware.bin failed with error -2
>> kern :info : [ 78.935260] Ignoring firmware sysfs fallback due to sysctl knob
> The above message looks like the problem. Firmware sysfs fallback has been turned off
> on this system using sysctl. Can you try turning it on and rerunning the test?
>
> Thanks,
> - Russ
>
>> kern :info : [ 78.941934] test_firmware: load of 'nope-test-firmware.bin' failed: -2
>> kern :info : [ 78.962155] test_firmware: loading 'test-firmware.bin'
>> kern :info : [ 78.968232] test_firmware: loaded: 9
>> kern :info : [ 78.986063] test_firmware: loading 'test-firmware.bin'
>> kern :info : [ 78.992269] test_firmware: loaded: 9
>> kern :info : [ 79.023611] test_firmware: reset
>> kern :info : [ 79.028466] test_firmware: batched sync firmware loading 'test-firmware.bin' 4 times
>>
>> best regards,

2022-12-08 02:56:47

by Luis Chamberlain

[permalink] [raw]
Subject: Re: fw_fallback.sh test failed in Debian 11

On Fri, Dec 02, 2022 at 08:29:15AM -0800, Russ Weight wrote:
>
> On 12/1/22 22:02, Zhou, Jie2X wrote:
> >> The above message looks like the problem. Firmware sysfs fallback has been turned off
> >> on this system using sysctl. Can you try turning it on and rerunning the test?
> > Sorry, I don't know how to turn on firmware sysfs fallback.
> > Could you tell me?
>
> Take a look at the kernel documentation (https://www.kernel.org/doc/html/v5.0/driver-api/firmware/fallback-mechanisms.html) which says, "This syfs fallback mechanism may be disabled completely on a system by setting the proc sysctl value ignore_sysfs_fallback to true."
>
> Also refer to the sysctl man page: https://manpages.debian.org/testing/procps/sysctl.8.en.html.

I often see folks mis-running selftests, even thougggh in theory it
should be easy. And so I've added initial kernel selftests support to kdevops:

https://github.com/linux-kdevops/kdevops

So try to enable the selftests dedicated workflow, enable the firmware
test, enable building a linux-next kernel and go to town:

make menuconfig
make
make linux # installs linux-next
make selftests # builds selftests
make selftests-firwmare # runs the selftests for firmware

I think we have to up our timeout now for the firmware loader as its
currently failing as the tests now take a bit too long. Anyone oppose we
bump the firmware selftests to 200s ?

Luis