Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1369576imu; Thu, 13 Dec 2018 14:00:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/WrXaagDJrYWj1WLhieAARLp0hbIHz0V1LhXE1jWPuqt9K0EbDnNfhrRW9+yhIIftnXwHXI X-Received: by 2002:aa7:81d0:: with SMTP id c16mr427051pfn.153.1544738437882; Thu, 13 Dec 2018 14:00:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544738437; cv=none; d=google.com; s=arc-20160816; b=w/A6xwO4bWWfze9enr6l5H5xiN2vrJNaOZFtKyub5WDIj8SSvaorbCehSa3oYzc4la 83F7sc7DfpOlG4kSow/f6ufPic0JfmYsH2c/AfBJ96Xn4s0s3g7UJ1omvUke57lVD1qo zNtZn/iia2HwHp2qyaZTT2a5jaiRNwbi6wuyenuHZpPdXF3i/8JYim1tCQKxvD5AyF0c HpuCwPgA2sDyzjls3CeVpsMbpc+xnsr10gPEVdyKBq463wTID/g9cP8GjzXLkO5lwHNE Se446GOIzKLoc+nydCjdxMapYvUwWMTxjToB6wTzSkfDCevuu+ogbJeBz0K6AWmbiF2F OAeQ== 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=/i3Qn5RbIp1Jj9tl455vSrzT6kqJoyyhRMnpm0rgy6M=; b=uUPXowgvgkskgGcQX2VwoSleshvvME0LRjDyleIm3h5y3vq7HRW9xOpgfAsSzGSrut LYtOvA2dvXhJcUhM3xq/hAzWhaggi/ft4SDnCmhJ45u9Ijc2ShoV9qZcqTbF+DpsnO7B piuI/unWrC4brYtkZIcikuO1NhE6IpGAHOC8g4rr9tuco3uF70qcMnNI2rMmFyxLj46f tjqlAon6LIiiEb8vyk0mgTeV4AmCd8YJe27Ms5TVb0KwTEMjXhuHL2FmxLCjbAIvPz5A 0T67kc4g9bSAB1vaSrzPVwZkKwdVwvDug63f/9k6F7egHOlW3AtayvVcaGhQmLviSY5M Nf3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aDCRYKFw; 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 b8si2364844plx.383.2018.12.13.14.00.23; Thu, 13 Dec 2018 14:00:37 -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=aDCRYKFw; 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 S1727245AbeLMV7X (ORCPT + 99 others); Thu, 13 Dec 2018 16:59:23 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:35946 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726435AbeLMV7X (ORCPT ); Thu, 13 Dec 2018 16:59:23 -0500 Received: by mail-lf1-f67.google.com with SMTP id a16so2766222lfg.3 for ; Thu, 13 Dec 2018 13:59:22 -0800 (PST) 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=/i3Qn5RbIp1Jj9tl455vSrzT6kqJoyyhRMnpm0rgy6M=; b=aDCRYKFw4DNAg/YTIDlFZfBRTdrjnwxkDhVWmL7eqcMCSR0qTFQuxZluHZkAKL53Id uEqlpBG9+byF5aRVn9qTvWoY93PKGLuBXJaYqNcASFfZH3N3XJZfuOiTCQG94uMqrW5f 2YO/EoMWUSQG1s6zKsjon+ttOFmbo0jo7i5OT5Bb03YQlvhLm5jdrfPV/s+CKYr5PLSm HtfsBM7kKjgyL15TzgsOnqUABF7A1omVmpEi2M91H+ewCYSLfMlMJwADuh3CUH2Xdf2M MjOrAH3PB5x7ewIRZMorDGdDvUwzgDnXZSFrBtyltfSWkJGkZfY6Q47Ndzzh7xzNBLKJ uJBg== 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=/i3Qn5RbIp1Jj9tl455vSrzT6kqJoyyhRMnpm0rgy6M=; b=NQzSbtb5hBOzBKvgh2iImeelW3G5Rg7oeqgWBSqRB3Ld7SbuctVNSXoKpPjQQWU832 XlDVzfVGohq3SxuVJSRUclryagGUjlB/C4ZZ+JrQbMl0N6XImJ6tEzgLBvKTVOVm7aY0 3pBZp+0wrHdniQSUY4M8OScI79AN06FxfEu+Oh0O1G/cDCqye2Zkw4LOhIaMeU7wEAce hdpX9P06GqjL2slhLae4faFATUV9QsptOUw1KFPU1/ooUBaem+xugkDWIPD8AJl259Fw oFf5FH/iAxaApk+XKDmvZNBbjPhS0p3FQyT99Hz9HPRq0oqMaQbIbGR9u/T0Yy4vAlhx vSig== X-Gm-Message-State: AA+aEWanuoVi7M/wpdIvXiA8P0ykOd6cBRkw3+DzZC4wDoqzpnXwKye8 K/lwj3kpGgrYCSs8EHdg0d0KyNfl/x8i6NQOeupVVdRrTzs= X-Received: by 2002:a19:54d7:: with SMTP id b84mr237163lfl.131.1544738361431; Thu, 13 Dec 2018 13:59:21 -0800 (PST) MIME-Version: 1.0 References: <20181209032715.3466040-1-liuxiaozhou@bytedance.com> In-Reply-To: <20181209032715.3466040-1-liuxiaozhou@bytedance.com> From: Miguel Ojeda Date: Thu, 13 Dec 2018 22:59:10 +0100 Message-ID: Subject: Re: [PATCH v2] Compiler Attributes: don't pollute userspace with macro definitions To: liuxiaozhou@bytedance.com, Greg KH Cc: linux-kernel , Linus Torvalds 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 Hi Xiaozhou, Couple of comments. On Sun, Dec 9, 2018 at 4:27 AM Xiaozhou Liu wrote: > > v2: update commit message. This line should go below the "---", since it shouldn't be part of the commit message. > +#ifdef __KERNEL__ > + > #ifdef CONFIG_ENABLE_MUST_CHECK > #define __must_check __attribute__((__warn_unused_result__)) > #else > @@ -215,4 +217,6 @@ struct ftrace_likely_data { > */ > #define noinline_for_stack noinline > > +#endif /* __KERNEL */ I wonder if we can/should simply move them into the __KERNEL__ && !__ASSEMBLY__ block that is above, instead. It would be simpler to read, and there aren't apparently dependencies to those outside it that go after the block. I took a look at where the macros were at each "step", and, on one hand, compiler-gcc.h was (and is) included entirely inside it, which is from where most of the macros come originally from. On the other hand, not all do: __must_check (the generic version, not the one in -gcc.h) and noinline_for_stack were defined in __KERNEL__ (only) before commit 815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually exclusive"). But anyway using those two in assembly does not make sense, right? What do you think? Greg/Linus, are you going to pick this (or a v3) directly? If not, I can pick it up in compiler-attributes tree linux-next. PS: In addition (related to this but not for this patch), we should review whether other macros that are currently outside should be there or simply pushed back into __KERNEL__ (and possibly __ASSEMBLY__). For instance, __latent_entropy (the generic one) is outside, but it is only defined in compiler-gcc.h, so the generic one should be inside the __KERNEL__ && !__ASSEMBLY__ block, no? Cheers, Miguel