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=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 C0B46C4338F for ; Mon, 23 Aug 2021 20:28:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 42228613E6 for ; Mon, 23 Aug 2021 20:28:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 42228613E6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 728426B006C; Mon, 23 Aug 2021 16:28:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D8956B0071; Mon, 23 Aug 2021 16:28:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A2508D0001; Mon, 23 Aug 2021 16:28:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0133.hostedemail.com [216.40.44.133]) by kanga.kvack.org (Postfix) with ESMTP id 4155B6B006C for ; Mon, 23 Aug 2021 16:28:15 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id CE29B8249980 for ; Mon, 23 Aug 2021 20:28:14 +0000 (UTC) X-FDA: 78507482508.08.D877D71 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf21.hostedemail.com (Postfix) with ESMTP id 62F08D014324 for ; Mon, 23 Aug 2021 20:28:14 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id C81D060E97; Mon, 23 Aug 2021 20:28:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629750493; bh=NCgpJgcEzQCjD+yVkgBxVNVZoRT9seZh+iLL2qkrejk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hnJQJrX6fIId/ECA3MShYP4AB15Noo4hg04FIEsXYBUu9o6LPZqIVICbxO8IhL6Mg bfhRyAwii6Nlv6QMeBR/+8FyB40jUSNznBC3QVZk0P02OYCQO/1eWnyFNHIFTI9EmT KuEZHQr3bFvy3eZySnw5KwLQgUtKrGRQ2e7SAr5y1Gbr18jaEeFJ/SmPBpur9t+ZhU NJpGYtmSDLzGXktfmfU6tj8gYlOhks7gZdddc7FFekG+KHjmc8/O6hn16xVl52U+FA p+usdp2JIcRTPRqnuoQlcGh77+0IGUVa/VI3A7CIKPPA4FiYSreRiuY4/KP7Ok3zuG qdM8sdaT7pM5w== Date: Mon, 23 Aug 2021 13:28:09 -0700 From: Nathan Chancellor To: Arnd Bergmann Cc: Viresh Kumar , kernel test robot , clang-built-linux , kbuild-all@lists.01.org, Linux Memory Management List , Quentin Perret , Lukasz Luba Subject: Re: [linux-next:master 6632/9522] include/linux/pm_opp.h:458:58: warning: unused parameter 'dev' Message-ID: References: <202108210311.CBtcgoUL-lkp@intel.com> <20210823031546.fupzmdxjntacsq2e@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 62F08D014324 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hnJQJrX6; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf21.hostedemail.com: domain of nathan@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=nathan@kernel.org X-Rspamd-Server: rspam01 X-Stat-Signature: 5rptpxahkdn9p1sy78b9wrpi33ghc557 X-HE-Tag: 1629750494-13155 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Aug 23, 2021 at 11:07:13AM +0200, Arnd Bergmann wrote: > On Mon, Aug 23, 2021 at 5:15 AM Viresh Kumar wrote: > > > > On 21-08-21, 03:30, kernel test robot wrote: > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > > > head: 86ed57fd8c93fdfaabb4f58e78455180fa7d8a84 > > > commit: c17495b01b72b53bd290f442d39b060e015c7aea [6632/9522] cpufreq: Add callback to register with energy model > > > config: i386-randconfig-a016-20210820 (attached as .config) > > > compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d9c5613e856cf2addfbf892fc4c1ce9ef9feceaa) > > > reproduce (this is a W=1 build): > > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > > chmod +x ~/bin/make.cross > > > # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=c17495b01b72b53bd290f442d39b060e015c7aea > > > git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > > > git fetch --no-tags linux-next master > > > git checkout c17495b01b72b53bd290f442d39b060e015c7aea > > > # save the attached .config to linux build tree > > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 > > > > > > If you fix the issue, kindly add following tag as appropriate > > > Reported-by: kernel test robot > > > > > > All warnings (new ones prefixed by >>): > > > > > > static inline void pm_vt_switch_unregister(struct device *dev) > > > ^ > > > In file included from drivers/gpu/drm/i915/gt/intel_llc.c:6: > > > In file included from include/linux/cpufreq.h:12: > > > In file included from include/linux/cpu.h:17: > > > In file included from include/linux/node.h:18: > > > include/linux/device.h:653:46: warning: unused parameter 'dev' [-Wunused-parameter] > > > static inline int dev_to_node(struct device *dev) > > > > False positives ? These are mostly inline dummies, which simply return > > errors. Their parameters aren't supposed to be used. > > It's a clang-14 W=1 build, probably something went wrong with the clang specific > warning flags there. I think we do want "-Wunused -Wno-unused-parameter". Not > sure what changed compared to older clang builds. W=1 already does this: $ sed -n '23,25p' scripts/Makefile.extrawarn ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter The problem is the same one as commit fa63da2ab046 ("arm64: Don't unconditionally add -Wno-psabi to KBUILD_CFLAGS") but just with an '-f' flag instead of a '-W' flag. This config has CONFIG_MEFFICEON=y, which adds a few '-falign-...' flags to cflags-y, namely '-falign-jumps=0', which is not supported by clang: clang-14: warning: optimization flag '-falign-jumps=0' is not supported [-Wignored-optimization-argument] As a result, all subsequent cc-{disable-warning,option} calls fail because the command always fails with an unknown flag in the mix since we added -Werror to cc-{disable-warning,option} to work around this exact situation where clang only emits a warning rather than an error for unknown flags. I improved this in commit 589834b3a009 ("kbuild: Add -Werror=unknown-warning-option to CLANG_FLAGS") so that we get alerted of failed flags before this but I guess I missed this one :). i915 enables '-Wall -Wextra' then disables a few warnings (including '-Wunused-parameter') with cc-disable-warning, which does not work, so we get all of these warnings as a result. I think fixing this once and for all is a three pronged approach: 1. '-falign-jumps=' should not be added unconditionally, as it is not supported in clang (as it warns rather than errors about...). '-falign-loops=' falls into the same category, as it is only supported on clang-14 and newer. Something like this should do it (no point in making GCC pay the cc-option cost): diff --git a/arch/x86/Makefile_32.cpu b/arch/x86/Makefile_32.cpu index cd3056759880..1db40f14719d 100644 --- a/arch/x86/Makefile_32.cpu +++ b/arch/x86/Makefile_32.cpu @@ -25,11 +25,16 @@ cflags-$(CONFIG_MK6) += -march=k6 # They make zero difference whatsosever to performance at this time. cflags-$(CONFIG_MK7) += -march=athlon cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8,-march=athlon) -cflags-$(CONFIG_MCRUSOE) += -march=i686 -falign-functions=0 -falign-jumps=0 -falign-loops=0 -cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) -falign-functions=0 -falign-jumps=0 -falign-loops=0 +ifdef CONFIG_CC_IS_CLANG +align := -falign-functions=0 $(call cc-option,-falign-jumps=0) $(call cc-option,-falign-loops=0) +else +align := -falign-functions=0 -falign-jumps=0 -falign-loops=0 +endif +cflags-$(CONFIG_MCRUSOE) += -march=i686 $(align) +cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) $(align) cflags-$(CONFIG_MWINCHIPC6) += $(call cc-option,-march=winchip-c6,-march=i586) cflags-$(CONFIG_MWINCHIP3D) += $(call cc-option,-march=winchip2,-march=i586) -cflags-$(CONFIG_MCYRIXIII) += $(call cc-option,-march=c3,-march=i486) -falign-functions=0 -falign-jumps=0 -falign-loops=0 +cflags-$(CONFIG_MCYRIXIII) += $(call cc-option,-march=c3,-march=i486) $(align) cflags-$(CONFIG_MVIAC3_2) += $(call cc-option,-march=c3-2,-march=i686) cflags-$(CONFIG_MVIAC7) += -march=i686 cflags-$(CONFIG_MCORE2) += -march=i686 $(call tune,core2) 2. i915 should not be using cc-disable-warning for most of the flags that they are, as they are supported by both compilers and the rest of the kernel assumes this. I plan to send a series to turn on -Wsometimes-uninitialized for i195 shortly so I will send this diff as a prior change in that series. diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 642a5b5a1b81..9f05b3b18816 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -13,15 +13,16 @@ # will most likely get a sudden build breakage... Hopefully we will fix # new warnings before CI updates! subdir-ccflags-y := -Wall -Wextra -subdir-ccflags-y += $(call cc-disable-warning, unused-parameter) -subdir-ccflags-y += $(call cc-disable-warning, type-limits) -subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers) +subdir-ccflags-y += -Wno-unused-parameter +subdir-ccflags-y += -Wno-type-limits +subdir-ccflags-y += -Wno-missing-field-initializers subdir-ccflags-y += $(call cc-disable-warning, unused-but-set-variable) -# clang warnings -subdir-ccflags-y += $(call cc-disable-warning, sign-compare) -subdir-ccflags-y += $(call cc-disable-warning, sometimes-uninitialized) -subdir-ccflags-y += $(call cc-disable-warning, initializer-overrides) subdir-ccflags-y += $(call cc-disable-warning, frame-address) +ifdef CONFIG_CC_IS_CLANG +subdir-ccflags-y += -Wno-sign-compare +subdir-ccflags-y += -Wno-sometimes-uninitialized +subdir-ccflags-y += -Wno-initializer-overrides +endif subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror # Fine grained warnings disable 3. We should not allow unknown flags to get added to the command line without our knowledge. Bugs like this are annoying for several parties so we should minimize them as much as possible. I will propose this in the same series as the first diff, which should avoid the initial issue altogether (the second step is more of an optimization for the future). diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang index f88ceb3d076e..94c9455adf59 100644 --- a/scripts/Makefile.clang +++ b/scripts/Makefile.clang @@ -12,7 +12,9 @@ CLANG_TARGET_FLAGS_s390 := s390x-linux-gnu CLANG_TARGET_FLAGS_x86 := x86_64-linux-gnu CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(SRCARCH)) +# Make clang behave more like gcc when it encounters an unknown '-W' or '-f' flag. TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option +TENTATIVE_CLANG_FLAGS += -Werror=ignored-optimization-argument ifeq ($(CROSS_COMPILE),) ifeq ($(CLANG_TARGET_FLAGS),) Sorry for the wall of text, hopefully it all makes sense. Cheers, Nathan From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8245772215263628991==" MIME-Version: 1.0 From: Nathan Chancellor To: kbuild-all@lists.01.org Subject: Re: [linux-next:master 6632/9522] include/linux/pm_opp.h:458:58: warning: unused parameter 'dev' Date: Mon, 23 Aug 2021 13:28:09 -0700 Message-ID: In-Reply-To: List-Id: --===============8245772215263628991== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Mon, Aug 23, 2021 at 11:07:13AM +0200, Arnd Bergmann wrote: > On Mon, Aug 23, 2021 at 5:15 AM Viresh Kumar = wrote: > > > > On 21-08-21, 03:30, kernel test robot wrote: > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-ne= xt.git master > > > head: 86ed57fd8c93fdfaabb4f58e78455180fa7d8a84 > > > commit: c17495b01b72b53bd290f442d39b060e015c7aea [6632/9522] cpufreq:= Add callback to register with energy model > > > config: i386-randconfig-a016-20210820 (attached as .config) > > > compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project = d9c5613e856cf2addfbf892fc4c1ce9ef9feceaa) > > > reproduce (this is a W=3D1 build): > > > wget https://raw.githubusercontent.com/intel/lkp-tests/master= /sbin/make.cross -O ~/bin/make.cross > > > chmod +x ~/bin/make.cross > > > # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-= next.git/commit/?id=3Dc17495b01b72b53bd290f442d39b060e015c7aea > > > git remote add linux-next https://git.kernel.org/pub/scm/linu= x/kernel/git/next/linux-next.git > > > git fetch --no-tags linux-next master > > > git checkout c17495b01b72b53bd290f442d39b060e015c7aea > > > # save the attached .config to linux build tree > > > COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dclang make.cros= s ARCH=3Di386 > > > > > > If you fix the issue, kindly add following tag as appropriate > > > Reported-by: kernel test robot > > > > > > All warnings (new ones prefixed by >>): > > > > > > static inline void pm_vt_switch_unregister(struct device *dev) > > > ^ > > > In file included from drivers/gpu/drm/i915/gt/intel_llc.c:6: > > > In file included from include/linux/cpufreq.h:12: > > > In file included from include/linux/cpu.h:17: > > > In file included from include/linux/node.h:18: > > > include/linux/device.h:653:46: warning: unused parameter 'dev' [-W= unused-parameter] > > > static inline int dev_to_node(struct device *dev) > > > > False positives ? These are mostly inline dummies, which simply return > > errors. Their parameters aren't supposed to be used. > = > It's a clang-14 W=3D1 build, probably something went wrong with the clang= specific > warning flags there. I think we do want "-Wunused -Wno-unused-parameter".= Not > sure what changed compared to older clang builds. W=3D1 already does this: $ sed -n '23,25p' scripts/Makefile.extrawarn ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) KBUILD_CFLAGS +=3D -Wextra -Wunused -Wno-unused-parameter The problem is the same one as commit fa63da2ab046 ("arm64: Don't unconditionally add -Wno-psabi to KBUILD_CFLAGS") but just with an '-f' flag instead of a '-W' flag. This config has CONFIG_MEFFICEON=3Dy, which adds a few '-falign-...' flags to cflags-y, namely '-falign-jumps=3D0', which is not supported by clang: clang-14: warning: optimization flag '-falign-jumps=3D0' is not supported [= -Wignored-optimization-argument] As a result, all subsequent cc-{disable-warning,option} calls fail because = the command always fails with an unknown flag in the mix since we added -Werror= to cc-{disable-warning,option} to work around this exact situation where clang only emits a warning rather than an error for unknown flags. I improved th= is in commit 589834b3a009 ("kbuild: Add -Werror=3Dunknown-warning-option to CLANG_FLAGS") so that we get alerted of failed flags before this but I gues= s I missed this one :). i915 enables '-Wall -Wextra' then disables a few warnings (including '-Wunused-parameter') with cc-disable-warning, which does not work, so we g= et all of these warnings as a result. I think fixing this once and for all is a three pronged approach: 1. '-falign-jumps=3D' should not be added unconditionally, as it is not supported in clang (as it warns rather than errors about...). '-falign-loops=3D' falls into the same category, as it is only supported on clang-14 and newer. Something like this should do it (no point in making GCC pay the cc-option cost): diff --git a/arch/x86/Makefile_32.cpu b/arch/x86/Makefile_32.cpu index cd3056759880..1db40f14719d 100644 --- a/arch/x86/Makefile_32.cpu +++ b/arch/x86/Makefile_32.cpu @@ -25,11 +25,16 @@ cflags-$(CONFIG_MK6) +=3D -march=3Dk6 # They make zero difference whatsosever to performance at this time. cflags-$(CONFIG_MK7) +=3D -march=3Dathlon cflags-$(CONFIG_MK8) +=3D $(call cc-option,-march=3Dk8,-march=3D= athlon) -cflags-$(CONFIG_MCRUSOE) +=3D -march=3Di686 -falign-functions=3D0 -f= align-jumps=3D0 -falign-loops=3D0 -cflags-$(CONFIG_MEFFICEON) +=3D -march=3Di686 $(call tune,pentium3) -f= align-functions=3D0 -falign-jumps=3D0 -falign-loops=3D0 +ifdef CONFIG_CC_IS_CLANG +align :=3D -falign-functions=3D0 $(call cc-option,-falign-jumps=3D0) $(cal= l cc-option,-falign-loops=3D0) +else +align :=3D -falign-functions=3D0 -falign-jumps=3D0 -falign-loops=3D0 +endif +cflags-$(CONFIG_MCRUSOE) +=3D -march=3Di686 $(align) +cflags-$(CONFIG_MEFFICEON) +=3D -march=3Di686 $(call tune,pentium3) $(= align) cflags-$(CONFIG_MWINCHIPC6) +=3D $(call cc-option,-march=3Dwinchip-c6,-= march=3Di586) cflags-$(CONFIG_MWINCHIP3D) +=3D $(call cc-option,-march=3Dwinchip2,-ma= rch=3Di586) -cflags-$(CONFIG_MCYRIXIII) +=3D $(call cc-option,-march=3Dc3,-march=3D= i486) -falign-functions=3D0 -falign-jumps=3D0 -falign-loops=3D0 +cflags-$(CONFIG_MCYRIXIII) +=3D $(call cc-option,-march=3Dc3,-march=3D= i486) $(align) cflags-$(CONFIG_MVIAC3_2) +=3D $(call cc-option,-march=3Dc3-2,-march= =3Di686) cflags-$(CONFIG_MVIAC7) +=3D -march=3Di686 cflags-$(CONFIG_MCORE2) +=3D -march=3Di686 $(call tune,core= 2) 2. i915 should not be using cc-disable-warning for most of the flags that they are, as they are supported by both compilers and the rest of the kernel assumes this. I plan to send a series to turn on -Wsometimes-uninitialized for i195 shortly so I will send this diff as a prior change in that series. diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 642a5b5a1b81..9f05b3b18816 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -13,15 +13,16 @@ # will most likely get a sudden build breakage... Hopefully we will fix # new warnings before CI updates! subdir-ccflags-y :=3D -Wall -Wextra -subdir-ccflags-y +=3D $(call cc-disable-warning, unused-parameter) -subdir-ccflags-y +=3D $(call cc-disable-warning, type-limits) -subdir-ccflags-y +=3D $(call cc-disable-warning, missing-field-initializer= s) +subdir-ccflags-y +=3D -Wno-unused-parameter +subdir-ccflags-y +=3D -Wno-type-limits +subdir-ccflags-y +=3D -Wno-missing-field-initializers subdir-ccflags-y +=3D $(call cc-disable-warning, unused-but-set-variable) -# clang warnings -subdir-ccflags-y +=3D $(call cc-disable-warning, sign-compare) -subdir-ccflags-y +=3D $(call cc-disable-warning, sometimes-uninitialized) -subdir-ccflags-y +=3D $(call cc-disable-warning, initializer-overrides) subdir-ccflags-y +=3D $(call cc-disable-warning, frame-address) +ifdef CONFIG_CC_IS_CLANG +subdir-ccflags-y +=3D -Wno-sign-compare +subdir-ccflags-y +=3D -Wno-sometimes-uninitialized +subdir-ccflags-y +=3D -Wno-initializer-overrides +endif subdir-ccflags-$(CONFIG_DRM_I915_WERROR) +=3D -Werror # Fine grained warnings disable 3. We should not allow unknown flags to get added to the command line without our knowledge. Bugs like this are annoying for several parties so we should minimize them as much as possible. I will propose this in the same series as the first diff, which should avoid the initial issue altogether (the second step is more of an optimization for the future). diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang index f88ceb3d076e..94c9455adf59 100644 --- a/scripts/Makefile.clang +++ b/scripts/Makefile.clang @@ -12,7 +12,9 @@ CLANG_TARGET_FLAGS_s390 :=3D s390x-linux-gnu CLANG_TARGET_FLAGS_x86 :=3D x86_64-linux-gnu CLANG_TARGET_FLAGS :=3D $(CLANG_TARGET_FLAGS_$(SRCARCH)) +# Make clang behave more like gcc when it encounters an unknown '-W' or '-= f' flag. TENTATIVE_CLANG_FLAGS :=3D -Werror=3Dunknown-warning-option +TENTATIVE_CLANG_FLAGS +=3D -Werror=3Dignored-optimization-argument ifeq ($(CROSS_COMPILE),) ifeq ($(CLANG_TARGET_FLAGS),) Sorry for the wall of text, hopefully it all makes sense. Cheers, Nathan --===============8245772215263628991==--