All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/2] Fix tst_search_driver for x86-64 modules
@ 2022-03-15 12:25 Petr Vorel
  2022-03-15 12:25 ` [LTP] [PATCH 1/2] tst_kernel: Fix search for foo-x86-64 module Petr Vorel
  2022-03-15 12:25 ` [LTP] [PATCH 2/2] tst_check_driver.sh: Add test for x68_64 module Petr Vorel
  0 siblings, 2 replies; 9+ messages in thread
From: Petr Vorel @ 2022-03-15 12:25 UTC (permalink / raw)
  To: ltp

Petr Vorel (2):
  tst_kernel: Fix search for foo-x86-64 module
  tst_check_driver.sh: Add test for x68_64 module

 lib/newlib_tests/shell/tst_check_driver.sh | 16 ++++++++++++----
 lib/tst_kernel.c                           |  5 +++++
 2 files changed, 17 insertions(+), 4 deletions(-)

-- 
2.35.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH 1/2] tst_kernel: Fix search for foo-x86-64 module
  2022-03-15 12:25 [LTP] [PATCH 0/2] Fix tst_search_driver for x86-64 modules Petr Vorel
@ 2022-03-15 12:25 ` Petr Vorel
  2022-03-16  6:34   ` xuyang2018.jy
  2022-03-15 12:25 ` [LTP] [PATCH 2/2] tst_check_driver.sh: Add test for x68_64 module Petr Vorel
  1 sibling, 1 reply; 9+ messages in thread
From: Petr Vorel @ 2022-03-15 12:25 UTC (permalink / raw)
  To: ltp

Although modules.{builtin,dep} contain modules with both dashes and
underscores and use this consistently, there the only exception: modules
for x86_64 arch are always named x86_64 no matter whether they use
dashes or underscore for the rest. E.g. libblake2s-x86-64.

modinfo works with all 4 combinations of libblake2s[-_]x86[-_]64,
thus fix tst_search_driver() to allow the same.

before:
tst_check_driver 3 TPASS: tst_check_drivers libblake2s-x86_64 2>/dev/null passed as expected
libblake2s-x86-64tst_check_driver 3 TFAIL: tst_check_drivers libblake2s-x86-64 failed unexpectedly

after fix:
tst_check_driver 3 TPASS: tst_check_drivers libblake2s-x86_64 2>/dev/null passed as expected
tst_check_driver 3 TPASS: tst_check_drivers libblake2s-x86-64 2>/dev/null passed as expected

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 lib/tst_kernel.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/tst_kernel.c b/lib/tst_kernel.c
index 6db85bff0e..ecf4b917e7 100644
--- a/lib/tst_kernel.c
+++ b/lib/tst_kernel.c
@@ -116,6 +116,11 @@ static int tst_search_driver(const char *driver, const char *file)
 		return -1;
 	}
 
+	/* always search for x86_64 */
+	char *fix = strstr(driver, "x86-64");
+	if (fix)
+		fix[3] = '_';
+
 	SAFE_ASPRINTF(NULL, &search, "/%s.ko", driver);
 
 	f = SAFE_FOPEN(NULL, path, "r");
-- 
2.35.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [PATCH 2/2] tst_check_driver.sh: Add test for x68_64 module
  2022-03-15 12:25 [LTP] [PATCH 0/2] Fix tst_search_driver for x86-64 modules Petr Vorel
  2022-03-15 12:25 ` [LTP] [PATCH 1/2] tst_kernel: Fix search for foo-x86-64 module Petr Vorel
@ 2022-03-15 12:25 ` Petr Vorel
  2022-07-27 13:05   ` Petr Vorel
  1 sibling, 1 reply; 9+ messages in thread
From: Petr Vorel @ 2022-03-15 12:25 UTC (permalink / raw)
  To: ltp

To cover problem fixed in previous commit.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 lib/newlib_tests/shell/tst_check_driver.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/lib/newlib_tests/shell/tst_check_driver.sh b/lib/newlib_tests/shell/tst_check_driver.sh
index d188b6f775..98098c07c5 100755
--- a/lib/newlib_tests/shell/tst_check_driver.sh
+++ b/lib/newlib_tests/shell/tst_check_driver.sh
@@ -4,7 +4,7 @@
 
 TST_TESTFUNC=test
 TST_SETUP=setup
-TST_CNT=3
+TST_CNT=4
 TST_NEEDS_CMDS="tst_check_drivers find grep head sed"
 . tst_test.sh
 
@@ -54,10 +54,18 @@ test3()
 
 	tst_res TINFO "check built-in module detection"
 
-	[ -f "$f" ] || \
-		tst_brk TCONF "missing '$f'"
-
+	[ -f "$f" ] || tst_brk TCONF "missing '$f'"
 	test_drivers $(grep -E '_[^/]+\.ko' $f | head -3)
 }
 
+test4()
+{
+	local f="$MODULES_DIR/modules.builtin"
+
+	tst_res TINFO "check for x68_64 arch module detection"
+
+	[ -f "$f" ] || tst_brk TCONF "missing '$f'"
+	test_drivers $(grep -E '[^/]+[-_]x86[-_]64.*\.ko' $f | head -3)
+}
+
 tst_run
-- 
2.35.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_kernel: Fix search for foo-x86-64 module
  2022-03-15 12:25 ` [LTP] [PATCH 1/2] tst_kernel: Fix search for foo-x86-64 module Petr Vorel
@ 2022-03-16  6:34   ` xuyang2018.jy
  2022-03-16 14:11     ` Petr Vorel
  0 siblings, 1 reply; 9+ messages in thread
From: xuyang2018.jy @ 2022-03-16  6:34 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp@lists.linux.it

Hi Petr
I don't understand why we must serach foo-x86-64 module, so what problem 
do you meet?

I used 5.17-rc8,  it still use foo-x86_64 named rule for 
kernel/arch/x86/crypto/libblake2s-x86_64.ko.

If kernel has libblake2s-x86_64 module, then tst_check_driver will use 
libblake2s_x86_64 to find, it should succeed.

If kernel doesn't have libblake2s-x86_64 module, then tst_ckeck_driver 
will search twice ,the first time use libblake2s-x86_64  and the second
time use libblake2s_x86_64, then search failed.

Best Regards
Yang Xu
> Although modules.{builtin,dep} contain modules with both dashes and
> underscores and use this consistently, there the only exception: modules
> for x86_64 arch are always named x86_64 no matter whether they use
> dashes or underscore for the rest. E.g. libblake2s-x86-64.
>
> modinfo works with all 4 combinations of libblake2s[-_]x86[-_]64,
> thus fix tst_search_driver() to allow the same.
>
> before:
> tst_check_driver 3 TPASS: tst_check_drivers libblake2s-x86_64 2>/dev/null passed as expected
> libblake2s-x86-64tst_check_driver 3 TFAIL: tst_check_drivers libblake2s-x86-64 failed unexpectedly
>
> after fix:
> tst_check_driver 3 TPASS: tst_check_drivers libblake2s-x86_64 2>/dev/null passed as expected
> tst_check_driver 3 TPASS: tst_check_drivers libblake2s-x86-64 2>/dev/null passed as expected
>
> Signed-off-by: Petr Vorel<pvorel@suse.cz>
> ---
>   lib/tst_kernel.c | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/lib/tst_kernel.c b/lib/tst_kernel.c
> index 6db85bff0e..ecf4b917e7 100644
> --- a/lib/tst_kernel.c
> +++ b/lib/tst_kernel.c
> @@ -116,6 +116,11 @@ static int tst_search_driver(const char *driver, const char *file)
>   		return -1;
>   	}
>
> +	/* always search for x86_64 */
> +	char *fix = strstr(driver, "x86-64");
> +	if (fix)
> +		fix[3] = '_';
> +
>   	SAFE_ASPRINTF(NULL,&search, "/%s.ko", driver);
>
>   	f = SAFE_FOPEN(NULL, path, "r");

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_kernel: Fix search for foo-x86-64 module
  2022-03-16  6:34   ` xuyang2018.jy
@ 2022-03-16 14:11     ` Petr Vorel
  2022-03-18  7:40       ` Li Wang
  0 siblings, 1 reply; 9+ messages in thread
From: Petr Vorel @ 2022-03-16 14:11 UTC (permalink / raw)
  To: xuyang2018.jy@fujitsu.com; +Cc: ltp@lists.linux.it

> Hi Petr
> I don't understand why we must serach foo-x86-64 module, so what problem 
> do you meet?

> I used 5.17-rc8,  it still use foo-x86_64 named rule for 
> kernel/arch/x86/crypto/libblake2s-x86_64.ko.

> If kernel has libblake2s-x86_64 module, then tst_check_driver will use 
> libblake2s_x86_64 to find, it should succeed.

> If kernel doesn't have libblake2s-x86_64 module, then tst_ckeck_driver 
> will search twice ,the first time use libblake2s-x86_64  and the second
> time use libblake2s_x86_64, then search failed.

tst_check_driver.sh is failing on intel based systems. Well, we could make sure
it does not try to test libblake2s-x86-64, IMHO it'd be better to make sure
tst_search_driver() works with it, because modinfo/modprobe works with it:

$ modinfo libblake2s-x86-64
name:           libblake2s_x86_64
filename:       (builtin)
license:        GPL v2
file:           arch/x86/crypto/libblake2s-x86_64

Sure, it's a corner case, but I'd still fix it.
Let's see what other think.

Kind regards,
Petr

> Best Regards
> Yang Xu

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_kernel: Fix search for foo-x86-64 module
  2022-03-16 14:11     ` Petr Vorel
@ 2022-03-18  7:40       ` Li Wang
  2022-03-18  9:50         ` Petr Vorel
  0 siblings, 1 reply; 9+ messages in thread
From: Li Wang @ 2022-03-18  7:40 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp@lists.linux.it


[-- Attachment #1.1: Type: text/plain, Size: 1766 bytes --]

On Wed, Mar 16, 2022 at 10:11 PM Petr Vorel <pvorel@suse.cz> wrote:

> > Hi Petr
> > I don't understand why we must serach foo-x86-64 module, so what problem
> > do you meet?
>
> > I used 5.17-rc8,  it still use foo-x86_64 named rule for
> > kernel/arch/x86/crypto/libblake2s-x86_64.ko.
>
> > If kernel has libblake2s-x86_64 module, then tst_check_driver will use
> > libblake2s_x86_64 to find, it should succeed.
>
> > If kernel doesn't have libblake2s-x86_64 module, then tst_ckeck_driver
> > will search twice ,the first time use libblake2s-x86_64  and the second
> > time use libblake2s_x86_64, then search failed.
>
> tst_check_driver.sh is failing on intel based systems. Well, we could make
> sure
> it does not try to test libblake2s-x86-64, IMHO it'd be better to make sure
> tst_search_driver() works with it, because modinfo/modprobe works with it:
>
> $ modinfo libblake2s-x86-64
> name:           libblake2s_x86_64
> filename:       (builtin)
> license:        GPL v2
> file:           arch/x86/crypto/libblake2s-x86_64
>
> Sure, it's a corner case, but I'd still fix it.
> Let's see what other think.
>

Which kernel (and kmod) version did you use?

I tried locally on my rhel8 and fedora 34 but that doesn't work for me.

$ rpm -q kmod
kmod-28-2.fc34.x86_64

$ lsmod  |grep  libblake2s
libblake2s             16384  0
blake2s_x86_64         20480  1 libblake2s
libblake2s_generic     20480  1 blake2s_x86_64

$ modinfo libblake2s-x86-64
modinfo: ERROR: Module libblake2s-x86-64 not found.


Then I checked the Linux source code and get:
------------------

$ cat linux/arch/x86/crypto/Makefile |grep libblake2s
obj-$(if $(CONFIG_CRYPTO_BLAKE2S_X86),y) += libblake2s-x86_64.o
libblake2s-x86_64-y := blake2s-core.o blake2s-glue.o


-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 3317 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_kernel: Fix search for foo-x86-64 module
  2022-03-18  7:40       ` Li Wang
@ 2022-03-18  9:50         ` Petr Vorel
  2022-03-21  8:19           ` Li Wang
  0 siblings, 1 reply; 9+ messages in thread
From: Petr Vorel @ 2022-03-18  9:50 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp@lists.linux.it

Hi Li,

> On Wed, Mar 16, 2022 at 10:11 PM Petr Vorel <pvorel@suse.cz> wrote:

