ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/3] ipc/semget05: Fix .save_restore flags
@ 2023-05-05 14:56 Martin Doucha
  2023-05-05 14:56 ` [LTP] [PATCH 2/3] ipc/semget05: Set dynamic run time Martin Doucha
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Martin Doucha @ 2023-05-05 14:56 UTC (permalink / raw)
  To: ltp

The test can run without root privileges. Add TST_SR_SKIP_RO to ignore
read-only permissions on /proc/sys/kernel/sem.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/kernel/syscalls/ipc/semget/semget05.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/ipc/semget/semget05.c b/testcases/kernel/syscalls/ipc/semget/semget05.c
index 38b0fad3c..d6810c11b 100644
--- a/testcases/kernel/syscalls/ipc/semget/semget05.c
+++ b/testcases/kernel/syscalls/ipc/semget/semget05.c
@@ -73,7 +73,8 @@ static struct tst_test test = {
 	.cleanup = cleanup,
 	.test_all = verify_semget,
 	.save_restore = (const struct tst_path_val[]){
-		{"/proc/sys/kernel/sem", NULL, TST_SR_TCONF},
+		{"/proc/sys/kernel/sem", NULL,
+			TST_SR_TCONF_MISSING | TST_SR_SKIP_RO},
 		{}
 	}
 };
-- 
2.40.0


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

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

* [LTP] [PATCH 2/3] ipc/semget05: Set dynamic run time
  2023-05-05 14:56 [LTP] [PATCH 1/3] ipc/semget05: Fix .save_restore flags Martin Doucha
@ 2023-05-05 14:56 ` Martin Doucha
  2023-05-05 16:24   ` Petr Vorel
  2023-05-05 14:56 ` [LTP] [PATCH 3/3] doc: Fix typo in max_runtime docs Martin Doucha
  2023-05-05 16:20 ` [LTP] [PATCH 1/3] ipc/semget05: Fix .save_restore flags Petr Vorel
  2 siblings, 1 reply; 7+ messages in thread
From: Martin Doucha @ 2023-05-05 14:56 UTC (permalink / raw)
  To: ltp

The semget() syscall can be slow on some archs so too high default
system limit may cause timeouts. Set dynamic run time based on
semaphore limit.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---

I've originally tried to create an IPC namespace and set low custom limit
but IPC namespaces don't allow unprivileged users to reconfigure them
like the network namespaces do. This is the second best solution.

 testcases/kernel/syscalls/ipc/semget/semget05.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/kernel/syscalls/ipc/semget/semget05.c b/testcases/kernel/syscalls/ipc/semget/semget05.c
index d6810c11b..dd9a6285d 100644
--- a/testcases/kernel/syscalls/ipc/semget/semget05.c
+++ b/testcases/kernel/syscalls/ipc/semget/semget05.c
@@ -42,6 +42,9 @@ static void setup(void)
 		used_cnt);
 	SAFE_FILE_SCANF("/proc/sys/kernel/sem", "%*d %*d %*d %d", &maxsems);
 
+	/* Prevent timeout due to high semaphore array limit */
+	tst_set_max_runtime(maxsems / 200);
+
 	sem_id_arr = SAFE_MALLOC((maxsems - used_cnt) * sizeof(int));
 	for (num = 0; num < maxsems - used_cnt; num++) {
 		res = semget(semkey + num, PSEMS, IPC_CREAT | IPC_EXCL | SEM_RA);
-- 
2.40.0


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

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

* [LTP] [PATCH 3/3] doc: Fix typo in max_runtime docs
  2023-05-05 14:56 [LTP] [PATCH 1/3] ipc/semget05: Fix .save_restore flags Martin Doucha
  2023-05-05 14:56 ` [LTP] [PATCH 2/3] ipc/semget05: Set dynamic run time Martin Doucha
