Received: by 10.223.185.116 with SMTP id b49csp2901715wrg; Mon, 5 Mar 2018 10:26:35 -0800 (PST) X-Google-Smtp-Source: AG47ELv14nS+VYtgDHTowizhtvqbHV3e0GTVpUZ9BP8YP0x3fstegNP8+88p273s8MdAvEbn5wn0 X-Received: by 10.98.254.6 with SMTP id z6mr16077884pfh.155.1520274395822; Mon, 05 Mar 2018 10:26:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520274395; cv=none; d=google.com; s=arc-20160816; b=l6yWhOsr+U9v75fhsr9bIXpwI96niDJqKROuWPtvRTk9TmJE3LIZH76yWy6IteaOJw dwzJR5NLsOHKOqNt+fAVWqbgD7bT44oX8jKC2syqPAn33fv3JcVO4KOGJQJ6ldipPe4R FS2iRzZGuB2CiX2gr5cyKy1RX50n6lCJDd+1VTkpe2E/UP7MXb1qtuoI3l/e49AJflTn 6Ut/ZtsdyRcKH3FhTmI1TjkKm1mfTcBqd7WmFpdK8pi4/tf51DU0msu3UrQxr7rvM4zZ 1lSK/KdqFc9VKGqP3A/gkzCfRxcp1T+zNkcKem9cxtIKz36yIhRcIbxGhoXOXubKgDsR T4eQ== 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=N/9N3yu2ncvnJFuWEYLb3s9TR2X5ePb48NYNAerxmCg=; b=Zl3s0sszblIk0vYeL4zPy0ejJDS1afMr1OBH08buJlqF6cDpHqru483hSB/MgBIgmk sGU9tLHBCLK3wjlLK/XhpdRfUjTnjmiyUnZWAfsUPd61/xC/9IzH33AvKIr7bzkNIN5v cwoYcJTokvti/7spdocoRE7Ge5krAvN8NZ4O4Lfq6QvEvsqxQmzS0gpT39RJH4mR03mz 0pICZoIuL2jAGn/NQCOP8WP1k9dVOMnXOz28lobQ+wtZRd+lZ5O5Y8/IL9F/HHi4oQ4f BUFDscQ116lqDzZujtmbvyzMwoi2orxjHkdSpZAomJn8wgt7kHOMu/s5von6xtLxmG/3 WOlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Eu9XLtM9; 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 h34-v6si9669391pld.761.2018.03.05.10.26.21; Mon, 05 Mar 2018 10:26:35 -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=Eu9XLtM9; 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 S932170AbeCESXt (ORCPT + 99 others); Mon, 5 Mar 2018 13:23:49 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:43188 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751838AbeCESXq (ORCPT ); Mon, 5 Mar 2018 13:23:46 -0500 Received: by mail-wr0-f195.google.com with SMTP id u49so18289315wrc.10 for ; Mon, 05 Mar 2018 10:23:46 -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=N/9N3yu2ncvnJFuWEYLb3s9TR2X5ePb48NYNAerxmCg=; b=Eu9XLtM9zkxTtHFI55m8SXDkH/fMEkNl3aidXjmQtAqUci03FcwYZNPKV9vB/kqtmd fylHxMQqc8WvRhTL+2w/Sn/VwdYot8bS7jMT/p/sw60Q2q3vUGxheHbqF4KWvn4XOM5q ErnsQp0Gj8ANVSU9g0La2O6t6LqMzjP9DKRB+yikLyPVoNzJmrO6UPL4mbeYCWYcsLAD fd6tz0l6l5B4PAlCT2AnPu8+E0Q3lCCRD+v/ijFFG1Mz5xTyvfP+Qq7TB100w3wXOpz7 kXq2378xcszYd2wHpUCMWf08QCHueYsuVkeUmjshR1DcQhlNqgvjHSRX6qLzE4up85F/ mBfQ== 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=N/9N3yu2ncvnJFuWEYLb3s9TR2X5ePb48NYNAerxmCg=; b=P7CDCtwX7j+gA6mVPj7mUl8LcTSLOKVjv828U90nybC6TL1ztmBwpfGhsltxohKRGJ xwACfQ2zUrj5COHZsDUhaTOinWAVY09fOVUVmTQN9WJD2OHCWIiNzVGzoPsU5ssmawhv HzhYUu+DtDG6lgWYTmBrwIBRpOH54WnV3eHDf3B+l2q5GHeGvN+rPhL7M9vZPD/okUkn DGtqUN/XFPN5E6kjyK//HMER83EKS8XELnkdTox4GID88PsSST8hmoMyZL3Igv92rVR0 xWQyTRWn1CxwCuERqjvYnIogmPueYD5x6uXHiByzIZkGIM2mkL8sgDZrugqO/x0vVqcy CAcg== X-Gm-Message-State: APf1xPAyvfy4QmpW1IIasbsVS4Wc788sMOiNDPEzqvKXfvTo2qEEsDxt c00DvwhKe5AFiLhHfFmY7JU= X-Received: by 10.223.179.17 with SMTP id j17mr13108700wrd.223.1520274225487; Mon, 05 Mar 2018 10:23:45 -0800 (PST) Received: from localhost.localdomain (94-74-211-130.client.rionet.cz. [94.74.211.130]) by smtp.gmail.com with ESMTPSA id m15sm12751298wrb.58.2018.03.05.10.23.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Mar 2018 10:23:45 -0800 (PST) From: Andrea Parri To: Palmer Dabbelt , Albert Ou Cc: Daniel Lustig , Alan Stern , Will Deacon , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , Paul McKenney , Akira Yokosawa , Ingo Molnar , Linus Torvalds , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrea Parri Subject: [RFC PATCH 0/2] riscv/spinlock,atomic: Miscellaneous fixes Date: Mon, 5 Mar 2018 19:23:30 +0100 Message-Id: <1520274210-21748-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 Hi, This RFC is a follow-up on the discussion in [1], which led to the discovery of a few issues in the current implementations of RISC-V locking and atomic operations. In summary, this series proposes the following modifications: 1. Use lightweigth fences for acquire/release (locking, atomics) 2. Use the combination of .rl and full fences for fully-ordered atomics implemented with LR/SC pairs. 3. A few style changes (80-chars lines, alignment). Applies on top of "next-smp_sl_ar". Cheers, Andrea [1] https://marc.info/?l=linux-kernel&m=151930201102853&w=2 Andrea Parri (2): riscv/spinlock: Strengthen implementations with fences riscv/atomic: Strengthen implementations with fences arch/riscv/include/asm/atomic.h | 417 ++++++++++++++++++++++++-------------- arch/riscv/include/asm/cmpxchg.h | 391 ++++++++++++++++++++++++++++------- arch/riscv/include/asm/fence.h | 12 ++ arch/riscv/include/asm/spinlock.h | 29 +-- 4 files changed, 615 insertions(+), 234 deletions(-) create mode 100644 arch/riscv/include/asm/fence.h -- 2.7.4