Re: New struct sock_common breaks parisc 64 bit compiles with a misalignment

From: $B5HF#1QL@(
Date: Sun Jun 15 2003 - 12:09:20 EST


In article <20030610.091217.112601441.davem@redhat.com> (at Tue, 10 Jun 2003 09:12:17 -0700 (PDT)), "David S. Miller" <davem@redhat.com> says:

> From: James Bottomley <James.Bottomley@SteelEye.com>
> Date: 09 Jun 2003 23:57:46 -0500
>
> A fix that seems to work for me on parisc64 is to move the atomic_t out
> of the end of struct sock_common and back into the two other structures
> (so struct sock_common now ends on 0 mod 8).
>
> I would suggest instead to add the proper alignment attribute
> to the appropriate members of the tw bucket.

Like this?

Index: linux-2.5/include/net/tcp.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/net/tcp.h,v
retrieving revision 1.38
diff -u -r1.38 tcp.h
--- linux-2.5/include/net/tcp.h 7 Jun 2003 00:22:34 -0000 1.38
+++ linux-2.5/include/net/tcp.h 15 Jun 2003 15:50:22 -0000
@@ -164,6 +164,14 @@
  * problems of sockets in such a state on heavily loaded servers, but
  * without violating the protocol specification.
  */
+
+/* Address pair should be aligned to 64-bits boundary to avoid penalties. */
+#if (BITS_PER_LONG == 64)
+# define __tw_aligned __attribute__ ((aligned(8)))
+#else
+# define __tw_aligned
+#endif
+
 struct tcp_tw_bucket {
         /*
          * Now struct sock also uses sock_common, so please just
@@ -184,7 +192,7 @@
         __u16 tw_sport;
         /* Socket demultiplex comparisons on incoming packets. */
         /* these five are in inet_opt */
- __u32 tw_daddr;
+ __u32 __tw_aligned tw_daddr;
         __u32 tw_rcv_saddr;
         __u16 tw_dport;
         __u16 tw_num;

-- 
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jun 15 2003 - 22:00:42 EST