Skip to contentSkip to conversation

mem/swapping01: Make sure swap is supported by kernel

PATCH In review Bogdan Lezhepekov via ltp 5 participants 11 messages Feb 10, 2022 – Feb 12, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mem/swapping01: Make sure swap is supported by kernel

Previous version caused false positive result
on machines support no swap in kernel.

---
 testcases/kernel/mem/swapping/swapping01.c | 7 +++++++
 1 file changed, 7 insertions(+)
testcases/kernel/mem/swapping/swapping01.c +7 -0
index 1a494bf69..3b4f0a61a 100644
@@ -155,11 +155,18 @@ static void check_swapping(void)
 	SAFE_WAITPID(pid, &status, 0);
 }
 
+static void setup(void)
+{
+	if (access("/proc/swaps", F_OK))
+		tst_brk(TCONF, "swap not supported by kernel");
+}
+
 static struct tst_test test = {
 	.needs_root = 1,
 	.forks_child = 1,
 	.min_mem_avail = 10,
 	.test_all = test_swapping,
+	.setup = setup,
 	.tags = (const struct tst_tag[]) {
 		{"linux-git", "50a15981a1fa"},
 		{}
Signature · 5 lines
2.35.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi!
Applied, thanks.

I guess that the SAFE_OPEN() caused TBROK on machines without CONFIG_SWAP, right?

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Absolutely correct 🙂

Thanks for the review!
-Bogdan
________________________________
From: Cyril Hrubis <[email protected]>
Sent: Thursday, February 10, 2022 18:11
To: Bogdan Lezhepekov <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: [LTP] [PATCH v1] mem/swapping01: Make sure swap is supported by kernel

Hi!
Applied, thanks.

I guess that the SAFE_OPEN() caused TBROK on machines without CONFIG_SWAP, right?

--
Cyril Hrubis
[email protected]

Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
In reply to Cyril Hrubis
Quoted 6 lines · Cyril Hrubis

Hi!
Applied, thanks.

I guess that the SAFE_OPEN() caused TBROK on machines without CONFIG_SWAP, right?

If so, why not go fix with .needs_config for "CONFIG_SWAP=y" ?

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

Hi Li

Quoted 5 lines

On Fri, Feb 11, 2022 at 12:09 AM Cyril Hrubis <[email protected] <mailto:[email protected]>> wrote:

Quoted 8 lines

Hi!
Applied, thanks.

I guess that the SAFE_OPEN() caused TBROK on machines without CONFIG_SWAP, right?

If so, why not go fix with .needs_config for "CONFIG_SWAP=y" ?

+1, it is also friendly to docparse.

ps: I never listen user complaint for the lack of CONFIG_PORC, so only using .needs_config for "CONFIG_SWAP=y" can work well.

Best Regards
Yang Xu

Quoted 8 lines

--
Regards,
Li Wang

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw

Hi all,

I didn't go for CONFIG_SWAP just because wanted to be aligned with syscalls/swapon/swapon03.c and to not multiply patterns.

If you see CONFIG_SWAP more beneficial for docparser, I can make another patch.

Should I?

Cheers,
Bogdan
________________________________
From: ltp <[email protected]> on behalf of [email protected] <[email protected]>
Sent: Friday, February 11, 2022 3:21
To: Li Wang <[email protected]>
Cc: LTP List <[email protected]>
Subject: Re: [LTP] [PATCH v1] mem/swapping01: Make sure swap is supported by kernel

Hi Li

Quoted 5 lines

On Fri, Feb 11, 2022 at 12:09 AM Cyril Hrubis <[email protected] <mailto:[email protected]>> wrote:

Quoted 8 lines

Hi!
Applied, thanks.

I guess that the SAFE_OPEN() caused TBROK on machines without CONFIG_SWAP, right?

If so, why not go fix with .needs_config for "CONFIG_SWAP=y" ?

+1, it is also friendly to docparse.

ps: I never listen user complaint for the lack of CONFIG_PORC, so only using .needs_config for "CONFIG_SWAP=y" can work well.

Best Regards
Yang Xu

Quoted 8 lines

--
Regards,
Li Wang

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

Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw

Hi Bogdan

Quoted 9 lines

Hi all,

I didn't go for CONFIG_SWAP just because wanted to be aligned with syscalls/swapon/swapon03.c and to not multiply patterns.

If you see CONFIG_SWAP more beneficial for docparser, I can make another patch.

Should I?

IMO, yes, but let's listen voice from other maintainers. @Petr,@Cyril

Best Regards
Yang Xu

Quoted 44 lines

Cheers,
Bogdan
------------------------------------------------------------------------
*From:* ltp <[email protected]> on behalf of [email protected] <[email protected]> *Sent:* Friday, February 11, 2022 3:21
*To:* Li Wang <[email protected]>
*Cc:* LTP List <[email protected]>
*Subject:* Re: [LTP] [PATCH v1] mem/swapping01: Make sure swap is supported by kernel
Hi Li

Quoted 5 lines

On Fri, Feb 11, 2022 at 12:09 AM Cyril Hrubis <[email protected] <mailto:[email protected]>> wrote:

Quoted 8 lines

Hi!
Applied, thanks.

I guess that the SAFE_OPEN() caused TBROK on machines without CONFIG_SWAP, right?

If so, why not go fix with .needs_config for "CONFIG_SWAP=y" ?

+1, it is also friendly to docparse.

ps: I never listen user complaint for the lack of CONFIG_PORC, so only using .needs_config for "CONFIG_SWAP=y" can work well.

Best Regards
Yang Xu

Quoted 8 lines

--
Regards,
Li Wang

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

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#7 lore raw

Hi all,

Quoted 6 lines

Hi Bogdan

Quoted 4 lines

Hi all,

I didn't go for CONFIG_SWAP just because wanted to be aligned with syscalls/swapon/swapon03.c and to not multiply patterns.

Quoted 6 lines
Quoted 4 lines

If you see CONFIG_SWAP more beneficial for docparser, I can make another patch.

Should I?

IMO, yes, but let's listen voice from other maintainers. @Petr,@Cyril

We have 3 options.

1) keep check access("/proc/swaps", F_OK)
2) use .needs_config for "CONFIG_SWAP=y"
3) Add .needs_swap flag to struct tst_test

