linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Aleksei Vetrov" <vvvvvv@google.com>,
	"Nathan Chancellor" <nathan@kernel.org>
Cc: "Shivamurthy Shastri" <shivamurthy.shastri@linutronix.de>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Vlastimil Babka" <vbabka@suse.cz>,
	"Matthew Wilcox" <willy@infradead.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Anna-Maria Gleixner" <anna-maria@linutronix.de>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	llvm@lists.linux.dev
Subject: Re: [PATCH] mm/vmstat: Fix -Wenum-enum-conversion warning in vmstat.h
Date: Fri, 11 Oct 2024 14:05:00 +0000	[thread overview]
Message-ID: <a2e8a76a-9fad-4e3e-bce1-bf8a9d180464@app.fastmail.com> (raw)
In-Reply-To: <ZwevGZHiXOBqoslA@google.com>

On Thu, Oct 10, 2024, at 10:40, Aleksei Vetrov wrote:
> On Mon, Oct 07, 2024 at 05:51:36PM -0700, Nathan Chancellor wrote:
>> For what it's worth, I never really saw Matthew's comment around what
>> value does this warning provide addressed. I was the one who originally
>> moved it into W=1 at the request of Arnd because he felt that instances
>> of this warning could be bugs and they should be audited.  However, I
>> have not seen many instances of this warning pop up in new code through
>> 0day build reports and the ones that I have seen seem to be intentional,
>> as they are using enums like integral values, such as here. If that is
>> just going to result in a bunch of patches like this adding unnecessary
>> casts, I think it would just be better to consider disabling this
>> warning altogether or at the very least, moving it to W=2 (which is for
>> warnings that are noisy but might contain bugs), since more people are
>> using W=1 as their normal build configuration nowadays.
>
> If time has proven that this warning has never found an unintended enum
> conversion, then it is worth to disable it for everyone. As you said in
> the original thread ([PATCH] kbuild: Disable two Clang specific
> enumeration warnings), W=2 is not run by any CI, so I would prefer to
> disable it completely.
>
> Alternatives considered:
>
> * Enable -Wenum-enum-conversion only for 0day build reports through
>   KCFLAGS. It will eliminate noise for regular users while keeping
>   developers informed about new instances of this warning.
> * -Wno-error=enum-enum-conversion to keep warning but don't block
>   compilation for CONFIG_WERROR users.
>
> Arnd Bergmann, what do you think? Have you found it useful after all?

I'm fairly sure I saw users mix up 'dma_data_direction' with
'dma_transfer_direction' and unrelated enum-enum mixups in
amdgpu. There were probably more.

I think what happened is that in clang-18 and earlier, the
warning option caught mistakes of passing the wrong enum 
to a function and a few others, but it did not catch arithmetic
operations between enums, so clang-19 now produces a lot more
output than older versions, and I don't think we can
control those independently.

       Arnd


  reply	other threads:[~2024-10-11 14:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-21 11:16 Shivamurthy Shastri
2024-06-21 18:13 ` Matthew Wilcox
2024-06-22  0:59   ` Andrew Morton
2024-10-07 20:13 ` Aleksei Vetrov
2024-10-08  0:51   ` Nathan Chancellor
2024-10-10 10:40     ` Aleksei Vetrov
2024-10-11 14:05       ` Arnd Bergmann [this message]
2024-10-15  8:47         ` Nathan Chancellor
2024-10-15 16:55           ` Aleksei Vetrov
2024-10-16 18:02             ` Nathan Chancellor

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=a2e8a76a-9fad-4e3e-bce1-bf8a9d180464@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=anna-maria@linutronix.de \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=shivamurthy.shastri@linutronix.de \
    --cc=tglx@linutronix.de \
    --cc=vbabka@suse.cz \
    --cc=vvvvvv@google.com \
    --cc=willy@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox