From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932564AbbDMPKH (ORCPT ); Mon, 13 Apr 2015 11:10:07 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:36923 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932108AbbDMPKD (ORCPT ); Mon, 13 Apr 2015 11:10:03 -0400 Date: Mon, 13 Apr 2015 17:09:34 +0200 From: Peter Zijlstra To: Waiman Long Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , linux-arch@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Paolo Bonzini , Konrad Rzeszutek Wilk , Boris Ostrovsky , "Paul E. McKenney" , Rik van Riel , Linus Torvalds , Raghavendra K T , David Vrabel , Oleg Nesterov , Daniel J Blueman , Scott J Norton , Douglas Hatch Subject: Re: [PATCH v15 09/15] pvqspinlock: Implement simple paravirt support for the qspinlock Message-ID: <20150413150934.GI5029@twins.programming.kicks-ass.net> References: <1428375350-9213-1-git-send-email-Waiman.Long@hp.com> <1428375350-9213-10-git-send-email-Waiman.Long@hp.com> <20150409181327.GY5029@twins.programming.kicks-ass.net> <5526F218.2070909@hp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5526F218.2070909@hp.com> 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 Thu, Apr 09, 2015 at 05:41:44PM -0400, Waiman Long wrote: > >>+__visible void __pv_queue_spin_unlock(struct qspinlock *lock) > >>+{ > >>+ struct __qspinlock *l = (void *)lock; > >>+ struct pv_node *node; > >>+ > >>+ if (likely(cmpxchg(&l->locked, _Q_LOCKED_VAL, 0) == _Q_LOCKED_VAL)) > >>+ return; > >>+ > >>+ /* > >>+ * The queue head has been halted. Need to locate it and wake it up. > >>+ */ > >>+ node = pv_hash_find(lock); > >>+ smp_store_release(&l->locked, 0); > >Ah yes, clever that. > > > >>+ /* > >>+ * At this point the memory pointed at by lock can be freed/reused, > >>+ * however we can still use the PV node to kick the CPU. > >>+ */ > >>+ if (READ_ONCE(node->state) == vcpu_halted) > >>+ pv_kick(node->cpu); > >>+} > >>+PV_CALLEE_SAVE_REGS_THUNK(__pv_queue_spin_unlock); > >However I feel the PV_CALLEE_SAVE_REGS_THUNK thing belongs in the x86 > >code. > > That is why I originally put my version of the qspinlock_paravirt.h header > file under arch/x86/include/asm. Maybe we should move it back there. Putting > the thunk in arch/x86/kernel/kvm.c didn't work when you consider that the > Xen code also need that. Well the function is 'generic' and belong here I think. Its just the PV_CALLEE_SAVE_REGS_THUNK thing that arch specific. Should have live in arch/x86/kernel/paravirt-spinlocks.c instead?