Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1971430imd; Fri, 2 Nov 2018 03:58:34 -0700 (PDT) X-Google-Smtp-Source: AJdET5dzhLoTcrAcH1SBsMmpeP32NTBaTTEUiVrhK4C8bEj7as7uL/+7IVAmQqON1czS8gbz9Fxo X-Received: by 2002:a63:f844:: with SMTP id v4mr10536662pgj.82.1541156314119; Fri, 02 Nov 2018 03:58:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541156314; cv=none; d=google.com; s=arc-20160816; b=cTB997L0SQoIURXYtaMKvRoISBPIl09tAtu7XsgeazegtOjRBG6oUdWCLTQ05xRT19 m1d9/CkNWdFBHXH/Wb59K43SNVSdB1qI/UmuMwoMIXC3iqZthKHg06Cfk1UUypi9S1Y4 pbmoj+Bd8onnNDi6hFD/asFJ5X++QQgJ1Z//z+K/TqzW7ViUe4M21Cj1MCn27ASAjR0o v1d61M8rIO86opW2dHuW2q31eeov25XUWpa43/PshmuVyrftwX9CM5eoe8eKI9MjCL+8 kKnxUvogrqFY56JfK+BVi9kP1RUMAhFv6ordYzlDQwCYcgNMXAwB9gQYDPQiIpYaQRca VUiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=0MZ5KgOhHuRLFFk/SrT8HwHB+XB5yR1eiEt0v4xJ4LA=; b=DVi+TZE+9Cu/3BVwjoizPPza4/1At1OTW4HaiVnCRuPki5NnIFtcnxWLvUM8k+vQv+ 3VRwHKK06CEfIVhbTXN+98hFmTTNqkcT/X8jHjbGpkgc//IcNtgH6UsaIllqmbphLl1o aBDonp16YFzvfa4yc3e4BgXIwXf7ANfMzFwz1ZVBGp0+G0CUkGNfcKUNE0x4CxxykpUf PkFgNGXrhC3VuB9zNxCk4/K6rsJeA+OM711O0sJ87JqwwLh67ZgL5A0c5l4RpCNNPJIF CmiylmhrSF4ROQ9mX2fz6afUHxOX3kyGse4biWDG8l180Dec/rZqmFd+k3SrmASjdRZF 38Zw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v18-v6si4576611pfa.3.2018.11.02.03.58.19; Fri, 02 Nov 2018 03:58:34 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726810AbeKBUDO convert rfc822-to-8bit (ORCPT + 99 others); Fri, 2 Nov 2018 16:03:14 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([146.101.78.151]:27527 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726016AbeKBUDO (ORCPT ); Fri, 2 Nov 2018 16:03:14 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by dkim.mimecast.com with ESMTP id uk-mta-11-qeGiSSCyMQiGTbbZCdWzuA-1; Fri, 02 Nov 2018 10:56:27 +0000 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 2 Nov 2018 10:56:31 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Fri, 2 Nov 2018 10:56:31 +0000 From: David Laight To: "'paulmck@linux.ibm.com'" , Peter Zijlstra CC: 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 Thread-Topic: [RFC PATCH] lib: Introduce generic __cmpxchg_u64() and use it where needed Thread-Index: AQHUcgSe+q6XzYqX/USdRpIoZo81C6U8TfVQ Date: Fri, 2 Nov 2018 10:56:31 +0000 Message-ID: <7d1ecd21c4c249138dfdd42b9aaa1cea@AcuMS.aculab.com> References: <1541015538-11382-1-git-send-email-linux@roeck-us.net> <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> In-Reply-To: <20181101170146.GQ4170@linux.ibm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-MC-Unique: qeGiSSCyMQiGTbbZCdWzuA-1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. > > 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. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)