All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH igt] overlay: Call setlocale around strtod
@ 2018-03-27 14:28 ` Chris Wilson
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2018-03-27 14:28 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

strtod() is locale-dependent. The decimal conversion depends on the radix
character ('.' for some of us like myself) varies by locale. As the
kernel reports its values using the "C" locale, we need to switch to
that when parsing; and switch back before reporting to the user.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105712
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 overlay/power.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/overlay/power.c b/overlay/power.c
index 9ac90fde..0f99e2a4 100644
--- a/overlay/power.c
+++ b/overlay/power.c
@@ -31,6 +31,7 @@
 #include <time.h>
 #include <errno.h>
 #include <ctype.h>
+#include <locale.h>
 #include <math.h>
 
 #include "igt_perf.h"
@@ -97,12 +98,18 @@ static uint64_t rapl_gpu_power(void)
 
 static double filename_to_double(const char *filename)
 {
-	char buf[64];
+	char *oldlocale;
+	char buf[80];
+	double v;
 
 	if (filename_to_buf(filename, buf, sizeof(buf)))
 		return 0;
 
-	return strtod(buf, NULL);
+	oldlocale = setlocale(LC_ALL, "C");
+	v = strtod(buf, NULL);
+	setlocale(LC_ALL, oldlocale);
+
+	return v;
 }
 
 static double rapl_gpu_power_scale(void)
-- 
2.16.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [Intel-gfx] [PATCH igt] overlay: Call setlocale around strtod
@ 2018-03-27 14:28 ` Chris Wilson
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2018-03-27 14:28 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

strtod() is locale-dependent. The decimal conversion depends on the radix
character ('.' for some of us like myself) varies by locale. As the
kernel reports its values using the "C" locale, we need to switch to
that when parsing; and switch back before reporting to the user.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105712
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 overlay/power.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/overlay/power.c b/overlay/power.c
index 9ac90fde..0f99e2a4 100644
--- a/overlay/power.c
+++ b/overlay/power.c
@@ -31,6 +31,7 @@
 #include <time.h>
 #include <errno.h>
 #include <ctype.h>
+#include <locale.h>
 #include <math.h>
 
 #include "igt_perf.h"
@@ -97,12 +98,18 @@ static uint64_t rapl_gpu_power(void)
 
 static double filename_to_double(const char *filename)
 {
-	char buf[64];
+	char *oldlocale;
+	char buf[80];
+	double v;
 
 	if (filename_to_buf(filename, buf, sizeof(buf)))
 		return 0;
 
-	return strtod(buf, NULL);
+	oldlocale = setlocale(LC_ALL, "C");
+	v = strtod(buf, NULL);
+	setlocale(LC_ALL, oldlocale);
+
+	return v;
 }
 
 static double rapl_gpu_power_scale(void)
-- 
2.16.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH igt] overlay: Call setlocale around strtod
  2018-03-27 14:28 ` [Intel-gfx] " Chris Wilson
@ 2018-03-27 14:42   ` Tvrtko Ursulin
  -1 siblings, 0 replies; 6+ messages in thread
From: Tvrtko Ursulin @ 2018-03-27 14:42 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx; +Cc: igt-dev


On 27/03/2018 15:28, Chris Wilson wrote:
> strtod() is locale-dependent. The decimal conversion depends on the radix
> character ('.' for some of us like myself) varies by locale. As the
> kernel reports its values using the "C" locale, we need to switch to
> that when parsing; and switch back before reporting to the user.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105712
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   overlay/power.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/overlay/power.c b/overlay/power.c
> index 9ac90fde..0f99e2a4 100644
> --- a/overlay/power.c
> +++ b/overlay/power.c
> @@ -31,6 +31,7 @@
>   #include <time.h>
>   #include <errno.h>
>   #include <ctype.h>
> +#include <locale.h>
>   #include <math.h>
>   
>   #include "igt_perf.h"
> @@ -97,12 +98,18 @@ static uint64_t rapl_gpu_power(void)
>   
>   static double filename_to_double(const char *filename)
>   {
> -	char buf[64];
> +	char *oldlocale;
> +	char buf[80];
> +	double v;
>   
>   	if (filename_to_buf(filename, buf, sizeof(buf)))
>   		return 0;
>   
> -	return strtod(buf, NULL);
> +	oldlocale = setlocale(LC_ALL, "C");
> +	v = strtod(buf, NULL);
> +	setlocale(LC_ALL, oldlocale);
> +
> +	return v;
>   }
>   
>   static double rapl_gpu_power_scale(void)
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH igt] overlay: Call setlocale around strtod
@ 2018-03-27 14:42   ` Tvrtko Ursulin
  0 siblings, 0 replies; 6+ messages in thread
From: Tvrtko Ursulin @ 2018-03-27 14:42 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx; +Cc: igt-dev


On 27/03/2018 15:28, Chris Wilson wrote:
> strtod() is locale-dependent. The decimal conversion depends on the radix
> character ('.' for some of us like myself) varies by locale. As the
> kernel reports its values using the "C" locale, we need to switch to
> that when parsing; and switch back before reporting to the user.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105712
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   overlay/power.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/overlay/power.c b/overlay/power.c
> index 9ac90fde..0f99e2a4 100644
> --- a/overlay/power.c
> +++ b/overlay/power.c
> @@ -31,6 +31,7 @@
>   #include <time.h>
>   #include <errno.h>
>   #include <ctype.h>
> +#include <locale.h>
>   #include <math.h>
>   
>   #include "igt_perf.h"
> @@ -97,12 +98,18 @@ static uint64_t rapl_gpu_power(void)
>   
>   static double filename_to_double(const char *filename)
>   {
> -	char buf[64];
> +	char *oldlocale;
> +	char buf[80];
> +	double v;
>   
>   	if (filename_to_buf(filename, buf, sizeof(buf)))
>   		return 0;
>   
> -	return strtod(buf, NULL);
> +	oldlocale = setlocale(LC_ALL, "C");
> +	v = strtod(buf, NULL);
> +	setlocale(LC_ALL, oldlocale);
> +
> +	return v;
>   }
>   
>   static double rapl_gpu_power_scale(void)
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [igt-dev] ✓ Fi.CI.BAT: success for overlay: Call setlocale around strtod
  2018-03-27 14:28 ` [Intel-gfx] " Chris Wilson
  (?)
  (?)
