Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp1481997imb; Sat, 2 Mar 2019 17:48:10 -0800 (PST) X-Google-Smtp-Source: APXvYqy3JcAIsPJvRJbx7No3NvyJgDwgHC/MpBelKnWHYjrIAUgdOnznYvt6Wlsco8n5cpU9Pkg4 X-Received: by 2002:a17:902:9001:: with SMTP id a1mr9437478plp.96.1551577690106; Sat, 02 Mar 2019 17:48:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551577690; cv=none; d=google.com; s=arc-20160816; b=nQiv1nNeJD84oEewAqnaerJUTt11UyT1Xf609h8pfOO2Ythjjf3cdPjrLl6GUYR0kS 6zq0v1qGEnNRpvvl6dpnsuNee2SNDXDuaZDXu/9z4UcA8YQw1ItTw2OyITvasedFEsxF inFuOAZjG744FFpDgVJ3sPHDR8G9SI9mJ3K2V1tx65TqTuEZtxdokgjyQBmwx+FIK5GV meSU7enCV3tP17xJt+0Q/91NXe7TKe9ciUopb81cLHRF6nTG1hj5L+8bvCqoyfvYLH5Q XS+ZNBk198TQOIOX3RkxtaiKtclb7C8pP1dswSbU8lDtJ+YSByLTTtFmL9+9J3HrJ+zl c1kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:message-id :user-agent:mime-version:in-reply-to:references:cc:to:subject:from :date:dkim-signature; bh=18FeiCiDw77JTEKmLK281O2l0nYlbRpwErNz8FWY5h8=; b=0raHeqXfwFbx3ug1igtLPErZ7CIHCr7pNg3Vj3Rw/uyimCSu69JkDU1fcpCPVjmJRa j5cuMdV+2PYTCQ8ufcEYfY8Ut/JVCkRsDnPGLfPPh92j7erar8rMOsh3czGCESBIIExw LiH9TmOrcLIn+FnprZeLVXHwV8Yu8lBfgaSosKGuOVksuytISUPqRDp+huYCUwGt6dof Ktpav7kbnO2jpCw+C3g/SQrnRXLpOYLngyh6RoYtEzox0nGKfpvF2QyZtFKWCH2mWCJt 9tF3X2s3Ptd75KHWFnw/zT4dypdFxjQacWEaPd6711nA8oBnT3svO165LN08dqLjmeaE yykA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XcR79mct; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si1788107pfi.288.2019.03.02.17.47.54; Sat, 02 Mar 2019 17:48:10 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XcR79mct; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727105AbfCCBra (ORCPT + 99 others); Sat, 2 Mar 2019 20:47:30 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:38070 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726017AbfCCBr3 (ORCPT ); Sat, 2 Mar 2019 20:47:29 -0500 Received: by mail-pl1-f194.google.com with SMTP id g37so810862plb.5; Sat, 02 Mar 2019 17:47:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :user-agent:message-id:content-transfer-encoding; bh=18FeiCiDw77JTEKmLK281O2l0nYlbRpwErNz8FWY5h8=; b=XcR79mctbpDOS+IYIzVYVKaTP8ZOEqpM/s6qUA5UFHkHrztmLzAn5OSSc0CFXweq0O CKw9NcrwB8IupI3yVJiswCUtmjjRTjupogHB//5GRwJ1oJhbKPUVtv2YOW4HW8ei13Iy DftzGgxPliQtWuMHEDWua43iifW+1Ky0BDXJTdyxJhkdrSmD3ylVMrEy4IXtHjDzMhmB 0mrdQLSi0+xj37FT4TwvrfbRk+tEGCbxGURoYuM056gLmNg6VOxOYVkUVuLX40u2CTTe UXbHDAXaH+9D7iXIQi2gJ1axep5V3NRyjQmgtuoU3kLlnIyvBJvOnvleLcuCt6iEhoES HYLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:user-agent:message-id:content-transfer-encoding; bh=18FeiCiDw77JTEKmLK281O2l0nYlbRpwErNz8FWY5h8=; b=F0jr7fWj3anueC4ZPD3Uipx7V650pFX6hM6TPiLLmQ9w6pjevaatIRWaBUo0NjjMGK 4Chk8W4UJloEl67ScVr57LirOVI1E5Kgd0yCPDQBcLtZ8KAbq+3IBFqBUj2XCMFyX/MY lcTgJ04TgEbsYnrmCpeh6UFwQDfRFlLiNqM/6uOV2DRzaNLV9WyXzW0NAc1ye0+UV4bE Pu8wolLWiyZQsEdiuz2opPhXRU7Guux88HIk8Cemh2JrzZmAkmuFqNrXPULYliMywBuO O+5nkxxYrMvrJBEcBj9F0tf91QJw0ieGMh2AzMWXtdX13dfosd9ZLaJffhN1eYGaI/Wm X/HA== X-Gm-Message-State: APjAAAVzFOX1RQyBM2+/sAxZPlCTRpjdU52SHeOJSvBTlpDtMOJvs9cZ tW1hSgQ59RcZMDtQ9MIdH1NjQLmX X-Received: by 2002:a17:902:9a84:: with SMTP id w4mr13449565plp.283.1551577648946; Sat, 02 Mar 2019 17:47:28 -0800 (PST) Received: from localhost (193-116-74-175.tpgi.com.au. [193.116.74.175]) by smtp.gmail.com with ESMTPSA id l64sm3007386pfj.179.2019.03.02.17.47.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 02 Mar 2019 17:47:28 -0800 (PST) Date: Sun, 03 Mar 2019 11:47:22 +1000 From: Nicholas Piggin Subject: Re: [PATCH 03/20] mmiowb: Hook up mmiowb helpers to spinlocks and generic I/O accessors To: linux-arch@vger.kernel.org, Will Deacon Cc: Andrea Parri , Arnd Bergmann , Benjamin Herrenschmidt , Rich Felker , David Howells , Daniel Lustig , linux-kernel@vger.kernel.org, "Maciej W. Rozycki" , Ingo Molnar , Michael Ellerman , Palmer Dabbelt , Paul Burton , "Paul E. McKenney" , Peter Zijlstra , Alan Stern , Tony Luck , Linus Torvalds , Yoshinori Sato References: <20190301140348.25175-1-will.deacon@arm.com> <20190301140348.25175-4-will.deacon@arm.com> In-Reply-To: <20190301140348.25175-4-will.deacon@arm.com> MIME-Version: 1.0 User-Agent: astroid/0.14.0 (https://github.com/astroidmail/astroid) Message-Id: <1551577391.707a6tsmt3.astroid@bobo.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Will Deacon's on March 2, 2019 12:03 am: > @@ -177,6 +178,7 @@ do { \ > static inline void do_raw_spin_lock(raw_spinlock_t *lock) __acquires(loc= k) > { > __acquire(lock); > + mmiowb_spin_lock(); > arch_spin_lock(&lock->raw_lock); > } > =20 > @@ -188,16 +190,23 @@ static inline void > do_raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long *flags) __acq= uires(lock) > { > __acquire(lock); > + mmiowb_spin_lock(); > arch_spin_lock_flags(&lock->raw_lock, *flags); > } You'd be better to put these inside the spin lock, to match your=20 trylock. Also it means the mmiowb state can be used inside a lock/unlock pair without a compiler barrer forcing it to be reloaded, should be better code generation for very small critical sections on archs which inline lock and unlock. > =20 > static inline int do_raw_spin_trylock(raw_spinlock_t *lock) > { > - return arch_spin_trylock(&(lock)->raw_lock); > + int ret =3D arch_spin_trylock(&(lock)->raw_lock); > + > + if (ret) > + mmiowb_spin_lock(); > + > + return ret; > } > =20 > static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(l= ock) > { > + mmiowb_spin_unlock(); > arch_spin_unlock(&lock->raw_lock); > __release(lock); > } Thanks, Nick =