From patchwork Mon Jan 30 19:23:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Pattrick X-Patchwork-Id: 1734340 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HdzQYeqP; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P5J5C5lt3z1yhq for ; Tue, 31 Jan 2023 06:23:59 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 0D5166103D; Mon, 30 Jan 2023 19:23:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 0D5166103D Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HdzQYeqP X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9YMI7HYZDlyQ; Mon, 30 Jan 2023 19:23:57 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 23F0A61037; Mon, 30 Jan 2023 19:23:56 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 23F0A61037 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DDF77C0032; Mon, 30 Jan 2023 19:23:55 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2F37AC0032 for ; Mon, 30 Jan 2023 19:23:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 198A86103D for ; Mon, 30 Jan 2023 19:23:53 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 198A86103D X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YCPTjK4Pf7zV for ; Mon, 30 Jan 2023 19:23:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6415A6103A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 6415A6103A for ; Mon, 30 Jan 2023 19:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675106631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h8/vY+YjoWXbQJQRGycLYx9cOX3ztB2q446V3/lxkpI=; b=HdzQYeqPG6ezmhZlCR0vcn4t0kHB08yWS+QajTUDmBy40jEzSjZZzD8n1BQFDHP2g5+aVb h9KPh92sGk7TKra87RqjUoFZWn8Z5P6dmQNEaqcn3QlR/knSWNcaFPNEzZ1kSM7PuLu1Ad ICl4BcEEJFl5+NS0F7orQJ2PYbwQ9AM= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-624-CrJAZQxwMl-5J_myhbjKUg-1; Mon, 30 Jan 2023 14:23:50 -0500 X-MC-Unique: CrJAZQxwMl-5J_myhbjKUg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0E02A2999B26 for ; Mon, 30 Jan 2023 19:23:50 +0000 (UTC) Received: from mpattric.remote.csb (unknown [10.22.16.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id C03BB40C2064; Mon, 30 Jan 2023 19:23:49 +0000 (UTC) From: Mike Pattrick To: dev@openvswitch.org Date: Mon, 30 Jan 2023 14:23:39 -0500 Message-Id: <20230130192341.514178-1-mkp@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v3 1/3] netdev-dummy: Allocate dummy_packet_stream on cacheline boundary X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" UB Sanitizer report: lib/netdev-dummy.c:197:15: runtime error: member access within misaligned address 0x00000217a7f0 for type 'struct dummy_packet_stream', which requires 64 byte alignment ^ #0 dummy_packet_stream_init lib/netdev-dummy.c:197 #1 dummy_packet_stream_create lib/netdev-dummy.c:208 #2 dummy_packet_conn_set_config lib/netdev-dummy.c:436 [...] Signed-off-by: Mike Pattrick --- v3: - used proper free method for non-posix platforms --- lib/netdev-dummy.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c index 72cb95471..921e5d533 100644 --- a/lib/netdev-dummy.c +++ b/lib/netdev-dummy.c @@ -204,7 +204,7 @@ dummy_packet_stream_create(struct stream *stream) { struct dummy_packet_stream *s; - s = xzalloc(sizeof *s); + s = xzalloc_cacheline(sizeof *s); dummy_packet_stream_init(s, stream); return s; @@ -350,7 +350,7 @@ dummy_packet_conn_close(struct dummy_packet_conn *conn) pstream_close(pconn->pstream); for (i = 0; i < pconn->n_streams; i++) { dummy_packet_stream_close(pconn->streams[i]); - free(pconn->streams[i]); + free_cachelines(pconn->streams[i]); } free(pconn->streams); pconn->pstream = NULL; @@ -359,7 +359,7 @@ dummy_packet_conn_close(struct dummy_packet_conn *conn) case ACTIVE: dummy_packet_stream_close(rconn->rstream); - free(rconn->rstream); + free_cacheline(rconn->rstream); rconn->rstream = NULL; reconnect_destroy(rconn->reconnect); rconn->reconnect = NULL; @@ -469,7 +469,7 @@ dummy_pconn_run(struct netdev_dummy *dev) pconn->streams = xrealloc(pconn->streams, ((pconn->n_streams + 1) * sizeof s)); - s = xmalloc(sizeof *s); + s = xmalloc_cacheline(sizeof *s); pconn->streams[pconn->n_streams++] = s; dummy_packet_stream_init(s, new_stream); } else if (error != EAGAIN) { @@ -489,7 +489,7 @@ dummy_pconn_run(struct netdev_dummy *dev) stream_get_name(s->stream), ovs_retval_to_string(error)); dummy_packet_stream_close(s); - free(s); + free_cacheline(s); pconn->streams[i] = pconn->streams[--pconn->n_streams]; } else { i++;