[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210402194648.GN28499@zn.tnic>
Date: Fri, 2 Apr 2021 21:46:48 +0200
From: Borislav Petkov <bp@...en8.de>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Kai Huang <kai.huang@...el.com>, kvm@...r.kernel.org,
linux-sgx@...r.kernel.org, x86@...nel.org,
linux-kernel@...r.kernel.org, jarkko@...nel.org, luto@...nel.org,
dave.hansen@...el.com, rick.p.edgecombe@...el.com,
haitao.huang@...el.com, pbonzini@...hat.com, tglx@...utronix.de,
mingo@...hat.com, hpa@...or.com
Subject: Re: [PATCH v3 07/25] x86/sgx: Initialize virtual EPC driver even
when SGX driver is disabled
On Fri, Apr 02, 2021 at 07:30:23PM +0000, Sean Christopherson wrote:
> Heh, that's what I had originally and used for literally years. IIRC, I
> suggested the "!! & !!" abomination after internal review complained about the
> oddness of the above.
Whut?
> FWIW, I think the above is far less likely to be misread, even though I love the
> cleverness of the bitwise AND.
The problem with using bitwise operations here is that they don't belong
in a logical expression of this sort - you do those when you actually
work with bitmasks etc and not when you wanna check whether the functions
returned success or not.
Yeah, yeah, the bitwise thing gets you what you want and yadda yadda but
readability is important. That thing that keeps this code maintainable
years from now...
Also, your original suggestion is literally translating the comment in
code, while
!!sgx_drv_init() & !!sgx_vepc_init()
especially with that bitwise-& in there, makes me go "say what now?!"
So yeah, you were right the first time.
:-)
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists