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 X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C4FBC4320A for ; Tue, 27 Jul 2021 21:43:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EAF0760F9B for ; Tue, 27 Jul 2021 21:43:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232511AbhG0Vny (ORCPT ); Tue, 27 Jul 2021 17:43:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231445AbhG0Vnw (ORCPT ); Tue, 27 Jul 2021 17:43:52 -0400 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65F2DC061757; Tue, 27 Jul 2021 14:43:51 -0700 (PDT) Received: by mail-yb1-xb2e.google.com with SMTP id k65so372447yba.13; Tue, 27 Jul 2021 14:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6u6wypJQeJmb/YfTyzmyqM0UJtBE0z6heRiSyMm9WoU=; b=ZwLmxb1TgizpkLWoUujWJlH4yHyMAxPpF7B1gyLjsnAFVyvUuGAl/582R6EQnGqPOQ VJYtZ96O+yh4aOftf1fjI0N6eZvizFHokQl/4bkWhB+9rqRhsyGGmpv9G+814ldsINAj pyThT4+/GMqmDiOvzi4dFzQIx4EgR8ivUE3Mslc/vublLkMoY06AzGHLtFtp+OpfHEdj oVCENJjFGcvOyn5yhHLqjMZF/Ki76bjYjNuy2tR7d871OX0zrCuRjGdkzoTxOUV5fnPa +yTGMKCUtkW7tMrZqa5fM9Hxv267csgf/A1SsTF7O/y+Y4YEnKBOBy2fMZcrqzjybtbn QKAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6u6wypJQeJmb/YfTyzmyqM0UJtBE0z6heRiSyMm9WoU=; b=LM2m3zSBD9SMeY2IGMeapGx2RY+eAYw7JniIflNFA+BhloYPEaZXrtQXDOCSARviid y9HOOOYWn/wBUkMm2418fmxF8vSaNGYn/Hv4bzfKIB0Tat1I5Tpb+OtZzLHpXTRTMNfm 5R7aCYzHq0V2oUAQeaqKHe+S3Ymj8sw+4b7u+IXJwYhnOs9IesTPpOxK4tEIzyCeisZ6 bPbkqzaaBRBVPnbWBiI7t1NactpHh6qoQRHBxEasOwsFizHhiXvKgFR5DSnwJhpzSeJ+ f+LRQkwDJiNJCm0eUnMB3vmWJqxuPTz+BhxKKbK9I6gJWte28JluUd7/Gw5CBgfxiYme MXhQ== X-Gm-Message-State: AOAM532hMqMiNhPUjksmsIsZW6lk1eYsivBDsYyyEAGJe9VTmBXLnZf1 FJ42p7mLY4qdFogPrknPKYYdbqv6mVfahqD7eh8= X-Google-Smtp-Source: ABdhPJz2rkdMm/N4pD3+cl4Wyi4GGBdI0Z2R9PTOr2miyLr3QrjV5+sF/QXS2PdyG9pr1d9ANZ+DmXR8OPMsHNQSAJs= X-Received: by 2002:a25:cdc7:: with SMTP id d190mr32876992ybf.425.1627422230617; Tue, 27 Jul 2021 14:43:50 -0700 (PDT) MIME-Version: 1.0 References: <20210727141119.19812-1-pavo.banicevic@sartura.hr> <20210727141119.19812-2-pavo.banicevic@sartura.hr> In-Reply-To: From: Andrii Nakryiko Date: Tue, 27 Jul 2021 14:43:39 -0700 Message-ID: Subject: Re: [PATCH 1/3] arm: include: asm: swab: mask rev16 instruction for clang To: Nick Desaulniers Cc: Pavo Banicevic , Arnd Bergmann , linux@armlinux.org.uk, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin Lau , Song Liu , Yonghong Song , john fastabend , KP Singh , Nathan Chancellor , Ivan Khoronzhuk , linux-arm-kernel , open list , Networking , bpf , clang-built-linux , matt.redfearn@mips.com, Ingo Molnar , dvlasenk@redhat.com, Juraj Vijtiuk , robert.marko@sartura.hr, Luka Perkov , Jakov Petrina Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 27, 2021 at 10:53 AM Nick Desaulniers wrote: > > On Tue, Jul 27, 2021 at 7:12 AM Pavo Banicevic > wrote: > > > > From: Ivan Khoronzhuk > > > > The samples/bpf with clang -emit-llvm reuses linux headers to build > > bpf samples, and this w/a only for samples (samples/bpf/Makefile > > CLANG-bpf). > > > > It allows to build samples/bpf for arm bpf using clang. > > In another way clang -emit-llvm generates errors like: > > > > CLANG-bpf samples/bpf/tc_l2_redirect_kern.o > > :1:2: error: invalid register/token name > > rev16 r3, r0 > > > > This decision is arguable, probably there is another way, but > > it doesn't have impact on samples/bpf, so it's easier just ignore > > it for clang, at least for now. > > NACK > > The way to fix these is to sort out the header includes, not turning > off arbitrary things that are used by the actual kernel build for 32b > ARM. Would it be too horrible to just get rid of `clang -emit-llvm` and use vmlinux.h (we don't need to do CO-RE, btw, just generate vmlinux.h from the matching kernel)? Kumar has already started moving in that direction in his recent patch set ([0]). Would that get rid of all these issues? [0] https://patchwork.kernel.org/project/netdevbpf/list/?series=519281&state=* > > > > > Signed-off-by: Ivan Khoronzhuk > > --- > > arch/arm/include/asm/swab.h | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/arch/arm/include/asm/swab.h b/arch/arm/include/asm/swab.h > > index c6051823048b..a9fd9cd33d5e 100644 > > --- a/arch/arm/include/asm/swab.h > > +++ b/arch/arm/include/asm/swab.h > > @@ -25,8 +25,11 @@ static inline __attribute_const__ __u32 __arch_swahb32(__u32 x) > > __asm__ ("rev16 %0, %1" : "=r" (x) : "r" (x)); > > return x; > > } > > + > > +#ifndef __clang__ > > #define __arch_swahb32 __arch_swahb32 > > #define __arch_swab16(x) ((__u16)__arch_swahb32(x)) > > +#endif > > > > static inline __attribute_const__ __u32 __arch_swab32(__u32 x) > > { > > -- > > 2.32.0 > > > > > -- > Thanks, > ~Nick Desaulniers