Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp485547imb; Fri, 1 Mar 2019 06:07:23 -0800 (PST) X-Google-Smtp-Source: APXvYqzRtAWXx/Ll56ZwBY5GhbWwLYrMQvg5jGiRfjTK1vLlAC/h0kSUANO0+qopog6VIIB4Uf12 X-Received: by 2002:a17:902:6f08:: with SMTP id w8mr5675898plk.5.1551449243433; Fri, 01 Mar 2019 06:07:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551449243; cv=none; d=google.com; s=arc-20160816; b=nJFY0FEOFhj64LwTJYolainfkeJnj4XFkIRyuh9f+CD8iJSmLIP4+tt3XrtudtrqGr nw70yudSWqKfFETGGTIjUOYFuNFJXyo1aRiWSRtX0oDFZqBLY3fEOPnupTIR35rVNpvy Xnc7X0XuMVm5dxDCmqC+gxdAaswNnoQLEzWB6K955dPw7jtD3USxCyEtwr7lTI/fezor dBsBbLRqt/pGuKLUYQO9HQgz+JmerzhAcnxNrxqSpR9kdF4a4ycq+ebvCW93/FFdxntj zEcyBRaEd+JJ96YK0P6qsCEmJBRd82SGO6RFdduocuFScbZcowqvdBD7vEaA8hQ3YRu9 yr/w== 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; bh=dVUwotK06hy4eX1YA0XDdEpdifp9veVzvradNce73zM=; b=EJTLZQEOPtItu9YxEGLuN9vKsMUPYpnXy3DMGba/6jEAW9IqwmBtT8bEZGzIV88jNp NmXhTUpEoqs8ig05Jr9gg9xKGJ/2/2MRgSsVbGUqKRhCIPyLU4COHmainbIzqwQnIBmn kZ2lQFqGRXA0kvgEfvnMi3TOxGoMt/SD2kwD9v7XJfrpAAbrizHBP9LbEtW/4QnJcvJP tUu10m8Lmlo8meEJnivNcue1Nxi4ikfYe7C+dhP7xQBqK/QFYJSWjBOaO+U6SVLFAu2y nBlTMDE4TTo8fRFgy/2HQoKLNT/6ds09+6I4AoF2Pg3sM9fL/QZ5aLAJjNc8zNns1zom jdGA== 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 l63si10248471pfi.131.2019.03.01.06.07.07; Fri, 01 Mar 2019 06:07:23 -0800 (PST) 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 S2388523AbfCAOEk (ORCPT + 99 others); Fri, 1 Mar 2019 09:04:40 -0500 Received: from foss.arm.com ([217.140.101.70]:35866 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388094AbfCAOEh (ORCPT ); Fri, 1 Mar 2019 09:04:37 -0500 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 F178A1A25; Fri, 1 Mar 2019 06:04:36 -0800 (PST) Received: from fuggles.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 B5ED03F720; Fri, 1 Mar 2019 06:04:33 -0800 (PST) From: Will Deacon To: linux-arch@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Will Deacon , "Paul E. McKenney" , Benjamin Herrenschmidt , Michael Ellerman , Arnd Bergmann , Peter Zijlstra , Andrea Parri , Palmer Dabbelt , Daniel Lustig , David Howells , Alan Stern , Linus Torvalds , "Maciej W. Rozycki" , Paul Burton , Ingo Molnar , Yoshinori Sato , Rich Felker , Tony Luck Subject: [PATCH 10/20] mips/mmiowb: Add unconditional mmiowb() to arch_spin_unlock() Date: Fri, 1 Mar 2019 14:03:38 +0000 Message-Id: <20190301140348.25175-11-will.deacon@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190301140348.25175-1-will.deacon@arm.com> References: <20190301140348.25175-1-will.deacon@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The mmiowb() macro is horribly difficult to use and drivers will continue to work most of the time if they omit a call when it is required. Rather than rely on driver authors getting this right, push mmiowb() into arch_spin_unlock() for mips. If this is deemed to be a performance issue, a subsequent optimisation could make use of ARCH_HAS_MMIOWB to elide the barrier in cases where no I/O writes were performed inside the critical section. Signed-off-by: Will Deacon --- arch/mips/include/asm/Kbuild | 1 - arch/mips/include/asm/io.h | 3 --- arch/mips/include/asm/mmiowb.h | 11 +++++++++++ arch/mips/include/asm/spinlock.h | 15 +++++++++++++++ 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 arch/mips/include/asm/mmiowb.h diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild index 5653b1e47dd0..f15d5db5dd67 100644 --- a/arch/mips/include/asm/Kbuild +++ b/arch/mips/include/asm/Kbuild @@ -13,7 +13,6 @@ generic-y += irq_work.h generic-y += local64.h generic-y += mcs_spinlock.h generic-y += mm-arch-hooks.h -generic-y += mmiowb.h generic-y += msi.h generic-y += parport.h generic-y += percpu.h diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 845fbbc7a2e3..29997e42480e 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -102,9 +102,6 @@ static inline void set_io_port_base(unsigned long base) #define iobarrier_w() wmb() #define iobarrier_sync() iob() -/* Some callers use this older API instead. */ -#define mmiowb() iobarrier_w() - /* * virt_to_phys - map virtual addresses to physical * @address: address to remap diff --git a/arch/mips/include/asm/mmiowb.h b/arch/mips/include/asm/mmiowb.h new file mode 100644 index 000000000000..a40824e3ef8e --- /dev/null +++ b/arch/mips/include/asm/mmiowb.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_MMIOWB_H +#define _ASM_MMIOWB_H + +#include + +#define mmiowb() iobarrier_w() + +#include + +#endif /* _ASM_MMIOWB_H */ diff --git a/arch/mips/include/asm/spinlock.h b/arch/mips/include/asm/spinlock.h index ee81297d9117..8a88eb265516 100644 --- a/arch/mips/include/asm/spinlock.h +++ b/arch/mips/include/asm/spinlock.h @@ -11,6 +11,21 @@ #include #include + +#include + +#define queued_spin_unlock queued_spin_unlock +/** + * queued_spin_unlock - release a queued spinlock + * @lock : Pointer to queued spinlock structure + */ +static inline void queued_spin_unlock(struct qspinlock *lock) +{ + /* This could be optimised with ARCH_HAS_MMIOWB */ + mmiowb(); + smp_store_release(&lock->locked, 0); +} + #include #endif /* _ASM_SPINLOCK_H */ -- 2.11.0