Received: by 10.223.185.116 with SMTP id b49csp748943wrg; Wed, 21 Feb 2018 06:21:25 -0800 (PST) X-Google-Smtp-Source: AH8x225JQsBRK4hjICEsO5cFQ/fBKSw5srlllFXg3NpB3+yG6klB0uZe62gHN+mCRung553tB9Oo X-Received: by 2002:a17:902:57c1:: with SMTP id g1-v6mr1156315plj.381.1519222885299; Wed, 21 Feb 2018 06:21:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519222885; cv=none; d=google.com; s=arc-20160816; b=WjB46HT8wEFxcFQ2DTtJwEX7GPfUc1O+s3VpQG/JIuBZwU3Yf6xTl1u8h1gtmS6Tnw kYepoe4wcsK5Ct6xR3nkn5qPVKLHWYcWG7GOB9iylXlC4jF65PBe4ho0VWeRFVOXyMzg htqDx38LazhsDO3H4mKab6UyHPmoDmW+CMKuHn5oa9Ss3yDB7sD2qZB7PR7zjwXwQHT1 cG5PE/FTz99tH7C7LP8M8651l90P1gC1cEZlDuYWXKphcXkOzs0/zGJDqSwnk3mIEGEe 2mu/UHqmjumtx2httsIjVW4eJBBurErpzrbqOIBpJjMIVh42BHTJdM0iRCmAUQxKKrk5 mafg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Jz+lVxhv7KEFYbQrzwXFEDgVopoxvJT2tg3rpZlLswg=; b=h4Q+5qZwOgt2Qv5ItvGWR/L58njPpIqjnbEZO0xk6e0jvSy3zkw8dLzqQp+k/KfKdX ZMZgpOx5tYL51LF2I22Y5NBkSQO+Abvk/tqGnL6aflDFs8nUJn0GoctYPG3yHVhOBd0I /udKMDdrpwxbt/xxPHaT5TSaEe+ovIFd3V4Jafn/cr+ViE0/uV6PCaWRM/fLRppjjEPT iUSFCQyYGPwqusO7x1iKtlTFk34leIFA6VAxfCGBF6+AgbwMZCX7+vv87I3C6poLyeNl H+q2kzeFsphR5x4HvmKU70JYDaRwdwJn0BSubez0KvPcngFf7RRq9ih92DlU1NqWc4ZK /bMg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 18si2449104pfh.118.2018.02.21.06.21.11; Wed, 21 Feb 2018 06:21:25 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935058AbeBUM7N (ORCPT + 99 others); Wed, 21 Feb 2018 07:59:13 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36404 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935025AbeBUM7J (ORCPT ); Wed, 21 Feb 2018 07:59:09 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A0CC7FD5; Wed, 21 Feb 2018 12:59:08 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bodong Wang , Parav Pandit , Leon Romanovsky , Jason Gunthorpe Subject: [PATCH 4.14 007/167] IB/core: Fix ib_wc structure size to remain in 64 bytes boundary Date: Wed, 21 Feb 2018 13:46:58 +0100 Message-Id: <20180221124525.029149938@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124524.639039577@linuxfoundation.org> References: <20180221124524.639039577@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bodong Wang commit cd2a6e7d384b043d5d029e39663061cebc949385 upstream. The change of slid from u16 to u32 results in sizeof(struct ib_wc) cross 64B boundary, which causes more cache misses. This patch rearranges the fields and remain the size to 64B. Pahole output before this change: struct ib_wc { union { u64 wr_id; /* 8 */ struct ib_cqe * wr_cqe; /* 8 */ }; /* 0 8 */ enum ib_wc_status status; /* 8 4 */ enum ib_wc_opcode opcode; /* 12 4 */ u32 vendor_err; /* 16 4 */ u32 byte_len; /* 20 4 */ struct ib_qp * qp; /* 24 8 */ union { __be32 imm_data; /* 4 */ u32 invalidate_rkey; /* 4 */ } ex; /* 32 4 */ u32 src_qp; /* 36 4 */ int wc_flags; /* 40 4 */ u16 pkey_index; /* 44 2 */ /* XXX 2 bytes hole, try to pack */ u32 slid; /* 48 4 */ u8 sl; /* 52 1 */ u8 dlid_path_bits; /* 53 1 */ u8 port_num; /* 54 1 */ u8 smac[6]; /* 55 6 */ /* XXX 1 byte hole, try to pack */ u16 vlan_id; /* 62 2 */ /* --- cacheline 1 boundary (64 bytes) --- */ u8 network_hdr_type; /* 64 1 */ /* size: 72, cachelines: 2, members: 17 */ /* sum members: 62, holes: 2, sum holes: 3 */ /* padding: 7 */ /* last cacheline: 8 bytes */ }; Pahole output after this change: struct ib_wc { union { u64 wr_id; /* 8 */ struct ib_cqe * wr_cqe; /* 8 */ }; /* 0 8 */ enum ib_wc_status status; /* 8 4 */ enum ib_wc_opcode opcode; /* 12 4 */ u32 vendor_err; /* 16 4 */ u32 byte_len; /* 20 4 */ struct ib_qp * qp; /* 24 8 */ union { __be32 imm_data; /* 4 */ u32 invalidate_rkey; /* 4 */ } ex; /* 32 4 */ u32 src_qp; /* 36 4 */ u32 slid; /* 40 4 */ int wc_flags; /* 44 4 */ u16 pkey_index; /* 48 2 */ u8 sl; /* 50 1 */ u8 dlid_path_bits; /* 51 1 */ u8 port_num; /* 52 1 */ u8 smac[6]; /* 53 6 */ /* XXX 1 byte hole, try to pack */ u16 vlan_id; /* 60 2 */ u8 network_hdr_type; /* 62 1 */ /* size: 64, cachelines: 1, members: 17 */ /* sum members: 62, holes: 1, sum holes: 1 */ /* padding: 1 */ }; Fixes: 7db20ecd1d97 ("IB/core: Change wc.slid from 16 to 32 bits") Signed-off-by: Bodong Wang Reviewed-by: Parav Pandit Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- include/rdma/ib_verbs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -971,9 +971,9 @@ struct ib_wc { u32 invalidate_rkey; } ex; u32 src_qp; + u32 slid; int wc_flags; u16 pkey_index; - u32 slid; u8 sl; u8 dlid_path_bits; u8 port_num; /* valid only for DR SMPs on switches */