From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43773C00140 for ; Fri, 5 Aug 2022 16:30:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241325AbiHEQaU (ORCPT ); Fri, 5 Aug 2022 12:30:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241522AbiHEQaE (ORCPT ); Fri, 5 Aug 2022 12:30:04 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCE5179ECE for ; Fri, 5 Aug 2022 09:29:52 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id e13so3976254edj.12 for ; Fri, 05 Aug 2022 09:29:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Nk4tkar6FQCklwHX1NANYf26V0QQZYpFM8xIdydL27g=; b=evx3+bJ4FbDQO1utt7AIkpXgtLAgg0Zl+ei+DcDS6dsPZLuUnqtrEPPBuSbh/vi2wv hwKNCXU4UKhHtyU+LtR/1X5rLbMspQvPUNTSaiBnD4wI1VcdsanKrt5c9vU6NvxWRtTj 3/4dKhTAADh1mBnnMpqjG3oagmrHvdf6RtaBftb8eqYQPo/LV6/3fIgSmq9NlsJDTEvX 6YrVjlfApaFhzT9kjqv9c93KCsp/bUalT/AjWP/NiJKPnAl0+Kni6+E/MncLYx1X4fSY 93vVCiyf0FgPLhQks2CUuraMi7icTPmqKsRq2WP8eaRmh1pujeLD11Fyh1SWWUJqNsnC B4Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Nk4tkar6FQCklwHX1NANYf26V0QQZYpFM8xIdydL27g=; b=l23fWeU7XIuqy9b8R/jZ5RwPuvvOktlGN94i7Cx2fMZrAqapNkpwqoQD5m7LSKRbHc YxTCixGT80tNZivxE4QTu6tKGcVN+Jz/DvzBFfLLzeC3nrxWg6A4vjt+UslDtrCgbeUS WPz9AcbErZpwFYMGR5mB9nI15jJl7fjPs8eqwj8Nlsa9P39XaGFC8duTHONT2C2fmxsc gKas6Hq32umzF5PtKatxCzTEUeFdCo5qvFfdpXUt32YQmR+cxI5qYlPVgz6VxnwTLo5d JDXQkF+LWKRbbd8J5KVpKjoUE5pUtbBQeiHHF2HrAnLr10p0vL9nTlMl3n/aaCyXuzm/ u6QA== X-Gm-Message-State: ACgBeo2qvB8AXdqEhn6O2G/p+4gyEd4sC4fOoOSB/fuJFvQaQMYbjhUd BlsPtULi60mQjrcKwmq0gCHCB7mozyPYqMqqsAKgJpPe X-Google-Smtp-Source: AA6agR61VsVwonVqdFPw96Zw1uRKIWHsneA7D43V0cRzo2/CTdlWfqdIM9adnOSbrScHqSuT2wKnJqFk+tXwXyzhsW4= X-Received: by 2002:a50:fb13:0:b0:43c:ef2b:d29 with SMTP id d19-20020a50fb13000000b0043cef2b0d29mr7460429edq.378.1659716991358; Fri, 05 Aug 2022 09:29:51 -0700 (PDT) MIME-Version: 1.0 References: <20220726184706.954822-1-joannelkoong@gmail.com> <20220726184706.954822-4-joannelkoong@gmail.com> In-Reply-To: From: Joanne Koong Date: Fri, 5 Aug 2022 09:29:40 -0700 Message-ID: Subject: Re: [PATCH bpf-next v1 3/3] selftests/bpf: tests for using dynptrs to parse skb and xdp buffers To: Alexei Starovoitov Cc: Andrii Nakryiko , bpf , Andrii Nakryiko , Daniel Borkmann , Alexei Starovoitov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Thu, Aug 4, 2022 at 11:45 AM Alexei Starovoitov wrote: > > On Wed, Aug 3, 2022 at 9:11 AM Joanne Koong wrote: > > > > > > __builtin_memcpy() is best. When we write just "memcpy()" we still > > > rely on compiler to actually optimizing that to __builtin_memcpy(), > > > because there is no memcpy() (we'd get unrecognized extern error if > > > compiler actually emitted call to memcpy()). > > > > Ohh I see, thanks for the explanation! > > > > I am going to do some selftests cleanup this week, so I'll change the > > other usages of memcpy() to __builtin_memcpy() as part of that clean > > up. > > builtin_memcpy might be doing single byte copy when > alignment is not known which is often the case when > working with packets. > If we do this cleanup, let's copy-paste cilium's memcpy > helper that does 8 byte copy. > It's much better than builtin_memcpy. > https://github.com/cilium/cilium/blob/master/bpf/include/bpf/builtins.h Maybe we should have a separate patchset to changing to use cilium's other builtins as well (eg memzero, memcmp, memmove); I'll leave the memcpy() -> __builtin_memcpy() changes to be part of that patchset.