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: 9122731 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 10DC4BF29F for ; Wed, 18 May 2016 22:03:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2EE6E20145 for ; Wed, 18 May 2016 22:03:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 227D820120 for ; Wed, 18 May 2016 22:03:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752144AbcERWDE (ORCPT ); Wed, 18 May 2016 18:03:04 -0400 Received: from smtp.opengridcomputing.com ([72.48.136.20]:32844 "EHLO smtp.opengridcomputing.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751858AbcERWDE (ORCPT ); Wed, 18 May 2016 18:03:04 -0400 Received: from smtp.ogc.us (build2.ogc.int [10.10.0.32]) by smtp.opengridcomputing.com (Postfix) with ESMTP id ACF7C29E7B; Wed, 18 May 2016 17:03:02 -0500 (CDT) Received: by smtp.ogc.us (Postfix, from userid 503) id 81260E09E9; Wed, 18 May 2016 17:03:02 -0500 (CDT) From: Steve Wise Date: Wed, 18 May 2016 14:16:39 -0700 Subject: [PATCH RFC] libibverbs: add ARM64 memory barrier macros To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org Message-Id: <20160518220302.81260E09E9@smtp.ogc.us> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.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 --- I wonder why the linux kernel doesn't export these? Also, if the hw platform is unknown, I don't think libibverbs should pick a default implementation that might cause data corruption. Rather, I think it should just fail a compile on that platform. Thoughts? --- 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.