Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8741429imu; Tue, 4 Dec 2018 13:24:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/UyscWwc7QkKBsfMqN2f99FrFxCDE+vwvltpPMOxsWaKt60uYzT6fjBVG8mpf5oI+UvhJ1s X-Received: by 2002:a63:ca0a:: with SMTP id n10mr18196538pgi.258.1543958641191; Tue, 04 Dec 2018 13:24:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543958641; cv=none; d=google.com; s=arc-20160816; b=Hbb5WI0OTLT1bEdgzJeZDO8s/JjA+oMUWCQh0YtyrzjhhF7Bug2fCz99bpRRBlxsNe tX3EJY9QRi/uCbPAvlOR1bN4ns2KhU8KJ9nDYv2q6D44RxdSl6fhjpKgMBbF5dtqYY2i vBBiIFfIz+yzJ7jWnDnlK9qH8zmoytlruAdNSPuHrK+L2RAxXy2n+KjIpaxhogANsEW/ TJy4c+AlcDHJxCJsI5leXVfowGr5frmAmvOGASjYMmoWCxxaLviQmzQJrvHeywYwjice ntxkR3TSnlZQaSUB3ZIlTE4JYwa4v385CIfifNSav3ANO/1w+t2KoYjB5HcppdTwyBDD thbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Okg2dLAdUq9xzknRgDrH/k6iGHxYSlP2kr+i2uhoW4c=; b=0dSHQ1VeigX8xSa/RVV+K6E35oCXraR4TwuqgGM2lTeDxcJFWmLtSOi+8Q0zYm29PS rFSPhZMaE5j66+7ps+67M3pf6OBukOjkeAUmNr4pNDtjMeP6NDnx4e0K9v2WY3TjT+f8 R3MwN/yzRKNzw9sXrdbndVrMmHdpWuMYZoJZsaCkhJEIOA+XzC+etBS843mnbNwTpEeO kmInCYuO7F0xuSCr0c1OwqPeH+fdjACmgi/mn5jo0NeLNIpw5FEfLXBY9xrJXVAmqoeu gVBnLJDkOeX0L/tWH6aYeCzlklzNVSYkirldHMbtrJISqPn+3ksQUOWfDiXwB71watzI s1PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=bJwh9xQa; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17si16252268pgi.513.2018.12.04.13.23.44; Tue, 04 Dec 2018 13:24:01 -0800 (PST) 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=@google.com header.s=20161025 header.b=bJwh9xQa; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726048AbeLDVVj (ORCPT + 99 others); Tue, 4 Dec 2018 16:21:39 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42787 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbeLDVVi (ORCPT ); Tue, 4 Dec 2018 16:21:38 -0500 Received: by mail-pf1-f194.google.com with SMTP id 64so8840260pfr.9 for ; Tue, 04 Dec 2018 13:21:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Okg2dLAdUq9xzknRgDrH/k6iGHxYSlP2kr+i2uhoW4c=; b=bJwh9xQaiwIdwcdg3WTWOEat47vkaTIHqYf6iKfqjU+V7OWvZGQedfvnTONkZCLO+T 3iNslwneI9t8DiNylQw6l0yhKkNRjjWnU/P2h6SVzFeqttY8pUCIIc+qmAFWr/hfF5Na 5IrAYF0Vutahdbg0tOs7lic8fX+IPFljxwRujRoIgVpy4ZKgv6sTtTBKyI6kIfIGi3Nx GC2+xAJ8QBGkYqYEE/KXvEECgv5qSKPEeb8zKE1rnnDcH/p2btFhw2Xt6f54rqrhWkfq WRez80PKxpnFpkN/nZsampersDAjyhuv04hms+eCknyVDRdBV2o8XARy91q2FxKNolE9 /8gQ== 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:content-transfer-encoding; bh=Okg2dLAdUq9xzknRgDrH/k6iGHxYSlP2kr+i2uhoW4c=; b=tWU2alMtpEudb07eV0AzAPWt+bPEfeYtAU1eKZ8PqdJd23PLQl8gbdO5AVrSKxoBVu CBq7iLSuIefoMwQ1CwGBqGeaabAct/IVPb9kkdyL4LOURyDWofJIfQ528bXtHt/8yNUA q0smWT92RXw8c3NOuTnfrpRw25RBUR517zCqCFoOxdt92mVCnSPookT+JRMhP+ik69Ww oyuGt1m1ko+TV/jBbqtP6B9lwyXsUidlEeOsFz4rSRJhRpvxC2wj6BKRqeAzfKAdKm+x RPr1BxLflgumu720cb/d9v8HmNIiEJ7LvfEBVh+mAfGkveuNRxR+SWUoSIii1iqgz2oa NFQQ== X-Gm-Message-State: AA+aEWZB3OsZqiJt7wJ4UQdAxDkbzG+GTBRSjBcQLUlApR9vrSMQybAL 610gZjXHmg8fLKXw/RhITP9n/6Ppe2Di5l/HYVNMyQ== X-Received: by 2002:a62:7e13:: with SMTP id z19mr21631726pfc.94.1543958496523; Tue, 04 Dec 2018 13:21:36 -0800 (PST) MIME-Version: 1.0 References: <20181128140852.178260-1-liuxiaozhou@bytedance.com> In-Reply-To: From: Nick Desaulniers Date: Tue, 4 Dec 2018 13:21:25 -0800 Message-ID: Subject: Re: [PATCH] Compiler Attributes: move kernel-only attributes into __KERNEL__ To: Miguel Ojeda Cc: liuxiaozhou@bytedance.com, Luc Van Oostenryck , paul.burton@mips.com, Masahiro Yamada , Arnd Bergmann , LKML , Linus Torvalds , Andrew Morton , Greg KH Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 28, 2018 at 9:35 AM Miguel Ojeda wrote: > > Hi Xiaozhou, > > On Wed, Nov 28, 2018 at 3:09 PM Xiaozhou Liu = wrote: > > > > Attributes such as `__gnu_inline' are meant to be used within the > > kernel. When userspace somehow includes > > (eg. tools/bpf), compilation errors would be shown: > > > > "error: unknown type name =E2=80=98__gnu_inline=E2=80=99" > > > > So just move these things into __KERNEL__ and the behavior is kept > > as before. > > That is not exactly correct -- a3f8a30f3f00 moved some attributes to > another file, moving them into __KERNEL__ (in particular,__gnu_inline > is). > > The problem is, instead, that __gnu_inline is not anymore defined > outside __KERNEL__, but something else that uses it is (the inline > macro definition, if I had to guess). > > If your problem is fixed by putting __gnu_inline into __KERNEL__ > again, it means we can simply move the inline definition inside > __KERNEL__ too. That way, we don't pollute userspace users with macro > definitions. > > Having said that, does someone know whether userspace should have > access to those attributes (or rather, other code that uses in turn > those attributes)? This is tricky territory; the kernel is redefining `inline` in headers in order to get __attribute__((gnu_inline)) semantics. If non kernel users include those headers, the kernel may be redefining the semantics of `inline` for those programs (unexpectedly). Admittedly, gnu_inline kind of an edge case so most users might not notice, but that may be an argument for `-f gnu_inline` rather than redefining `inline` in a header. > > Cheers, > Miguel --=20 Thanks, ~Nick Desaulniers