mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* v3.18-rc5 build failure on ppc64 in Documentation/mic/mpssd/mpssd.o
@ 2014-11-20  0:07 Seth Jennings
  2014-11-20 10:49 ` Jiri Kosina
  0 siblings, 1 reply; 4+ messages in thread
From: Seth Jennings @ 2014-11-20  0:07 UTC (permalink / raw)
  To: Peter Foley; +Cc: Jiri Kosina, Greg Kroah-Hartman, linux-doc, linux-kernel

One or more in the following commit set in the 3.18 merge window is causing
build failure on ppc64 with the default config:

7b345771ba921361b318e95bf21b257c65ac141c Documentation: update include path for mpssd
8c2b0dc83d9840da4d993a5dbb15c5974ad5a188 Documentation: support glibc versions without htole macros
6ab0e475f1f38b6be90aff4ef3ebf928c4a73dc8 Documentation: fix misc. warnings
adb19fb66eeebac07fe37d968725bb8906dadb8e Documentation: add makefiles for more targets

Building v3.18-rc5 and I have glibc 2.17.

The problem is that for big endian, the htole* macros are not simple compile
time transforms by the precompiler, but rather block code that must be executed
in function context.

Build errors:
===
  HOSTCC  Documentation/mic/mpssd/mpssd.o
In file included from /usr/include/bits/byteswap.h:34:0,
                 from /usr/include/endian.h:60,
                 from /usr/include/bits/waitstatus.h:64,
                 from /usr/include/stdlib.h:42,
                 from Documentation/mic/mpssd/mpssd.c:23:
Documentation/mic/mpssd/mpssd.c:93:10: error: braced-group within expression allowed only inside a function
   .num = htole16(MIC_VRING_ENTRIES),
          ^
Documentation/mic/mpssd/mpssd.c:96:10: error: braced-group within expression allowed only inside a function
   .num = htole16(MIC_VRING_ENTRIES),
          ^
Documentation/mic/mpssd/mpssd.c:113:10: error: braced-group within expression allowed only inside a function
   .num = htole16(MIC_VRING_ENTRIES),
          ^
Documentation/mic/mpssd/mpssd.c:116:10: error: braced-group within expression allowed only inside a function
   .num = htole16(MIC_VRING_ENTRIES),
          ^
Documentation/mic/mpssd/mpssd.c:119:3: error: initializer element is not constant
   .host_features = htole32(
   ^
Documentation/mic/mpssd/mpssd.c:119:3: error: (near initialization for ‘virtnet_dev_page.host_features’)
In file included from /usr/include/bits/byteswap.h:34:0,
                 from /usr/include/endian.h:60,
                 from /usr/include/bits/waitstatus.h:64,
                 from /usr/include/stdlib.h:42,
                 from Documentation/mic/mpssd/mpssd.c:23:
Documentation/mic/mpssd/mpssd.c:146:10: error: braced-group within expression allowed only inside a function
   .num = htole16(MIC_VRING_ENTRIES),
          ^
Documentation/mic/mpssd/mpssd.c:149:3: error: initializer element is not constant
   htole32(1<<VIRTIO_BLK_F_SEG_MAX),
   ^
Documentation/mic/mpssd/mpssd.c:149:3: error: (near initialization for ‘virtblk_dev_page.host_features’)
Documentation/mic/mpssd/mpssd.c:151:3: error: initializer element is not constant
   .seg_max = htole32(MIC_VRING_ENTRIES - 2),
   ^
Documentation/mic/mpssd/mpssd.c:151:3: error: (near initialization for ‘virtblk_dev_page.blk_config.seg_max’)
Documentation/mic/mpssd/mpssd.c:152:3: error: initializer element is not constant
   .capacity = htole64(0),
   ^
Documentation/mic/mpssd/mpssd.c:152:3: error: (near initialization for ‘virtblk_dev_page.blk_config.capacity’)
make[3]: *** [Documentation/mic/mpssd/mpssd.o] Error 1
===

Reverting the commits fixes the issue, however, a more targeted approach could
just skip make on Documentation/mic/mpssd/ until the endianness issue is
resolved. Or something else...

Thanks,
Seth

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

* Re: v3.18-rc5 build failure on ppc64 in Documentation/mic/mpssd/mpssd.o
  2014-11-20  0:07 v3.18-rc5 build failure on ppc64 in Documentation/mic/mpssd/mpssd.o Seth Jennings
@ 2014-11-20 10:49 ` Jiri Kosina
  2014-12-04 16:01   ` [PATCH] Documentation/mic/mpssd: fix compile error on BE platforms Dan Streetman
  0 siblings, 1 reply; 4+ messages in thread
From: Jiri Kosina @ 2014-11-20 10:49 UTC (permalink / raw)
  To: Seth Jennings
  Cc: Peter Foley, Greg Kroah-Hartman, linux-doc, linux-kernel,
	Jonathan Corbet


[ adding John to CC ]

On Wed, 19 Nov 2014, Seth Jennings wrote:

> One or more in the following commit set in the 3.18 merge window is causing
> build failure on ppc64 with the default config:
> 
> 7b345771ba921361b318e95bf21b257c65ac141c Documentation: update include path for mpssd
> 8c2b0dc83d9840da4d993a5dbb15c5974ad5a188 Documentation: support glibc versions without htole macros
> 6ab0e475f1f38b6be90aff4ef3ebf928c4a73dc8 Documentation: fix misc. warnings
> adb19fb66eeebac07fe37d968725bb8906dadb8e Documentation: add makefiles for more targets
> 
> Building v3.18-rc5 and I have glibc 2.17.
> 
> The problem is that for big endian, the htole* macros are not simple compile
> time transforms by the precompiler, but rather block code that must be executed
> in function context.
> 
> Build errors:
> ===
>   HOSTCC  Documentation/mic/mpssd/mpssd.o
> In file included from /usr/include/bits/byteswap.h:34:0,
>                  from /usr/include/endian.h:60,
>                  from /usr/include/bits/waitstatus.h:64,
>                  from /usr/include/stdlib.h:42,
>                  from Documentation/mic/mpssd/mpssd.c:23:
> Documentation/mic/mpssd/mpssd.c:93:10: error: braced-group within expression allowed only inside a function
>    .num = htole16(MIC_VRING_ENTRIES),
>           ^
> Documentation/mic/mpssd/mpssd.c:96:10: error: braced-group within expression allowed only inside a function
>    .num = htole16(MIC_VRING_ENTRIES),
>           ^
> Documentation/mic/mpssd/mpssd.c:113:10: error: braced-group within expression allowed only inside a function
>    .num = htole16(MIC_VRING_ENTRIES),
>           ^
> Documentation/mic/mpssd/mpssd.c:116:10: error: braced-group within expression allowed only inside a function
>    .num = htole16(MIC_VRING_ENTRIES),
>           ^
> Documentation/mic/mpssd/mpssd.c:119:3: error: initializer element is not constant
>    .host_features = htole32(
>    ^
> Documentation/mic/mpssd/mpssd.c:119:3: error: (near initialization for ‘virtnet_dev_page.host_features’)
> In file included from /usr/include/bits/byteswap.h:34:0,
>                  from /usr/include/endian.h:60,
>                  from /usr/include/bits/waitstatus.h:64,
>                  from /usr/include/stdlib.h:42,
>                  from Documentation/mic/mpssd/mpssd.c:23:
> Documentation/mic/mpssd/mpssd.c:146:10: error: braced-group within expression allowed only inside a function
>    .num = htole16(MIC_VRING_ENTRIES),
>           ^
> Documentation/mic/mpssd/mpssd.c:149:3: error: initializer element is not constant
>    htole32(1<<VIRTIO_BLK_F_SEG_MAX),
>    ^
> Documentation/mic/mpssd/mpssd.c:149:3: error: (near initialization for ‘virtblk_dev_page.host_features’)
> Documentation/mic/mpssd/mpssd.c:151:3: error: initializer element is not constant
>    .seg_max = htole32(MIC_VRING_ENTRIES - 2),
>    ^
> Documentation/mic/mpssd/mpssd.c:151:3: error: (near initialization for ‘virtblk_dev_page.blk_config.seg_max’)
> Documentation/mic/mpssd/mpssd.c:152:3: error: initializer element is not constant
>    .capacity = htole64(0),
>    ^
> Documentation/mic/mpssd/mpssd.c:152:3: error: (near initialization for ‘virtblk_dev_page.blk_config.capacity’)
> make[3]: *** [Documentation/mic/mpssd/mpssd.o] Error 1
> ===
> 
> Reverting the commits fixes the issue, however, a more targeted approach could
> just skip make on Documentation/mic/mpssd/ until the endianness issue is
> resolved. Or something else...
> 
> Thanks,
> Seth
> 

-- 
Jiri Kosina
SUSE Labs

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

* [PATCH] Documentation/mic/mpssd: fix compile error on BE platforms
  2014-11-20 10:49 ` Jiri Kosina
