From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752541AbcEDNxm (ORCPT ); Wed, 4 May 2016 09:53:42 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:37915 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752446AbcEDNxj (ORCPT ); Wed, 4 May 2016 09:53:39 -0400 Date: Wed, 4 May 2016 15:53:29 +0200 From: Peter Zijlstra To: Petr Mladek Cc: Josh Poimboeuf , Jessica Yu , Jiri Kosina , Miroslav Benes , Ingo Molnar , Michael Ellerman , Heiko Carstens , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, Vojtech Pavlik , Jiri Slaby , Chris J Arges , Andy Lutomirski Subject: Re: barriers: was: [RFC PATCH v2 17/18] livepatch: change to a per-task consistency model Message-ID: <20160504135329.GQ3430@twins.programming.kicks-ass.net> References: <20160504123940.GR2749@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160504123940.GR2749@pathway.suse.cz> 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 Wed, May 04, 2016 at 02:39:40PM +0200, Petr Mladek wrote: > > + * This barrier also ensures that if another CPU goes through the > > + * syscall barrier, sees the TIF_PATCH_PENDING writes in > > + * klp_start_transition(), and calls klp_patch_task(), it also sees the > > + * above write to the target state. Otherwise it can put the task in > > + * the wrong universe. > > + */ > > By other words, it makes sure that klp_patch_task() will assign the > right patch_state. Where klp_patch_task() could not be called > before we set TIF_PATCH_PENDING in klp_start_transition(). > > > + smp_wmb(); > > +} So I've not read the patch; but ending a function with an smp_wmb() feels wrong. A wmb orders two stores, and I feel both stores should be well visible in the same function.