Received: by 10.213.65.68 with SMTP id h4csp2164038imn; Thu, 5 Apr 2018 10:02:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx49PTFkfZ8vI43+ZaTMHBawuqTVKD5HkD0uyvVa+XGatOxRg4ti9UIxtS43aCpghU817xW9K X-Received: by 10.101.99.129 with SMTP id h1mr15016714pgv.27.1522947737006; Thu, 05 Apr 2018 10:02:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522947736; cv=none; d=google.com; s=arc-20160816; b=RM3qUv+znGvIivYCHqPZUUyjz1m03aL657GlbsEgbzKctZFLQfaFgOYKR6G4utZoiE U7rbwDj+SY/FMaYGiyzK7kih6gFdaJxTV/tGVLVSy72bHjXtccqyO2hIUb5ulxnGT+M5 wW2SXWkUAwSY2AZfDNIsjD8yaz/iw1QeQYPrqN7whOctUfo5tD1oK9AQhGziqK4/ueXV Zk8Q0YtQfatABIl5EJPlJTJJU5qHabA9SVASeApH1D6IwD63RGjvf1S7P9i7r8X2usu9 iNS5YgfUCmx0kBTwVcqqdJ+bqN5Pqa2ZxwYGtCK/48jSAttyQd5qdHjf38MN2q2wrE35 N2UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=rLT3J5NT3Po6sGkKekSQxoftE0EryCGY3wZKvMbGpfQ=; b=vvbP8ObF2kjH4Qh/8r9y8+jj94D2eF3mt3uhP7v1sWgqnNo3TZ9+weWoSIOIyGKuqn eCwCoRGM+bCkCoswfRI1G6b3Kj98MPEqXDz9VuJhs72QyKTawKFJv+PnlpbKEjNPGf+7 6kuyoqjf9He9Wt+Ox1MA/5U/jXYQsB/T7v9XPRhzvBFaScTRTQHkrZHw2riq6E4CUVGL thWrB+mi2RPmaesTisOj7TAcn4ZxHwsT56j1btMDApqoIIhVOFoCyvFJei0fhRMnoNTO W5VrdlV0vqpOj2UW+iA5SLEz/D8FTs5xXdpnEynS06j4V+8SVmXkAwL99DpaqrFhQPNp Yirg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si5698980pgc.609.2018.04.05.10.01.53; Thu, 05 Apr 2018 10:02:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751749AbeDEQ7W (ORCPT + 99 others); Thu, 5 Apr 2018 12:59:22 -0400 Received: from foss.arm.com ([217.140.101.70]:57396 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751461AbeDEQ64 (ORCPT ); Thu, 5 Apr 2018 12:58:56 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 25D9316A3; Thu, 5 Apr 2018 09:58:56 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id ECCEC3F7DB; Thu, 5 Apr 2018 09:58:55 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 1F8AC1AE55AA; Thu, 5 Apr 2018 17:59:09 +0100 (BST) From: Will Deacon To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, peterz@infradead.org, mingo@kernel.org, boqun.feng@gmail.com, paulmck@linux.vnet.ibm.com, catalin.marinas@arm.com, Will Deacon Subject: [PATCH 09/10] locking/qspinlock: Make queued_spin_unlock use smp_store_release Date: Thu, 5 Apr 2018 17:59:06 +0100 Message-Id: <1522947547-24081-10-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1522947547-24081-1-git-send-email-will.deacon@arm.com> References: <1522947547-24081-1-git-send-email-will.deacon@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A qspinlock can be unlocked simply by writing zero to the locked byte. This can be implemented in the generic code, so do that and remove the arch-specific override for x86 in the !PV case. Cc: Peter Zijlstra Cc: Ingo Molnar Signed-off-by: Will Deacon --- arch/x86/include/asm/qspinlock.h | 17 ++++++----------- include/asm-generic/qspinlock.h | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h index 90b0b0ed8161..cc77cbb01432 100644 --- a/arch/x86/include/asm/qspinlock.h +++ b/arch/x86/include/asm/qspinlock.h @@ -7,6 +7,12 @@ #include #include +#ifdef CONFIG_PARAVIRT_SPINLOCKS +extern void native_queued_spin_lock_slowpath(struct qspinlock *lock, u32 val); +extern void __pv_init_lock_hash(void); +extern void __pv_queued_spin_lock_slowpath(struct qspinlock *lock, u32 val); +extern void __raw_callee_save___pv_queued_spin_unlock(struct qspinlock *lock); + #define queued_spin_unlock queued_spin_unlock /** * queued_spin_unlock - release a queued spinlock @@ -19,12 +25,6 @@ static inline void native_queued_spin_unlock(struct qspinlock *lock) smp_store_release(&lock->locked, 0); } -#ifdef CONFIG_PARAVIRT_SPINLOCKS -extern void native_queued_spin_lock_slowpath(struct qspinlock *lock, u32 val); -extern void __pv_init_lock_hash(void); -extern void __pv_queued_spin_lock_slowpath(struct qspinlock *lock, u32 val); -extern void __raw_callee_save___pv_queued_spin_unlock(struct qspinlock *lock); - static inline void queued_spin_lock_slowpath(struct qspinlock *lock, u32 val) { pv_queued_spin_lock_slowpath(lock, val); @@ -40,11 +40,6 @@ static inline bool vcpu_is_preempted(long cpu) { return pv_vcpu_is_preempted(cpu); } -#else -static inline void queued_spin_unlock(struct qspinlock *lock) -{ - native_queued_spin_unlock(lock); -} #endif #ifdef CONFIG_PARAVIRT diff --git a/include/asm-generic/qspinlock.h b/include/asm-generic/qspinlock.h index b37b4ad7eb94..a8ed0a352d75 100644 --- a/include/asm-generic/qspinlock.h +++ b/include/asm-generic/qspinlock.h @@ -100,7 +100,7 @@ static __always_inline void queued_spin_unlock(struct qspinlock *lock) /* * unlock() needs release semantics: */ - (void)atomic_sub_return_release(_Q_LOCKED_VAL, &lock->val); + smp_store_release(&lock->locked, 0); } #endif -- 2.1.4