From patchwork Wed May 18 21:16:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Wise X-Patchwork-Id: 9129881 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8922B60221 for ; Fri, 20 May 2016 16:32:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EB6C27CC9 for ; Fri, 20 May 2016 16:32:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7395F27D00; Fri, 20 May 2016 16:32:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=2.0 tests=BAYES_00, DATE_IN_PAST_24_48, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00E9A27CC9 for ; Fri, 20 May 2016 16:32:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755293AbcETQcJ (ORCPT ); Fri, 20 May 2016 12:32:09 -0400 Received: from smtp.opengridcomputing.com ([72.48.136.20]:35377 "EHLO smtp.opengridcomputing.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754743AbcETQcI (ORCPT ); Fri, 20 May 2016 12:32:08 -0400 Received: from smtp.ogc.us (build2.ogc.int [10.10.0.32]) by smtp.opengridcomputing.com (Postfix) with ESMTP id D16B729E79; Fri, 20 May 2016 11:32:07 -0500 (CDT) Received: by smtp.ogc.us (Postfix, from userid 503) id B99DCE0B9D; Fri, 20 May 2016 11:32:07 -0500 (CDT) From: Steve Wise Date: Wed, 18 May 2016 14:16:39 -0700 Subject: [PATCH] libibverbs: add ARM64 memory barrier macros To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org Message-Id: <20160520163207.B99DCE0B9D@smtp.ogc.us> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The default generic barriers are not correct for ARM64. This results in data corruption. The correct macros are lifted from the linux kernel. Signed-off-by: Steve Wise --- Changes since RFC: no change to the patch - just productive discussion about these barrier implementations. I propose we proceed to add this patch since it resolves a data corruption bug. --- include/infiniband/arch.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/include/infiniband/arch.h b/include/infiniband/arch.h index bc1738a..71f02f8 100644 --- a/include/infiniband/arch.h +++ b/include/infiniband/arch.h @@ -122,6 +122,15 @@ static inline uint64_t ntohll(uint64_t x) { return x; } #define wmb() mb() /* for s390x */ #define wc_wmb() wmb() /* for s390x */ +#elif defined(__aarch64__) + +#define dsb(opt) asm volatile("dsb " #opt : : : "memory") + +#define mb() dsb(sy) +#define rmb() dsb(ld) +#define wmb() dsb(st) +#define wc_wmb() wmb() + #else #warning No architecture specific defines found. Using generic implementation.