From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754683AbbCRBF5 (ORCPT ); Tue, 17 Mar 2015 21:05:57 -0400 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.232]:15905 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753211AbbCRBFz (ORCPT ); Tue, 17 Mar 2015 21:05:55 -0400 Date: Tue, 17 Mar 2015 21:06:35 -0400 From: Steven Rostedt To: Mathieu Desnoyers Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, KOSAKI Motohiro , "Paul E. McKenney" , Nicholas Miell , Linus Torvalds , Ingo Molnar , Alan Cox , Lai Jiangshan , Stephen Hemminger , Andrew Morton , Josh Triplett , Thomas Gleixner , David Howells Subject: Re: [RFC PATCH] sys_membarrier(): system/process-wide memory barrier (x86) (v12) Message-ID: <20150317210635.5d08255c@grimm.local.home> In-Reply-To: <894387964.19110.1426596401635.JavaMail.zimbra@efficios.com> References: <1426447459-28620-1-git-send-email-mathieu.desnoyers@efficios.com> <20150316141939.GE21418@twins.programming.kicks-ass.net> <1203077851.9491.1426520636551.JavaMail.zimbra@efficios.com> <20150316172104.GH21418@twins.programming.kicks-ass.net> <1003922584.10662.1426532015839.JavaMail.zimbra@efficios.com> <20150316205435.GJ21418@twins.programming.kicks-ass.net> <910572156.13900.1426556725438.JavaMail.zimbra@efficios.com> <20150316222611.782cc0e4@grimm.local.home> <894387964.19110.1426596401635.JavaMail.zimbra@efficios.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-RR-Connecting-IP: 107.14.168.142:25 X-Cloudmark-Score: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 17 Mar 2015 12:46:41 +0000 (UTC) Mathieu Desnoyers wrote: > > Would that help? > > > > this_cpu_write(saved_next, next); > > rq = context_switch(rq, prev, next); > > rq->curr = this_cpu_read(saved_next); > > Assuming there is a full memory barrier (e.g. load_cr3) within > context_switch, it would help for ordering memory accesses that > are performed prior to the preemption, but not for memory accesses > to be performed immediately after return to userspace from preemption. Hmm, I was thinking that there was a spin_unlock(rq->lock) after that, but it appears that context_switch() does the unlock. If there was an spin_unlock() after this code, then it could work. There's always setting the rq->curr in the context_switch() call itself. -- Steve