From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vineet Gupta Subject: Re: [PATCH] coredump: Replace opencoded set_mask_bits() Date: Fri, 07 Aug 2015 21:28:05 +0530 Message-ID: <55C4D58D.8040503@synopsys.com> References: <1438935406-5762-1-git-send-email-vgupta@synopsys.com> <20150807115710.GA16897@redhat.com> <55C4C433.5000501@synopsys.com> <20150807145737.GL16853@twins.programming.kicks-ass.net> <55C4D02A.5000902@synopsys.com> <20150807154525.GO16853@twins.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: Oleg Nesterov , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Peter Zijlstra Return-path: In-Reply-To: <20150807154525.GO16853@twins.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Friday 07 August 2015 09:15 PM, Peter Zijlstra wrote: > On Fri, Aug 07, 2015 at 09:05:06PM +0530, Vineet Gupta wrote: >> On Friday 07 August 2015 08:27 PM, Peter Zijlstra wrote: >>> On Fri, Aug 07, 2015 at 08:14:03PM +0530, Vineet Gupta wrote: >>> >>>>> See, I have such a cmpxchg loop in ARC code - originally from Peter :-) >>>>> arch/arc/kernel/smp.c. @ipi_data_ptr is NOT atomic_t >>>>> >>>>> do { >>>>> new = old = ACCESS_ONCE(*ipi_data_ptr); >>>>> new |= 1U << msg; >>>>> } while (cmpxchg(ipi_data_ptr, old, new) != old); >>>>> >>> Well, you'll have atomic_or() real soon now. >> >> Doesn't help my cause - ipi_data_ptr is not atomic_t - hence my prev question in >> this thread > > A cast will work :-) > How ? We have typedef struct { int counter; } atomic_t; > But yes, ideally everything will be type safe because of those archs > that cannot have atomic RmW ops like !ARC_HAS_LLSC. Type safe - how / what ? > > Mixing cmpxchg()/xchg() with regular stores is broken on those. Right, but how does that relate to this discussion - perhaps I shd stop talking - long friday already :-) > > Fwiw, you might want to set ARCH_SUPPORTS_ATOMIC_RMW for ARC_HAS_LLSC. > Sure I will !