@ 2018-03-27 16:49 ` Patchwork
  -1 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2018-03-27 16:49 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: overlay: Call setlocale around strtod
URL   : https://patchwork.freedesktop.org/series/40743/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
a9741da52ad1963f7632ef1e852cbe1c3bcc601e tests/perf_pmu: Improve accuracy by waiting on spinner to start

with latest DRM-Tip kernel build CI_DRM_3989
ff7820832182 drm-tip: 2018y-03m-27d-14h-31m-00s UTC integration manifest

No testlist changes.

---- Known issues:

Test gem_mmap_gtt:
        Subgroup basic-small-bo-tiledx:
                pass       -> FAIL       (fi-gdg-551) fdo#102575
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                dmesg-warn -> PASS       (fi-cnl-y3) fdo#104951 +1
        Subgroup suspend-read-crc-pipe-c:
                pass       -> INCOMPLETE (fi-skl-6700k2) fdo#104108
Test prime_vgem:
        Subgroup basic-fence-flip:
                pass       -> FAIL       (fi-ilk-650) fdo#104008

fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#104951 https://bugs.freedesktop.org/show_bug.cgi?id=104951
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008

fi-bdw-5557u     total:285  pass:264  dwarn:0   dfail:0   fail:0   skip:21  time:434s
fi-bdw-gvtdvm    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:444s
fi-blb-e6850     total:285  pass:220  dwarn:1   dfail:0   fail:0   skip:64  time:381s
fi-bsw-n3050     total:285  pass:239  dwarn:0   dfail:0   fail:0   skip:46  time:542s
fi-bwr-2160      total:285  pass:180  dwarn:0   dfail:0   fail:0   skip:105 time:300s
fi-bxt-dsi       total:285  pass:255  dwarn:0   dfail:0   fail:0   skip:30  time:516s
fi-bxt-j4205     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:516s
fi-byt-j1900     total:285  pass:250  dwarn:0   dfail:0   fail:0   skip:35  time:528s
fi-byt-n2820     total:285  pass:246  dwarn:0   dfail:0   fail:0   skip:39  time:515s
fi-cfl-8700k     total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:413s
fi-cfl-s3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:568s
fi-cfl-u         total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:514s
fi-cnl-y3        total:285  pass:258  dwarn:1   dfail:0   fail:0   skip:26  time:592s
fi-elk-e7500     total:285  pass:225  dwarn:1   dfail:0   fail:0   skip:59  time:430s
fi-gdg-551       total:285  pass:176  dwarn:0   dfail:0   fail:1   skip:108 time:324s
fi-glk-1         total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:536s
fi-hsw-4770      total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:408s
fi-ilk-650       total:285  pass:224  dwarn:0   dfail:0   fail:1   skip:60  time:431s
fi-ivb-3520m     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:471s
fi-ivb-3770      total:285  pass:252  dwarn:0   dfail:0   fail:0   skip:33  time:429s
fi-kbl-7500u     total:285  pass:260  dwarn:1   dfail:0   fail:0   skip:24  time:476s
fi-kbl-7567u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:473s
fi-kbl-r         total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:516s
fi-pnv-d510      total:285  pass:219  dwarn:1   dfail:0   fail:0   skip:65  time:662s
fi-skl-6260u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:445s
fi-skl-6600u     total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:534s
fi-skl-6700k2    total:243  pass:222  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6770hq    total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:508s
fi-skl-guc       total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:430s
fi-skl-gvtdvm    total:285  pass:262  dwarn:0   dfail:0   fail:0   skip:23  time:446s
fi-snb-2520m     total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:595s
fi-snb-2600      total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:403s
Blacklisted hosts:
fi-cnl-psr       total:285  pass:256  dwarn:3   dfail:0   fail:0   skip:26  time:539s
fi-glk-j4005     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:486s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1197/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✗ Fi.CI.IGT: warning for overlay: Call setlocale around strtod
  2018-03-27 14:28 ` [Intel-gfx] " Chris Wilson
                   ` (2 preceding siblings ...)
  (?)
@ 2018-03-27 22:28 ` Patchwork
  -1 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2018-03-27 22:28 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: overlay: Call setlocale around strtod
URL   : https://patchwork.freedesktop.org/series/40743/
State : warning

== Summary ==

---- Possible new issues:

Test kms_frontbuffer_tracking:
        Subgroup fbc-2p-scndscrn-spr-indfb-draw-mmap-wc:
                pass       -> DMESG-WARN (shard-hsw)

---- Known issues:

Test kms_cursor_legacy:
        Subgroup flip-vs-cursor-atomic:
                fail       -> PASS       (shard-hsw) fdo#102670
Test kms_flip:
        Subgroup 2x-flip-vs-wf_vblank:
                fail       -> PASS       (shard-hsw) fdo#100368 +1
        Subgroup flip-vs-expired-vblank-interruptible:
                pass       -> FAIL       (shard-hsw) fdo#102887
Test kms_rotation_crc:
        Subgroup primary-rotation-180:
                fail       -> PASS       (shard-snb) fdo#103925
Test kms_sysfs_edid_timing:
                pass       -> WARN       (shard-apl) fdo#100047

fdo#102670 https://bugs.freedesktop.org/show_bug.cgi?id=102670
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047

shard-apl        total:3495 pass:1831 dwarn:1   dfail:0   fail:7   skip:1655 time:12890s
shard-hsw        total:3495 pass:1780 dwarn:2   dfail:0   fail:3   skip:1709 time:11677s
shard-snb        total:3495 pass:1375 dwarn:1   dfail:0   fail:2   skip:2117 time:6976s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1197/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2018-03-27 22:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-27 14:28 [PATCH igt] overlay: Call setlocale around strtod Chris Wilson
2018-03-27 14:28 ` [Intel-gfx] " Chris Wilson
2018-03-27 14:42 ` Tvrtko Ursulin
2018-03-27 14:42   ` [Intel-gfx] " Tvrtko Ursulin
2018-03-27 16:49 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-03-27 22:28 ` [igt-dev] ✗ Fi.CI.IGT: warning " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.