From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753172AbbGJHFf (ORCPT ); Fri, 10 Jul 2015 03:05:35 -0400 Received: from casper.infradead.org ([85.118.1.10]:38497 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751739AbbGJHF1 (ORCPT ); Fri, 10 Jul 2015 03:05:27 -0400 Date: Fri, 10 Jul 2015 09:05:11 +0200 From: Peter Zijlstra To: Vineet Gupta Cc: "linux-kernel@vger.kernel.org" , "linux-arch@vger.kernel.org" , "rth@twiddle.net" , "linux@arm.linux.org.uk" , "will.deacon@arm.com" , "hskinnemoen@gmail.com" , "realmz6@gmail.com" , "dhowells@redhat.com" , "rkuo@codeaurora.org" , "tony.luck@intel.com" , "geert@linux-m68k.org" , "james.hogan@imgtec.com" , "ralf@linux-mips.org" , "jejb@parisc-linux.org" , "benh@kernel.crashing.org" , "heiko.carstens@de.ibm.com" , "davem@davemloft.net" , "cmetcalf@ezchip.com" , "mingo@kernel.org" Subject: Re: [RFC][PATCH 02/24] arc: Provide atomic_{or,xor,and} Message-ID: <20150710070511.GE19282@twins.programming.kicks-ass.net> References: <20150709172855.564686637@infradead.org> <20150709175308.217482496@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 10, 2015 at 04:30:46AM +0000, Vineet Gupta wrote: > > Since we are on the topic, the cmpxchg() loop in arch/arc/kernel/smp.c still > irritates me. > Do we need a new set of primitives to operate atomically on non atomic_t data or > does that mean that the data *not* being atomic_t but requiring such semantics is > the fundamental problem and thus needs to be converted first. So if you look at the last patch, there's already a few sites that do things like: + atomic_or(*mask, (atomic_t *)&flushcache_cpumask); Which is of course ugly as hell, but does work. Esp. inside arch code. Now the 'problem' with cmpxchg/xchg, the instructions working on !atomic data is: http://lkml.kernel.org/r/alpine.LRH.2.02.1406011342470.20831@file01.intranet.prod.int.rdu2.redhat.com http://lkml.kernel.org/r/20140606175316.GV13930@laptop.programming.kicks-ass.net And note that includes some arc. Adding more such primitives will only make it harder on those already 'broken' archs.