* [LTP] [PATCH v1] libswap.c: Improve caculate swap dev number @ 2024-03-01 6:27 Wei Gao via ltp 2024-03-01 6:45 ` Yang Xu (Fujitsu) via ltp 2024-03-05 14:10 ` [LTP] [PATCH v2] libswap.c: Improve calculate " Wei Gao via ltp 0 siblings, 2 replies; 14+ messages in thread From: Wei Gao via ltp @ 2024-03-01 6:27 UTC (permalink / raw) To: ltp I encounter a dead loop on following code in our test on ppc64 machine: while ((c = fgetc(fp)) != EOF) I think "/proc/swaps" is not normal file and can not get EOF in some situation, so i use fgets a line and caculate swap dev number. Signed-off-by: Wei Gao <wegao@suse.com> --- libs/libltpswap/libswap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/libltpswap/libswap.c b/libs/libltpswap/libswap.c index c8cbb8ea1..6924066b7 100644 --- a/libs/libltpswap/libswap.c +++ b/libs/libltpswap/libswap.c @@ -13,6 +13,7 @@ #define TST_NO_DEFAULT_MAIN #define DEFAULT_MAX_SWAPFILE 32 +#define MAX_LINE_LEN 256 #include "tst_test.h" #include "libswap.h" @@ -274,16 +275,17 @@ int tst_max_swapfiles(void) int tst_count_swaps(void) { FILE *fp; - int used = -1; - char c; + int used = 0; fp = SAFE_FOPEN("/proc/swaps", "r"); if (fp == NULL) return -1; - while ((c = fgetc(fp)) != EOF) { - if (c == '\n') + char line[MAX_LINE_LEN]; + while (fgets(line, MAX_LINE_LEN, fp) != NULL) { + if (strstr(line, "/dev/") != NULL) { used++; + } } SAFE_FCLOSE(fp); -- 2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [LTP] [PATCH v1] libswap.c: Improve caculate swap dev number 2024-03-01 6:27 [LTP] [PATCH v1] libswap.c: Improve caculate swap dev number Wei Gao via ltp @ 2024-03-01 6:45 ` Yang Xu (Fujitsu) via ltp 2024-03-03 13:14 ` Petr Vorel 2024-03-05 14:10 ` [LTP] [PATCH v2] libswap.c: Improve calculate " Wei Gao via ltp 1 sibling, 1 reply; 14+ messages in thread From: Yang Xu (Fujitsu) via ltp @ 2024-03-01 6:45 UTC (permalink / raw) To: Wei Gao, ltp@lists.linux.it Hi Wei > I encounter a dead loop on following code in our test on ppc64 machine: > while ((c = fgetc(fp)) != EOF) > > I think "/proc/swaps" is not normal file and can not get EOF in some situation, > so i use fgets a line and caculate swap dev number. > > Signed-off-by: Wei Gao <wegao@suse.com> > --- > libs/libltpswap/libswap.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/libs/libltpswap/libswap.c b/libs/libltpswap/libswap.c > index c8cbb8ea1..6924066b7 100644 > --- a/libs/libltpswap/libswap.c > +++ b/libs/libltpswap/libswap.c > @@ -13,6 +13,7 @@ > > #define TST_NO_DEFAULT_MAIN > #define DEFAULT_MAX_SWAPFILE 32 > +#define MAX_LINE_LEN 256 > > #include "tst_test.h" > #include "libswap.h" > @@ -274,16 +275,17 @@ int tst_max_swapfiles(void) > int tst_count_swaps(void) > { > FILE *fp; > - int used = -1; > - char c; > + int used = 0; > > fp = SAFE_FOPEN("/proc/swaps", "r"); > if (fp == NULL) > return -1; > > - while ((c = fgetc(fp)) != EOF) { > - if (c == '\n') > + char line[MAX_LINE_LEN]; > + while (fgets(line, MAX_LINE_LEN, fp) != NULL) { > + if (strstr(line, "/dev/") != NULL) { > used++; > + } > } You are not the first person to meet this deadloop problem, Petr also met this[1] in my v4 patch.. But I don't think it related to /proc/swapfiles, I doubot libc wrapper for fgetc problem on ppc64 machine. Can you try fgetc problem by using fgetc api in ipc library[2]? Then we can know the right reason whether is /proc/swaps or getc problem. If so, I think we can change this as my v2 way[3]. [1]https://patchwork.ozlabs.org/project/ltp/patch/20240220074218.13487-3-xuyang2018.jy@fujitsu.com/ [2]https://github.com/linux-test-project/ltp/blob/master/libs/libltpnewipc/libnewipc.c#L58 [3]https://patchwork.ozlabs.org/project/ltp/patch/20231222050006.148845-2-xuyang2018.jy@fujitsu.com/ Best Regards Yang Xu > > SAFE_FCLOSE(fp); -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [LTP] [PATCH v1] libswap.c: Improve caculate swap dev number 2024-03-01 6:45 ` Yang Xu (Fujitsu) via ltp @ 2024-03-03 13:14 ` Petr Vorel 2024-03-04 8:49 ` Li Wang 0 siblings, 1 reply; 14+ messages in thread From: Petr Vorel @ 2024-03-03 13:14 UTC (permalink / raw) To: Yang Xu (Fujitsu); +Cc: ltp@lists.linux.it Hi Wei, Xu, > Hi Wei > > I encounter a dead loop on following code in our test on ppc64 machine: > > while ((c = fgetc(fp)) != EOF) > > I think "/proc/swaps" is not normal file and can not get EOF in some situation, > > so i use fgets a line and caculate swap dev number. I guess the problem has been fixed by another patch [1], thus closing it in patchwork. Please let me know if not. Kind regards, Petr [1] https://github.com/linux-test-project/ltp/commit/0f5d8c520d4e5b22325526eab41ed6bcad1847fc -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [LTP] [PATCH v1] libswap.c: Improve caculate swap dev number 2024-03-03 13:14 ` Petr Vorel @ 2024-03-04 8:49 ` Li Wang 2024-03-04 9:04 ` Petr Vorel 2024-03-04 9:18 ` Yang Xu (Fujitsu) via ltp 0 siblings, 2 replies; 14+ messages in thread From: Li Wang @ 2024-03-04 8:49 UTC (permalink / raw) To: Petr Vorel; +Cc: ltp@lists.linux.it On Sun, Mar 3, 2024 at 9:14 PM Petr Vorel <pvorel@suse.cz> wrote: > Hi Wei, Xu, > > > Hi Wei > > > > I encounter a dead loop on following code in our test on ppc64 machine: > > > while ((c = fgetc(fp)) != EOF) > > > > I think "/proc/swaps" is not normal file and can not get EOF in some > situation, > > > so i use fgets a line and caculate swap dev number. > > I guess the problem has been fixed by another patch [1], thus closing it in > patchwork. Please let me know if not. > Seems not, the patch [1] below is mainly to count the free disk size. But Wei's work here is to calculate swap-dev numbers correctly (especially get rid of EOF affection to some degree). Xu Yang, what do you think? or did I miss anything here? -- Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [LTP] [PATCH v1] libswap.c: Improve caculate swap dev number 2024-03-04 8:49 ` Li Wang @ 2024-03-04 9:04 ` Petr Vorel 2024-03-04 9:18 ` Yang Xu (Fujitsu) via ltp 1 sibling, 0 replies; 14+ messages in thread From: Petr Vorel @ 2024-03-04 9:04 UTC (permalink / raw) To: Li Wang; +Cc: ltp@lists.linux.it > On Sun, Mar 3, 2024 at 9:14 PM Petr Vorel <pvorel@suse.cz> wrote: > > Hi Wei, Xu, > > > Hi Wei > > > > I encounter a dead loop on following code in our test on ppc64 machine: > > > > while ((c = fgetc(fp)) != EOF) > > > > I think "/proc/swaps" is not normal file and can not get EOF in some > > situation, > > > > so i use fgets a line and caculate swap dev number. > > I guess the problem has been fixed by another patch [1], thus closing it in > > patchwork. Please let me know if not. > Seems not, the patch [1] below is mainly to count the free disk size. > But Wei's work here is to calculate swap-dev numbers correctly > (especially get rid of EOF affection to some degree). OK, setting it as "New" again. Kind regards, Petr > Xu Yang, what do you think? or did I miss anything here? -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [LTP] [PATCH v1] libswap.c: Improve caculate swap dev number 2024-03-04 8:49 ` Li Wang 2024-03-04 9:04 ` Petr Vorel @ 2024-03-04 9:18 ` Yang Xu (Fujitsu) via ltp 2024-03-04 10:04 ` Li Wang 1 sibling, 1 reply; 14+ messages in thread From: Yang Xu (Fujitsu) via ltp @ 2024-03-04 9:18 UTC (permalink / raw) To: Li Wang, Petr Vorel; +Cc: ltp@lists.linux.it Hi Li, > > > On Sun, Mar 3, 2024 at 9:14 PM Petr Vorel <pvorel@suse.cz > <mailto:pvorel@suse.cz>> wrote: > > Hi Wei, Xu, > > > Hi Wei > > > > I encounter a dead loop on following code in our test on ppc64 > machine: > > > while ((c = fgetc(fp)) != EOF) > > > > I think "/proc/swaps" is not normal file and can not get EOF in > some situation, > > > so i use fgets a line and caculate swap dev number. > > I guess the problem has been fixed by another patch [1], thus > closing it in > patchwork. Please let me know if not. > > > Seems not, the patch [1] below is mainly to count the free disk size. > > But Wei's work here is to calculate swap-dev numbers correctly > (especially get rid of EOF affection to some degree). > > Xu Yang, what do you think? or did I miss anything here? > > I still think we can use the same way in ipc libs to get rid of the EOF problem instead of searching "dev" keyword. We just don't need to calcualte "/proc/swaps" header. int get_used_sysvipc(const char *file, const int lineno, const char *sysvipc_file) { FILE *fp; int used = -1; char buf[BUFSIZE]; fp = safe_fopen(file, lineno, NULL, sysvipc_file, "r"); while (fgets(buf, BUFSIZE, fp) != NULL) used++; fclose(fp); if (used < 0) { tst_brk(TBROK, "can't read %s to get used sysvipc resource total at " "%s:%d", sysvipc_file, file, lineno); } return used; } But we don't get the actual reason, I still wonder why this deadloop exists o ppcc64 instead of other architecture(ie x86_64). Best Regards Yang Xu > > -- > Regards, > Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [LTP] [PATCH v1] libswap.c: Improve caculate swap dev number 2024-03-04 9:18 ` Yang Xu (Fujitsu) via ltp @ 2024-03-04 10:04 ` Li Wang 2024-03-05 4:01 ` Wei Gao via ltp 0 siblings, 1 reply; 14+ messages in thread From: Li Wang @ 2024-03-04 10:04 UTC (permalink / raw) To: Yang Xu (Fujitsu); +Cc: ltp@lists.linux.it On Mon, Mar 4, 2024 at 5:19 PM Yang Xu (Fujitsu) <xuyang2018.jy@fujitsu.com> wrote: > Hi Li, > > > > > > > On Sun, Mar 3, 2024 at 9:14 PM Petr Vorel <pvorel@suse.cz > > <mailto:pvorel@suse.cz>> wrote: > > > > Hi Wei, Xu, > > > > > Hi Wei > > > > > > I encounter a dead loop on following code in our test on ppc64 > > machine: > > > > while ((c = fgetc(fp)) != EOF) > > > > > > I think "/proc/swaps" is not normal file and can not get EOF in > > some situation, > > > > so i use fgets a line and caculate swap dev number. > > > > I guess the problem has been fixed by another patch [1], thus > > closing it in > > patchwork. Please let me know if not. > > > > > > Seems not, the patch [1] below is mainly to count the free disk size. > > > > But Wei's work here is to calculate swap-dev numbers correctly > > (especially get rid of EOF affection to some degree). > > > > Xu Yang, what do you think? or did I miss anything here? > > > > > > I still think we can use the same way in ipc libs to get rid of the EOF > problem instead of > searching "dev" keyword. We just don't need to calcualte "/proc/swaps" > header. > Sounds good to me. At least it counts right lines. It'd be great to have a patch by that way. > > int get_used_sysvipc(const char *file, const int lineno, const char > *sysvipc_file) > { > FILE *fp; > int used = -1; > char buf[BUFSIZE]; > > fp = safe_fopen(file, lineno, NULL, sysvipc_file, "r"); > > while (fgets(buf, BUFSIZE, fp) != NULL) > used++; > > fclose(fp); > > if (used < 0) { > tst_brk(TBROK, "can't read %s to get used sysvipc resource > total at " > "%s:%d", sysvipc_file, file, lineno); > } > > return used; > } > > But we don't get the actual reason, I still wonder why this deadloop > exists o ppcc64 instead of > other architecture(ie x86_64). > Ok, I think we can just apply your suggested method to see if that deadloop disappears. -- Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [LTP] [PATCH v1] libswap.c: Improve caculate swap dev number 2024-03-04 10:04 ` Li Wang @ 2024-03-05 4:01 ` Wei Gao via ltp 2024-03-05 10:15 ` Petr Vorel 0 siblings, 1 reply; 14+ messages in thread From: Wei Gao via ltp @ 2024-03-05 4:01 UTC (permalink / raw) To: Li Wang; +Cc: ltp@lists.linux.it On Mon, Mar 04, 2024 at 06:04:08PM +0800, Li Wang wrote: > On Mon, Mar 4, 2024 at 5:19 PM Yang Xu (Fujitsu) <xuyang2018.jy@fujitsu.com> > wrote: > > > Hi Li, > > > > > > > > > > > On Sun, Mar 3, 2024 at 9:14 PM Petr Vorel <pvorel@suse.cz > > > <mailto:pvorel@suse.cz>> wrote: > > > > > > Hi Wei, Xu, > > > > > > > Hi Wei > > > > > > > > I encounter a dead loop on following code in our test on ppc64 > > > machine: > > > > > while ((c = fgetc(fp)) != EOF) > > > > > > > > I think "/proc/swaps" is not normal file and can not get EOF in > > > some situation, > > > > > so i use fgets a line and caculate swap dev number. > > > > > > I guess the problem has been fixed by another patch [1], thus > > > closing it in > > > patchwork. Please let me know if not. > > > > > > > > > Seems not, the patch [1] below is mainly to count the free disk size. > > > > > > But Wei's work here is to calculate swap-dev numbers correctly > > > (especially get rid of EOF affection to some degree). > > > > > > Xu Yang, what do you think? or did I miss anything here? > > > > > > > > > > I still think we can use the same way in ipc libs to get rid of the EOF > > problem instead of > > searching "dev" keyword. We just don't need to calcualte "/proc/swaps" > > header. > > > > Sounds good to me. At least it counts right lines. > > It'd be great to have a patch by that way. > > > > > > > int get_used_sysvipc(const char *file, const int lineno, const char > > *sysvipc_file) > > { > > FILE *fp; > > int used = -1; > > char buf[BUFSIZE]; > > > > fp = safe_fopen(file, lineno, NULL, sysvipc_file, "r"); > > > > while (fgets(buf, BUFSIZE, fp) != NULL) > > used++; > > > > fclose(fp); > > > > if (used < 0) { > > tst_brk(TBROK, "can't read %s to get used sysvipc resource > > total at " > > "%s:%d", sysvipc_file, file, lineno); > > } > > > > return used; > > } > > > > But we don't get the actual reason, I still wonder why this deadloop > > exists o ppcc64 instead of > > other architecture(ie x86_64). > > > > Ok, I think we can just apply your suggested method to see if that deadloop > disappears. > Hi Petr, Xu, Li Deadloop will disappear if you use fgets, fgetc can not get EOF on ppc64.(Suspect an bug) So either use my patch or Xu's suggestion both can work. > > > -- > Regards, > Li Wang > > -- > Mailing list info: https://lists.linux.it/listinfo/ltp -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [LTP] [PATCH v1] libswap.c: Improve caculate swap dev number 2024-03-05 4:01 ` Wei Gao via ltp @ 2024-03-05 10:15 ` Petr Vorel 0 siblings, 0 replies; 14+ messages in thread From: Petr Vorel @ 2024-03-05 10:15 UTC (permalink / raw) To: Wei Gao; +Cc: ltp@lists.linux.it > On Mon, Mar 04, 2024 at 06:04:08PM +0800, Li Wang wrote: > > On Mon, Mar 4, 2024 at 5:19 PM Yang Xu (Fujitsu) <xuyang2018.jy@fujitsu.com> > > wrote: > > > Hi Li, > > > > On Sun, Mar 3, 2024 at 9:14 PM Petr Vorel <pvorel@suse.cz > > > > <mailto:pvorel@suse.cz>> wrote: > > > > Hi Wei, Xu, > > > > > Hi Wei > > > > > > I encounter a dead loop on following code in our test on ppc64 > > > > machine: > > > > > > while ((c = fgetc(fp)) != EOF) > > > > > > I think "/proc/swaps" is not normal file and can not get EOF in > > > > some situation, > > > > > > so i use fgets a line and caculate swap dev number. > > > > I guess the problem has been fixed by another patch [1], thus > > > > closing it in > > > > patchwork. Please let me know if not. > > > > Seems not, the patch [1] below is mainly to count the free disk size. > > > > But Wei's work here is to calculate swap-dev numbers correctly > > > > (especially get rid of EOF affection to some degree). > > > > Xu Yang, what do you think? or did I miss anything here? > > > I still think we can use the same way in ipc libs to get rid of the EOF > > > problem instead of > > > searching "dev" keyword. We just don't need to calcualte "/proc/swaps" > > > header. > > Sounds good to me. At least it counts right lines. > > It'd be great to have a patch by that way. > > > int get_used_sysvipc(const char *file, const int lineno, const char > > > *sysvipc_file) > > > { > > > FILE *fp; > > > int used = -1; > > > char buf[BUFSIZE]; > > > fp = safe_fopen(file, lineno, NULL, sysvipc_file, "r"); > > > while (fgets(buf, BUFSIZE, fp) != NULL) > > > used++; > > > fclose(fp); > > > if (used < 0) { > > > tst_brk(TBROK, "can't read %s to get used sysvipc resource > > > total at " > > > "%s:%d", sysvipc_file, file, lineno); > > > } > > > return used; > > > } > > > But we don't get the actual reason, I still wonder why this deadloop > > > exists o ppcc64 instead of > > > other architecture(ie x86_64). FYI also other architectures fails (eg.g least aarch64, s390x and ppc64le which was in the original report; it looks to me it works on x86_64). Problem is somewhere in c1b8c011e447088b08787462e0c2ed50cd8c43f3..8fd941649afeecc5f87508c9f94e9a840a84e44d which contains 319693d0b ("libltpswap: alter tst_count_swaps API"), which is Wei trying to fix. > > Ok, I think we can just apply your suggested method to see if that deadloop > > disappears. > Hi Petr, Xu, Li > Deadloop will disappear if you use fgets, fgetc can not get EOF on ppc64.(Suspect an bug) > So either use my patch or Xu's suggestion both can work. I would vote for Xu's suggestion (any line except the first header is valid), actually this implementation is not correct when it counts only /dev: # dd if=/dev/zero of=/root/swap bs=100M count=1 # mkswap -f /root/swap # swapon /root/swap # cat /proc/swaps Filename Type Size Used Priority /dev/dm-0 partition 192508 4048 -2 /root/swap file 102396 0 -3 (second line without /dev) Also typo in the subject: s/caculate/calculate/ Wei, please send new version and Cc us. Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 14+ messages in thread
* [LTP] [PATCH v2] libswap.c: Improve calculate swap dev number 2024-03-01 6:27 [LTP] [PATCH v1] libswap.c: Improve caculate swap dev number Wei Gao via ltp 2024-03-01 6:45 ` Yang Xu (Fujitsu) via ltp @ 2024-03-05 14:10 ` Wei Gao via ltp 2024-03-05 14:45 ` Petr Vorel 2024-03-05 21:04 ` Petr Vorel 1 sibling, 2 replies; 14+ messages in thread From: Wei Gao via ltp @ 2024-03-05 14:10 UTC (permalink / raw) To: ltp I encounter a dead loop on following code in our test on ppc64 machine: while ((c = fgetc(fp)) != EOF) Use fgets instead of fgetc can avoid above issue. Signed-off-by: Wei Gao <wegao@suse.com> --- libs/libltpswap/libswap.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/libltpswap/libswap.c b/libs/libltpswap/libswap.c index c10db91c0..a26ea25e4 100644 --- a/libs/libltpswap/libswap.c +++ b/libs/libltpswap/libswap.c @@ -13,6 +13,7 @@ #define TST_NO_DEFAULT_MAIN #define DEFAULT_MAX_SWAPFILE 32 +#define BUFSIZE 200 #include "tst_test.h" #include "libswap.h" @@ -279,16 +280,14 @@ int tst_count_swaps(void) { FILE *fp; int used = -1; - char c; + char buf[BUFSIZE]; fp = SAFE_FOPEN("/proc/swaps", "r"); if (fp == NULL) return -1; - while ((c = fgetc(fp)) != EOF) { - if (c == '\n') - used++; - } + while (fgets(buf, BUFSIZE, fp) != NULL) + used++; SAFE_FCLOSE(fp); if (used < 0) -- 2.35.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [LTP] [PATCH v2] libswap.c: Improve calculate swap dev number 2024-03-05 14:10 ` [LTP] [PATCH v2] libswap.c: Improve calculate " Wei Gao via ltp @ 2024-03-05 14:45 ` Petr Vorel 2024-03-05 21:04 ` Petr Vorel 1 sibling, 0 replies; 14+ messages in thread From: Petr Vorel @ 2024-03-05 14:45 UTC (permalink / raw) To: Wei Gao; +Cc: ltp > I encounter a dead loop on following code in our test on ppc64 machine: > while ((c = fgetc(fp)) != EOF) FYI it fails also on aarch64 and s390x, thus I'll add it to the commit message before merge. I also try to have look why it's broken. > Use fgets instead of fgetc can avoid above issue. LGTM. I probably merge it tonight. Reviewed-by: Petr Vorel <pvorel@suse.cz> Kind regards, Petr > Signed-off-by: Wei Gao <wegao@suse.com> > --- > libs/libltpswap/libswap.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > diff --git a/libs/libltpswap/libswap.c b/libs/libltpswap/libswap.c > index c10db91c0..a26ea25e4 100644 > --- a/libs/libltpswap/libswap.c > +++ b/libs/libltpswap/libswap.c > @@ -13,6 +13,7 @@ > #define TST_NO_DEFAULT_MAIN > #define DEFAULT_MAX_SWAPFILE 32 > +#define BUFSIZE 200 > #include "tst_test.h" > #include "libswap.h" > @@ -279,16 +280,14 @@ int tst_count_swaps(void) > { > FILE *fp; > int used = -1; > - char c; > + char buf[BUFSIZE]; > fp = SAFE_FOPEN("/proc/swaps", "r"); > if (fp == NULL) > return -1; > - while ((c = fgetc(fp)) != EOF) { > - if (c == '\n') > - used++; > - } > + while (fgets(buf, BUFSIZE, fp) != NULL) > + used++; > SAFE_FCLOSE(fp); > if (used < 0) -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [LTP] [PATCH v2] libswap.c: Improve calculate swap dev number 2024-03-05 14:10 ` [LTP] [PATCH v2] libswap.c: Improve calculate " Wei Gao via ltp 2024-03-05 14:45 ` Petr Vorel @ 2024-03-05 21:04 ` Petr Vorel 2024-03-06 1:32 ` Yang Xu (Fujitsu) via ltp 1 sibling, 1 reply; 14+ messages in thread From: Petr Vorel @ 2024-03-05 21:04 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi Wei, all, thanks, merged! FYI swapon03 with this patch still fails on SLES 12-SP5 (4.12 based kernel): tst_kconfig.c:87: TINFO: Parsing kernel config '/proc/config.gz' tst_kconfig.c:87: TINFO: Parsing kernel config '/proc/config.gz' swapon03.c:55: TFAIL: swapon(filename, 0) failed: EPERM (1) swapon03.c:55: TFAIL: swapon(filename, 0) failed: EPERM (1) But that's likely fails even without the patch (going to verify older SLES releases). Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [LTP] [PATCH v2] libswap.c: Improve calculate swap dev number 2024-03-05 21:04 ` Petr Vorel @ 2024-03-06 1:32 ` Yang Xu (Fujitsu) via ltp 2024-03-06 9:59 ` Petr Vorel 0 siblings, 1 reply; 14+ messages in thread From: Yang Xu (Fujitsu) via ltp @ 2024-03-06 1:32 UTC (permalink / raw) To: Petr Vorel, Wei Gao; +Cc: ltp@lists.linux.it Hi Petr, all, > Hi Wei, all, > > thanks, merged! > > FYI swapon03 with this patch still fails on SLES 12-SP5 (4.12 based kernel): > > tst_kconfig.c:87: TINFO: Parsing kernel config '/proc/config.gz' > tst_kconfig.c:87: TINFO: Parsing kernel config '/proc/config.gz' > swapon03.c:55: TFAIL: swapon(filename, 0) failed: EPERM (1) > swapon03.c:55: TFAIL: swapon(filename, 0) failed: EPERM (1) > > But that's likely fails even without the patch (going to verify older SLES > releases). > > Kind regards, > Petr I guess SLES 12-SP5 has backported some patch that modified kernel constant MAX_SWAPFILES value[1]. But ltp doesn't add fallback for SLES like I did for RHEL9. I think you can paste your kernel code(include/linux/swap.h), then you or we can figure out what cause this failure. [1]https://github.com/linux-test-project/ltp/commit/c1b8c011e447088b08787462e0c2ed50cd8c43f3 Best Regards Yang Xu -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [LTP] [PATCH v2] libswap.c: Improve calculate swap dev number 2024-03-06 1:32 ` Yang Xu (Fujitsu) via ltp @ 2024-03-06 9:59 ` Petr Vorel 0 siblings, 0 replies; 14+ messages in thread From: Petr Vorel @ 2024-03-06 9:59 UTC (permalink / raw) To: Yang Xu (Fujitsu); +Cc: ltp@lists.linux.it Hi Xu, > Hi Petr, all, > > Hi Wei, all, > > thanks, merged! > > FYI swapon03 with this patch still fails on SLES 12-SP5 (4.12 based kernel): > > tst_kconfig.c:87: TINFO: Parsing kernel config '/proc/config.gz' > > tst_kconfig.c:87: TINFO: Parsing kernel config '/proc/config.gz' > > swapon03.c:55: TFAIL: swapon(filename, 0) failed: EPERM (1) > > swapon03.c:55: TFAIL: swapon(filename, 0) failed: EPERM (1) > > But that's likely fails even without the patch (going to verify older SLES > > releases). > > Kind regards, > > Petr > I guess SLES 12-SP5 has backported some patch that modified kernel > constant MAX_SWAPFILES value[1]. But ltp doesn't add fallback for SLES > like I did for RHEL9. Very good point, there are some patches. > I think you can paste your kernel code(include/linux/swap.h), then you > or we can figure out what cause this failure. I'll try to figure out what is missing and post the config (either with patches or just config). Thanks! > [1]https://github.com/linux-test-project/ltp/commit/c1b8c011e447088b08787462e0c2ed50cd8c43f3 > Best Regards > Yang Xu -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2024-03-06 9:59 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-03-01 6:27 [LTP] [PATCH v1] libswap.c: Improve caculate swap dev number Wei Gao via ltp 2024-03-01 6:45 ` Yang Xu (Fujitsu) via ltp 2024-03-03 13:14 ` Petr Vorel 2024-03-04 8:49 ` Li Wang 2024-03-04 9:04 ` Petr Vorel 2024-03-04 9:18 ` Yang Xu (Fujitsu) via ltp 2024-03-04 10:04 ` Li Wang 2024-03-05 4:01 ` Wei Gao via ltp 2024-03-05 10:15 ` Petr Vorel 2024-03-05 14:10 ` [LTP] [PATCH v2] libswap.c: Improve calculate " Wei Gao via ltp 2024-03-05 14:45 ` Petr Vorel 2024-03-05 21:04 ` Petr Vorel 2024-03-06 1:32 ` Yang Xu (Fujitsu) via ltp 2024-03-06 9:59 ` Petr Vorel
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox