Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162124AbdD0G1w (ORCPT ); Thu, 27 Apr 2017 02:27:52 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33471 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162060AbdD0G1f (ORCPT ); Thu, 27 Apr 2017 02:27:35 -0400 Date: Thu, 27 Apr 2017 08:27:31 +0200 From: Ingo Molnar To: Boris Ostrovsky Cc: Andy Lutomirski , "xen-devel@lists.xenproject.org" , Juergen Gross , X86 ML , Borislav Petkov , "linux-kernel@vger.kernel.org" Subject: Re: xen_exit_mmap() questions Message-ID: <20170427062731.3r5bovikjgjolmew@gmail.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1085 Lines: 33 * Boris Ostrovsky wrote: > > xen_mc_issue() does: > > > > if ((paravirt_get_lazy_mode() & mode) == 0) > > xen_mc_flush(); > > > > I assume the load_cr3() is intended to deal with the case where we're > > in lazy mode, but we'll still be in lazy mode, right? Or does it > > serve some other purpose? > > Of course. I can't read (I ignored the "== 0" part). Ha, ob'sidenote: the preferred form to write this is: if (!(paravirt_get_lazy_mode() & mode)) xen_mc_flush(); ... exactly due to the readability problem you ran into: a 'pre' negation is much easier to read, plus '==' tends to trigger 'equal to' attributes in the brain, which is the opposite of negation. So it's very easy to mis-read such syntactic constructs even if they are technically correct. I think '== 0' should be forbidden in all cases where the purpose is a logic operation and should be used strictly only in cases where we do explicit integer arithmetics. (Bools and '== false' are suboptimal for similar reasons.) ... but I digress! Ingo