From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AFAB644093; Wed, 22 May 2024 05:30:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0BF91402C8; Wed, 22 May 2024 05:30:30 +0200 (CEST) Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by mails.dpdk.org (Postfix) with ESMTP id 4C13F4025C for ; Wed, 22 May 2024 05:30:27 +0200 (CEST) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1edfc57ac0cso6547275ad.3 for ; Tue, 21 May 2024 20:30:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1716348626; x=1716953426; 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=HmSOgtgWS/Zv6CMX3f5yCgcQDSHnZlsPruUu8U5+zn4=; b=Z5joMTBxR2BcmOMFo6tl61teT7+/EmAoZA5hkrILcdTXB/gGLPgEhKAK9U4oq9bkmM 13UiklKPGhm0I46T82pjNQXxghFCCpgJclF5IhPdLRoJiAcakZWVUPeyGbY02xxHfdLB oBiCfoKv3A0xqmLMIuKyQQ8wBmWD07HTm2+C2UqKFnhr7q7fC1B5reGPvkqTE65DsgFl MLzD7b3iPRpaSWEe5X6n7XQ9vevNJH5ewlfgxKSzjYAL7PTkT5hp6tqdVrRQCipZzZGY TPFEt/6zJCoWjQJZsfsJoawjDfjZvR/73Gvq+LiI7f460sEPj6DMOd23nRJAXSzggyAh s+Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716348626; x=1716953426; 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=HmSOgtgWS/Zv6CMX3f5yCgcQDSHnZlsPruUu8U5+zn4=; b=PfbvzdjGYY4yd+Dr7DNj4x2KMFYTgvmB+vgbXuotbx/9Rvoa+8uYib57t7j2BUsFgn kanEz7sEpvNOzgbDPNIvFGZxj6TqqU+Mfctvq68bkbZtJaIF7PjeG3RVouE4IjQR0Lhg eMTXONz9rwzuLCEC60/SyOLQGOVnY1XsVaw/7ACCtZCpn5sXEv/w+fN5YS3WLi79IK0i yiAtRyAc/baoaN4N4kncRz2kD15jODoOplss/jcAoKMQx+uC4LinfJtVufcVcl99WVEc kH2mbCg72PIuTtS/VfH8MvBhc6gjkoeiLQEDN0dmb/OrKqCZGfZhzVg2f55ST2gN5byu qeRQ== X-Gm-Message-State: AOJu0Yz28U5A2tVd7g+rXT8k9D70xJuO3SeMHC2aY15GBVvMl+V4qav3 0TUdz8OWc+qgBpOmmHWM0mlAZkEQx4cEqQ/M4TIwdTvA40cSK4XnH8CIb1APbeE7tDlTD4hSiC7 8L1A= X-Google-Smtp-Source: AGHT+IEVI26Wg6+XrdDm55usmkD9GuWMcSDvJIkX0l3IWjmwPTRbHo8uCVNG3ajzeFX6HMrERu/xuw== X-Received: by 2002:a17:902:eccc:b0:1f2:f8b7:60d1 with SMTP id d9443c01a7336-1f31c9a100dmr9317175ad.26.1716348626373; Tue, 21 May 2024 20:30:26 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f323c70dafsm2264325ad.260.2024.05.21.20.30.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 20:30:26 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v5 01/32] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy Date: Tue, 21 May 2024 20:27:28 -0700 Message-ID: <20240522033009.143100-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240522033009.143100-1-stephen@networkplumber.org> References: <20240403163432.437275-1-stephen@networkplumber.org> <20240522033009.143100-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 need not be used for the simple case of copying a fix size structure because it is not faster and will hide problems from code analysis tools. Coverity, Fortify and other analyzers special case memcpy() and can find issues that rte_memcpy() will hide. Many platforms use memcpy instead of rte_memcpy already. The only reason rte_memcpy() was added in original DPDK was that the older Gcc was doing slower on x86 than the special rte_memcpy() when handling larger size copies. 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) +) -- 2.43.0