All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Jani Nikula <jani.nikula@intel.com>
Cc: Pan@freedesktop.org, "Karol Herbst" <kherbst@redhat.com>,
	intel-gfx@lists.freedesktop.org, Xinhui <Xinhui.Pan@amd.com>,
	"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
	dri-devel@lists.freedesktop.org,
	"Maxime Ripard" <mripard@kernel.org>,
	"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
	"Danilo Krummrich" <dakr@redhat.com>,
	"Hamza Mahfooz" <hamza.mahfooz@amd.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Marijn Suijten" <marijn.suijten@somainline.org>,
	"Sean Paul" <sean@poorly.run>,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [RFC] drm: enable W=1 warnings by default across the subsystem
Date: Fri, 1 Dec 2023 10:59:39 -0700	[thread overview]
Message-ID: <20231201175939.GA231094@dev-arch.thelio-3990X> (raw)
In-Reply-To: <874jh362ta.fsf@intel.com>

On Thu, Nov 30, 2023 at 10:52:17AM +0200, Jani Nikula wrote:
> On Wed, 29 Nov 2023, Hamza Mahfooz <hamza.mahfooz@amd.com> wrote:
> > Cc: Nathan Chancellor <nathan@kernel.org>
> >
> > On 11/29/23 13:12, Jani Nikula wrote:
> >> At least the i915 and amd drivers enable a bunch more compiler warnings
> >> than the kernel defaults.
> >> 
> >> Extend the W=1 warnings to the entire drm subsystem by default. Use the
> >> copy-pasted warnings from scripts/Makefile.extrawarn with
> >> s/KBUILD_CFLAGS/subdir-ccflags-y/ to make it easier to compare and keep
> >> up with them in the future.
> >> 
> >> This is similar to the approach currently used in i915.
> >> 
> >> Some of the -Wextra warnings do need to be disabled, just like in
> >> Makefile.extrawarn, but take care to not disable them for W=2 or W=3
> >> builds, depending on the warning.
> >
> > I think this should go in after drm-misc-next has a clean build (for
> > COMPILE_TEST builds) with this patch applied. Otherwise, it will break a
> > lot of build configs.
> 
> Oh, I'm absolutely not suggesting this should be merged before known
> warnings have been addressed one way or another. Either by fixing them
> or by disabling said warning in driver local Makefiles, depending on the
> case.
> 
> While I'm suggesting this, I obviously (I hope) can't take on fixing all
> the warnings this exposes. One way to scale would be for folks to apply
> this locally, see what it uncovers in their drivers, and fix some.
> 
> As an intermediate step we might also apply this to a topic branch in
> drm-tip, so you'd see the warnings when building drm-tip, but not in
> indidual branches or in anything that's merged upstream.

For what it's worth, I ran this through my personal build matrix with
LLVM/clang and it only found a few instances of
-Wunused-but-set-variable:

drivers/gpu/drm/mediatek/mtk_disp_gamma.c:121:6: warning: variable 'cfg_val' set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/nouveau/nouveau_svm.c:115:24: warning: variable 'priority' set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/nouveau/nouveau_svm.c:929:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c:221:7: warning: variable 'loc' set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/qxl/qxl_cmd.c:424:6: warning: variable 'count' set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/qxl/qxl_ioctl.c:148:14: warning: variable 'num_relocs' set but not used [-Wunused-but-set-variable]

I know that clang does not support all the warnings that are being
enabled here but I suspect there won't be too many instances of the
other warnings. -Wformat-overflow and -Wformat-truncation might be the
big ones. I know -Wstringop-overflow is being turned on globally
in -next so that is one that you shouldn't have to worry much about.

Cheers,
Nathan

WARNING: multiple messages have this Message-ID (diff)
From: Nathan Chancellor <nathan@kernel.org>
To: Jani Nikula <jani.nikula@intel.com>
Cc: Pan@freedesktop.org, "Karol Herbst" <kherbst@redhat.com>,
	intel-gfx@lists.freedesktop.org, Xinhui <Xinhui.Pan@amd.com>,
	"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
	dri-devel@lists.freedesktop.org,
	"Maxime Ripard" <mripard@kernel.org>,
	"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
	"Danilo Krummrich" <dakr@redhat.com>,
	"Hamza Mahfooz" <hamza.mahfooz@amd.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Marijn Suijten" <marijn.suijten@somainline.org>,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [Intel-gfx] [RFC] drm: enable W=1 warnings by default across the subsystem
Date: Fri, 1 Dec 2023 10:59:39 -0700	[thread overview]
Message-ID: <20231201175939.GA231094@dev-arch.thelio-3990X> (raw)
In-Reply-To: <874jh362ta.fsf@intel.com>

On Thu, Nov 30, 2023 at 10:52:17AM +0200, Jani Nikula wrote:
> On Wed, 29 Nov 2023, Hamza Mahfooz <hamza.mahfooz@amd.com> wrote:
> > Cc: Nathan Chancellor <nathan@kernel.org>
> >
> > On 11/29/23 13:12, Jani Nikula wrote:
> >> At least the i915 and amd drivers enable a bunch more compiler warnings
> >> than the kernel defaults.
> >> 
> >> Extend the W=1 warnings to the entire drm subsystem by default. Use the
> >> copy-pasted warnings from scripts/Makefile.extrawarn with
> >> s/KBUILD_CFLAGS/subdir-ccflags-y/ to make it easier to compare and keep
> >> up with them in the future.
> >> 
> >> This is similar to the approach currently used in i915.
> >> 
> >> Some of the -Wextra warnings do need to be disabled, just like in
> >> Makefile.extrawarn, but take care to not disable them for W=2 or W=3
> >> builds, depending on the warning.
> >
> > I think this should go in after drm-misc-next has a clean build (for
> > COMPILE_TEST builds) with this patch applied. Otherwise, it will break a
> > lot of build configs.
> 
> Oh, I'm absolutely not suggesting this should be merged before known
> warnings have been addressed one way or another. Either by fixing them
> or by disabling said warning in driver local Makefiles, depending on the
> case.
> 
> While I'm suggesting this, I obviously (I hope) can't take on fixing all
> the warnings this exposes. One way to scale would be for folks to apply
> this locally, see what it uncovers in their drivers, and fix some.
> 
> As an intermediate step we might also apply this to a topic branch in
> drm-tip, so you'd see the warnings when building drm-tip, but not in
> indidual branches or in anything that's merged upstream.

For what it's worth, I ran this through my personal build matrix with
LLVM/clang and it only found a few instances of
-Wunused-but-set-variable:

drivers/gpu/drm/mediatek/mtk_disp_gamma.c:121:6: warning: variable 'cfg_val' set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/nouveau/nouveau_svm.c:115:24: warning: variable 'priority' set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/nouveau/nouveau_svm.c:929:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c:221:7: warning: variable 'loc' set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/qxl/qxl_cmd.c:424:6: warning: variable 'count' set but not used [-Wunused-but-set-variable]
drivers/gpu/drm/qxl/qxl_ioctl.c:148:14: warning: variable 'num_relocs' set but not used [-Wunused-but-set-variable]

I know that clang does not support all the warnings that are being
enabled here but I suspect there won't be too many instances of the
other warnings. -Wformat-overflow and -Wformat-truncation might be the
big ones. I know -Wstringop-overflow is being turned on globally
in -next so that is one that you shouldn't have to worry much about.

Cheers,
Nathan

  parent reply	other threads:[~2023-12-01 17:59 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29 18:12 [RFC] drm: enable W=1 warnings by default across the subsystem Jani Nikula
2023-11-29 18:12 ` [Intel-gfx] " Jani Nikula
2023-11-29 20:21 ` Hamza Mahfooz
2023-11-29 20:21   ` [Intel-gfx] " Hamza Mahfooz
2023-11-30  8:52   ` Jani Nikula
2023-11-30  8:52     ` [Intel-gfx] " Jani Nikula
2023-11-30  9:18     ` Maxime Ripard
2023-11-30  9:18       ` [Intel-gfx] " Maxime Ripard
2023-11-30  9:30       ` Javier Martinez Canillas
2023-11-30  9:30         ` [Intel-gfx] " Javier Martinez Canillas
2023-11-30  9:46         ` Jani Nikula
2023-11-30  9:46           ` [Intel-gfx] " Jani Nikula
2023-11-30  9:59           ` Javier Martinez Canillas
2023-11-30  9:59             ` [Intel-gfx] " Javier Martinez Canillas
2023-11-30 10:06           ` Maxime Ripard
2023-11-30 10:06             ` [Intel-gfx] " Maxime Ripard
2023-11-30 10:19             ` Javier Martinez Canillas
2023-11-30 10:19               ` [Intel-gfx] " Javier Martinez Canillas
2023-12-05 14:25       ` Dmitry Baryshkov
2023-12-05 14:25         ` Dmitry Baryshkov
2023-12-01 17:59     ` Nathan Chancellor [this message]
2023-12-01 17:59       ` [Intel-gfx] " Nathan Chancellor
2023-11-30  5:59 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork
2023-11-30  6:04 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-11-30 10:01 ` [RFC] " Thomas Zimmermann
2023-11-30 10:01   ` [Intel-gfx] " Thomas Zimmermann
2023-12-01  6:15 ` [Intel-gfx] ✗ Fi.CI.IGT: failure for " Patchwork
2023-12-05 14:08 ` [RFC] " Sui Jingfeng
2023-12-05 14:08   ` [Intel-gfx] " Sui Jingfeng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231201175939.GA231094@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=Pan@freedesktop.org \
    --cc=Xinhui.Pan@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dakr@redhat.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamza.mahfooz@amd.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=kherbst@redhat.com \
    --cc=marijn.suijten@somainline.org \
    --cc=mripard@kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=sean@poorly.run \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.