Skip to contentSkip to conversation

pc-bios/s390-ccw: struct tpi_info must be declared as aligned(4)

PATCH In review Thomas Huth 4 participants 8 messages May 8, 2018 – May 16, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pc-bios/s390-ccw: struct tpi_info must be declared as aligned(4)

I've run into a compilation error today with the current version of GCC 8:

In file included from s390-ccw.h:49,

                 from main.c:12:

cio.h:128:1: error: alignment 1 of 'struct tpi_info' is less than 4 [-Werror=packed-not-aligned]
} __attribute__ ((packed));
^
cc1: all warnings being treated as errors

Since the struct tpi_info contains an element ("struct subchannel_id schid") which is marked as aligned(4), we've got to mark the struct tpi_info as aligned(4), too.

---
 pc-bios/s390-ccw/cio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/cio.h +1 -1
index 55eaeee..1a0795f 100644
@@ -125,7 +125,7 @@ struct tpi_info {
     __u32 reserved3  : 12;
     __u32 int_type   : 3;
     __u32 reserved4  : 12;
-} __attribute__ ((packed));
+} __attribute__ ((packed, aligned(4)));
 
 /* channel command word (type 1) */
 struct ccw1 {
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · On Tue, 8 May 2018 12:17:52 +0200 Thomas Huth <[email protected]> wrote:

I've run into a compilation error today with the current version of GCC 8:

In file included from s390-ccw.h:49,

                 from main.c:12:

cio.h:128:1: error: alignment 1 of 'struct tpi_info' is less than 4 [-Werror=packed-not-aligned]
} __attribute__ ((packed));
^
cc1: all warnings being treated as errors

Since the struct tpi_info contains an element ("struct subchannel_id schid") which is marked as aligned(4), we've got to mark the struct tpi_info as aligned(4), too.

---
 pc-bios/s390-ccw/cio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/cio.h +0 -0
index 55eaeee..1a0795f 100644

pc-bios/s390-ccw/cio.h struct tpi_info { · line 131

Quoted 8 lines
pc-bios/s390-ccw/cio.h +1 -1
@@ -125,7 +125,7 @@ struct tpi_info {
     __u32 reserved3  : 12;
     __u32 int_type   : 3;
     __u32 reserved4  : 12;
-} __attribute__ ((packed));
+} __attribute__ ((packed, aligned(4)));
 
 /* channel command word (type 1) */
 struct ccw1 {

Alternatively, we could also ditch this struct and the tpi function... but I have not given up hope yet that we might someday handle channel I/O more canonically in the bios :)

#2 lore raw
Quoted 32 lines · Cornelia Huck
Quoted 29 lines · On Tue, 8 May 2018 12:17:52 +0200 Thomas Huth <[email protected]> wrote:

I've run into a compilation error today with the current version of GCC 8:

In file included from s390-ccw.h:49,

                 from main.c:12:

cio.h:128:1: error: alignment 1 of 'struct tpi_info' is less than 4 [-Werror=packed-not-aligned]
} __attribute__ ((packed));
^
cc1: all warnings being treated as errors

Since the struct tpi_info contains an element ("struct subchannel_id schid") which is marked as aligned(4), we've got to mark the struct tpi_info as aligned(4), too.

---
 pc-bios/s390-ccw/cio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/cio.h +1 -1
index 55eaeee..1a0795f 100644
@@ -125,7 +125,7 @@ struct tpi_info {
     __u32 reserved3  : 12;
     __u32 int_type   : 3;
     __u32 reserved4  : 12;
-} __attribute__ ((packed));
+} __attribute__ ((packed, aligned(4)));
 
Quoted 8 lines

pc-bios/s390-ccw/cio.h struct tpi_info { · line 131

Quoted 2 lines
pc-bios/s390-ccw/cio.h +0 -0
 /* channel command word (type 1) */
 struct ccw1 {

Alternatively, we could also ditch this struct and the tpi function... but I have not given up hope yet that we might someday handle channel I/O more canonically in the bios :)

Yes, it's currently unused (so I think you could also pick up the patch directly, without the need for recompiling the s390-ccw.img just because of this) ... I don't mind too much if we fix it or remove it, but since you've said that it might be useful in the future again, I think we can simply keep it for now.

Thomas

#3 lore raw
Quoted 42 lines · On Tue, 8 May 2018 12:49:59 +0200 Thomas Huth <[email protected]> wrote:
Quoted 32 lines · Cornelia Huck
Quoted 29 lines · On Tue, 8 May 2018 12:17:52 +0200 Thomas Huth <[email protected]> wrote:

I've run into a compilation error today with the current version of GCC 8:

In file included from s390-ccw.h:49,

                 from main.c:12:

cio.h:128:1: error: alignment 1 of 'struct tpi_info' is less than 4 [-Werror=packed-not-aligned]
} __attribute__ ((packed));
^
cc1: all warnings being treated as errors