@ 2014-12-04 16:01   ` Dan Streetman
  2014-12-04 21:33     ` Ashutosh Dixit
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Streetman @ 2014-12-04 16:01 UTC (permalink / raw)
  To: Jonathan Corbet, Jiri Kosina
  Cc: Dan Streetman, Greg Kroah-Hartman, Peter Foley, Seth Jennings,
	Randy Dunlap, Ashutosh Dixit, Caz Yokoyama,
	Dasaratharaman Chandramouli, Sudeep Dutt, linux-doc,
	linux-kernel

Change any use of htole* macro in static context to instead manually check
for endianness and use __bswap_constant_* macro instead.

The current glibc definitions of the htole* macros don't allow their use
in a static context; on big endian systems the build fails with:

  HOSTCC  Documentation/mic/mpssd/mpssd.o
In file included from /usr/include/bits/byteswap.h:34:0,
                 from /usr/include/endian.h:60,
                 from /usr/include/bits/waitstatus.h:64,
                 from /usr/include/stdlib.h:42,
                 from .../Documentation/mic/mpssd/mpssd.c:23:
.../Documentation/mic/mpssd/mpssd.c:93:10:
error: braced-group within expression allowed only inside a function
   .num = htole16(MIC_VRING_ENTRIES),

...and...

.../Documentation/mic/mpssd/mpssd.c:119:3:
error: initializer element is not constant
   .host_features = htole32(

I also opened a glibc bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=17679

But this patch is still needed to prevent build failures with the current
glibc htole* macro definitions.

Signed-off-by: Dan Streetman <ddstreet@ieee.org>
---
 Documentation/mic/mpssd/mpssd.c | 54 ++++++++++++++++++++++++++++-------------
 1 file changed, 37 insertions(+), 17 deletions(-)

diff --git a/Documentation/mic/mpssd/mpssd.c b/Documentation/mic/mpssd/mpssd.c
index 3c5c379..b6cfbf0 100644
--- a/Documentation/mic/mpssd/mpssd.c
+++ b/Documentation/mic/mpssd/mpssd.c
@@ -77,6 +77,33 @@ static struct mic_info mic_list;
 #define VIRTIO_NET_HDR_F_DATA_VALID	2	/* Csum is valid */
 #endif
 
+#define VIRTNET_HOST_FEATURES			\
+	(1 << VIRTIO_NET_F_CSUM |		\
+	1 << VIRTIO_NET_F_GSO |			\
+	1 << VIRTIO_NET_F_GUEST_TSO4 |		\
+	1 << VIRTIO_NET_F_GUEST_TSO6 |		\
+	1 << VIRTIO_NET_F_GUEST_ECN |		\
+	1 << VIRTIO_NET_F_GUEST_UFO)
+
+/* Currently, glibc htole* macros don't allow use in static context,
+ * so we check and use __bswap_constant_* instead
+ */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# define MIC_VRING_ENTRIES_LE		MIC_VRING_ENTRIES
+# define VIRTNET_HOST_FEATURES_LE	VIRTNET_HOST_FEATURES
+# define VIRTBLK_HOST_FEATURES_LE	(1<<VIRTIO_BLK_F_SEG_MAX)
+# define VIRTBLK_CONFIG_SEG_MAX_LE	(MIC_VRING_ENTRIES - 2)
+#else /* __BIG_ENDIAN */
+# define MIC_VRING_ENTRIES_LE		\
+		__bswap_constant_16(MIC_VRING_ENTRIES)
+# define VIRTNET_HOST_FEATURES_LE	\
+		__bswap_constant_32(VIRTNET_HOST_FEATURES)
+# define VIRTBLK_HOST_FEATURES_LE	\
+		__bswap_constant_32(1<<VIRTIO_BLK_F_SEG_MAX)
+# define VIRTBLK_CONFIG_SEG_MAX_LE	\
+		__bswap_constant_32(MIC_VRING_ENTRIES - 2)
+#endif
+
 static struct {
 	struct mic_device_desc dd;
 	struct mic_vqconfig vqconfig[2];
@@ -90,10 +117,10 @@ static struct {
 		.config_len = sizeof(virtcons_dev_page.cons_config),
 	},
 	.vqconfig[0] = {
-		.num = htole16(MIC_VRING_ENTRIES),
+		.num = MIC_VRING_ENTRIES_LE,
 	},
 	.vqconfig[1] = {
-		.num = htole16(MIC_VRING_ENTRIES),
+		.num = MIC_VRING_ENTRIES_LE,
 	},
 };
 
@@ -110,21 +137,15 @@ static struct {
 		.config_len = sizeof(virtnet_dev_page.net_config),
 	},
 	.vqconfig[0] = {
-		.num = htole16(MIC_VRING_ENTRIES),
+		.num = MIC_VRING_ENTRIES_LE,
 	},
 	.vqconfig[1] = {
-		.num = htole16(MIC_VRING_ENTRIES),
+		.num = MIC_VRING_ENTRIES_LE,
 	},
 #if GSO_ENABLED
-		.host_features = htole32(
-		1 << VIRTIO_NET_F_CSUM |
-		1 << VIRTIO_NET_F_GSO |
-		1 << VIRTIO_NET_F_GUEST_TSO4 |
-		1 << VIRTIO_NET_F_GUEST_TSO6 |
-		1 << VIRTIO_NET_F_GUEST_ECN |
-		1 << VIRTIO_NET_F_GUEST_UFO),
+	.host_features = VIRTNET_HOST_FEATURES_LE,
 #else
-		.host_features = 0,
+	.host_features = 0,
 #endif
 };
 