To be honest, I'm not sure, what's the best, probably .needs_config. I worried little bit about .needs_config forcing config to be available in the past, but that should be solved KCONFIG_SKIP_CHECK added by Xu.

Kind regards,
Petr

Quoted 38 lines

Best Regards
Yang Xu

Quoted 35 lines

Cheers,
Bogdan
------------------------------------------------------------------------
*From:* ltp <[email protected]> on behalf of [email protected] <[email protected]> *Sent:* Friday, February 11, 2022 3:21
*To:* Li Wang <[email protected]>
*Cc:* LTP List <[email protected]>
*Subject:* Re: [LTP] [PATCH v1] mem/swapping01: Make sure swap is supported by kernel
Hi Li

Quoted 11 lines

On Fri, Feb 11, 2022 at 12:09 AM Cyril Hrubis <[email protected] <mailto:[email protected]>> wrote:

Hi!
Applied, thanks.

I guess that the SAFE_OPEN() caused TBROK on machines without CONFIG_SWAP, right?

If so, why not go fix with .needs_config for "CONFIG_SWAP=y" ?

+1, it is also friendly to docparse.

ps: I never listen user complaint for the lack of CONFIG_PORC, so only using .needs_config for "CONFIG_SWAP=y" can work well.

Best Regards
Yang Xu

Quoted 3 lines

--
Regards,
Li Wang

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#8 lore raw

Hi!

Quoted 7 lines

1) keep check access("/proc/swaps", F_OK)
2) use .needs_config for "CONFIG_SWAP=y"
3) Add .needs_swap flag to struct tst_test

To be honest, I'm not sure, what's the best, probably .needs_config. I worried little bit about .needs_config forcing config to be available in the past, but that should be solved KCONFIG_SKIP_CHECK added by Xu.

I guess that the easiest solution would be .needs_kconfig, we ended up depending on it in quite a few testcases anyway so I would say that nobody is runing LTP without having kernel config exproted anyways.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#9 lore raw

Hi,

Ok, I will send out a new patch.

Do I need to update syscalls/swapon/swapon03.c accordingly to make it a pattern?

Cheers,
Bogdan
________________________________
From: Cyril Hrubis <[email protected]>
Sent: Friday, February 11, 2022 15:15
To: Petr Vorel <[email protected]>
Cc: [email protected] <[email protected]>; Bogdan Lezhepekov <[email protected]>; Li Wang <[email protected]>; LTP List <[email protected]>
Subject: Re: [LTP] [PATCH v1] mem/swapping01: Make sure swap is supported by kernel

Hi!

Quoted 7 lines

1) keep check access("/proc/swaps", F_OK)
2) use .needs_config for "CONFIG_SWAP=y"
3) Add .needs_swap flag to struct tst_test

To be honest, I'm not sure, what's the best, probably .needs_config. I worried little bit about .needs_config forcing config to be available in the past, but that should be solved KCONFIG_SKIP_CHECK added by Xu.

I guess that the easiest solution would be .needs_kconfig, we ended up depending on it in quite a few testcases anyway so I would say that nobody is runing LTP without having kernel config exproted anyways.

--
Cyril Hrubis
[email protected]

Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#10 lore raw
Quoted 7 lines · Bogdan Lezhepekov

Hi,

Ok, I will send out a new patch.

Do I need to update syscalls/swapon/swapon03.c accordingly to make it a pattern?

Yes, that would be great to have. Thanks~

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp