linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"the arch/x86 maintainers" <x86@kernel.org>
Subject: Re: [GIT pull] x86/urgent for v5.8-rc4
Date: Sun, 5 Jul 2020 12:46:30 -0700	[thread overview]
Message-ID: <CAHk-=wgV9toS7GU3KmNpj8hCS9SeF+A0voHS8F275_mgLhL4Lw@mail.gmail.com> (raw)
In-Reply-To: <159396401656.28963.9621378879403780463.tglx@nanos.tec.linutronix.de>

On Sun, Jul 5, 2020 at 8:47 AM Thomas Gleixner <tglx@linutronix.de> wrote:
>
>  - Disable 16 bit segments on XEN PV. It's not supported because XEN PV
>    does not implement ESPFIX64

I don't disagree with this conceptually, and I've pulled it, but
christ, that warning is over-engineered.

Seriously, it uses a mutex to protect a "set once" variable. That's just crazy.

We have "pr_info_once()", which does all of this for you. And no, it's
not thread-safe, becasue ABSOLUTELY NOBODY CARES.

If you happen to get two or more warnings because they happen on
separate CPU's at exactly the same time, nobody possibly cares.

And if you really are so anal that you care about that case, using a
mutex is still the wrong thing to do for something as simple as this.

You could literally have made it just a single atomic variable, and
that would have been simpler, faster, and be context-safe at the same
time.

So using a mutex is not only overkill, it is literally technically
_inferior_ to just about all the possible ways you can do this.

I've pulled this, but I found that code so bad as to be actually
offensive, and added a commit to remove the garbage and just use
"pr_info_once()".

And if somebody wants to guarantee the "it really can only happen once
even in theory", that person can add the code to "pr_info_once()" to
improve it to first optimistically load the value, and then use a
"cmpxchg" or whatever.

But that sounds pointless, and I'm not going to waste my time on it.

But I _did_ waste my time on removing this horrendous case of
re-implementing "pr_info_once()" horribly badly.

Because it physically hurt my eyes to look at that code.

                   Linus

  reply	other threads:[~2020-07-05 19:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-05 15:46 [GIT pull] core/urgent for v5.8-rc4 Thomas Gleixner
2020-07-05 15:46 ` [GIT pull] irq/urgent " Thomas Gleixner
2020-07-05 19:55   ` pr-tracker-bot
2020-07-05 15:46 ` [GIT pull] x86/urgent " Thomas Gleixner
2020-07-05 19:46   ` Linus Torvalds [this message]
2020-07-05 20:23     ` Andy Lutomirski
2020-07-05 19:55   ` pr-tracker-bot
2020-07-05 19:55 ` [GIT pull] core/urgent " pr-tracker-bot

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='CAHk-=wgV9toS7GU3KmNpj8hCS9SeF+A0voHS8F275_mgLhL4Lw@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).