@ 2023-05-05 14:56 ` Martin Doucha
  2023-05-05 16:18   ` Petr Vorel
  2023-05-05 16:20 ` [LTP] [PATCH 1/3] ipc/semget05: Fix .save_restore flags Petr Vorel
  2 siblings, 1 reply; 7+ messages in thread
From: Martin Doucha @ 2023-05-05 14:56 UTC (permalink / raw)
  To: ltp

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 doc/c-test-api.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/c-test-api.txt b/doc/c-test-api.txt
index bd9ec72b9..dcb6e1ba8 100644
--- a/doc/c-test-api.txt
+++ b/doc/c-test-api.txt
@@ -102,7 +102,7 @@ that should cover the duration of test setup and cleanup plus some safety.
 Any test that runs for more than a second or two has to make sure to:
 
 - set the runtime either by setting the '.max_runtime' in tst_test or by
-  calling 'tst_set_runtime()' in the test setup
+  calling 'tst_set_max_runtime()' in the test setup
 
 - monitor remaning runtime by regular calls to 'tst_remaining_runtime()' and
   exit when runtime has been used up
-- 
2.40.0


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

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

* Re: [LTP] [PATCH 3/3] doc: Fix typo in max_runtime docs
  2023-05-05 14:56 ` [LTP] [PATCH 3/3] doc: Fix typo in max_runtime docs Martin Doucha
@ 2023-05-05 16:18   ` Petr Vorel
  2023-05-08  1:31     ` Yang Xu (Fujitsu)
  0 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2023-05-05 16:18 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp

Hi Martin,

I merged this simple fix.
And I'll ask in "LTP release preparations" thread for merging this.
Thanks!

Kind regards,
Petr

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

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

* Re: [LTP] [PATCH 1/3] ipc/semget05: Fix .save_restore flags
  2023-05-05 14:56 [LTP] [PATCH 1/3] ipc/semget05: Fix .save_restore flags Martin Doucha
  2023-05-05 14:56 ` [LTP] [PATCH 2/3] ipc/semget05: Set dynamic run time Martin Doucha
  2023-05-05 14:56 ` [LTP] [PATCH 3/3] doc: Fix typo in max_runtime docs Martin Doucha
@ 2023-05-05 16:20 ` Petr Vorel
  2 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2023-05-05 16:20 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp

Hi Martin,

> The test can run without root privileges. Add TST_SR_SKIP_RO to ignore
> read-only permissions on /proc/sys/kernel/sem.

Very good catch, thanks!
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Tested-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

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

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

* Re: [LTP] [PATCH 2/3] ipc/semget05: Set dynamic run time
  2023-05-05 14:56 ` [LTP] [PATCH 2/3] ipc/semget05: Set dynamic run time Martin Doucha
@ 2023-05-05 16:24   ` Petr Vorel
  0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2023-05-05 16:24 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp

Hi Martin,

> The semget() syscall can be slow on some archs so too high default
> system limit may cause timeouts. Set dynamic run time based on
> semaphore limit.

> I've originally tried to create an IPC namespace and set low custom limit
> but IPC namespaces don't allow unprivileged users to reconfigure them
> like the network namespaces do. This is the second best solution.

IMHO good enough.
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

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

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

* Re: [LTP] [PATCH 3/3] doc: Fix typo in max_runtime docs
  2023-05-05 16:18   ` Petr Vorel
@ 2023-05-08  1:31     ` Yang Xu (Fujitsu)
  0 siblings, 0 replies; 7+ messages in thread
From: Yang Xu (Fujitsu) @ 2023-05-08  1:31 UTC (permalink / raw)
  To: Petr Vorel, Martin Doucha; +Cc: ltp

Hi Petr, Martin

> Hi Martin,
> 
> I merged this simple fix.
> And I'll ask in "LTP release preparations" thread for merging this.

This patchset is LGTM, I don't see this email and has merged this 
patchset, sorry.

ps: This patchset is simple change, so I guess it will not affect
a lot for "LTP release preparations".

Best Regards
Yang Xu
> Thanks!
> 
> Kind regards,
> Petr
> 

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

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

end of thread, other threads:[~2023-05-08  1:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05 14:56 [LTP] [PATCH 1/3] ipc/semget05: Fix .save_restore flags Martin Doucha
2023-05-05 14:56 ` [LTP] [PATCH 2/3] ipc/semget05: Set dynamic run time Martin Doucha
2023-05-05 16:24   ` Petr Vorel
2023-05-05 14:56 ` [LTP] [PATCH 3/3] doc: Fix typo in max_runtime docs Martin Doucha
2023-05-05 16:18   ` Petr Vorel
2023-05-08  1:31     ` Yang Xu (Fujitsu)
2023-05-05 16:20 ` [LTP] [PATCH 1/3] ipc/semget05: Fix .save_restore flags Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).