[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHk-=wjvCmUSD5sqFDgN3QNi1q=C5A=G2xDNToFP-ktCF3UjJg@mail.gmail.com>
Date: Wed, 9 Aug 2023 20:23:07 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Andrew Cooper <andrew.cooper3@...rix.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org
Subject: Re: [PATCH] x86/AMD: Fix ASM constraints in amd_clear_divider()
On Wed, 9 Aug 2023 at 16:12, Andrew Cooper <andrew.cooper3@...rix.com> wrote:
>
> But IMO, the risk of someone copy&pasting this as if it were a good
> example, and the debugging thereafter ought to be enough of a reason to
> avoid klever tricks to save 1 line of C.
That's not the point. The point is that this is very special code, and
there's no way you can copy-and-paste it for anything else.
In fact, the very lack of outputs in the asm is part of what makes
such a copy-and-paste impossible.
You copy-and-paste that thing, and you simply don't get any useful
results, because the asm doesn't have any outputs.
There's literally no other possible use of that asm than as a "this
doesn't do anything but write to whatever stale divide buffers".
In other words, you might as well have fun with it. Because it is in
no way useful in any other way.
And I think that's a feature. This is *literally* not a divide that
gives any useful output. Don't try to make it look like it does.
Linus
Powered by blists - more mailing lists