Received: by 10.223.185.116 with SMTP id b49csp4439499wrg; Mon, 26 Feb 2018 18:25:27 -0800 (PST) X-Google-Smtp-Source: AH8x225qYcmZmDgnXfYw6LFVINoyft3B96AFF5DErbUwRuvvswTroj+TJMc7Z56SV/ssu9kXy6PM X-Received: by 10.101.93.71 with SMTP id e7mr10252942pgt.248.1519698327195; Mon, 26 Feb 2018 18:25:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519698327; cv=none; d=google.com; s=arc-20160816; b=Wv7/ttB8yrwgrHj6KV6GwGOBvtM2kFRP0p7BGpDTTFmCSAGV9EbI0vsJFC9iKbn8Rp AiljD7XA2IdpZvkaDqvVMWFE+d1FeiCmDGm2wVzSPVIlj/IgbP76TzIwscNqep1Bg9h2 PuqaUp/a7hQX0cKvgWQPP/PjPuJsNNpKnxlsu1Tvk7BkOg16USPUs/f3TCB5kurX93+S iFSG0Q1ajnlXsvofF3owvr7d8Zm5dRexYuienacUIUuB9JAvk/iNdQDlClNmRXLJsigz ZClC3GYOFsbzR2akE7m9yA98hovJqcnniMcJhizC5k6v43MpK//DkUqnURcpLQz4us2y 9vRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=HI3EG0nulv2N43Y8OqpHqnpEzmXEE3YCiSO5qbW3wMA=; b=MdkReXSPJ5yrQmbT1gUa9/AL4SwcMqlDE2iV7/nW2PqxyuI73xLPPKKmckhofUVUUb J+oY7bHRh1oT73c3b67Ym4ZOh1LJuswQiHENGDgdUDFVdSsdOjt0l8rhu0z5qw49hwFe PbzJtoyeCXxEYjLnTVyt2cCTTKDu8BuY1GdNSced5bjoP80CdUu3a6cSelk1Z2cEs77B BtJZm+HrnjI8Y71Ne9IGEtZWw38eyfrIVAGed4U/HtgWjFMvbZKkcrIqgO65rlxyw8yy uXg/LV4TZlSHaaULI6DtJzWiO/LuEazcDPjsFa/NE1xOvO/sC2i4HgIYIFgLJrOTN5qu jiYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BW1rPf3P; 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 c23-v6si7203992plo.702.2018.02.26.18.25.12; Mon, 26 Feb 2018 18:25:27 -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=BW1rPf3P; 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 S1751881AbeB0CYc (ORCPT + 99 others); Mon, 26 Feb 2018 21:24:32 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:54603 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751733AbeB0CYb (ORCPT ); Mon, 26 Feb 2018 21:24:31 -0500 Received: by mail-wm0-f65.google.com with SMTP id z81so21054341wmb.4 for ; Mon, 26 Feb 2018 18:24:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=HI3EG0nulv2N43Y8OqpHqnpEzmXEE3YCiSO5qbW3wMA=; b=BW1rPf3PJOEabG8OWqQYZOEzhRXkCoHTxlnoVx3HmZCNdZuYhrnVz4c99Ye0bYbHh5 5ayosAyYy4YpBJ6X72gmkQoTsrFmkLjxeJ7RsiZcXmdjYW7pJLXytv/gHF/k56FBnckD qt1Z24/1IJwqvF5SDtuXUgpK3h3AE0TdDNR7r6JG2jadrs9XVDh4LUkffpHAFE/TRt0m UlYGuK4ZkINeyAigF5T62TUM8Lecz+/5GLje8rKnlhHHy319NzB10x7CTOeDIxP3pJH/ cI1A9aBaa9Bp1vBSviE4pR57ndleDC4VHVnBORuhyXS06B9etraaHBbSqeXSI+B2+gUH ThAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=HI3EG0nulv2N43Y8OqpHqnpEzmXEE3YCiSO5qbW3wMA=; b=BiyocJM/1ytZFdaqY/9KHSx/bEyp6hupRgrDyz86DM0onAZleTRfzqtcOjq2CGYt/U PRMovhsKwXebDj8aSa2RW0NXKmf3yo9zR8CN+mIgbYThf7obMGcOS8DiG3sq0MAPwCJP vdrU2Z9GHOHV2zT7xnEe2MUE3MoBz1y4uNgVl+kayJ5a4uE72VoRw7i0m1ypZpWLvaad Pz4T0XX7wPBSN4yQP0zFXCTOKL9NSUETWIqCJ/ihZO5vOQBsEwguDWAHC96JjllyNHE8 SXVe19TB8Lx5T6TazXB9udg53cj1EPT+0BAYWkk3rPBoall1PH0YVvtFan9OHVnlcXsZ qerA== X-Gm-Message-State: APf1xPAM91YXmJBz/a1hLrqUgC5XkMnNU6Wma9ef2I+5tVIul/W6HLQd bX1WU5+hp40/m4ei4awiWBM= X-Received: by 10.28.7.209 with SMTP id 200mr9286866wmh.49.1519698270279; Mon, 26 Feb 2018 18:24:30 -0800 (PST) Received: from localhost.localdomain (dynamic-2a00-1028-8386-da8a-79ac-85fb-2a06-3199.ipv6.broadband.iol.cz. [2a00:1028:8386:da8a:79ac:85fb:2a06:3199]) by smtp.gmail.com with ESMTPSA id k18sm12638915wmd.4.2018.02.26.18.24.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Feb 2018 18:24:29 -0800 (PST) From: Andrea Parri To: Palmer Dabbelt , Albert Ou Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrea Parri Subject: [PATCH] riscv/barrier: Define __smp_{store_release,load_acquire} Date: Tue, 27 Feb 2018 03:24:11 +0100 Message-Id: <1519698251-19272-1-git-send-email-parri.andrea@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce __smp_{store_release,load_acquire}, and rely on the generic definitions for smp_{store_release,load_acquire}. This avoids the use of full ("rw,rw") fences on SMP. Signed-off-by: Andrea Parri --- arch/riscv/include/asm/barrier.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/riscv/include/asm/barrier.h b/arch/riscv/include/asm/barrier.h index 5510366d169ae..d4628e4b3a5ea 100644 --- a/arch/riscv/include/asm/barrier.h +++ b/arch/riscv/include/asm/barrier.h @@ -38,6 +38,21 @@ #define __smp_rmb() RISCV_FENCE(r,r) #define __smp_wmb() RISCV_FENCE(w,w) +#define __smp_store_release(p, v) \ +do { \ + compiletime_assert_atomic_type(*p); \ + RISCV_FENCE(rw,w); \ + WRITE_ONCE(*p, v); \ +} while (0) + +#define __smp_load_acquire(p) \ +({ \ + typeof(*p) ___p1 = READ_ONCE(*p); \ + compiletime_assert_atomic_type(*p); \ + RISCV_FENCE(r,rw); \ + ___p1; \ +}) + /* * This is a very specific barrier: it's currently only used in two places in * the kernel, both in the scheduler. See include/linux/spinlock.h for the two -- 2.7.4