shmget03: fix test when some shm segments already exist
PATCH 1/1 shmget03: fix test when some shm segments already exist
It's unlikely, but still possible that some of them could be created during the test as well, so the patch only checks errno.
--- testcases/kernel/syscalls/ipc/shmget/shmget03.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/ipc/shmget/shmget03.c +8 -4
@@ -42,13 +42,17 @@ static void setup(void) queues =SAFE_MALLOC (maxshms *sizeof (int ));for (num =0 ; num < maxshms; num++) { res =shmget (shmkey + num,SHM_SIZE ,IPC_CREAT |IPC_EXCL |SHM_RW ); -if (res ==-1 ) -tst_brk (TBROK |TERRNO ,"shmget failed unexpectedly" ); +if (res ==-1 ) { +if (errno ==ENOSPC ) +break ; +tst_brk (TBROK |TERRNO , +"shmget failed unexpectedly, num %d" , num); + } queues[queue_cnt++] = res; } -tst_res (TINFO ,"The maximum number of memory segments (%d) has been reached" , - maxshms); +tst_res (TINFO ,"The max number of memory segments (%d) has been reached, used by test %d" , + maxshms, queue_cnt); }static void cleanup (void )
Signature · 1 line
2.25.1
PATCH 1/1 shmget03: fix test when some shm segments already exist
Hi Alexey,
Quoted 4 lines · Alexey Kodanev
It's unlikely, but still possible that some of them could be created during the test as well, so the patch only checks errno.
Thanks for fixing this, seems the msgget03 has this problem as well.
https://github.com/linux-test-project/ltp/issues/842
Quoted 2 lines
Signed-off-by Alexey Kodanev <[email protected]>
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20210706/d67fbe02/attachment.htm>
PATCH 1/1 shmget03: fix test when some shm segments already exist
Hi Li,
Quoted 11 lines · Li Wang
Hi Alexey,
On Tue, Jul 6, 2021 at 6:59 PM Alexey Kodanev <[email protected] <mailto:[email protected]>> wrote:
It's unlikely, but still possible that some of them could be created during the test as well, so the patch only checks errno.
Thanks for fixing this, seems the msgget03 has this problem as well.
https://github.com/linux-test-project/ltp/issues/842 <https://github.com/linux-test-project/ltp/issues/842>
Yes, it is the same, it can be easily reproduced:
$ ./msgget03 tst_test.c:1311: TINFO: Timeout per run is 0h 05m 00s msgget03.c:50: TINFO: The maximum number of message queues (32000) reached msgget03.c:29: TPASS: msgget(1627491660, 1536) : ENOSPC (28)
$ ipcmk -Q Message queue id: 32768
$ ./msgget03 tst_test.c:1311: TINFO: Timeout per run is 0h 05m 00s msgget03.c:46: TBROK: msgget failed unexpectedly: ENOSPC (28)
We can fix it similarly.
Quoted 9 lines
Signed-off-by Alexey Kodanev <[email protected] <mailto:[email protected]>>?Reviewed-by: Li Wang <[email protected] <mailto:[email protected]>>
Signature · 2 lines
Regards, Li Wang
PATCH 1/1 shmget03: fix test when some shm segments already exist
Quoted 24 lines · Alexey Kodanev
Hi Li,
Quoted 11 lines · Li Wang
Hi Alexey,
On Tue, Jul 6, 2021 at 6:59 PM Alexey Kodanev <[email protected] <mailto:[email protected]>> wrote:
It's unlikely, but still possible that some of them could be created during the test as well, so the patch only checks errno.
Thanks for fixing this, seems the msgget03 has this problem as well.
https://github.com/linux-test-project/ltp/issues/842 <https://github.com/linux-test-project/ltp/issues/842>Yes, it is the same, it can be easily reproduced:
$ ./msgget03 tst_test.c:1311: TINFO: Timeout per run is 0h 05m 00s msgget03.c:50: TINFO: The maximum number of message queues (32000) reached msgget03.c:29: TPASS: msgget(1627491660, 1536) : ENOSPC (28)$ ipcmk -Q Message queue id: 32768
Quoted 7 lines
$ ./msgget03 tst_test.c:1311: TINFO: Timeout per run is 0h 05m 00s msgget03.c:46: TBROK: msgget failed unexpectedly: ENOSPC (28)We can fix it similarly.
It's also possible that some resources will be freed during the tests... perhaps, moving the loop to verify_*() is the better option?
testcases/kernel/syscalls/ipc/msgget/msgget03.c +14 -2
@@ -26,29 +26,29 @@ static key_t msgkey;static void verify_msgget (void ) { -TST_EXP_FAIL2 (msgget (msgkey + maxmsgs,IPC_CREAT |IPC_EXCL ),ENOSPC , -"msgget(%i, %i)" , msgkey + maxmsgs,IPC_CREAT |IPC_EXCL ); +int num, res; + +for (num =0 ; num <= maxmsgs; ++num) { + res =msgget (msgkey + num,IPC_CREAT |IPC_EXCL ); +if (res ==-1 ) { +if (errno ==ENOSPC ) { +tst_res (TPASS |TERRNO ,"created queues %d" , num); +return ; + } +tst_brk (TFAIL |TERRNO , +"msgget failed unexpectedly, num %d" , num); + } + queues[queue_cnt++] = res; + } }
...
PATCH 1/1 shmget03: fix test when some shm segments already exist
Quoted 5 lines · Alexey Kodanev
It's also possible that some resources will be freed during the tests... perhaps, moving the loop to verify_*() is the better option?
Yes, good point, that would be more precise for ENOSPC testing.
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20210707/89e22f1e/attachment.htm>
PATCH 1/1 shmget03: fix test when some shm segments already exist
Hi Li, Alexey
Quoted 10 lines
Alexey Kodanev <[email protected]
<mailto:[email protected]>> wrote:It's also possible that some resources will be freed during the tests... perhaps, moving the loop to verify_*() is the better option?
Yes, good point, that would be more precise for ENOSPC testing.
AFAIK, ltp doesn't support parallel test now. I think parallel test maybe a future plan that is why we use docparase to collect each case's used resources(so we can convert many groups, like pid, memory, disk space..., then we can run pid group and memory groups test case parallelly).
This is my understanding. If wrong, please correct me.
Best Regards
Yang Xu
Quoted 5 lines
--
Regards,
Li Wang
PATCH 1/1 shmget03: fix test when some shm segments already exist
Quoted 10 lines · On 07.07.2021 04:59, [email protected] wrote:
Hi Li, Alexey
Quoted 9 lines
Alexey Kodanev <[email protected]
<mailto:[email protected]>> wrote:It's also possible that some resources will be freed during the tests... perhaps, moving the loop to verify_*() is the better option?
Quoted 7 lines
Quoted 1 line
Yes, good point, that would be more precise for ENOSPC testing.
AFAIK, ltp doesn't support parallel test now. I think parallel test maybe a future plan that is why we use docparase to collect each case's used resources(so we can convert many groups, like pid, memory, disk space..., then we can run pid group and memory groups test case parallelly).
This is my understanding. If wrong, please correct me.
The problem is that these shared resources might be acquired/released not only by ltp tests. And changing limits in proc is not the same...
PATCH 1/1 shmget03: fix test when some shm segments already exist
In reply to [email protected]Hi Xu, all,
Quoted 10 lines
Hi Li, Alexey
Quoted 7 lines
Alexey Kodanev <[email protected]
<mailto:[email protected]>> wrote:It's also possible that some resources will be freed during the tests... perhaps, moving the loop to verify_*() is the better option?
Quoted 5 lines
Quoted 1 line
Yes, good point, that would be more precise for ENOSPC testing.
AFAIK, ltp doesn't support parallel test now. I think parallel test maybe a future plan that is why we use docparase to collect each case's used resources(so we can convert many groups, like pid, memory, disk space..., then we can run pid group and memory groups test case parallelly).
Yes, parallel support is not supported atm. Richie and Cyril has done some work on runltp-ng to support it. Yes, first it's needed to add support in resources (docparse), see Cyril's old block post [1].
Kind regards,
Petr
[1] https://people.kernel.org/metan/towards-parallel-kernel-test-runs
Quoted 9 lines
This is my understanding. If wrong, please correct me.
Best Regards
Yang XuQuoted 3 lines
--
Regards,
Li Wang
PATCH 1/1 shmget03: fix test when some shm segments already exist
Hi!
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Yes, good point, that would be more precise for ENOSPC testing.
AFAIK, ltp doesn't support parallel test now. I think parallel test maybe a future plan that is why we use docparase to collect each case's used resources(so we can convert many groups, like pid, memory, disk space..., then we can run pid group and memory groups test case parallelly).
Yes, parallel support is not supported atm. Richie and Cyril has done some work on runltp-ng to support it. Yes, first it's needed to add support in resources (docparse), see Cyril's old block post [1].
Besides most of the SHM tests will crash and burn if executed in parallel. The SysV IPC shares a global namespace and because of that we can't really write tests without assuming that we are the only one manipulating them when the test is executed.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 shmget03: fix test when some shm segments already exist
Hi All
Quoted 6 lines
Hi!
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Yes, good point, that would be more precise for ENOSPC testing.
AFAIK, ltp doesn't support parallel test now. I think parallel test maybe a future plan that is why we use docparase to collect each case's used resources(so we can convert many groups, like pid, memory, disk space..., then we can run pid group and memory groups test case parallelly).
Quoted 8 lines
Quoted 3 lines
Yes, parallel support is not supported atm. Richie and Cyril has done some work on runltp-ng to support it. Yes, first it's needed to add support in resources (docparse), see Cyril's old block post [1].
Besides most of the SHM tests will crash and burn if executed in parallel. The SysV IPC shares a global namespace and because of that we can't really write tests without assuming that we are the only one manipulating them when the test is executed.
I guess we should reach a consensus that how to fix this problem 1)use for loop to trigger this error
2)use CLONE_NEWIPC to trigger this error
3)Or we are the only one that use shm and we can add a api to count the existed_cnt
ps: I don't want to leave this problem too long time.
Best Regards
Yang Xu
Quoted 1 line
PATCH 1/1 shmget03: fix test when some shm segments already exist
Quoted 11 lines · On 12.07.2021 05:31, [email protected] wrote:
Hi All
Quoted 10 lines
Hi!
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Yes, good point, that would be more precise for ENOSPC testing.
AFAIK, ltp doesn't support parallel test now. I think parallel test maybe a future plan that is why we use docparase to collect each case's used resources(so we can convert many groups, like pid, memory, disk space..., then we can run pid group and memory groups test case parallelly).
Yes, parallel support is not supported atm. Richie and Cyril has done some work on runltp-ng to support it. Yes, first it's needed to add support in resources (docparse), see Cyril's old block post [1].
Quoted 7 lines
Quoted 4 lines
Besides most of the SHM tests will crash and burn if executed in parallel. The SysV IPC shares a global namespace and because of that we can't really write tests without assuming that we are the only one manipulating them when the test is executed.
I guess we should reach a consensus that how to fix this problem 1)use for loop to trigger this error
2)useCLONE_NEWIPCto trigger this error
Perhaps it can be done at the higher level, e.g. in the ltp tests runner if some tests request it with a newipc flag...
Quoted 8 lines
3)Or we are the only one that use shm and we can add a api to count the
existed_cntps: I don't want to leave this problem too long time.
Best Regards
Yang XuQuoted 1 line
PATCH 1/1 shmget03: fix test when some shm segments already exist
Quoted 16 lines · On 12.07.2021 05:31, [email protected] wrote:
Quoted 15 lines
Hi All
Quoted 14 lines
Hi!
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Yes, good point, that would be more precise for ENOSPC testing.
AFAIK, ltp doesn't support parallel test now. I think parallel test maybe a future plan that is why we use docparase to collect each case's used resources(so we can convert many groups, like pid, memory, disk space..., then we can run pid group and memory groups test case parallelly).
Yes, parallel support is not supported atm. Richie and Cyril has done some work on runltp-ng to support it. Yes, first it's needed to add support in resources (docparse), see Cyril's old block post [1].
Besides most of the SHM tests will crash and burn if executed in parallel. The SysV IPC shares a global namespace and because of that we can't really write tests without assuming that we are the only one manipulating them when the test is executed.
Quoted 6 lines
Quoted 3 lines
I guess we should reach a consensus that how to fix this problem 1)use for loop to trigger this error
2)useCLONE_NEWIPCto trigger this errorPerhaps it can be done at the higher level, e.g. in the ltp tests runner if some tests request it with a newipc flag...
Well, we have at least two runners (runltp which uses ltp-pan, runltp-ng) and we also support running tests without runner, it'd be nice to solve this in LTP API.
Kind regards,
Petr
Quoted 7 lines
Quoted 7 lines
3)Or we are the only one that use shm and we can add a api to count the
existed_cntps: I don't want to leave this problem too long time.
Best Regards
Yang Xu
PATCH 1/1 shmget03: fix test when some shm segments already exist
Quoted 20 lines · Petr Vorel
Quoted 19 lines · On 12.07.2021 05:31, [email protected] wrote:
Quoted 18 lines
Hi All
Quoted 6 lines
Hi!
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Yes, good point, that would be more precise for ENOSPC testing.
AFAIK, ltp doesn't support parallel test now. I think parallel test maybe a future plan that is why we use docparase to collect each case's used resources(so we can convert many groups, like pid, memory, disk space..., then we can run pid group and memory groups test case parallelly).
Quoted 8 lines
Quoted 3 lines
Yes, parallel support is not supported atm. Richie and Cyril has done some work on runltp-ng to support it. Yes, first it's needed to add support in resources (docparse), see Cyril's old block post [1].
Besides most of the SHM tests will crash and burn if executed in parallel. The SysV IPC shares a global namespace and because of that we can't really write tests without assuming that we are the only one manipulating them when the test is executed.
I guess we should reach a consensus that how to fix this problem 1)use for loop to trigger this error
2)useCLONE_NEWIPCto trigger this error
Quoted 5 lines
Quoted 2 lines
Perhaps it can be done at the higher level, e.g. in the ltp tests runner if some tests request it with a newipc flag...
Well, we have at least two runners (runltp which uses ltp-pan, runltp-ng) and we also support running tests without runner, it'd be nice to solve this in LTP API.
I didn't mean these runners, I was thinking about fork_testrun() in tst_test.c.
Quoted 13 lines
Kind regards,
PetrQuoted 7 lines
Quoted 7 lines
3)Or we are the only one that use shm and we can add a api to count the
existed_cntps: I don't want to leave this problem too long time.
Best Regards
Yang Xu
PATCH 1/1 shmget03: fix test when some shm segments already exist
Hi!
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Perhaps it can be done at the higher level, e.g. in the ltp tests runner if some tests request it with a newipc flag...
Well, we have at least two runners (runltp which uses ltp-pan, runltp-ng) and we also support running tests without runner, it'd be nice to solve this in LTP API.
I didn't mean these runners, I was thinking about
fork_testrun()intst_test.c.
We will need to have some kind of flag that would tell the testrunner that the test is using/modifying SysV IPC anyways as without namespaces these tests cannot run in parallel at all.
So I would say that we should:
* Write these tests in a way that they expect that they are the only process that modifies these resources during the testrun
* Mark all these tests with .sysv_ipc flag in the tst_test structure
* Then we can easily add support for running them in a separate namespace in the test library
Does that sound reasonable?
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 shmget03: fix test when some shm segments already exist
Hi,
...
Quoted 9 lines
We will need to have some kind of flag that would tell the testrunner that the test is using/modifying SysV IPC anyways as without namespaces these tests cannot run in parallel at all.
So I would say that we should:
* Write these tests in a way that they expect that they are the only process that modifies these resources during the testrun
Quoted 6 lines
* Mark all these tests with .sysv_ipc flag in the
tst_teststructure* Then we can easily add support for running them in a separate namespace in the test library
Does that sound reasonable?
+1
Kind regards,
Petr
PATCH 1/1 shmget03: fix test when some shm segments already exist
Hi Cyril, Petr
Quoted 12 lines
Hi,
...
Quoted 8 lines
We will need to have some kind of flag that would tell the testrunner that the test is using/modifying SysV IPC anyways as without namespaces these tests cannot run in parallel at all.
So I would say that we should:
* Write these tests in a way that they expect that they are the only process that modifies these resources during the testrun
Quoted 7 lines
Quoted 6 lines
* Mark all these tests with .sysv_ipc flag in the
tst_teststructure* Then we can easily add support for running them in a separate namespace in the test library
Does that sound reasonable?
+1
+1
Since now ltp test libary uses fork_testrun, I wonder whether we should add clone_testrun. So test's setup/test/cleanup function are all in new namespace.
Maybe we should support two ways for running test cases in lib/tst_test(fork and clone)?
And we can add clone and flag argument(the value can be CLONE_NEWIPC/CLONE_NEWNET/CLONENEWPID or more ) in tst_test struct.
ps: Just a initial idea
Best Regards
Yang Xu
Quoted 2 lines
Kind regards,
Petr
PATCH 1/1 shmget03: fix test when some shm segments already exist
In reply to Alexey KodanevHi Alexey,Li
Quoted 52 lines · Alexey Kodanev
Quoted 24 lines
Hi Li,
Quoted 11 lines · Li Wang
Hi Alexey,
On Tue, Jul 6, 2021 at 6:59 PM Alexey Kodanev<[email protected]<mailto:[email protected]>> wrote:
It's unlikely, but still possible that some of them could be created during the test as well, so the patch only checks errno.
Thanks for fixing this, seems the msgget03 has this problem as well.
https://github.com/linux-test-project/ltp/issues/842<https://github.com/linux-test-project/ltp/issues/842>Yes, it is the same, it can be easily reproduced:
$ ./msgget03 tst_test.c:1311: TINFO: Timeout per run is 0h 05m 00s msgget03.c:50: TINFO: The maximum number of message queues (32000) reached msgget03.c:29: TPASS: msgget(1627491660, 1536) : ENOSPC (28)$ ipcmk -Q Message queue id: 32768Quoted 7 lines
$ ./msgget03 tst_test.c:1311: TINFO: Timeout per run is 0h 05m 00s msgget03.c:46: TBROK: msgget failed unexpectedly: ENOSPC (28)We can fix it similarly.
It's also possible that some resources will be freed during the tests... perhaps, moving the loop to verify_*() is the better option?
testcases/kernel/syscalls/ipc/msgget/msgget03.c +5
-2@@ -26,29 +26,29 @@ static key_t msgkey;static void verify_msgget (void ) { -TST_EXP_FAIL2 (msgget (msgkey + maxmsgs,IPC_CREAT |IPC_EXCL ),ENOSPC , -"msgget(%i, %i)" , msgkey + maxmsgs,IPC_CREAT |IPC_EXCL ); +int num, res; + +for (num =0 ; num<= maxmsgs; ++num) { + res =msgget (msgkey + num,IPC_CREAT |IPC_EXCL ); +if (res ==-1 ) {
testcases/kernel/syscalls/ipc/msgget/msgget03.c static key_t msgkey; · line 43
Quoted 10 lines
testcases/kernel/syscalls/ipc/msgget/msgget03.c +9
-0+if (errno ==ENOSPC ) { +tst_res (TPASS |TERRNO ,"created queues %d" , num); +return ; + } +tst_brk (TFAIL |TERRNO , +"msgget failed unexpectedly, num %d" , num); + } + queues[queue_cnt++] = res; + } }
If we use this old format, then we can not ensure whether we trigger the ENOSPC errer correctly when reaching the expected nums.
So to avoid the existed memory segments error, I think we should alter get_used_queus api to count the existed memory segments by adding a file argument.
ps:get_used_queus seems never be used.
code maybe as below:
include/libnewipc.h +1 -3
@@ -49,9 +49,9 @@ key_t getipckey(const char *file, const int lineno);#define GETIPCKEY () \ getipckey(__FILE__, __LINE__) -int get_used_queues (const char *file,const int lineno); -#define GET_USED_QUEUES () \ - get_used_queues(__FILE__, __LINE__) +int get_used_queues(const char *file, const int lineno, const char
*proc_file);
+#define GET_USED_QUEUES(proc_file) \
+ get_used_queues(__FILE__, __LINE__, proc_file)
void *probe_free_addr(const char *file, const int lineno); #define PROBE_FREE_ADDR() \
libs/libltpnewipc/libnewipc.c +1 -1
@@ -48,13 +48,13 @@ key_t getipckey(const char *file, const int lineno)return key; } -int get_used_queues (const char *file,const int lineno) +int get_used_queues(const char *file, const int lineno, const char
*proc_file )
{
FILE *fp;
int used_queues = -1;
char buf[BUFSIZE];- fp = safe_fopen(file, lineno, NULL, "/proc/sysvipc/msg", "r");
+ fp = safe_fopen(file, lineno, NULL, proc_file, "r");
while (fgets(buf, BUFSIZE, fp) != NULL)
used_queues++;
@@ -62,8 +62,8 @@ int get_used_queues(const char *file, const int lineno)
fclose(fp);
if (used_queues < 0) {
- tst_brk(TBROK, "can't read /proc/sysvipc/msg to get "
- "used message queues@%s:%d", file, lineno);
+ tst_brk(TBROK, "can't read %s to get used message queues "
+ "at %s:%d", proc_file, file, lineno);
}testcases/kernel/syscalls/ipc/shmget/shmget03.c +3 -1
@@ -22,7 +22,7 @@#include "libnewipc.h" static int *queues; -static int maxshms, queue_cnt; +static int maxshms, queue_cnt, existed_cnt;static key_t shmkey;static void verify_shmget (void )
@@ -36,11 +36,14 @@ static void setup(void)int res, num; shmkey =GETIPCKEY (); + existed_cnt =GET_USED_QUEUES ("/proc/sysvipc/shm" ); + tst_res(TINFO, "Current environment has %d existed shared emory
segments",
+ existed_cnt);
SAFE_FILE_SCANF("/proc/sys/kernel/shmmni", "%i", &maxshms);- queues = SAFE_MALLOC(maxshms * sizeof(int));
- for (num = 0; num < maxshms; num++) {
+ queues = SAFE_MALLOC((maxshms - existed_cnt) * sizeof(int));
+ for (num = 0; num < maxshms - existed_cnt; num++) { res = shmget(shmkey + num, SHM_SIZE, IPC_CREAT |IPC_EXCL | SHM_RW);
if (res == -1)
tst_brk(TBROK | TERRNO, "shmget failed
unexpectedly");
Best Regards
Yang Xu
Quoted 1 line
...
PATCH 1/1 shmget03: fix test when some shm segments already exist
Hi Xu,
Quoted 7 lines · [email protected] <[email protected]> wrote:
If we use this old format, then we can not ensure whether we trigger the ENOSPC errer correctly when reaching the expected nums.
So to avoid the existed memory segments error, I think we should alter
get_used_queusapi to count the existed memory segments by adding a file argument.
Just as Alex pointed, if there are some resources be freed after invoking get_used_queus, then the value of existed_cnt will be imprecise, how do you think that affects the test result?
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20210707/4126b872/attachment.htm>
PATCH 1/1 shmget03: fix test when some shm segments already exist
Hi Li
Quoted 9 lines
Hi Xu,
[email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]>> wrote:
If we use this old format, then we can not ensure whether we trigger the
ENOSPC errer correctly when reaching the expected nums.
Quoted 8 lines
So to avoid the existed memory segments error, I think we should alter
get_used_queusapi to count the existed memory segments by adding a file argument.Just as Alex pointed, if there are some resources be freedafter invoking
get_used_queus, then the value ofexisted_cntwillbe imprecise, how do you think that affects the test result?
We can move this count api and the create phase into verify* function, but still exist the chance to free resource after invoking get_used_queues.
We can't avoid it because /proc/sys/kernel/shmmni is designed for all user instead of the calling process.
I think it is common in ltp because user also can set a different value after we use ltp api to set proc value.
But if we only use for loop to trigger the ENOSPC error, it goes against the test's aim(see old shmget03.c, it also does the same thing as I do, it doesn't trigger error because it uses a big value than default 4096).
Since this case only wastes a little time when run, I don't think we should avoid rare race to give up to test the ENOSPC error when reaching the expected num.
Also, Let's listen advise from other maintainers.
@Cyril,Petr
Best Regards
Yang Xu
Quoted 5 lines
--
Regards,
Li Wang
PATCH 1/1 shmget03: fix test when some shm segments already exist
Hi Li
How about using CLONE_NEWIPC to test this, so we can avoid this race situation.
Best Regards
Yang Xu
Quoted 48 lines
Hi Li
Quoted 9 lines
Hi Xu,
[email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>> wrote:
If we use this old format, then we can not ensure whether we trigger the
ENOSPC errer correctly when reaching the expected nums.Quoted 8 lines
So to avoid the existed memory segments error, I think we should alter
get_used_queusapi to count the existed memory segments by adding a file argument.Just as Alex pointed, if there are some resources be freedafter invoking
get_used_queus, then the value ofexisted_cntwillbe imprecise, how do you think that affects the test result?We can move this count api and the create phase into verify* function, but still exist the chance to free resource after invoking
get_used_queues.We can't avoid it because
/proc/sys/kernel/shmmniis designed for all user instead of the calling process.I think it is common in ltp because user also can set a different value after we use ltp api to set proc value.
But if we only use for loop to trigger the ENOSPC error, it goes against the test's aim(see old
shmget03.c, it also does the same thing as I do, it doesn't trigger error because it uses a big value than default 4096).Since this case only wastes a little time when run, I don't think we should avoid rare race to give up to test the ENOSPC error when reaching the expected num.
Also, Let's listen advise from other maintainers.
@Cyril,PetrBest Regards
Yang XuQuoted 5 lines
--
Regards,
Li Wang
PATCH 1/1 shmget03: fix test when some shm segments already exist
Quoted 5 lines · On Thu, Jul 8, 2021 at 10:24 AM [email protected] <…
Hi Li
How about using
CLONE_NEWIPCto test this, so we can avoid this race situation.
Maybe yes, but that sounds a bit like a new test.
If let me choose from Alex suggestion or this CLONE_NEWIPC, I think both are OK, because it just an error return check, not a big deal.
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20210708/ce66ae30/attachment.htm>