Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2140272imd; Fri, 2 Nov 2018 06:40:06 -0700 (PDT) X-Google-Smtp-Source: AJdET5c9uk7Pujb74AMR9Sx3311sMKg4/2w7tE2vTr9R5IGpXypZKb0obBMoSdybtVKBLSGMRbGj X-Received: by 2002:a17:902:930b:: with SMTP id bc11-v6mr12036513plb.101.1541166006143; Fri, 02 Nov 2018 06:40:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541166006; cv=none; d=google.com; s=arc-20160816; b=VHd7t/NlFlNcVhJekqJPM4hl7yY8+Jhzv6T5nteCNnR+cUwiy5diziDutKH7/R0zzV lZ9BaEGD25RPZXSk6ctgzqg+3N9aLUnv+rxMg3u+axen7BbO+q5WnxhH0HsKvlbFojQG Cbv2R7mkimMmht2NYRz6ofB4Ip05lNsiRyMm+vbE22Or4WcLcQQKzGMD9oKwxuWT6Lmo nlV0zzXkxhUe6FPwZ74ktgejseE8x5gdO6AEpcmPsUGO10YP+An0VKgZloUilp1HxdtK BttfkE4/oxeIbkahOHo0pIsk2PwZDgDpgqTEqavck8FjWuP9V18DQ9vHPbuJtuoHTGI1 +kfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date; bh=1k26I0gy6TX1rUVXRguwye9FHjLywLMkja68aXY4agQ=; b=HQBBFFpuHOvLLZWsIA3qrtSqQ00k/f9g+OaJPSOu3gToWHZZlQznixASOFMXD8tCZe rv1VxCt61tb5bF06Lqg4g2e6mPH42597s4wfYeGQwjkPboTTxkKxEeK2Dza4pr44/aQH EMnLA6cqUjqkR5Lg8T4ZEvgzRDfnFIzKNK8Wy5gMC6gsdHjOEBIvdQtGbjscb6dK0YCz 4VLenvxuE7QVPDxD/r4Y12OBSWN9CVJ6crkB/GxPMyHcl2vjEpk75cbNfPCDLovLXm78 Rz78QQUepq0QUTFST6Kr6NRPVlVpxF8DdO5DywlsRCOHwHOnJz2kw+UAaeyH3P9eXj8e W3Ew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k4-v6si6895999pll.89.2018.11.02.06.39.51; Fri, 02 Nov 2018 06:40:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727828AbeKBWot (ORCPT + 99 others); Fri, 2 Nov 2018 18:44:49 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43466 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727477AbeKBWot (ORCPT ); Fri, 2 Nov 2018 18:44:49 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wA2DXruv013115 for ; Fri, 2 Nov 2018 09:37:37 -0400 Received: from e16.ny.us.ibm.com (e16.ny.us.ibm.com [129.33.205.206]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ngmj1ftu7-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 02 Nov 2018 09:37:37 -0400 Received: from localhost by e16.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 2 Nov 2018 13:37:36 -0000 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e16.ny.us.ibm.com (146.89.104.203) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 2 Nov 2018 13:37:29 -0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wA2DbSIP38338648 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Nov 2018 13:37:28 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 74EE8B205F; Fri, 2 Nov 2018 13:37:28 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3D013B2068; Fri, 2 Nov 2018 13:37:28 +0000 (GMT) Received: from paulmck-ThinkPad-W541 (unknown [9.85.148.108]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 2 Nov 2018 13:37:28 +0000 (GMT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 64F6A16C36E4; Fri, 2 Nov 2018 06:37:28 -0700 (PDT) Date: Fri, 2 Nov 2018 06:37:28 -0700 From: "Paul E. McKenney" To: David Laight Cc: Peter Zijlstra , Trond Myklebust , "mark.rutland@arm.com" , "linux-kernel@vger.kernel.org" , "ralf@linux-mips.org" , "jlayton@kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "bfields@fieldses.org" , "linux-mips@linux-mips.org" , "linux@roeck-us.net" , "linux-nfs@vger.kernel.org" , "akpm@linux-foundation.org" , "will.deacon@arm.com" , "boqun.feng@gmail.com" , "paul.burton@mips.com" , "anna.schumaker@netapp.com" , "jhogan@kernel.org" , "netdev@vger.kernel.org" , "davem@davemloft.net" , "arnd@arndb.de" , "paulus@samba.org" , "mpe@ellerman.id.au" , "benh@kernel.crashing.org" , "aryabinin@virtuozzo.com" , "dvyukov@google.com" Subject: Re: [RFC PATCH] lib: Introduce generic __cmpxchg_u64() and use it where needed Reply-To: paulmck@linux.ibm.com References: <20181031213240.zhh7dfcm47ucuyfl@pburton-laptop> <20181031220253.GA15505@roeck-us.net> <20181031233235.qbedw3pinxcuk7me@pburton-laptop> <4e2438a23d2edf03368950a72ec058d1d299c32e.camel@hammerspace.com> <20181101131846.biyilr2msonljmij@lakrids.cambridge.arm.com> <20181101145926.GE3178@hirez.programming.kicks-ass.net> <20181101163212.GF3159@hirez.programming.kicks-ass.net> <20181101170146.GQ4170@linux.ibm.com> <7d1ecd21c4c249138dfdd42b9aaa1cea@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7d1ecd21c4c249138dfdd42b9aaa1cea@AcuMS.aculab.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18110213-0072-0000-0000-000003C17830 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009972; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01111590; UDB=6.00576070; IPR=6.00891681; MB=3.00024005; MTD=3.00000008; XFM=3.00000015; UTC=2018-11-02 13:37:35 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18110213-0073-0000-0000-000049F921A3 Message-Id: <20181102133728.GR4170@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-02_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=240 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1811020124 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 02, 2018 at 10:56:31AM +0000, David Laight wrote: > From: Paul E. McKenney > > Sent: 01 November 2018 17:02 > ... > > And there is a push to define C++ signed arithmetic as 2s complement, > > but there are still 1s complement systems with C compilers. Just not > > C++ compilers. Legacy... > > Hmmm... I've used C compilers for DSPs where signed integer arithmetic > used the 'data registers' and would saturate, unsigned used the 'address > registers' and wrapped. > That was deliberate because it is much better to clip analogue values. There are no C++ compilers for those DSPs, correct? (Some of the C++ standards commmittee members believe that they have fully checked, but they might well have missed something.) > Then there was the annoying cobol run time that didn't update the > result variable if the result wouldn't fit. > Took a while to notice that the sum of a list of values was even wrong! > That would be perfectly valid for C - if unexpected. Heh! COBOL and FORTRAN also helped fund my first pass through university. > > > But for us using -fno-strict-overflow which actually defines signed > > > overflow > > I wonder how much real code 'strict-overflow' gets rid of? > IIRC gcc silently turns loops like: > int i; for (i = 1; i != 0; i *= 2) ... > into infinite ones. > Which is never what is required. The usual response is something like this: for (i = 1; i < n; i++) where the compiler has no idea what range of values "n" might take on. Can't say that I am convinced by that example, but at least we do have -fno-strict-overflow. Thanx, Paul