From patchwork Tue Apr 2 21:50:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 139035 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4928A43DC8; Tue, 2 Apr 2024 23:55:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 76905402D5; Tue, 2 Apr 2024 23:55:44 +0200 (CEST) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id 086674025D for ; Tue, 2 Apr 2024 23:55:41 +0200 (CEST) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1e0025ef1efso39231605ad.1 for ; Tue, 02 Apr 2024 14:55:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1712094941; x=1712699741; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lN/P2ynaspZBYC0V2kpB/XNQsVjxxcNkYZCwr4zPgSA=; b=YQPK042+UYJ8l83/fhbumtgfmXFYznw+DTynV6NSGhnAqOUcWOBTqlKk6ZST1LgpYr Cr4mGrymQzc4ThHYaKCzM7of8HwTwrvqFSOKQQocDnXaE5m/oZlXEfqZqSDO+PHJBTOG cSdTrlia2KgLc8IrXJRJI5mqs6BPAS5U+QbR4wHj0pqfYtLQVnhT9REvr3F+hCN8oDD+ OVC7WkeUrq6dGS8NN3mSgIGd/U1vbyUcJHfzla+B+kMKHwF2iH3/YUB+weQLcIf2o4KA Y9AhohAKKQUYgTLuVCV/FqlcGSlmaKOaHWgfWEp6wZg38ydGcykhBt8FD43/+rhTHb1S SkaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712094941; x=1712699741; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lN/P2ynaspZBYC0V2kpB/XNQsVjxxcNkYZCwr4zPgSA=; b=g0sZoqkbq44MEfIXmNp+SV3pJ1e1OE1QleMFoZpb+aABsRxB/5AzlAQlN6IsSAt9Ir chycx1dFEuOQQzGc6K9/KN/8sxRxJuMYzqs7coTC2YS0+PgE5x0WjoA6lxeUOCABrNZI uA8QhwAQxMKBJ3kV2t0tttUbC9WKr0/MvOh+X9oBuTigYQrGmusXqJ04k9Tz/IS8/NJ1 Z76uIcbrqttuYzUJSgtJMG0z4rfPjFFr/7iUDYGsb/xdOGPh4BDVy+7nMFm/kKduggU4 rbE9A2PgqZE4Hjgz+0+NMY3IRfHIjYhzqwA0RlQUs1+c7qNXOYqa+EY25lSO6HuNU+wF jfLQ== X-Gm-Message-State: AOJu0Yx9ySbQeAZbweTeXs/FAB8u/B4Z7w5LmnRowGn3sMYbiY8fnFr3 Na3vxH2hYVZ1Mrb/cRCu0bIW9jNZEmHZf3A5o1WFQAaq6Pqj1Yo6HcPgOlbJ9NTmIAEOsZaK3og Y X-Google-Smtp-Source: AGHT+IGMHxjYu3rXyLfKdHhNmlkytjW7jdVwrNffc6/NRxn+YQ4AXIqyRAPY+DEOrf7vVFyFiCMY3w== X-Received: by 2002:a17:903:2283:b0:1e0:b60e:1a33 with SMTP id b3-20020a170903228300b001e0b60e1a33mr1083018plh.31.1712094941236; Tue, 02 Apr 2024 14:55:41 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id x15-20020a170902820f00b001dddf29b6e8sm11609381pln.299.2024.04.02.14.55.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 14:55:40 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v3 01/30] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy Date: Tue, 2 Apr 2024 14:50:17 -0700 Message-ID: <20240402215502.278838-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402215502.278838-1-stephen@networkplumber.org> References: <20240229225936.483472-1-stephen@networkplumber.org> <20240402215502.278838-1-stephen@networkplumber.org> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Rte_memcpy should not be used for the simple case of copying a fix size structure because it is slower and will hide problems from code analysis tools. Coverity, fortify and other analyzers special case memcpy(). Gcc (and Clang) are smart enough to inline copies which will be faster. Signed-off-by: Stephen Hemminger --- devtools/cocci/rte_memcpy.cocci | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 devtools/cocci/rte_memcpy.cocci diff --git a/devtools/cocci/rte_memcpy.cocci b/devtools/cocci/rte_memcpy.cocci new file mode 100644 index 0000000000..fa1038fc06 --- /dev/null +++ b/devtools/cocci/rte_memcpy.cocci @@ -0,0 +1,11 @@ +// +// rte_memcpy should not be used for simple fixed size structure +// because compiler's are smart enough to inline these. +// +@@ +expression src, dst; constant size; +@@ +( +- rte_memcpy(dst, src, size) ++ memcpy(dst, src, size) +)