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 2C90DA00C3; Sat, 15 Jan 2022 23:13:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F5D14114F; Sat, 15 Jan 2022 23:13:47 +0100 (CET) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mails.dpdk.org (Postfix) with ESMTP id 744F5410F4 for ; Sat, 15 Jan 2022 23:13:46 +0100 (CET) Received: by mail-pf1-f178.google.com with SMTP id w204so6137615pfc.7 for ; Sat, 15 Jan 2022 14:13:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y06SJ8RHviP4jitV22C7OXICLm+9i+PxZN4v6YEWs6s=; b=p1niUigDUa6/Hg9F8/1G9QgXwFXoW1X7hqzvhnchGnR/h5nQQxINlDbbMPGPF3yRWO a+Odm0O0JDosVYoMjO4QE6pI/YoeHiC/n8Yj0lA8QJeyiTfWl98Nw3d6k1vJ5iU1ZANV 9m+x6Ou0RWfBwjRv7cgO47/M0RXIdcLUEhCY9paviB9MBBzyJOugY6lQ4M10gpUBEw1u aEtDlIc5pL2TzaYyMfKIfX2jeA7xQacIkShxGNUF97+aNaybVQmdPbWCmcCtDUcA7Cq2 3XR+5EuB52Yq/POiLcSWL9nPCNfNOyHB9imQzqyvMKYwEwUFy5HHUuh26BJFe+LXwIaO XsIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y06SJ8RHviP4jitV22C7OXICLm+9i+PxZN4v6YEWs6s=; b=Szd9Bk+c2aja/KZ/oe/VNr7zwFJAPp2eQpYqj7fGwIU8C0lrBEnYGRo1KSt4lg/abe m9JmSnZgDSY38fpCbdLkKkbEfQdiwiWWSL7nLVcqK2lJRzaIjnWR6+4abEoVFKu6Roe9 vFQ7adLtJ28Ljj1kfChIC/MXTKS4uYh/kDBAbGiBpQKOU/5+qU36gLM8WUnUIDIwNEvW enLsfZtPET/T9/49VFWXPHzUz2evshF6eya28dkwRGmAprP8rywLbnJXwa0yMSOCS8KP aMGxuj6AwiCrRcVhWHEz0jjUSkv1+29GfoUzbphigqe7HjWFTpv9vETMYvx0OxjUql5D mj/Q== X-Gm-Message-State: AOAM530LGuO64DKbCMk3An7wVNCPNTn36xM8jrDT5tyLU0YbAWrxJnB/ 8L7hKEgf67u6pjbmmLPrPAu4sA== X-Google-Smtp-Source: ABdhPJz5o9dXQNmQBrPp5ZmdqZPAdOD2DHc9vuQIdmsyLozUveLl9JAejnCq6GgO+0YH7s5icDm9Lw== X-Received: by 2002:a05:6a00:1a86:b0:4c1:3039:16a6 with SMTP id e6-20020a056a001a8600b004c1303916a6mr15022638pfv.5.1642284825582; Sat, 15 Jan 2022 14:13:45 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q8sm9857171pfl.194.2022.01.15.14.13.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jan 2022 14:13:45 -0800 (PST) Date: Sat, 15 Jan 2022 14:13:42 -0800 From: Stephen Hemminger To: Luc Pelletier Cc: bruce.richardson@intel.com, konstantin.ananyev@intel.com, dev@dpdk.org, Xiaoyun Li , stable@dpdk.org Subject: Re: [PATCH v2] eal: fix unaligned loads/stores in rte_memcpy_generic Message-ID: <20220115141342.396a5f3a@hermes.local> In-Reply-To: <20220115213949.449313-1-lucp.at.work@gmail.com> References: <20220115194102.444140-1-lucp.at.work@gmail.com> <20220115213949.449313-1-lucp.at.work@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Sat, 15 Jan 2022 16:39:50 -0500 Luc Pelletier wrote: > diff --git a/lib/eal/x86/include/rte_memcpy.h b/lib/eal/x86/include/rte_memcpy.h > index 1b6c6e585f..e422397e49 100644 > --- a/lib/eal/x86/include/rte_memcpy.h > +++ b/lib/eal/x86/include/rte_memcpy.h > @@ -45,6 +45,23 @@ extern "C" { > static __rte_always_inline void * > rte_memcpy(void *dst, const void *src, size_t n); > > +/** > + * Copy bytes from one location to another, > + * locations should not overlap. > + * Use with unaligned src/dst, and n <= 15. > + */ > +static __rte_always_inline void * > +rte_mov15_or_less_unaligned(void *dst, const void *src, size_t n) > +{ > + void *ret = dst; > + for (; n; n--) { > + *((char *)dst) = *((const char *) src); > + dst = ((char *)dst) + 1; > + src = ((const char *)src) + 1; > + } > + return ret; > +} X86 always allows unaligned access. Irregardless of what tools say. Why impose additional overhead in performance critical code.