public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vineet Gupta <vgupta@synopsys.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] coredump: Replace opencoded set_mask_bits()
Date: Fri, 7 Aug 2015 17:45:25 +0200	[thread overview]
Message-ID: <20150807154525.GO16853@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <55C4D02A.5000902@synopsys.com>

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 :-)

But yes, ideally everything will be type safe because of those archs
that cannot have atomic RmW ops like !ARC_HAS_LLSC.

Mixing cmpxchg()/xchg() with regular stores is broken on those.

Fwiw, you might want to set ARCH_SUPPORTS_ATOMIC_RMW for ARC_HAS_LLSC.

  reply	other threads:[~2015-08-07 15:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07  8:16 [PATCH] coredump: Replace opencoded set_mask_bits() Vineet Gupta
2015-08-07 11:57 ` Oleg Nesterov
2015-08-07 14:44   ` Vineet Gupta
2015-08-07 14:57     ` Peter Zijlstra
2015-08-07 15:35       ` Vineet Gupta
2015-08-07 15:45         ` Peter Zijlstra [this message]
2015-08-07 15:58           ` Vineet Gupta
2015-08-07 16:09             ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150807154525.GO16853@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=vgupta@synopsys.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox