From patchwork Fri Jan 26 16:57:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roberto Bartzen Acosta X-Patchwork-Id: 1891481 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=luizalabs.com header.i=@luizalabs.com header.a=rsa-sha256 header.s=google header.b=gnmnfbjs; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TM3lH3G1gz23gB for ; Sat, 27 Jan 2024 03:57:15 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id D744B41FF6; Fri, 26 Jan 2024 16:57:12 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org D744B41FF6 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=luizalabs.com header.i=@luizalabs.com header.a=rsa-sha256 header.s=google header.b=gnmnfbjs X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id figuy3i8-vdw; Fri, 26 Jan 2024 16:57:12 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 0863A41FF9; Fri, 26 Jan 2024 16:57:11 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0863A41FF9 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E39CCC0077; Fri, 26 Jan 2024 16:57:10 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id EE83AC0037 for ; Fri, 26 Jan 2024 16:57:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C837D41FF6 for ; Fri, 26 Jan 2024 16:57:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C837D41FF6 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S2ga0ijh60PM for ; Fri, 26 Jan 2024 16:57:07 +0000 (UTC) Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by smtp4.osuosl.org (Postfix) with ESMTPS id B9B6A41FC5 for ; Fri, 26 Jan 2024 16:57:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org B9B6A41FC5 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1d730b6943bso3803755ad.2 for ; Fri, 26 Jan 2024 08:57:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=luizalabs.com; s=google; t=1706288226; x=1706893026; darn=openvswitch.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vxYmv52FdrgWcvMRZWkqw7LWILpIBfUF/FfjOQIFwGM=; b=gnmnfbjsyWzZwefGr/GXWSDCSCsmgGye+HSu8uJA5J/BhNSSq2/hYj1PWUVaEeJXX4 hzeCFdQ7rHLHPGjSdq796vRZquBCq7AD1XhshqX/a5deViczR26a9PsLZ2FdiNMGYJS+ 7gu5XyR98IxRwggNgHbMAR9w0lXG0jE8LX3L0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706288226; x=1706893026; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vxYmv52FdrgWcvMRZWkqw7LWILpIBfUF/FfjOQIFwGM=; b=VL8UcGaRPSdfYT4f7qGPChjkzMzl9ms3q8a4hS5NjZTidresqnId1/s2CuimIX4EFi ajRWJvMDCNkm4uskXdG+Jh7XoPqu1+qZds3AzoNFuWF7AchyavLJ+SHIse1L4QZvWlz7 v2DXS3H33fabvXafrV4gbyGNoLjwFPT7kG+FS5jMhQI4GX9wg0snmzBTAHjbElRPR3UE 9pWETuJdggln/eZ+dZR0CkbBZaKLuLX1MGZqi+8QJzlQLpBsUbJdm/teR9992Y2kR/PU +lBloaais7V/CpFMjwPvHh2Enyrb4EARqExUZKPti/YQEoSDg0ozfxH6G7nn+9/ahRoO A2rQ== X-Gm-Message-State: AOJu0YypxKf9rym0ZZDseeUcT9C8DBtUZ5qzUYN4uQLT2pkG+WHMc+hZ j1CdUflVF4Ocp+iGi9R3ZTD5jLJpRB/G4CmzetXEzOrHlpJMWE6B7tIbaoquJcNQ9g4wXE+zBtk 3fnSlRoXX4goTa0rhiNKzzzWeXRMC+JBwUsQFRkmSSIoJR7uidpHGu5iF X-Google-Smtp-Source: AGHT+IH2uD4Rh6SnPcSTtMYEpduIxfhdWl6toaQLC2Yu88xMVbvLaN/ZHfNBIFwymy3HXjvhj2GWNQ== X-Received: by 2002:a17:903:2615:b0:1d4:672f:1f30 with SMTP id jd21-20020a170903261500b001d4672f1f30mr22470plb.78.1706288226100; Fri, 26 Jan 2024 08:57:06 -0800 (PST) Received: from WNL1099LABS421.magazineluiza.intranet ([191.187.213.146]) by smtp.gmail.com with ESMTPSA id w3-20020a170902c78300b001d4b5e444d2sm1168141pla.48.2024.01.26.08.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 08:57:05 -0800 (PST) To: dev@openvswitch.org Date: Fri, 26 Jan 2024 13:57:49 -0300 Message-Id: <20240126165749.2152018-1-roberto.acosta@luizalabs.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovs] Documentation: Adding note about using the jemalloc library. 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: , X-Patchwork-Original-From: Roberto Bartzen Acosta via dev From: Roberto Bartzen Acosta Reply-To: Roberto Bartzen Acosta Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Current version of debian/rules simply uses the default GCC optimization settings during the linkage process. The main problem with this approach is that GCC on OS like Ubuntu Jammy, for example, can enable the -flto=auto flag option during the Open vSwitch building and linking process. In this case, the linked dynamic libraries would need to be compatible with the same lto optimization options, at the risk of not working, according to documentation [1]. However, it could be possible to link to jemalloc using the LTO option but the GIMPLE-bytecode may not work correctly. In this case, it would be necessary to disable the -fbuiltin flag [2] if it is set as default. Updating the reference documentation with the inclusion of possible building problems with libjemalloc and solution suggestions. [1] https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-flto [2] https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html Reported-at: https://bugs.launchpad.net/ubuntu/+source/openvswitch/+bug/2015748 Signed-off-by: Roberto Bartzen Acosta --- Documentation/intro/install/general.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Documentation/intro/install/general.rst b/Documentation/intro/install/general.rst index 19e360d47..ef4e6181d 100644 --- a/Documentation/intro/install/general.rst +++ b/Documentation/intro/install/general.rst @@ -344,6 +344,23 @@ you wish to link with jemalloc add it to LIBS:: $ ./configure LIBS=-ljemalloc +.. note:: + Linking Open vSwitch with the jemalloc shared library may not work as + expected in certain operating system development environments if the GCC + compiler tries to optimize the linking process using the ``-flto`` flag. + You can overrides the automatic compiler decision removing the link-time + optimization by passing ``-fno-lto`` or disabling ``-fno-builtin`` flag since + the jemalloc override standard built-in memory allocation functions such as + malloc, calloc, etc. Both options can solve possible jemalloc linker issues + with pros and cons for each case, feel free to choose the path that appears + best to you. Disabling LTO flag example:: + + $ ./configure LIBS=-ljemalloc CFLAGS=-fno-lto + + Disabling built-in flag example:: + + ./configure LIBS=-ljemalloc CFLAGS=-fno-builtin + .. _general-building: Building