Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1926682imu; Wed, 28 Nov 2018 18:17:45 -0800 (PST) X-Google-Smtp-Source: AFSGD/V/VwCdjpaWfGaBMBox0UogBYpac2rNWrPDx8UCVqpp0HjWuPz+x7no4vBInzwl5CI5RbBA X-Received: by 2002:a17:902:4025:: with SMTP id b34mr39714901pld.181.1543457865639; Wed, 28 Nov 2018 18:17:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543457865; cv=none; d=google.com; s=arc-20160816; b=TSOx0xEQmvy5b5PCnL3/Sk1ger1zL0ysIuIdYNbcqep650XsryHiq1K3DGKfS8A9dF AHKbMv1pHM7BijxP4cgw1qEXoUKv9Swywv0vKW+4MRCFjJDIWYK3HoUTF9RA948yw1yO XXJDhmNjHwmTckN8eguHPlPbusUCb05JxiUhiF4bavzM4Tl5OkdvEmgY8rpauwlNE10v 9w8SHS/ZStf8f8ZiT5kFztt7pUpIdSJjg5wVUGNMLoA0aY/hZo2ufR4YJOm6IO9U9pcZ cwaih0u98beET0I4aKgQmQ1rnuSic3jHTfw15UQaEgwXsbVlV64WwgF+iTSis/kvRkDJ e0Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IPR5nIyHZDdPLDZfkU2TiFWAFZrkV8aoha9yy8TDNg0=; b=tzHQJrfEzUY/sugn4Ul8KKHk+n2Qqvf302h+EgQgK4ndRhPlyq2vypfSqhCXNly586 IhMX0/+eEB1dbN6zxD/b7lhl+XJqmXX3Kt0QnoMSD08SPYfp3Md/gxKGsUDVm7fOWfDd qI4thYGPBrDCFuOnH14t/jcAPpyvqPXcr6BmaANapDWvAEAosqAPzyySdFAPMNlmyHnV HwK1ar5o/28XvXV/1E0QJLcaRT/EUBdseA2KWncHhETPicSNMODwzn6f7uU+f1S4s5p9 LwboczcavpB8h56SMkLeEm3nwuG7hrhUsM+VTymsv3bYPvzRoAgiYUkrh2Fdg2rxpquZ 6iWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UJJKkQJf; 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 a12si545297pll.112.2018.11.28.18.17.29; Wed, 28 Nov 2018 18:17:45 -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=@gmail.com header.s=20161025 header.b=UJJKkQJf; 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 S1727529AbeK2NUh (ORCPT + 99 others); Thu, 29 Nov 2018 08:20:37 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38330 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726795AbeK2NUg (ORCPT ); Thu, 29 Nov 2018 08:20:36 -0500 Received: by mail-pf1-f194.google.com with SMTP id q1so218847pfi.5; Wed, 28 Nov 2018 18:16:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=IPR5nIyHZDdPLDZfkU2TiFWAFZrkV8aoha9yy8TDNg0=; b=UJJKkQJfCb66cMGRj8enZVuby41zZmg55ovQgw9hENmQOjOFgxdMpnx5YsXVNCa2CF 2eGm8lrswYxRnW7Cv8mWNQcMRu/ZQHVxSWXcUIm2HAXFGCThyvi4FDlrIfEK0G86sxB/ J43YmTDhvS80om2exn2d3rmp3PvOGmiJHLdSE+3JNTRxrFLBDeO/++q48tV7Pde8nXEa k0jLzSRvCsr5fbvfex7+1uSBHC2ZhcdzMWX9q/BaqOt06oEJbubpiH0VfwTfOQJfefxc GYVPJzIGwmTXii0y3ljU7YQOrRTVtpaO+0pYVNaARZb+m3j5lnPbqeHg/hp/bth6jiRK TlpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=IPR5nIyHZDdPLDZfkU2TiFWAFZrkV8aoha9yy8TDNg0=; b=WdvHdMe5IC4JDX/A9lR1VXhElaC+teGdOyxFDgCHntRqhqh++agk4/l61PrrjiKUn7 jklt9d9gQYfyZ762wrZuYs965gVuOa/3/2ZSjs+oJyD/kg47XAdwqj/mN+Dr0Zy4Z0Ba 3lgnlZ+c7HzFaX68N2Q6d4yk/F5Ctont4GTCJdvyIKICQ0hAw4Sw3oFRX7HcTQQPIqp3 JveQoz2xwQZWPma6PlLUL4dXy28XPo/bWQPFq+cem7PvGirvmCnRiqziwgWB+XSDpJN9 t72O+J9qfG7uOinMs49Ru3hy9GYVnTCAPO+7pQvroh4vncTUVI9ZQohqZFk+OfnfpN5P RUig== X-Gm-Message-State: AA+aEWYuZFkE05pcB2zGA+xajadO/lvGB+mb4ceWQOjWcokdNdQQ7MSm o1lUR8L7uKCKJA4HajyA3AI= X-Received: by 2002:a63:6506:: with SMTP id z6mr35160024pgb.334.1543457813424; Wed, 28 Nov 2018 18:16:53 -0800 (PST) Received: from bytedancedeMacBook-Air.local ([61.120.150.66]) by smtp.gmail.com with ESMTPSA id m65sm359118pfg.180.2018.11.28.18.16.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 18:16:52 -0800 (PST) Date: Thu, 29 Nov 2018 10:16:35 +0800 From: Xiaozhou Liu To: Miguel Ojeda Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, jakub.kicinski@netronome.com, quentin.monnet@netronome.com Subject: Re: [PATCH] Compiler Attributes: move kernel-only attributes into __KERNEL__ Message-ID: <20181129021635.rzmehzzfgt2jvpgi@bytedancedeMacBook-Air.local> References: <20181128140852.178260-1-liuxiaozhou@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Miguel, On Wed, Nov 28, 2018 at 06:35:18PM +0100, 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 ‘__gnu_inline’" > > > > So just move these things into __KERNEL__ and the behavior is kept > > as before. By `these' I mean inline and the like, to be clear. > That is not exactly correct -- a3f8a30f3f00 moved some attributes to > another file, moving them into __KERNEL__ (in particular,__gnu_inline > is). Yes, that is what a3f8a30f3f00 did. Sorry. Turns out the commits in question are 815f0ddb346c and a3f8a30f3f00. > 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). Yes and no. Let's recall the whole story. Before 815f0ddb346c("include/linux/compiler*.h: make compiler-*.h mutually exclusive"), __gnu_inline and inline were both *in* __KERNEL__ as the were in , which was entirely put to __KERNEL__ in . Everything was fine. Then 815f0ddb346c moved inline and __gnu_inline *out* of __KERNEL__ and put them in so userspace could see them both. Not sure if it's intended behavior, but everything looked fine. Then a3f8a30f3f00 moved __gnu_inline back into __KERNEL__ and left inline behind. Since inline depends on __gnu_inline, error showing "unknown type name ‘__gnu_inline’" pops up. > 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. It'd be good. That's exactly what my patch does. > Having said that, does someone know whether userspace should have > access to those attributes (or rather, other code that uses in turn > those attributes)? It'd be better to keep those attributes out of userspace, as is the case before 815f0ddb346c. BTW, the userspace code failed to compile in my case is under directory tools/bpf/. Thanks, Xiaozhou