From patchwork Tue Mar 20 20:19:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10297823 X-Patchwork-Delegate: jgg@ziepe.ca 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 AF0AA6039A for ; Tue, 20 Mar 2018 20:20:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A027928C5E for ; Tue, 20 Mar 2018 20:20:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94F7E2964D; Tue, 20 Mar 2018 20:20:22 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 B32BE28F5F for ; Tue, 20 Mar 2018 20:20:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751475AbeCTUUR (ORCPT ); Tue, 20 Mar 2018 16:20:17 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:51821 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbeCTUUQ (ORCPT ); Tue, 20 Mar 2018 16:20:16 -0400 Received: by mail-wm0-f68.google.com with SMTP id h21so5853132wmd.1 for ; Tue, 20 Mar 2018 13:20:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yxF9I6wPJG8aeLdoOmCIEYP/G+o77uOGqwa3clBrnWg=; b=OOLYQwqWmDWOLxtoNFngiXOAX68dtvjeNAtiuBwnJDNwmAh2idXr6rZAlnsedMuNy3 xqfPYlmNcLBWmxCU/Cgz59fPLJDEOsYR2mUwtDHRS/xsHtHBlkmAIChUKJXmh4/eAFkR t6QphYUQ5A6cKZIEExLUBHWPNQpGRIaCuf1gD06NTDWwSGrOLGS7SJms3L9yEZ3+Kibp O5SOLpk9piwdhxc+aRrL6clnX8FlxF/3HEJcq04AQNTxb4gH0Jt1ln3cn2+LyRY3Vpu5 9DaiQgdfKXPeVhYrypi2Avav5SOy39LYHmD5vhqK2rN0FqzrIBmefiQRUtfxBsRKERcu +qTg== 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:in-reply-to :references; bh=yxF9I6wPJG8aeLdoOmCIEYP/G+o77uOGqwa3clBrnWg=; b=e68jUbQCsrK01Y/g8ZO3VDlj71A5S5Dhz1w4Xrapl2SZSMjOXG+FdTQgVqPjsPc4Lr xVHqsDtNsn5UREOdQwIlWzO0INH6tK5qyyXqeL3jIZ1T5+GZIA934bjvKWMqwD0hpn+i 6cVc7YiKmVhdbFIkiZM8vwb74UvBYtl9ddIokRzTAxm0tO2T4bjZfI9FPGPJ0Zv0UW5E Ph5KCkYtpvuOg6nXCpFIske/8xfXMN0QgYhxeWttjYC4gfHQ9A50qnKbzGl52PNnI18n 5mTgM1YItmmyuJ9oWxvgAro6KMcnuJ/mhTFrxbJ1guWUp8HOXsFXmmcNVzbMBg5UC62a TYZw== X-Gm-Message-State: AElRT7GZ8U9Cufay35132K6yoR/XYW6QzmN8B8cwAYQtl4QhgnSTaTqd BOykxBfdsIcmlb+RGgm4v5xlkjGKGHE= X-Google-Smtp-Source: AG47ELtgrCY4eVNslxQgGF6lBXOBSaOP6sZic7xp6XRZ7KLJWyiUtlciA+j8CmJXyGdBPOJ2B/OgOw== X-Received: by 10.28.167.80 with SMTP id q77mr340439wme.98.1521577214652; Tue, 20 Mar 2018 13:20:14 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id e53sm2991692wrg.34.2018.03.20.13.20.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Mar 2018 13:20:12 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1eyNjt-0001Nr-TT; Tue, 20 Mar 2018 14:20:09 -0600 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org, Moni Shoua Cc: Jason Gunthorpe Subject: [PATCH 5/6] RDMA/rxe: Fix uABI structure layouts for 32/64 compat Date: Tue, 20 Mar 2018 14:19:50 -0600 Message-Id: <20180320201951.4998-6-jgg@ziepe.ca> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180320201951.4998-1-jgg@ziepe.ca> References: <20180320201951.4998-1-jgg@ziepe.ca> 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 From: Jason Gunthorpe With 32 bit compilation several of the fields become misaligned here. Fixing this is an ABI break for 32 bit rxe and it is in well used portions of the rxe ABI. To handle this we bump the ABI version, as expected. However the user space driver doesn't handle it properly today, so all existing user space continues to work. Updated userspace will start to require the necessary kernel version. We don't expect there to be any 32 bit users of rxe. Most likely cases, such as ARM 32 already generally don't work because rxe does not handle the CPU cache properly on its shared with userspace pages. Signed-off-by: Jason Gunthorpe --- drivers/infiniband/sw/rxe/rxe.h | 6 +++++- include/uapi/rdma/rdma_user_rxe.h | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe.h b/drivers/infiniband/sw/rxe/rxe.h index 7d232611303f40..561ad307c6ecac 100644 --- a/drivers/infiniband/sw/rxe/rxe.h +++ b/drivers/infiniband/sw/rxe/rxe.h @@ -59,7 +59,11 @@ #include "rxe_verbs.h" #include "rxe_loc.h" -#define RXE_UVERBS_ABI_VERSION (1) +/* + * Version 1 and Version 2 are identical on 64 bit machines, but on 32 bit + * machines Version 2 has a different struct layout. + */ +#define RXE_UVERBS_ABI_VERSION 2 #define IB_PHYS_STATE_LINK_UP (5) #define IB_PHYS_STATE_LINK_DOWN (3) diff --git a/include/uapi/rdma/rdma_user_rxe.h b/include/uapi/rdma/rdma_user_rxe.h index 231190b841c816..af8f8218aed57a 100644 --- a/include/uapi/rdma/rdma_user_rxe.h +++ b/include/uapi/rdma/rdma_user_rxe.h @@ -58,6 +58,8 @@ struct rxe_global_route { struct rxe_av { __u8 port_num; __u8 network_type; + __u16 reserved1; + __u32 reserved2; struct rxe_global_route grh; union { struct sockaddr_in _sockaddr_in; @@ -92,10 +94,14 @@ struct rxe_send_wr { __u32 remote_qkey; __u16 pkey_index; } ud; + /* reg is only used by the kernel and is not part of the uapi */ struct { - struct ib_mr *mr; + union { + struct ib_mr *mr; + __u64 reserved; + }; __u32 key; - int access; + __u32 access; } reg; } wr; }; @@ -118,6 +124,7 @@ struct rxe_dma_info { __u32 cur_sge; __u32 num_sge; __u32 sge_offset; + __u32 reserved; union { __u8 inline_data[0]; struct rxe_sge sge[0]; @@ -162,6 +169,7 @@ struct rxe_create_qp_resp { struct rxe_create_srq_resp { struct mminfo mi; __u32 srq_num; + __u32 reserved; }; struct rxe_modify_srq_cmd {