Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1355162ybn; Wed, 2 Oct 2019 14:57:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxCtjNDLo6PAhboCVZFNcBDM3fh2Gsrts9rPviWrJjEi8pLA6w3Z96GrdEfrh9AlEte++0O X-Received: by 2002:a50:d949:: with SMTP id u9mr6253283edj.142.1570053463328; Wed, 02 Oct 2019 14:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570053463; cv=none; d=google.com; s=arc-20160816; b=eax0BbEAOVMI5OEzUbCdSmvggtRKutWm9AfG+13CZx+39jrnDAPXLPZUOgCz9UNsGi k9EHHKXTYAe3QcALplV4tlvRthw2xhgCdnxkaBOOXfEsmYg/2aRsZhG9aI1iiWp2ZNgL wZkTs+CoXpbQmZfq5oraQlv4IEoXAobm5AfN1JRqQKhJZbOve4zGAkZ9KiDb+tKM/TAn OQzG/D8vZBRz23MgESXMoB5+gXSjV8uBcW15BZKUBv5Emwm+5SVGtVgEN8HaBH+px1OJ DbBtTfEkEUWf3OtgXO7KRNZAut5Z9RtQFTEq0203D1df59pOFDe6IjA0Mwzlb87Nq59s pa+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=nS55Gc+Wv5/nS3zhWqKGsQA+EFTAinrmi2NmXLvOimM=; b=Pqt36px0HGdwcGqBRAyaBLrKdJexHkB/IsxI5+w9BMbJB/Sjze+lEAaiY48jmwtmIT jz6eOMTTUlv73u+N1tpGzp2VpOsCVqk3nHY/sZGWRTTNLRJci2K4P3prMQXdgaujlv/b Y/DVv1EOkblbdWRVYEMQZwB+MqVr/K8+5N2yiZO+gEKGlph9lnbmpgT/QAtZ5XjORVWi id4x925aMZT5B4JA/l7ZBe2NljeVQDG0n46ZWoc0ZbI/6wY2/qBoUYy6VU/gmJ8aXPhx TpYn64gs5wXWFICQ82SDaEm/UXR+F9HnpksUWVW2rujCYS1JipQc9eJioQWhXUow0/RN Hh+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="p5/RX4IY"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a24si222835ejg.127.2019.10.02.14.57.19; Wed, 02 Oct 2019 14:57:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="p5/RX4IY"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729376AbfJBVNb (ORCPT + 99 others); Wed, 2 Oct 2019 17:13:31 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:39278 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729293AbfJBVNb (ORCPT ); Wed, 2 Oct 2019 17:13:31 -0400 Received: by mail-qk1-f193.google.com with SMTP id 4so184637qki.6; Wed, 02 Oct 2019 14:13:29 -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=nS55Gc+Wv5/nS3zhWqKGsQA+EFTAinrmi2NmXLvOimM=; b=p5/RX4IYlDc7ukUBIt6El1HamNmNTdFO1AOqwKivIZtpuB59c9V4J7GnoqgOUeSkQ3 5bxDF5IgF1YRRpSHWaCkbTdbAA0JXIwTJSomNFSwjcGgtfMRb3oKus1wRN4z5SmN+a7R Y8oV9TywyZ5rCm5wrVbjPUsAYTLKI8wnE0vhGeHFBM/9s6wA1O3Uzr8uswpp/Ti4gg8Y m/vIB6JQl7L0JBvxC5cSp8tY05kRmvEYSBQSGfsd4xMpxM0XhHY6M51ltN/BKA/So7Qa ZUFjaPguL1kE3gd1ESJ+CFhsz854H/0b2SLSoACfC7nk4B+JT3oOpc7+sOEcsphEesDJ EAGQ== 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=nS55Gc+Wv5/nS3zhWqKGsQA+EFTAinrmi2NmXLvOimM=; b=LN7mxXhMTSnBV+g/EKjYyLTv8WNbZTbiYJwcwSg1vssZfOygLGWsraZGabPvndzjmM Ph9I/6xjt/hUXSaxwa55cFdvnGwjfdvsC3ZyQO+0wFxdk3u7J31j6bHfqkNmmXnqxne2 sPLhCeX+mFiqtJZzetx5AFLSOocWTc837cAbdtV3ZrHNfTssPdpU6yeZLS/pBtUROEiX uzh2qAs9KQpRpHcOTi1aOG28GhN9xe5DpN0vdNX5OYCxPhdknhV/1B0NT3lCad+BzGxa Hc5GZ3/YjpKmKE4a5T1qOXPBjgQceoppa4ETDEDqXzi59KOappVsbm6VFpooPy5CIf24 8Y4A== X-Gm-Message-State: APjAAAUXKP4iCz7ZbWd7U3wQLSI4IJkNAZOueAIzzxJkEyH8BaBgK3Zu CVewL8z1hFu3azL5Y8rAnpIKuJ8PUu3bQfYzxtM= X-Received: by 2002:a37:4e55:: with SMTP id c82mr897485qkb.437.1570050808374; Wed, 02 Oct 2019 14:13:28 -0700 (PDT) MIME-Version: 1.0 References: <20191002191652.11432-1-kpsingh@chromium.org> In-Reply-To: From: Andrii Nakryiko Date: Wed, 2 Oct 2019 14:13:16 -0700 Message-ID: Subject: Re: [PATCH v2] samples/bpf: Add a workaround for asm_inline To: Song Liu Cc: KP Singh , open list , bpf , Florent Revest , Alexei Starovoitov , Daniel Borkmann , Martin Lau , Yonghong Song , Florent Revest , Rasmus Villemoes , Arnaldo Carvalho de Melo Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 2, 2019 at 2:05 PM Song Liu wrote: > > > > > On Oct 2, 2019, at 1:22 PM, Andrii Nakryiko wrote: > > > > On Wed, Oct 2, 2019 at 12:17 PM KP Singh wrote: > >> > >> From: KP Singh > >> > >> This was added in: > >> > >> commit eb111869301e ("compiler-types.h: add asm_inline definition") > >> > >> and breaks samples/bpf as clang does not support asm __inline. > >> > >> Co-developed-by: Florent Revest > >> Signed-off-by: Florent Revest > >> Signed-off-by: KP Singh > >> --- > >> > >> Changes since v1: > >> > >> - Dropped the rename from asm_workaround.h to asm_goto_workaround.h > >> - Dropped the fix for task_fd_query_user.c as it is updated in > >> https://lore.kernel.org/bpf/20191001112249.27341-1-bjorn.topel@gmail.com/ > >> > >> samples/bpf/asm_goto_workaround.h | 13 ++++++++++++- > >> 1 file changed, 12 insertions(+), 1 deletion(-) > >> > >> diff --git a/samples/bpf/asm_goto_workaround.h b/samples/bpf/asm_goto_workaround.h > >> index 7409722727ca..7048bb3594d6 100644 > >> --- a/samples/bpf/asm_goto_workaround.h > >> +++ b/samples/bpf/asm_goto_workaround.h > >> @@ -3,7 +3,8 @@ > >> #ifndef __ASM_GOTO_WORKAROUND_H > >> #define __ASM_GOTO_WORKAROUND_H > >> > >> -/* this will bring in asm_volatile_goto macro definition > >> +/* > >> + * This will bring in asm_volatile_goto and asm_inline macro definitions > >> * if enabled by compiler and config options. > >> */ > >> #include > >> @@ -13,5 +14,15 @@ > >> #define asm_volatile_goto(x...) asm volatile("invalid use of asm_volatile_goto") > >> #endif > >> > >> +/* > >> + * asm_inline is defined as asm __inline in "include/linux/compiler_types.h" > >> + * if supported by the kernel's CC (i.e CONFIG_CC_HAS_ASM_INLINE) which is not > >> + * supported by CLANG. > >> + */ > >> +#ifdef asm_inline > >> +#undef asm_inline > >> +#define asm_inline asm > >> +#endif > > > > Would it be better to just #undef CONFIG_CC_HAS_ASM_INLINE for BPF programs? > > I guess that is still useful when gcc fully support BPF? Ah, I missed that it's Clang-specific, not BPF target-specific thing. Yeah, then it makes sense. Acked-by: Andrii Nakryiko > > Thanks, > Song >