public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [r12-4438 Regression] FAIL: libgomp.c/places-10.c execution test on Linux/x86_64
@ 2021-10-15 19:26 sunil.k.pandey
  2021-10-18 13:03 ` [committed] openmp: Fix handling of numa_domains(1) Jakub Jelinek
  0 siblings, 1 reply; 5+ messages in thread
From: sunil.k.pandey @ 2021-10-15 19:26 UTC (permalink / raw)
  To: gcc-patches, gcc-regression, jakub

On Linux/x86_64,

4764049dd620affcd3e2658dc7f03a6616370a29 is the first bad commit
commit 4764049dd620affcd3e2658dc7f03a6616370a29
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Oct 15 16:25:25 2021 +0200

    openmp: Fix up handling of OMP_PLACES=threads(1)

caused

FAIL: libgomp.c/places-10.c execution test

with GCC configured with

../../gcc/configure --prefix=/local/skpandey/gccwork/toolwork/gcc-bisect-master/master/r12-4438/usr --enable-clocale=gnu --with-system-zlib --with-demangler-in-ld --with-fpmath=sse --enable-languages=c,c++,fortran --enable-cet --without-isl --enable-libmpx x86_64-linux --disable-bootstrap

To reproduce:

$ cd {build_dir}/x86_64-linux/libgomp/testsuite && make check RUNTESTFLAGS="c.exp=libgomp.c/places-10.c --target_board='unix{-m32}'"
$ cd {build_dir}/x86_64-linux/libgomp/testsuite && make check RUNTESTFLAGS="c.exp=libgomp.c/places-10.c --target_board='unix{-m32\ -march=cascadelake}'"
$ cd {build_dir}/x86_64-linux/libgomp/testsuite && make check RUNTESTFLAGS="c.exp=libgomp.c/places-10.c --target_board='unix{-m64}'"
$ cd {build_dir}/x86_64-linux/libgomp/testsuite && make check RUNTESTFLAGS="c.exp=libgomp.c/places-10.c --target_board='unix{-m64\ -march=cascadelake}'"

(Please do not reply to this email, for question about this report, contact me at skpgkp2 at gmail dot com)

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

* [committed] openmp: Fix handling of numa_domains(1)
  2021-10-15 19:26 [r12-4438 Regression] FAIL: libgomp.c/places-10.c execution test on Linux/x86_64 sunil.k.pandey
@ 2021-10-18 13:03 ` Jakub Jelinek
  2021-11-11 13:14   ` Thomas Schwinge
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Jelinek @ 2021-10-18 13:03 UTC (permalink / raw)
  To: sunil.k.pandey; +Cc: gcc-patches

On Fri, Oct 15, 2021 at 12:26:34PM -0700, sunil.k.pandey wrote:
> 4764049dd620affcd3e2658dc7f03a6616370a29 is the first bad commit
> commit 4764049dd620affcd3e2658dc7f03a6616370a29
> Author: Jakub Jelinek <jakub@redhat.com>
> Date:   Fri Oct 15 16:25:25 2021 +0200
> 
>     openmp: Fix up handling of OMP_PLACES=threads(1)
> 
> caused
> 
> FAIL: libgomp.c/places-10.c execution test

Reproduced on gcc112 in CompileFarm (my ws isn't NUMA).
If numa-domains is used with num-places count, sometimes the function
could create more places than requested and crash.  This depended on the
content of /sys/devices/system/node/online file, e.g. if the file
contains
0-1,16-17
and all NUMA nodes contain at least one CPU in the cpuset of the program,
then numa_domains(2) or numa_domains(4) (or 5+) work fine while
numa_domains(1) or numa_domains(3) misbehave.  I.e. the function was able
to stop after reaching limit on the , separators (or trivially at the end),
but not within in the ranges.

Fixed thusly, tested on powerpc64le-linux, committed to trunk.

2021-10-18  Jakub Jelinek  <jakub@redhat.com>

	* config/linux/affinity.c (gomp_affinity_init_numa_domains): Add
	&& gomp_places_list_len < count after nfirst <= nlast loop condition.

--- libgomp/config/linux/affinity.c.jj	2021-10-15 16:28:30.374460522 +0200
+++ libgomp/config/linux/affinity.c	2021-10-18 14:44:51.559667127 +0200
@@ -401,7 +401,7 @@ gomp_affinity_init_numa_domains (unsigne
 	    break;
 	  q = end;
 	}
-      for (; nfirst <= nlast; nfirst++)
+      for (; nfirst <= nlast && gomp_places_list_len < count; nfirst++)
 	{
 	  sprintf (name + prefix_len, "node%lu/cpulist", nfirst);
 	  f = fopen (name, "r");


	Jakub


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

* Re: [committed] openmp: Fix handling of numa_domains(1)
  2021-10-18 13:03 ` [committed] openmp: Fix handling of numa_domains(1) Jakub Jelinek
@ 2021-11-11 13:14   ` Thomas Schwinge
  2022-03-17 16:16     ` [PATCH] openmp: Fix up gomp_affinity_init_numa_domains Jakub Jelinek
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Schwinge @ 2021-11-11 13:14 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

Hi!

On 2021-10-18T15:03:08+0200, Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> On Fri, Oct 15, 2021 at 12:26:34PM -0700, sunil.k.pandey wrote:
>> 4764049dd620affcd3e2658dc7f03a6616370a29 is the first bad commit
>> commit 4764049dd620affcd3e2658dc7f03a6616370a29
>> Author: Jakub Jelinek <jakub@redhat.com>
>> Date:   Fri Oct 15 16:25:25 2021 +0200
>>
>>     openmp: Fix up handling of OMP_PLACES=threads(1)
>>
>> caused
>>
>> FAIL: libgomp.c/places-10.c execution test
>
> Reproduced on gcc112 in CompileFarm (my ws isn't NUMA).
> If numa-domains is used with num-places count, sometimes the function
> could create more places than requested and crash.  This depended on the
> content of /sys/devices/system/node/online file, e.g. if the file
> contains
> 0-1,16-17
> and all NUMA nodes contain at least one CPU in the cpuset of the program,
> then numa_domains(2) or numa_domains(4) (or 5+) work fine while
> numa_domains(1) or numa_domains(3) misbehave.  I.e. the function was able
> to stop after reaching limit on the , separators (or trivially at the end),
> but not within in the ranges.
>
> Fixed thusly, tested on powerpc64le-linux, committed to trunk.

There appears to be yet another issue: there still are quite a number of
'FAIL: libgomp.c/places-10.c execution test' reports on
<gcc-testresults@gcc.gnu.org>.  Also in my testing testing, on a system
where '/sys/devices/system/node/online' contains '0-1', I get a FAIL:

    [...]
    OPENMP DISPLAY ENVIRONMENT BEGIN
      _OPENMP = '201511'
      OMP_DYNAMIC = 'FALSE'
      OMP_NESTED = 'FALSE'
      OMP_NUM_THREADS = '8'
      OMP_SCHEDULE = 'DYNAMIC'
      OMP_PROC_BIND = 'TRUE'
      OMP_PLACES = '{0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30},{FAIL: libgomp.c/places-10.c execution test


Grüße
 Thomas


> 2021-10-18  Jakub Jelinek  <jakub@redhat.com>
>
>       * config/linux/affinity.c (gomp_affinity_init_numa_domains): Add
>       && gomp_places_list_len < count after nfirst <= nlast loop condition.
>
> --- libgomp/config/linux/affinity.c.jj        2021-10-15 16:28:30.374460522 +0200
> +++ libgomp/config/linux/affinity.c   2021-10-18 14:44:51.559667127 +0200
> @@ -401,7 +401,7 @@ gomp_affinity_init_numa_domains (unsigne
>           break;
>         q = end;
>       }
> -      for (; nfirst <= nlast; nfirst++)
> +      for (; nfirst <= nlast && gomp_places_list_len < count; nfirst++)
>       {
>         sprintf (name + prefix_len, "node%lu/cpulist", nfirst);
>         f = fopen (name, "r");
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

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

* [PATCH] openmp: Fix up gomp_affinity_init_numa_domains
  2021-11-11 13:14   ` Thomas Schwinge
@ 2022-03-17 16:16     ` Jakub Jelinek
  2022-03-18  7:21       ` Thomas Schwinge
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Jelinek @ 2022-03-17 16:16 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches

Hi!

On Thu, Nov 11, 2021 at 02:14:05PM +0100, Thomas Schwinge wrote:
> There appears to be yet another issue: there still are quite a number of
> 'FAIL: libgomp.c/places-10.c execution test' reports on
> <gcc-testresults@gcc.gnu.org>.  Also in my testing testing, on a system
> where '/sys/devices/system/node/online' contains '0-1', I get a FAIL:
> 
>     [...]
>     OPENMP DISPLAY ENVIRONMENT BEGIN
>       _OPENMP = '201511'
>       OMP_DYNAMIC = 'FALSE'
>       OMP_NESTED = 'FALSE'
>       OMP_NUM_THREADS = '8'
>       OMP_SCHEDULE = 'DYNAMIC'
>       OMP_PROC_BIND = 'TRUE'
>       OMP_PLACES = '{0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30},{FAIL: libgomp.c/places-10.c execution test

I've finally managed to debug this (by dumping used /sys/ files from
an affected system in Fedora build system, replacing /sys/ with /tmp/
in gcc sources and populating there those files), I think following patch
ought to fix it.
I'll test it tonight in my bootstrap/regtest (but that's a non-numa box),
can somebody with a box where places-10.c fails reliably test this too?

Thanks.

2022-03-17  Jakub Jelinek  <jakub@redhat.com>

	* config/linux/affinity.c (gomp_affinity_init_numa_domains): Move seen
	variable next to pl variable.

--- libgomp/config/linux/affinity.c.jj	2022-01-11 23:11:23.887269117 +0100
+++ libgomp/config/linux/affinity.c	2022-03-17 17:05:38.129008653 +0100
@@ -411,11 +411,11 @@ gomp_affinity_init_numa_domains (unsigne
 	    {
 	      char *p = line;
 	      void *pl = NULL;
+	      bool seen = false;
 
 	      while (*p && *p != '\n')
 		{
 		  unsigned long first, last;
-		  bool seen = false;
 
 		  errno = 0;
 		  first = strtoul (p, &end, 10);


	Jakub


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

* Re: [PATCH] openmp: Fix up gomp_affinity_init_numa_domains
  2022-03-17 16:16     ` [PATCH] openmp: Fix up gomp_affinity_init_numa_domains Jakub Jelinek
@ 2022-03-18  7:21       ` Thomas Schwinge
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Schwinge @ 2022-03-18  7:21 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

Hi Jakub!

On 2022-03-17T17:16:04+0100, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Nov 11, 2021 at 02:14:05PM +0100, Thomas Schwinge wrote:
>> There appears to be yet another issue: there still are quite a number of
>> 'FAIL: libgomp.c/places-10.c execution test' reports on
>> <gcc-testresults@gcc.gnu.org>.  Also in my testing testing, on a system
>> where '/sys/devices/system/node/online' contains '0-1', I get a FAIL:
>>
>>     [...]
>>     OPENMP DISPLAY ENVIRONMENT BEGIN
>>       _OPENMP = '201511'
>>       OMP_DYNAMIC = 'FALSE'
>>       OMP_NESTED = 'FALSE'
>>       OMP_NUM_THREADS = '8'
>>       OMP_SCHEDULE = 'DYNAMIC'
>>       OMP_PROC_BIND = 'TRUE'
>>       OMP_PLACES = '{0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30},{FAIL: libgomp.c/places-10.c execution test
>
> I've finally managed to debug this (by dumping used /sys/ files from
> an affected system in Fedora build system, replacing /sys/ with /tmp/
> in gcc sources and populating there those files), I think following patch
> ought to fix it.
> I'll test it tonight in my bootstrap/regtest (but that's a non-numa box),
> can somebody with a box where places-10.c fails reliably test this too?

Thanks, confirmed to resolve all the 'libgomp.c/places-10.c' FAILs that
I've seen on different systems.


Grüße
 Thomas


> 2022-03-17  Jakub Jelinek  <jakub@redhat.com>
>
>       * config/linux/affinity.c (gomp_affinity_init_numa_domains): Move seen
>       variable next to pl variable.
>
> --- libgomp/config/linux/affinity.c.jj        2022-01-11 23:11:23.887269117 +0100
> +++ libgomp/config/linux/affinity.c   2022-03-17 17:05:38.129008653 +0100
> @@ -411,11 +411,11 @@ gomp_affinity_init_numa_domains (unsigne
>           {
>             char *p = line;
>             void *pl = NULL;
> +           bool seen = false;
>
>             while (*p && *p != '\n')
>               {
>                 unsigned long first, last;
> -               bool seen = false;
>
>                 errno = 0;
>                 first = strtoul (p, &end, 10);
>
>
>       Jakub
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

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

end of thread, other threads:[~2022-03-18  7:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15 19:26 [r12-4438 Regression] FAIL: libgomp.c/places-10.c execution test on Linux/x86_64 sunil.k.pandey
2021-10-18 13:03 ` [committed] openmp: Fix handling of numa_domains(1) Jakub Jelinek
2021-11-11 13:14   ` Thomas Schwinge
2022-03-17 16:16     ` [PATCH] openmp: Fix up gomp_affinity_init_numa_domains Jakub Jelinek
2022-03-18  7:21       ` Thomas Schwinge

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 read-only IMAP folder(s) and NNTP newsgroup(s).