* [PATCH] tcp: Disable optimisations for tcp_hash()
@ 2023-02-22 12:16 Stefano Brivio
0 siblings, 0 replies; only message in thread
From: Stefano Brivio @ 2023-02-22 12:16 UTC (permalink / raw)
To: passt-dev
I'm not sure if we're breaking some aliasing rule here, but with gcc
12.2.1 on x86_64 and -flto, the siphash_20b() call in tcp_hash()
doesn't see the connection address -- it gets all zeroes instead.
Fix this temporarily by disabling optimisations for this tcp_hash().
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
tcp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tcp.c b/tcp.c
index 81468d9..803c2c4 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1185,6 +1185,9 @@ static int tcp_hash_match(const struct tcp_tap_conn *conn,
#if TCP_HASH_NOINLINE
__attribute__((__noinline__)) /* See comment in Makefile */
#endif
+__attribute__((optimize("O0"))) /* TODO: with -O2 and -flto on gcc 12.2,
+ * siphash_20b() doesn't see 'addr', why?
+ */
static unsigned int tcp_hash(const struct ctx *c, const union inany_addr *addr,
in_port_t tap_port, in_port_t sock_port)
{
--
@@ -1185,6 +1185,9 @@ static int tcp_hash_match(const struct tcp_tap_conn *conn,
#if TCP_HASH_NOINLINE
__attribute__((__noinline__)) /* See comment in Makefile */
#endif
+__attribute__((optimize("O0"))) /* TODO: with -O2 and -flto on gcc 12.2,
+ * siphash_20b() doesn't see 'addr', why?
+ */
static unsigned int tcp_hash(const struct ctx *c, const union inany_addr *addr,
in_port_t tap_port, in_port_t sock_port)
{
--
2.39.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-22 12:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-22 12:16 [PATCH] tcp: Disable optimisations for tcp_hash() Stefano Brivio
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).