Re: [Mesa-dev] [PATCH] i965: perf: ensure reading config IDs from sysfs isn't interrupted
Fair, but since we're reading from sysfs, I think we should be fine. On 09/02/18 12:27, Grazvydas Ignotas wrote: Is this really sufficient? From what I read in the manpage, you can get an incomplete read instead when a signal arrives. Gražvydas On Fri, Feb 9, 2018 at 12:03 PM, Lionel Landwerlin wrote: Fixes: 458468c136e "i965: Expose OA counters via INTEL_performance_query" Signed-off-by: Lionel Landwerlin Cc: "18.0" --- src/mesa/drivers/dri/i965/brw_performance_query.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c b/src/mesa/drivers/dri/i965/brw_performance_query.c index c0bb4442bec..613e61653fe 100644 --- a/src/mesa/drivers/dri/i965/brw_performance_query.c +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c @@ -1720,7 +1720,8 @@ read_file_uint64(const char *file, uint64_t *val) fd = open(file, 0); if (fd < 0) return false; -n = read(fd, buf, sizeof (buf) - 1); +while ((n = read(fd, buf, sizeof (buf) - 1)) < 0 && + errno == EINTR); close(fd); if (n < 0) return false; -- 2.16.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: perf: ensure reading config IDs from sysfs isn't interrupted
Is this really sufficient? From what I read in the manpage, you can get an incomplete read instead when a signal arrives. Gražvydas On Fri, Feb 9, 2018 at 12:03 PM, Lionel Landwerlin wrote: > Fixes: 458468c136e "i965: Expose OA counters via INTEL_performance_query" > Signed-off-by: Lionel Landwerlin > Cc: "18.0" > --- > src/mesa/drivers/dri/i965/brw_performance_query.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c > b/src/mesa/drivers/dri/i965/brw_performance_query.c > index c0bb4442bec..613e61653fe 100644 > --- a/src/mesa/drivers/dri/i965/brw_performance_query.c > +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c > @@ -1720,7 +1720,8 @@ read_file_uint64(const char *file, uint64_t *val) > fd = open(file, 0); > if (fd < 0) > return false; > -n = read(fd, buf, sizeof (buf) - 1); > +while ((n = read(fd, buf, sizeof (buf) - 1)) < 0 && > + errno == EINTR); > close(fd); > if (n < 0) > return false; > -- > 2.16.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: perf: ensure reading config IDs from sysfs isn't interrupted
On Friday, 2018-02-09 10:03:53 +, Lionel Landwerlin wrote: > Fixes: 458468c136e "i965: Expose OA counters via INTEL_performance_query" > Signed-off-by: Lionel Landwerlin > Cc: "18.0" The Fixes: tag with a commit which is in 18.0 already nominates it for backporting to that branch, you don't need to manually Cc: 18.0 :) Reviewed-by: Eric Engestrom > --- > src/mesa/drivers/dri/i965/brw_performance_query.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c > b/src/mesa/drivers/dri/i965/brw_performance_query.c > index c0bb4442bec..613e61653fe 100644 > --- a/src/mesa/drivers/dri/i965/brw_performance_query.c > +++ b/src/mesa/drivers/dri/i965/brw_performance_query.c > @@ -1720,7 +1720,8 @@ read_file_uint64(const char *file, uint64_t *val) > fd = open(file, 0); > if (fd < 0) > return false; > -n = read(fd, buf, sizeof (buf) - 1); > +while ((n = read(fd, buf, sizeof (buf) - 1)) < 0 && > + errno == EINTR); > close(fd); > if (n < 0) > return false; > -- > 2.16.1 > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev