* [PATCH] fio: fix alignement to prevent bus error on ARM
@ 2014-10-24 20:42 Gwendal Grignou
2014-10-24 20:44 ` Jens Axboe
2014-10-24 20:47 ` Mike Frysinger
0 siblings, 2 replies; 10+ messages in thread
From: Gwendal Grignou @ 2014-10-24 20:42 UTC (permalink / raw)
To: axboe; +Cc: fio, vapier, puthik, Gwendal Grignou
Add a filler field to be ensure 64bit alignment.
Otherwise, we would trigger SIGBUS error in sum_stat()
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
stat.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/stat.h b/stat.h
index 32ea226..9595e59 100644
--- a/stat.h
+++ b/stat.h
@@ -172,6 +172,7 @@ struct thread_stat {
* IO Error related stats
*/
uint16_t continue_on_error;
+ uint16_t filler[3];
uint64_t total_err_count;
uint32_t first_error;
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] fio: fix alignement to prevent bus error on ARM
2014-10-24 20:42 [PATCH] fio: fix alignement to prevent bus error on ARM Gwendal Grignou
@ 2014-10-24 20:44 ` Jens Axboe
2014-10-24 20:47 ` Mike Frysinger
1 sibling, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2014-10-24 20:44 UTC (permalink / raw)
To: Gwendal Grignou; +Cc: fio, vapier, puthik
On 10/24/2014 02:42 PM, Gwendal Grignou wrote:
> Add a filler field to be ensure 64bit alignment.
> Otherwise, we would trigger SIGBUS error in sum_stat()
Thanks, applied.
--
Jens Axboe
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] fio: fix alignement to prevent bus error on ARM
2014-10-24 20:42 [PATCH] fio: fix alignement to prevent bus error on ARM Gwendal Grignou
2014-10-24 20:44 ` Jens Axboe
@ 2014-10-24 20:47 ` Mike Frysinger
2014-10-24 20:49 ` Jens Axboe
1 sibling, 1 reply; 10+ messages in thread
From: Mike Frysinger @ 2014-10-24 20:47 UTC (permalink / raw)
To: Gwendal Grignou; +Cc: axboe, fio, Puthikorn Voravootivat
[-- Attachment #1: Type: text/plain, Size: 840 bytes --]
the code seems to be fine with gcc-isms, so i might suggest anon unions
instead to make it harder to break:
union {
uint64_t __aligner;
uint16_t continue_on_error;
};
-mike
On Fri, Oct 24, 2014 at 4:42 PM, Gwendal Grignou <gwendal@chromium.org>
wrote:
> Add a filler field to be ensure 64bit alignment.
> Otherwise, we would trigger SIGBUS error in sum_stat()
>
> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> ---
> stat.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/stat.h b/stat.h
> index 32ea226..9595e59 100644
> --- a/stat.h
> +++ b/stat.h
> @@ -172,6 +172,7 @@ struct thread_stat {
> * IO Error related stats
> */
> uint16_t continue_on_error;
> + uint16_t filler[3];
> uint64_t total_err_count;
> uint32_t first_error;
>
> --
> 2.1.0.rc2.206.gedb03e5
>
>
[-- Attachment #2: Type: text/html, Size: 1391 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] fio: fix alignement to prevent bus error on ARM
2014-10-24 20:47 ` Mike Frysinger
@ 2014-10-24 20:49 ` Jens Axboe
2014-10-24 21:06 ` [PATCH v2] fio: Fix padding properly Gwendal Grignou
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Jens Axboe @ 2014-10-24 20:49 UTC (permalink / raw)
To: Mike Frysinger, Gwendal Grignou; +Cc: fio, Puthikorn Voravootivat
On 10/24/2014 02:47 PM, Mike Frysinger wrote:
> the code seems to be fine with gcc-isms, so i might suggest anon unions
> instead to make it harder to break:
> union {
> uint64_t __aligner;
> uint16_t continue_on_error;
> };
It's not a bad idea... Your commit broke alignment further down, btw,
but I fixed it up.
I'll be happy to take anon union patches for the alignment parts :-)
--
Jens Axboe
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2] fio: Fix padding properly
2014-10-24 20:49 ` Jens Axboe
@ 2014-10-24 21:06 ` Gwendal Grignou
2014-10-24 21:21 ` Gwendal Grignou
2014-10-24 21:32 ` [PATCH v3] " Gwendal Grignou
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Gwendal Grignou @ 2014-10-24 21:06 UTC (permalink / raw)
To: axboe; +Cc: fio, vapier, puthik, Gwendal Grignou
Completely fix padding:
- use anonymous union for padding
- remove remaining padding in thread_stat.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
stat.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/stat.h b/stat.h
index 16b3d1a..1257835 100644
--- a/stat.h
+++ b/stat.h
@@ -171,8 +171,10 @@ struct thread_stat {
/*
* IO Error related stats
*/
- uint16_t continue_on_error;
- uint16_t filler[3];
+ union {
+ uint16_t continue_on_error;
+ uint64_t pad;
+ }
uint64_t total_err_count;
uint32_t first_error;
@@ -181,7 +183,6 @@ struct thread_stat {
uint32_t latency_depth;
uint64_t latency_target;
- uint32_t pad;
fio_fp64_t latency_percentile;
uint64_t latency_window;
} __attribute__((packed));
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2] fio: Fix padding properly
2014-10-24 21:06 ` [PATCH v2] fio: Fix padding properly Gwendal Grignou
@ 2014-10-24 21:21 ` Gwendal Grignou
0 siblings, 0 replies; 10+ messages in thread
From: Gwendal Grignou @ 2014-10-24 21:21 UTC (permalink / raw)
To: fio
Gwendal Grignou <gwendal@...> writes:
>
> Completely fix padding:
Ignore this patch, I did not properly test it.
Gwendal.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3] fio: Fix padding properly
2014-10-24 20:49 ` Jens Axboe
2014-10-24 21:06 ` [PATCH v2] fio: Fix padding properly Gwendal Grignou
@ 2014-10-24 21:32 ` Gwendal Grignou
2014-10-25 23:04 ` [PATCH v4] " Gwendal Grignou
2014-10-27 16:50 ` [PATCH v5] " Gwendal Grignou
3 siblings, 0 replies; 10+ messages in thread
From: Gwendal Grignou @ 2014-10-24 21:32 UTC (permalink / raw)
To: axboe; +Cc: fio, vapier, puthik, Gwendal Grignou
Completely fix padding:
- use anonymous union for padding
- remove remaining padding in thread_stat.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
stat.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/stat.h b/stat.h
index 16b3d1a..c2c30b2 100644
--- a/stat.h
+++ b/stat.h
@@ -171,8 +171,10 @@ struct thread_stat {
/*
* IO Error related stats
*/
- uint16_t continue_on_error;
- uint16_t filler[3];
+ union {
+ uint16_t continue_on_error;
+ uint64_t pad;
+ };
uint64_t total_err_count;
uint32_t first_error;
@@ -181,7 +183,6 @@ struct thread_stat {
uint32_t latency_depth;
uint64_t latency_target;
- uint32_t pad;
fio_fp64_t latency_percentile;
uint64_t latency_window;
} __attribute__((packed));
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v4] fio: Fix padding properly
2014-10-24 20:49 ` Jens Axboe
2014-10-24 21:06 ` [PATCH v2] fio: Fix padding properly Gwendal Grignou
2014-10-24 21:32 ` [PATCH v3] " Gwendal Grignou
@ 2014-10-25 23:04 ` Gwendal Grignou
2014-10-27 14:50 ` Jens Axboe
2014-10-27 16:50 ` [PATCH v5] " Gwendal Grignou
3 siblings, 1 reply; 10+ messages in thread
From: Gwendal Grignou @ 2014-10-25 23:04 UTC (permalink / raw)
To: axboe; +Cc: fio, vapier, puthik, Gwendal Grignou
Completely fix padding:
- use anonymous union for padding.
- move existing padding in thread_stat.
- add alignment checks.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
libfio.c | 2 ++
stat.h | 9 ++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/libfio.c b/libfio.c
index b823bd4..1abf39a 100644
--- a/libfio.c
+++ b/libfio.c
@@ -305,6 +305,8 @@ int initialize_fio(char *envp[])
* access (ARM).
*/
compiletime_assert((offsetof(struct thread_stat, percentile_list) % 8) == 0, "stat percentile_list");
+ compiletime_assert((offsetof(struct thread_stat, total_run_time) % 8) == 0, "total_run_time");
+ compiletime_assert((offsetof(struct thread_stat, total_err_count) % 8) == 0, "total_err_count");
compiletime_assert((offsetof(struct thread_stat, latency_percentile) % 8) == 0, "stat latency_percentile");
compiletime_assert((offsetof(struct thread_options_pack, zipf_theta) % 8) == 0, "zipf_theta");
compiletime_assert((offsetof(struct thread_options_pack, pareto_h) % 8) == 0, "pareto_h");
diff --git a/stat.h b/stat.h
index 16b3d1a..db83f65 100644
--- a/stat.h
+++ b/stat.h
@@ -158,6 +158,8 @@ struct thread_stat {
uint32_t io_u_lat_u[FIO_IO_U_LAT_U_NR];
uint32_t io_u_lat_m[FIO_IO_U_LAT_M_NR];
uint32_t io_u_plat[DDIR_RWDIR_CNT][FIO_IO_U_PLAT_NR];
+ uint32_t pad;
+
uint64_t total_io_u[3];
uint64_t short_io_u[3];
uint64_t drop_io_u[3];
@@ -171,8 +173,10 @@ struct thread_stat {
/*
* IO Error related stats
*/
- uint16_t continue_on_error;
- uint16_t filler[3];
+ union {
+ uint16_t continue_on_error;
+ uint64_t pad;
+ };
uint64_t total_err_count;
uint32_t first_error;
@@ -181,7 +185,6 @@ struct thread_stat {
uint32_t latency_depth;
uint64_t latency_target;
- uint32_t pad;
fio_fp64_t latency_percentile;
uint64_t latency_window;
} __attribute__((packed));
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v4] fio: Fix padding properly
2014-10-25 23:04 ` [PATCH v4] " Gwendal Grignou
@ 2014-10-27 14:50 ` Jens Axboe
0 siblings, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2014-10-27 14:50 UTC (permalink / raw)
To: Gwendal Grignou; +Cc: fio, vapier, puthik
On 10/25/2014 05:04 PM, Gwendal Grignou wrote:
> diff --git a/stat.h b/stat.h
> index 16b3d1a..db83f65 100644
> --- a/stat.h
> +++ b/stat.h
> @@ -158,6 +158,8 @@ struct thread_stat {
> uint32_t io_u_lat_u[FIO_IO_U_LAT_U_NR];
> uint32_t io_u_lat_m[FIO_IO_U_LAT_M_NR];
> uint32_t io_u_plat[DDIR_RWDIR_CNT][FIO_IO_U_PLAT_NR];
> + uint32_t pad;
> +
> uint64_t total_io_u[3];
> uint64_t short_io_u[3];
> uint64_t drop_io_u[3];
> @@ -171,8 +173,10 @@ struct thread_stat {
> /*
> * IO Error related stats
> */
> - uint16_t continue_on_error;
> - uint16_t filler[3];
> + union {
> + uint16_t continue_on_error;
> + uint64_t pad;
> + };
> uint64_t total_err_count;
> uint32_t first_error;
>
These two hunks are both in struct thread_stat, the compile wont be
happy about the duplicate naming...
--
Jens Axboe
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v5] fio: Fix padding properly
2014-10-24 20:49 ` Jens Axboe
` (2 preceding siblings ...)
2014-10-25 23:04 ` [PATCH v4] " Gwendal Grignou
@ 2014-10-27 16:50 ` Gwendal Grignou
3 siblings, 0 replies; 10+ messages in thread
From: Gwendal Grignou @ 2014-10-27 16:50 UTC (permalink / raw)
To: axboe; +Cc: fio, vapier, puthik, Gwendal Grignou
Completely fix padding:
- use anonymous union for padding
- remove remaining padding in thread_stat.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
libfio.c | 2 ++
stat.h | 9 ++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/libfio.c b/libfio.c
index b823bd4..1abf39a 100644
--- a/libfio.c
+++ b/libfio.c
@@ -305,6 +305,8 @@ int initialize_fio(char *envp[])
* access (ARM).
*/
compiletime_assert((offsetof(struct thread_stat, percentile_list) % 8) == 0, "stat percentile_list");
+ compiletime_assert((offsetof(struct thread_stat, total_run_time) % 8) == 0, "total_run_time");
+ compiletime_assert((offsetof(struct thread_stat, total_err_count) % 8) == 0, "total_err_count");
compiletime_assert((offsetof(struct thread_stat, latency_percentile) % 8) == 0, "stat latency_percentile");
compiletime_assert((offsetof(struct thread_options_pack, zipf_theta) % 8) == 0, "zipf_theta");
compiletime_assert((offsetof(struct thread_options_pack, pareto_h) % 8) == 0, "pareto_h");
diff --git a/stat.h b/stat.h
index 16b3d1a..7a0dd55 100644
--- a/stat.h
+++ b/stat.h
@@ -158,6 +158,8 @@ struct thread_stat {
uint32_t io_u_lat_u[FIO_IO_U_LAT_U_NR];
uint32_t io_u_lat_m[FIO_IO_U_LAT_M_NR];
uint32_t io_u_plat[DDIR_RWDIR_CNT][FIO_IO_U_PLAT_NR];
+ uint32_t pad1;
+
uint64_t total_io_u[3];
uint64_t short_io_u[3];
uint64_t drop_io_u[3];
@@ -171,8 +173,10 @@ struct thread_stat {
/*
* IO Error related stats
*/
- uint16_t continue_on_error;
- uint16_t filler[3];
+ union {
+ uint16_t continue_on_error;
+ uint64_t pad2;
+ };
uint64_t total_err_count;
uint32_t first_error;
@@ -181,7 +185,6 @@ struct thread_stat {
uint32_t latency_depth;
uint64_t latency_target;
- uint32_t pad;
fio_fp64_t latency_percentile;
uint64_t latency_window;
} __attribute__((packed));
--
2.1.0.rc2.206.gedb03e5
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-10-27 16:50 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-24 20:42 [PATCH] fio: fix alignement to prevent bus error on ARM Gwendal Grignou
2014-10-24 20:44 ` Jens Axboe
2014-10-24 20:47 ` Mike Frysinger
2014-10-24 20:49 ` Jens Axboe
2014-10-24 21:06 ` [PATCH v2] fio: Fix padding properly Gwendal Grignou
2014-10-24 21:21 ` Gwendal Grignou
2014-10-24 21:32 ` [PATCH v3] " Gwendal Grignou
2014-10-25 23:04 ` [PATCH v4] " Gwendal Grignou
2014-10-27 14:50 ` Jens Axboe
2014-10-27 16:50 ` [PATCH v5] " Gwendal Grignou
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.