Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1627676ybm; Thu, 23 May 2019 04:22:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2WCAX9HUEnihnkj0VDmbKjIzQT1nhLjYDohcfLiPL5qUQcuziU6OjdrlF6BzrtDPQ6Euu X-Received: by 2002:a65:5684:: with SMTP id v4mr96761398pgs.160.1558610556880; Thu, 23 May 2019 04:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558610556; cv=none; d=google.com; s=arc-20160816; b=j9dYsXYrtarYoqPVmxpdmO8rbXXkhpmasuVEAjxfGyWvgatOL/0/4pDueN55A4Ebu2 FqnuL2mK9S05TCWXudrTc7Ak2oeZUg1CbDTjtKJ40Or3GQO/smCrLnyr+wHPHYYnqNc/ F8oRBtLO+2QV0F+APX48q6nqZR5f+hPuDFBoYaP/j+qeUf/0ssI47m85fPgoRZb2FQbK vePIBrIjjQlqIGNKmKbkvnWQHbn5WuXIetO1mZD8/lsnzQV16O9+QG2wmOA44q0FMF7d /EzUSVuufHAKrQjl/pGt+xoS0CRmGem7BWp7RnLjn/8o2hFk15DRtbBUcQ2pbxwtjoV9 1kjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=TSU8XlJEMK+KpQjqT+wKCWosXAXefjk73b4VzzoBmws=; b=JZWjNBSq6604zNITcWfUYZyKdGs7fGYsHFmfZTtKAcuGfyRsrEsEVzxijZsHTGryAN IXHArk41b5c5lKV9n5JATazw09x5Qx6r+fAWBMXbGcK/DbUle45UKV1LeqUPrSeTyGW6 1KvY3+I/fKX55muaM9Lv+kEuGDVLb8yxaKCDgvNqEYlV7r5AED3kJp/s61PxMA3Mszgy uW48CmA1yRKHK1gGfOSZ2b/RZz4NiEtYLu3YIpDwyLWrvA0qngJ4pQ0lt4gIo2tpZZvE rU4MZdhBvGcb46smMcMz8RHEKhhI69bSzNHAlxAYa7cKFQjjZfg9aUG+Mk92ecdRC0Vw LjLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DOyuxxCq; 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 g7si28666239pgb.109.2019.05.23.04.22.21; Thu, 23 May 2019 04:22:36 -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; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DOyuxxCq; 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 S1730492AbfEWLUX (ORCPT + 99 others); Thu, 23 May 2019 07:20:23 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:38889 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730469AbfEWLUW (ORCPT ); Thu, 23 May 2019 07:20:22 -0400 Received: by mail-wm1-f65.google.com with SMTP id t5so5371080wmh.3 for ; Thu, 23 May 2019 04:20:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=TSU8XlJEMK+KpQjqT+wKCWosXAXefjk73b4VzzoBmws=; b=DOyuxxCqspOt3cSWF1wpAKD57vDkx064yFDRmD+HdF5x1UUC8AMynQLy3b8yeJzxTU t3GKAaiBkG03shVf7En4dFXk2OJZN/jzJV/07Jm9mRiRqydU23p/IsIcNghogpPnWstI tB9I9j8TUMhhRM2qaxs77EVMXjQ2dkDzDjET0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=TSU8XlJEMK+KpQjqT+wKCWosXAXefjk73b4VzzoBmws=; b=BDcn2TuVzp8ihcf9ZD+b4mXDGPnM/Zra1OeCw8ctHDFYMXVU7oXSu66/j5sKezkPFl QGBAIB+Rs71FtndIaLvvu5IP7B6p+oVlXHtxDMzDf03RcwSNKoduSe2ZW9pBmbpjoii4 LxALVAxXvs67F8ihHqxtEbPGNZktaayBeVNWChduqOPpiSsSXMCyUPpszP6WhmlCkq2V 4eRciD8Ks5bZZhSiTxxhmXP6mYEBrU6yAmmF7k7fRJW9E6VYClKy+WIjJtqCxSJGEbPZ jUT3IvLY6PCoJa/bjc4BK0CHncpywPRAkyRTkF180daCVUJcEdqjE97tFQ9y1v7pLaFr 7oSw== X-Gm-Message-State: APjAAAVU8eyOBK4H1LZPwlxXfRQ2JEPlLPz+P+mQAIus/JcduxwtE/MP JKPNfRGNZEkr9pGXqwwi2XOROQ== X-Received: by 2002:a1c:3cc2:: with SMTP id j185mr10979151wma.26.1558610420174; Thu, 23 May 2019 04:20:20 -0700 (PDT) Received: from andrea (86.100.broadband17.iol.cz. [109.80.100.86]) by smtp.gmail.com with ESMTPSA id d20sm5195243wra.68.2019.05.23.04.20.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 04:20:19 -0700 (PDT) Date: Thu, 23 May 2019 13:20:13 +0200 From: Andrea Parri To: Mark Rutland Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, will.deacon@arm.com, aou@eecs.berkeley.edu, arnd@arndb.de, bp@alien8.de, catalin.marinas@arm.com, davem@davemloft.net, fenghua.yu@intel.com, heiko.carstens@de.ibm.com, herbert@gondor.apana.org.au, ink@jurassic.park.msu.ru, jhogan@kernel.org, linux@armlinux.org.uk, mattst88@gmail.com, mingo@kernel.org, mpe@ellerman.id.au, palmer@sifive.com, paul.burton@mips.com, paulus@samba.org, ralf@linux-mips.org, rth@twiddle.net, stable@vger.kernel.org, tglx@linutronix.de, tony.luck@intel.com, vgupta@synopsys.com Subject: Re: [PATCH 00/18] locking/atomic: atomic64 type cleanup Message-ID: <20190523112013.GA14035@andrea> References: <20190522132250.26499-1-mark.rutland@arm.com> <20190523083013.GA4616@andrea> <20190523101926.GA3370@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190523101926.GA3370@lakrids.cambridge.arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > While reading the series, I realized that the following expression: > > > > atomic64_t v; > > ... > > typeof(v.counter) my_val = atomic64_set(&v, VAL); > > > > is a valid expression on some architectures (in part., on architectures > > which #define atomic64_set() to WRITE_ONCE()) but is invalid on others. > > (This is due to the fact that WRITE_ONCE() can be used as an rvalue in > > the above assignment; TBH, I ignore the reasons for having such rvalue?) > > > > IIUC, similar considerations hold for atomic_set(). > > > > The question is whether this is a known/"expected" inconsistency in the > > implementation of atomic64_set() or if this would also need to be fixed > > /addressed (say in a different patchset)? > > In either case, I don't think the intent is that they should be used that way, > and from a quick scan, I can only fine a single relevant instance today: > > [mark@lakrids:~/src/linux]% git grep '\(return\|=\)\s\+atomic\(64\)\?_set' > include/linux/vmw_vmci_defs.h: return atomic_set((atomic_t *)var, (u32)new_val); > include/linux/vmw_vmci_defs.h: return atomic64_set(var, new_val); > > > [mark@lakrids:~/src/linux]% git grep '=\s+atomic_set' | wc -l > 0 > [mark@lakrids:~/src/linux]% git grep '=\s+atomic64_set' | wc -l > 0 > > Any architectures implementing arch_atomic_* will have both of these functions > returning void. Currently that's x86 and arm64, but (time permitting) I intend > to migrate other architectures, so I guess we'll have to fix the above up as > required. > > I think it's best to avoid the construct above. Thank you for the clarification, Mark. I agree with you that it'd be better to avoid such constructs. (FWIW, it is not currently possible to use them in litmus tests for the LKMM...) Thanks, Andrea