Since the struct tpi_info contains an element ("struct subchannel_id schid") which is marked as aligned(4), we've got to mark the struct tpi_info as aligned(4), too.

---
 pc-bios/s390-ccw/cio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/cio.h +1 -1
index 55eaeee..1a0795f 100644
@@ -125,7 +125,7 @@ struct tpi_info {
     __u32 reserved3  : 12;
     __u32 int_type   : 3;
     __u32 reserved4  : 12;
-} __attribute__ ((packed));
+} __attribute__ ((packed, aligned(4)));
 
Quoted 8 lines

pc-bios/s390-ccw/cio.h struct tpi_info { · line 131

Quoted 2 lines
pc-bios/s390-ccw/cio.h +0 -0
 /* channel command word (type 1) */
 struct ccw1 {  

Alternatively, we could also ditch this struct and the tpi function... but I have not given up hope yet that we might someday handle channel I/O more canonically in the bios :)

Quoted 5 lines

Yes, it's currently unused (so I think you could also pick up the patch directly, without the need for recompiling the s390-ccw.img just because of this) ... I don't mind too much if we fix it or remove it, but since you've said that it might be useful in the future again, I think we can simply keep it for now.

Related question: Should this be cc:stable (without a rebuild)? The same logic as for the just-merged e500 patch probably applies.

#4 lore raw
Quoted 45 lines · Cornelia Huck
Quoted 42 lines · On Tue, 8 May 2018 12:49:59 +0200 Thomas Huth <[email protected]> wrote:
Quoted 40 lines · Cornelia Huck
Quoted 23 lines · On Tue, 8 May 2018 12:17:52 +0200 Thomas Huth <[email protected]> wrote:

I've run into a compilation error today with the current version of GCC 8:

In file included from s390-ccw.h:49,

                 from main.c:12:

cio.h:128:1: error: alignment 1 of 'struct tpi_info' is less than 4 [-Werror=packed-not-aligned]
} __attribute__ ((packed));
^
cc1: all warnings being treated as errors

Since the struct tpi_info contains an element ("struct subchannel_id schid") which is marked as aligned(4), we've got to mark the struct tpi_info as aligned(4), too.

---
 pc-bios/s390-ccw/cio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/cio.h +0 -0
index 55eaeee..1a0795f 100644

pc-bios/s390-ccw/cio.h struct tpi_info { · line 131

Quoted 8 lines
pc-bios/s390-ccw/cio.h +1 -1
@@ -125,7 +125,7 @@ struct tpi_info {
     __u32 reserved3  : 12;
     __u32 int_type   : 3;
     __u32 reserved4  : 12;
-} __attribute__ ((packed));
+} __attribute__ ((packed, aligned(4)));
 
 /* channel command word (type 1) */
 struct ccw1 {  

Alternatively, we could also ditch this struct and the tpi function... but I have not given up hope yet that we might someday handle channel I/O more canonically in the bios :)

Quoted 8 lines
Quoted 5 lines

Yes, it's currently unused (so I think you could also pick up the patch directly, without the need for recompiling the s390-ccw.img just because of this) ... I don't mind too much if we fix it or remove it, but since you've said that it might be useful in the future again, I think we can simply keep it for now.

Related question: Should this be cc:stable (without a rebuild)? The same logic as for the just-merged e500 patch probably applies.

Ack. Compile warnings/errors qualify for stable I think.

#5 lore raw
In reply to Cornelia Huck
Quoted 45 lines · Cornelia Huck
Quoted 42 lines · On Tue, 8 May 2018 12:49:59 +0200 Thomas Huth <[email protected]> wrote:
Quoted 40 lines · Cornelia Huck
Quoted 23 lines · On Tue, 8 May 2018 12:17:52 +0200 Thomas Huth <[email protected]> wrote:

I've run into a compilation error today with the current version of GCC 8:

In file included from s390-ccw.h:49,

                 from main.c:12:

cio.h:128:1: error: alignment 1 of 'struct tpi_info' is less than 4 [-Werror=packed-not-aligned]
} __attribute__ ((packed));
^
cc1: all warnings being treated as errors

Since the struct tpi_info contains an element ("struct subchannel_id schid") which is marked as aligned(4), we've got to mark the struct tpi_info as aligned(4), too.

---
 pc-bios/s390-ccw/cio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/cio.h +0 -0
index 55eaeee..1a0795f 100644

pc-bios/s390-ccw/cio.h struct tpi_info { · line 131

Quoted 8 lines
pc-bios/s390-ccw/cio.h +1 -1
@@ -125,7 +125,7 @@ struct tpi_info {
     __u32 reserved3  : 12;
     __u32 int_type   : 3;
     __u32 reserved4  : 12;
-} __attribute__ ((packed));
+} __attribute__ ((packed, aligned(4)));
 
 /* channel command word (type 1) */
 struct ccw1 {  

Alternatively, we could also ditch this struct and the tpi function... but I have not given up hope yet that we might someday handle channel I/O more canonically in the bios :)

Quoted 8 lines
Quoted 5 lines

Yes, it's currently unused (so I think you could also pick up the patch directly, without the need for recompiling the s390-ccw.img just because of this) ... I don't mind too much if we fix it or remove it, but since you've said that it might be useful in the future again, I think we can simply keep it for now.

Related question: Should this be cc:stable (without a rebuild)? The same logic as for the just-merged e500 patch probably applies.

Since the stable releases are normally not built with -Werror, I think it's ok to not include it there. OTOH it also does not hurt and silences an annoying warning, and in case somebody tries to build a stable release with -Werror, it also fixes the build there. So why not, please add a "Cc: stable" when you pick up the patch.

Thomas

#6 lore raw
In reply to Thomas Huth
Quoted 23 lines · On Tue, 8 May 2018 12:17:52 +0200 Thomas Huth <[email protected]> wrote:

I've run into a compilation error today with the current version of GCC 8:

In file included from s390-ccw.h:49,

                 from main.c:12:

cio.h:128:1: error: alignment 1 of 'struct tpi_info' is less than 4 [-Werror=packed-not-aligned]
} __attribute__ ((packed));
^
cc1: all warnings being treated as errors

Since the struct tpi_info contains an element ("struct subchannel_id schid") which is marked as aligned(4), we've got to mark the struct tpi_info as aligned(4), too.

---
 pc-bios/s390-ccw/cio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/cio.h +0 -0
index 55eaeee..1a0795f 100644

pc-bios/s390-ccw/cio.h struct tpi_info { · line 131

Quoted 8 lines
pc-bios/s390-ccw/cio.h +1 -1
@@ -125,7 +125,7 @@ struct tpi_info {
     __u32 reserved3  : 12;
     __u32 int_type   : 3;
     __u32 reserved4  : 12;
-} __attribute__ ((packed));
+} __attribute__ ((packed, aligned(4)));
 
 /* channel command word (type 1) */
 struct ccw1 {

Thanks, queued to s390-next with a cc:stable.

Reviewed-by on v1 1/1
#7 lore raw
In reply to Thomas Huth
Quoted 24 lines · Thomas Huth

I've run into a compilation error today with the current version of GCC 8:

In file included from s390-ccw.h:49,

                 from main.c:12:

cio.h:128:1: error: alignment 1 of 'struct tpi_info' is less than 4 [-Werror=packed-not-aligned]
} __attribute__ ((packed));
^
cc1: all warnings being treated as errors

Since the struct tpi_info contains an element ("struct subchannel_id schid") which is marked as aligned(4), we've got to mark the struct tpi_info as aligned(4), too.

---
 pc-bios/s390-ccw/cio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/cio.h +0 -0
index 55eaeee..1a0795f 100644

pc-bios/s390-ccw/cio.h struct tpi_info { · line 131

Quoted 8 lines
pc-bios/s390-ccw/cio.h +1 -1
@@ -125,7 +125,7 @@ struct tpi_info {
     __u32 reserved3  : 12;
     __u32 int_type   : 3;
     __u32 reserved4  : 12;
-} __attribute__ ((packed));
+} __attribute__ ((packed, aligned(4)));
 
 /* channel command word (type 1) */
 struct ccw1 {

Late but still

Signature · 3 lines
Thanks,

David / dhildenb