@@ -143,13 +164,12 @@ static struct {
 		.config_len = sizeof(virtblk_dev_page.blk_config),
 	},
 	.vqconfig[0] = {
-		.num = htole16(MIC_VRING_ENTRIES),
+		.num = MIC_VRING_ENTRIES_LE,
 	},
-	.host_features =
-		htole32(1<<VIRTIO_BLK_F_SEG_MAX),
+	.host_features = VIRTBLK_HOST_FEATURES_LE,
 	.blk_config = {
-		.seg_max = htole32(MIC_VRING_ENTRIES - 2),
-		.capacity = htole64(0),
+		.seg_max = VIRTBLK_CONFIG_SEG_MAX_LE,
+		.capacity = 0,
 	 }
 };
 
-- 
1.8.3.1


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

* Re: [PATCH] Documentation/mic/mpssd: fix compile error on BE platforms
  2014-12-04 16:01   ` [PATCH] Documentation/mic/mpssd: fix compile error on BE platforms Dan Streetman
@ 2014-12-04 21:33     ` Ashutosh Dixit
  0 siblings, 0 replies; 4+ messages in thread
From: Ashutosh Dixit @ 2014-12-04 21:33 UTC (permalink / raw)
  To: Dan Streetman
  Cc: Jonathan Corbet, Jiri Kosina, Greg Kroah-Hartman, Peter Foley,
	Seth Jennings, Randy Dunlap, Yokoyama, Caz, Chandramouli,
	Dasaratharaman, Dutt, Sudeep, linux-doc, linux-kernel

On Thu, Dec 04 2014 at 08:01:15 AM, Dan Streetman <ddstreet@ieee.org> wrote:
> Change any use of htole* macro in static context to instead manually check
> for endianness and use __bswap_constant_* macro instead.
>
> The current glibc definitions of the htole* macros don't allow their use
> in a static context; on big endian systems the build fails with:

Instead of building Documentation/mic/mpssd for all architectures, I
have submitted a patch which would build it only for x86_64 since that
is the only place where it will ever be used. This would resolve this
and future builds breaks and also make this patch unnecessary. The
maintainers can decide to accept either or these patches, or even both.

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

end of thread, other threads:[~2014-12-04 21:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-20  0:07 v3.18-rc5 build failure on ppc64 in Documentation/mic/mpssd/mpssd.o Seth Jennings
2014-11-20 10:49 ` Jiri Kosina
2014-12-04 16:01   ` [PATCH] Documentation/mic/mpssd: fix compile error on BE platforms Dan Streetman
2014-12-04 21:33     ` Ashutosh Dixit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome