From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED101C4725C for ; Tue, 5 May 2020 15:32:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CA0252085B for ; Tue, 5 May 2020 15:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588692758; bh=NR80z2yPjqgO14WXQRPXI+q6gF+1S53iofV6VuLwBac=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=wR5KcpnW1S6CrgSrxLvlcA6C6Eo9Ic5JNt0f4QgwfhwVGlu4dA2+MUIq7xW/+SFf8 SoR198qDSPdMwZlPo+I1PjSfRZCPdE8IJdwlDJUbXiLjN5NkyI8IJK7PcPPLucbnKI Yfv4MvVSgCwBES/pDd9fRT8SZkru454eQ57Ub0As= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730181AbgEEPci (ORCPT ); Tue, 5 May 2020 11:32:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:32910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730110AbgEEPc3 (ORCPT ); Tue, 5 May 2020 11:32:29 -0400 Received: from localhost (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 916B92083B; Tue, 5 May 2020 15:32:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588692748; bh=NR80z2yPjqgO14WXQRPXI+q6gF+1S53iofV6VuLwBac=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JkMfcC55zIFvs6+OSV4SiX2FtfTw0QIvi20Axw9EpOzMh5R1ceS8HDj73hIA5jtpR MNC6119kGguNpko2xuC5B4eGdJueQJNXg4VIt8q/vNXhhUSvpm9QSOE9ryaZR63Kq6 d3gagdQdwxFajtWcNHeSKNPLpF4ShuOAp2ltZpyM= Date: Tue, 5 May 2020 11:32:27 -0400 From: Sasha Levin To: Andy Shevchenko Cc: Pavel Machek , Greg Kroah-Hartman , Linux Kernel Mailing List , Stable , Dan Williams , Nicolas Ferre , Andy Shevchenko , Vinod Koul Subject: Re: [PATCH 4.19 28/37] dmaengine: dmatest: Fix iteration non-stop logic Message-ID: <20200505153227.GI13035@sasha-vm> References: <20200504165448.264746645@linuxfoundation.org> <20200504165451.307643203@linuxfoundation.org> <20200505123159.GC28722@amd> <20200505125818.GA31126@amd> <20200505133700.GA31753@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 05, 2020 at 05:05:37PM +0300, Andy Shevchenko wrote: >On Tue, May 5, 2020 at 4:37 PM Pavel Machek wrote: >> On Tue 2020-05-05 16:19:11, Andy Shevchenko wrote: >> > On Tue, May 5, 2020 at 3:58 PM Pavel Machek wrote: >> > > On Tue 2020-05-05 15:51:16, Andy Shevchenko wrote: >> > > > On Tue, May 5, 2020 at 3:37 PM Pavel Machek wrote: >> > > Yeah, I pointed that out above. Both && and || permit short >> > > execution. But that does not matter, as neither "params->iterations" >> > > nor "total_tests >= params->iterations" have side effects. >> > > >> > > Where is the runtime difference? >> > >> > We have to check *both* conditions. If we don't check iterations, we >> > just wait indefinitely until somebody tells us to stop. >> > Everything in the commit message and mentioned there commit IDs which >> > you may check. >> >> No. > >Yes. Please, read carefully the commit message (for your convenience I >emphasized above). I don't want to spend time on this basics stuff >anymore. I'm a bit confused about this too. Maybe it's too early in the morning, so I wrote this little test program: #include #include int main(int argc, char *argv[]) { int a = atoi(argv[1]); int b = atoi(argv[2]); if (!a && !b) printf("A"); else printf("B"); if (!(a || b)) printf("A"); else printf("B"); printf("\n"); return 0; } Andy, could you give an example of two values which will print something other than "AA" or "BB"? Heck, gcc even compiles these two conditions the same way: if (!a && !b) 11a8: 83 7d f8 00 cmpl $0x0,-0x8(%rbp) 11ac: 75 12 jne 11c0 11ae: 83 7d fc 00 cmpl $0x0,-0x4(%rbp) 11b2: 75 0c jne 11c0 printf("A"); 11b4: bf 41 00 00 00 mov $0x41,%edi 11b9: e8 a2 fe ff ff callq 1060 11be: eb 0a jmp 11ca else printf("B"); 11c0: bf 42 00 00 00 mov $0x42,%edi 11c5: e8 96 fe ff ff callq 1060 if (!(a || b)) 11ca: 83 7d f8 00 cmpl $0x0,-0x8(%rbp) 11ce: 75 12 jne 11e2 11d0: 83 7d fc 00 cmpl $0x0,-0x4(%rbp) 11d4: 75 0c jne 11e2 printf("A"); 11d6: bf 41 00 00 00 mov $0x41,%edi 11db: e8 80 fe ff ff callq 1060 11e0: eb 0a jmp 11ec else printf("B"); 11e2: bf 42 00 00 00 mov $0x42,%edi 11e7: e8 74 fe ff ff callq 1060 -- Thanks, Sasha