From: "Jan Beulich" Subject: Re: [PATCH v8 3/8] xen/arm: return int *_dcache_va_range Date: Mon, 20 Oct 2014 16:23:59 +0100 Message-ID: <5445452F02000078000405BD@mail.emea.novell.com> References: <1413798499-28314-3-git-send-email-stefano.stabellini@eu.citrix.com> <1413817046.13796.21.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XgEoW-0004rX-5i for xen-devel@lists.xenproject.org; Mon, 20 Oct 2014 15:24:04 +0000 In-Reply-To: <1413817046.13796.21.camel@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell , Stefano Stabellini Cc: julien.grall@citrix.com, xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 20.10.14 at 16:57, wrote: >> --- a/xen/arch/arm/mm.c >> +++ b/xen/arch/arm/mm.c >> @@ -388,7 +388,7 @@ void flush_page_to_ram(unsigned long mfn) >> { >> void *v = map_domain_page(mfn); >> >> - clean_and_invalidate_dcache_va_range(v, PAGE_SIZE); >> + ASSERT(clean_and_invalidate_dcache_va_range(v, PAGE_SIZE) == 0); > > Just this one assert? What about all the other callers of > *_dcache_va_range? I'm glad I looked at this reply (I skipped the original one because of being ARM-only): Uses of ASSERT() like above won't work in non- debug builds. You have to latch the result into a variable and assert on it. The fundamental rule is: Expressions passed to ASSERT() must never have side effects. That's different from BUG_ON(), but even there Keir advocates not using expressions with side effects, aiui both to avoid the above mistake (i.e. getting used to doing it the right way) and to leave open the option of adding a build option to eliminate the BUG()s and BUG_ON()s too. Jan