> > > Hi Petr
> > > I don't understand why we must serach foo-x86-64 module, so what problem
> > > do you meet?

> > > I used 5.17-rc8,  it still use foo-x86_64 named rule for
> > > kernel/arch/x86/crypto/libblake2s-x86_64.ko.

> > > If kernel has libblake2s-x86_64 module, then tst_check_driver will use
> > > libblake2s_x86_64 to find, it should succeed.

> > > If kernel doesn't have libblake2s-x86_64 module, then tst_ckeck_driver
> > > will search twice ,the first time use libblake2s-x86_64  and the second
> > > time use libblake2s_x86_64, then search failed.

> > tst_check_driver.sh is failing on intel based systems. Well, we could make
> > sure
> > it does not try to test libblake2s-x86-64, IMHO it'd be better to make sure
> > tst_search_driver() works with it, because modinfo/modprobe works with it:

> > $ modinfo libblake2s-x86-64
> > name:           libblake2s_x86_64
> > filename:       (builtin)
> > license:        GPL v2
> > file:           arch/x86/crypto/libblake2s-x86_64

> > Sure, it's a corner case, but I'd still fix it.
> > Let's see what other think.


> Which kernel (and kmod) version did you use?

> I tried locally on my rhel8 and fedora 34 but that doesn't work for me.

> $ rpm -q kmod
> kmod-28-2.fc34.x86_64

> $ lsmod  |grep  libblake2s
> libblake2s             16384  0
> blake2s_x86_64         20480  1 libblake2s
> libblake2s_generic     20480  1 blake2s_x86_64

> $ modinfo libblake2s-x86-64
> modinfo: ERROR: Module libblake2s-x86-64 not found.
=> 5.16 had blake2s_x86_64, not libblake2s_x86_64

openSUSE
* 5.17.0-rc7-26.g04b7727-default, kmod-29-8.4.x86_64
works (testing libblake2s-x86-64)
* 5.16, kmod-29-7.1.x86_64
works (testing blake2s_x86-64)

Fedora 34
* 5.13.16, kmod-29-2.fc34.x86_64
works (testing blake2s_x86-64)


> Then I checked the Linux source code and get:
> ------------------

> $ cat linux/arch/x86/crypto/Makefile |grep libblake2s
> obj-$(if $(CONFIG_CRYPTO_BLAKE2S_X86),y) += libblake2s-x86_64.o
> libblake2s-x86_64-y := blake2s-core.o blake2s-glue.o
6048fdcc5f26 ("lib/crypto: blake2s: include as built-in")
Follows: v5.16-rc8
Precedes: v5.17-rc1
...
+++ b/arch/x86/crypto/Makefile
...
-blake2s-x86_64-y := blake2s-core.o blake2s-glue.o
+blake2s-x86_64-y := blake2s-shash.o
+obj-$(if $(CONFIG_CRYPTO_BLAKE2S_X86),y) += libblake2s-x86_64.o
+libblake2s-x86_64-y := blake2s-core.o blake2s-glue.o

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH 1/2] tst_kernel: Fix search for foo-x86-64 module
  2022-03-18  9:50         ` Petr Vorel
@ 2022-03-21  8:19           ` Li Wang
  0 siblings, 0 replies; 9+ messages in thread
From: Li Wang @ 2022-03-21  8:19 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp@lists.linux.it


[-- Attachment #1.1: Type: text/plain, Size: 2763 bytes --]

On Fri, Mar 18, 2022 at 5:50 PM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Li,
>
> > On Wed, Mar 16, 2022 at 10:11 PM Petr Vorel <pvorel@suse.cz> wrote:
>
> > > > Hi Petr
> > > > I don't understand why we must serach foo-x86-64 module, so what
> problem
> > > > do you meet?
>
> > > > I used 5.17-rc8,  it still use foo-x86_64 named rule for
> > > > kernel/arch/x86/crypto/libblake2s-x86_64.ko.
>
> > > > If kernel has libblake2s-x86_64 module, then tst_check_driver will
> use
> > > > libblake2s_x86_64 to find, it should succeed.
>
> > > > If kernel doesn't have libblake2s-x86_64 module, then
> tst_ckeck_driver
> > > > will search twice ,the first time use libblake2s-x86_64  and the
> second
> > > > time use libblake2s_x86_64, then search failed.
>
> > > tst_check_driver.sh is failing on intel based systems. Well, we could
> make
> > > sure
> > > it does not try to test libblake2s-x86-64, IMHO it'd be better to make
> sure
> > > tst_search_driver() works with it, because modinfo/modprobe works with
> it:
>
> > > $ modinfo libblake2s-x86-64
> > > name:           libblake2s_x86_64
> > > filename:       (builtin)
> > > license:        GPL v2
> > > file:           arch/x86/crypto/libblake2s-x86_64
>
> > > Sure, it's a corner case, but I'd still fix it.
> > > Let's see what other think.
>

Ah, I see. Sure, I'm fine to go with your fix :).



>
>
> > Which kernel (and kmod) version did you use?
>
> > I tried locally on my rhel8 and fedora 34 but that doesn't work for me.
>
> > $ rpm -q kmod
> > kmod-28-2.fc34.x86_64
>
> > $ lsmod  |grep  libblake2s
> > libblake2s             16384  0
> > blake2s_x86_64         20480  1 libblake2s
> > libblake2s_generic     20480  1 blake2s_x86_64
>
> > $ modinfo libblake2s-x86-64
> > modinfo: ERROR: Module libblake2s-x86-64 not found.
> => 5.16 had blake2s_x86_64, not libblake2s_x86_64
>
> openSUSE
> * 5.17.0-rc7-26.g04b7727-default, kmod-29-8.4.x86_64
> works (testing libblake2s-x86-64)
> * 5.16, kmod-29-7.1.x86_64
> works (testing blake2s_x86-64)
>
> Fedora 34
> * 5.13.16, kmod-29-2.fc34.x86_64
> works (testing blake2s_x86-64)
>
>
> > Then I checked the Linux source code and get:
> > ------------------
>
> > $ cat linux/arch/x86/crypto/Makefile |grep libblake2s
> > obj-$(if $(CONFIG_CRYPTO_BLAKE2S_X86),y) += libblake2s-x86_64.o
> > libblake2s-x86_64-y := blake2s-core.o blake2s-glue.o
> 6048fdcc5f26 ("lib/crypto: blake2s: include as built-in")
> Follows: v5.16-rc8
> Precedes: v5.17-rc1
> ...
> +++ b/arch/x86/crypto/Makefile
> ...
> -blake2s-x86_64-y := blake2s-core.o blake2s-glue.o
> +blake2s-x86_64-y := blake2s-shash.o
> +obj-$(if $(CONFIG_CRYPTO_BLAKE2S_X86),y) += libblake2s-x86_64.o
> +libblake2s-x86_64-y := blake2s-core.o blake2s-glue.o
>
> Kind regards,
> Petr
>
>

-- 
Regards,
Li Wang

[-- Attachment #1.2: Type: text/html, Size: 4069 bytes --]

[-- Attachment #2: Type: text/plain, Size: 60 bytes --]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [LTP] [PATCH 2/2] tst_check_driver.sh: Add test for x68_64 module
  2022-03-15 12:25 ` [LTP] [PATCH 2/2] tst_check_driver.sh: Add test for x68_64 module Petr Vorel
@ 2022-07-27 13:05   ` Petr Vorel
  0 siblings, 0 replies; 9+ messages in thread
From: Petr Vorel @ 2022-07-27 13:05 UTC (permalink / raw)
  To: ltp

Hi,

FYI patchset merged.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-07-27 13:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-15 12:25 [LTP] [PATCH 0/2] Fix tst_search_driver for x86-64 modules Petr Vorel
2022-03-15 12:25 ` [LTP] [PATCH 1/2] tst_kernel: Fix search for foo-x86-64 module Petr Vorel
2022-03-16  6:34   ` xuyang2018.jy
2022-03-16 14:11     ` Petr Vorel
2022-03-18  7:40       ` Li Wang
2022-03-18  9:50         ` Petr Vorel
2022-03-21  8:19           ` Li Wang
2022-03-15 12:25 ` [LTP] [PATCH 2/2] tst_check_driver.sh: Add test for x68_64 module Petr Vorel
2022-07-27 13:05   ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.