Re: [Qemu-devel] [PATCH 5/9] linux-user: Fix epoll on ARM hosts

2013-07-06 Thread Peter Maydell
On 6 July 2013 01:36, Alexander Graf ag...@suse.de wrote:
 diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
 index 8b06a19..fbc3cac 100644
 --- a/linux-user/syscall_defs.h
 +++ b/linux-user/syscall_defs.h
 @@ -2434,8 +2434,11 @@ typedef union target_epoll_data {

  struct target_epoll_event {
  uint32_t events;
 +#ifdef TARGET_ARM
 +uint32_t __pad;
 +#endif
  target_epoll_data_t data;
 -};
 +} QEMU_PACKED;
  #endif
  struct target_rlimit64 {
  uint64_t rlim_cur;

Is ARM really the only arch that needs the pad field?

-- PMM



Re: [Qemu-devel] [PATCH 5/9] linux-user: Fix epoll on ARM hosts

2013-07-06 Thread Alexander Graf

On 06.07.2013, at 12:45, Peter Maydell wrote:

 On 6 July 2013 01:36, Alexander Graf ag...@suse.de wrote:
 diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
 index 8b06a19..fbc3cac 100644
 --- a/linux-user/syscall_defs.h
 +++ b/linux-user/syscall_defs.h
 @@ -2434,8 +2434,11 @@ typedef union target_epoll_data {
 
 struct target_epoll_event {
 uint32_t events;
 +#ifdef TARGET_ARM
 +uint32_t __pad;
 +#endif
 target_epoll_data_t data;
 -};
 +} QEMU_PACKED;
 #endif
 struct target_rlimit64 {
 uint64_t rlim_cur;
 
 Is ARM really the only arch that needs the pad field?

It's the only one I definitely know about. Other targets may add it as they see 
fit. It shouldn't be more broken than before really, where we just took random 
host alignment.


Alex




[Qemu-devel] [PATCH 5/9] linux-user: Fix epoll on ARM hosts

2013-07-06 Thread Alexander Graf
The epoll emulation uses data structures without packing them, so the
compiler might choose to add padding inside.

This patch makes the most offending one (target_epoll_event) a packed
structure to make sure we don't pad it by accident. ARM would pad it,
so declare the padding mandatory for ARM targets.

This fixes i386-on-ARM epoll emulation for me.

Signed-off-by: Alexander Graf ag...@suse.de
---
 linux-user/syscall_defs.h |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 84da7f7..c99aed6 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2454,8 +2454,11 @@ typedef union target_epoll_data {
 
 struct target_epoll_event {
 uint32_t events;
+#ifdef TARGET_ARM
+uint32_t __pad;
+#endif
 target_epoll_data_t data;
-};
+} QEMU_PACKED;
 #endif
 struct target_rlimit64 {
 uint64_t rlim_cur;
-- 
1.6.0.2




[Qemu-devel] [PATCH 5/9] linux-user: Fix epoll on ARM hosts

2013-07-05 Thread Alexander Graf
The epoll emulation uses data structures without packing them, so the
compiler might choose to add padding inside.

This patch makes the most offending one (target_epoll_event) a packed
structure to make sure we don't pad it by accident. ARM would pad it,
so declare the padding mandatory for ARM targets.

This fixes i386-on-ARM epoll emulation for me.

Signed-off-by: Alexander Graf ag...@suse.de
---
 linux-user/syscall_defs.h |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 8b06a19..fbc3cac 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2434,8 +2434,11 @@ typedef union target_epoll_data {
 
 struct target_epoll_event {
 uint32_t events;
+#ifdef TARGET_ARM
+uint32_t __pad;
+#endif
 target_epoll_data_t data;
-};
+} QEMU_PACKED;
 #endif
 struct target_rlimit64 {
 uint64_t rlim_cur;
-- 
1.6.0.2