From patchwork Tue Oct 6 18:49:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 7338991 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A50F89F6CD for ; Tue, 6 Oct 2015 18:49:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B93582038A for ; Tue, 6 Oct 2015 18:49:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A8C6F20695 for ; Tue, 6 Oct 2015 18:49:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751531AbbJFStm (ORCPT ); Tue, 6 Oct 2015 14:49:42 -0400 Received: from mail-by2on0066.outbound.protection.outlook.com ([207.46.100.66]:14645 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750810AbbJFStk (ORCPT ); Tue, 6 Oct 2015 14:49:40 -0400 Received: from BLUPR02MB1251.namprd02.prod.outlook.com (10.163.80.156) by BLUPR02MB1234.namprd02.prod.outlook.com (10.163.80.151) with Microsoft SMTP Server (TLS) id 15.1.286.20; Tue, 6 Oct 2015 18:49:38 +0000 Received: from BY2PR02CA0080.namprd02.prod.outlook.com (10.242.32.38) by BLUPR02MB1251.namprd02.prod.outlook.com (10.163.80.156) with Microsoft SMTP Server (TLS) id 15.1.280.20; Tue, 6 Oct 2015 18:49:36 +0000 Received: from BY2FFO11FD006.protection.gbl (2a01:111:f400:7c0c::160) by BY2PR02CA0080.outlook.office365.com (2a01:111:e400:2c2a::38) with Microsoft SMTP Server (TLS) id 15.1.286.20 via Frontend Transport; Tue, 6 Oct 2015 18:49:36 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.173 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.173; helo=milsmgep12.sandisk.com; Received: from milsmgep12.sandisk.com (63.163.107.173) by BY2FFO11FD006.mail.protection.outlook.com (10.1.14.127) with Microsoft SMTP Server id 15.1.286.14 via Frontend Transport; Tue, 6 Oct 2015 18:49:31 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id 75.3F.32178.AB714165; Tue, 6 Oct 2015 11:49:30 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.248.2; Tue, 6 Oct 2015 11:49:29 -0700 X-AuditID: ac160a69-f79f76d000007db2-42-561417baedbc Received: from [10.60.52.33] ( [10.177.8.100]) by milsmgip12.sandisk.com (Symantec Messaging Gateway) with SMTP id 47.17.04661.9B714165; Tue, 6 Oct 2015 11:49:29 -0700 (PDT) Subject: Re: [PATCH v1 00/24] New fast registration API To: Sagi Grimberg References: <1442482947-27785-1-git-send-email-sagig@mellanox.com> <560AE099.2080004@sandisk.com> <560AFB71.3010003@dev.mellanox.co.il> <560C30F4.50900@sandisk.com> <560C42CE.6090000@sandisk.com> <560CDDBC.8000400@dev.mellanox.co.il> <560D730C.9000302@sandisk.com> <560D9E69.70604@sandisk.com> <35618B90-4D6E-4036-A69B-4405F020D440@dev.mellanox.co.il> <560EA4A1.3080709@sandisk.com> <56138854.4040209@dev.mellanox.co.il> CC: Sagi Grimberg , "linux-rdma@vger.kernel.org" , "linux-nfs@vger.kernel.org" , "Nicholas A. Bellinger" From: Bart Van Assche Message-ID: <561417B9.2080505@sandisk.com> Date: Tue, 6 Oct 2015 11:49:29 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <56138854.4040209@dev.mellanox.co.il> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRmVeSWpSXmKPExsWyRoxnke4ucZEwg4k3mS0uHDjNavHsUC+L RdvqM4wWr48/ZbK40faAzYHVY/qMTawe97cfYfJ4Nv0wk8fnTXIBLFFcNimpOZllqUX6dglc GTMbz7EV7BWvOHJwMWsD4wmhLkZODgkBE4kLS1YyQ9hiEhfurWfrYuTiEBI4wShxa/4+Zghn O6PE5873LDAdzRN3QFVtYpR4d20nI0hCWMBc4uquyUBFHBwiAjoS6w8bQtRsYJY4/PU0E0gN s8BZRolDF8JBbDYBI4lv72eC1fMKaEl8emIOEmYRUJHY37ySFcQWFYiQOHX2LRuIzSsgKHFy 5hOwGziBWqe9+MEO0sosoCmxfpc+xHR5ie1v54DdLCGwl1Vi+oyfYHOEBNQlTi6ZzzSBUWQW klGzENpnIWlfwMi8ilEsNzOnODc9tcDQSK84MS8lszhbLzk/dxMjOFK4MncwrphkfohRgINR iYdX4qZQmBBrYllxZe4hRgkOZiURXoUjwmFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeXtzdUKF BNITS1KzU1MLUotgskwcnFINjAlWMikJLcI2ytWheVPcFpXbvYnmVF6UWbf6ZeyaU3NEb9ge iuS3qSuWXc0goaqx7qmu72MDuZgbk/6I+eY22ceqJL9+sCVrTp/IOqM9z9ctbPygMsHWW999 5rYkGT+zjuczY78//dptr63PmSXXMdM57ZwxX8W58rl+nf/1w4/GVzUan7qmxFKckWioxVxU nAgAp+aY8pACAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMJMWRmVeSWpSXmKPExsXCtZEjRXenuEiYwd2b5hYXDpxmtXh2qJfF om31GUaL18efMlncaHvA5sDqMX3GJlaP+9uPMHk8m36YyePzJrkAligum5TUnMyy1CJ9uwSu jJmN59gK9opXHDm4mLWB8YRQFyMnh4SAiUTzxB1sELaYxIV768FsIYENjBKt63RAbGEBc4mr uyazdDFycIgI6EisP2zYxcgFUsIscfjraSaQGmaB84wSfzZLgthsAkYS397PBKvnFdCS+PTE HCTMIqAisb95JSuILSoQIXHq7FuwVbwCghInZz5hAbE5gVqnvfjBDjFSXeLPvEvMELa8xPa3 c5gnMPLPQtIyC0nZLCRlCxiZVzGK5WbmFOemZxYYGukVJ+alZBZn6yXn525iBAcrZ9QOxusT zQ8xMnFwSjUwrlqxIqmefUfxOuOGlrR5fx9VCUqxxzj7mC++/0PAsbbLceqz3R90qvoV59+6 1bFXcNHh5e6h6abKUxTLQmp2ftghZX+MIzXhgvbZ8iXh8xxlJu2LZvN/alH0ryC8kLXZppw/ +PGJG3vr01oU5j4oOvjM8Cn/Eo0VZtab9ZO5Nt5+KWnP7VmsxFKckWioxVxUnAgAzmVwLQYC AAA= X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD006; 1:O9Y2G4EsW7APEdXEO5kNuTdsSIkaSmrFFg9c5fQMpecw6IFORo/u+F7fT03Hdo5BUtm8S/ScVWTMAD0Pvj6VRLECInQjdg8+Qr9XmbP0sKwkNgZ5Lvgnt1tkDNDAR/OYm+JK7NarwZOCx3JhC8MFQoPEpP/KS93KpfxbVPf8OXEkGmiaRU0kuH6rv5Qg41l/vuaI/R/1voEoeNr2/qU+dTdiwoCWonxOl83/GGMFPDHPygMmtV1RFLQ565gLHE2dS7DsNI3i9Y7PJLMcyvp3LyQOuRI0dDKV+klsTdg6QAmqaWKQsgOmGAAqccS6Hs78lMvjOg+lNlgEwbZprvRr24Xq+hEVZyPGWPtvhFvZPo2sROre73dIHkdnhRxGjYLG52fCeQBpk8nOEkzEtA0qEQ== X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(377454003)(199003)(43544003)(189002)(51914003)(24454002)(479174004)(33656002)(110136002)(59896002)(11100500001)(87936001)(50986999)(69596002)(99136001)(81156007)(92566002)(2950100001)(93886004)(65806001)(5008740100001)(65956001)(23676002)(80316001)(47776003)(97736004)(86362001)(4001350100001)(64706001)(87266999)(189998001)(76176999)(5001960100002)(5007970100001)(65816999)(64126003)(77096005)(54356999)(36756003)(50466002)(83506001)(46102003)(106466001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR02MB1251; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; PTR:ErrorRetry; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB1251; 2:5tS8SRA7Sg1fCHWLteQJ60zbu2GDWbunV8jZtzCk4ouJ3neJ9T52tAO0uhLzNMQAzvFJKYJUagzjiwoq8KQR6M+c05h6M5gnuSOoJpSd2Z2yq8buxHwoaG1ji1sxkRsAPExe/IXrkWuKf4IQEzdBSvWBMJz6N+oZVfpsGHPGSJM=; 3:IcwoPVG2v7l8wKuaJ8N768nER6Qfap7BUqqQCSpXPOl+Xy2p+vzI9AyzaVQI3+Vgv306gAfvz+ApSYQdKdo2UxtYuCPHg3m4iyVCM4nk62oWeulZr28ArqmQ2Vcu8TJopPyOiUrPGTxEslXAtlkX7k3BlAWAY6UWP5n//68tBmK6Dl54yip+x7/YpHjF8aDuDcdd5US8RKjJSRETOtP141CpJg7V4Qs96s4YqPk/0X9LiYnARoRGn+MyFk6pV0CbKH3yguq2bOd/kI1AhHojMg==; 25:iTFffZYwbjk5DJKZEv8/FLIoEA3Lb+O9567eilbrg95Chda5XwRpQLOTFCBq6SeZIgGaRdzAM67QFYPkqF/v2P7MSoPuaybuIGxkcS7i7NpPrxSn/gQDPi189eXiR+c2HpW+v3BIx/oYvSj0TBnACQ1kEU+hkhBkpD7qvTlWSdCA3+MONUviMI8CGV77rOD/ohXQXNA20RWs+iUXN6Q6nz/tb0OJGqeALET8/ZwVP/QWbAfB6SuD17VEOe8fmBqo X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:BLUPR02MB1251; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB1251; 20:afzxbwxlTHHmN38jl4q4TnL41F+ZYSxdW8qXRpxwLVoEQbZZoifBkFsHm//oVCBm1fYBRCsz+MQj8+Taqax1T9Q/NWHAj/2K+ccMulYZN1OeQrW4fx3qPX/2xYJJ5NdxikUG6o9l0LgUdzHbkDClz2lkf6ilU7Q9UAextEV0eO3x/FVHZtF7ROClnT258I9xds6EsF6OdwEb20j76loC0Edty/VI9dXc+eaNq5Acw25Qjq19Dqs+8IprAgW1I1/wy5NNNr26XBY3Scnk+UAUB5FfJW4m1pINnprYEpXfg9bkVSSwRDJ9qvW7dLbXb87LV7LbS6Xh5jJk6MaMa60RQbFHbyf+wn9V7fREgZD52u7qnmiiKrCmCDUMtrrVL85FDnRrMkN/om7Z9/0lFAHJUoL/jMA97r9cjboj1cqaNPec24s4UcfAHh2JT+Xh+3DtN9dt0+bS12A0DfF5ZWFNRk5mtuzsw1ocnCGtqVUiry+odOExyzLmu/UEMNhvuV8Q; 4:guKQs604vHBn4iyR0AynUDDYfG9eAum2hFbV/kr0HM/rPIYyJj1uLHL0EffhwmW1H9CtZJAJ4MB6qZnzrre6ekWwWDlycs7xnXeIG4GuhzHVAfyr5+DXCEzofyduu5UAB4era0GcVheyCOQAYd3kxBFMGvgezFjU4knQlbalZAWucptPLudWhYKfibdBFCEZ6sgrs8wSsQUxGhsstR1buJMm7Gc3a8iEV17AR68Brs0FAbiwEUjeewohbILjnZ8tQ2UyusPqmhi9YBwDWyBkPtAMvRHri6c9zJiuHuIpDKKH6ffoT8zse3XVS0WLrhpaPCe7MT3eAIfsJsA/mkh6zJi7LsWUUD75hAun32GPJB0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001); SRVR:BLUPR02MB1251; BCL:0; PCL:0; RULEID:; SRVR:BLUPR02MB1251; X-Forefront-PRVS: 07215D0470 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTFVQUjAyTUIxMjUxOzIzOmJmR3ZXamdHVmJxaXhXRDRKcDVZR2ZFVUk0?= =?utf-8?B?SVBwN3JxdElEWmhPb1ZSbFErdGs5a001NllyOEFhUUR1NXIrTEFlTjloZU5R?= =?utf-8?B?ck5JT1JnVnNoUVlkaHFTWm1pSmRldjE0VXlicHdmd2RvWU5GNDNCb0laaTdT?= =?utf-8?B?MDZudmRmczVxbEd6T3BONEowTU5tRUc1amJ0d0IwcVRoZitmQXRLeWVwc3Jy?= =?utf-8?B?L25vOXBtaHFTcXRZSVdrRHVJVXRpOHhNTGVzZjMwTEhIYlB4eHQzL1J4WGpx?= =?utf-8?B?cEU1UXFEakpNMFRhc09LbncxUitQR2pETnZ1NzFLZjJmMXJKVDRnbkpCcDUr?= =?utf-8?B?SUhoRnU3N0prK2xrMjZBOXZRSGJBZVBjalJWQVhlYzZuMllLMmUvUlRKSHBS?= =?utf-8?B?MGVaZU9aNDJoRWZEV0pqOHF0K0dkMDNBdm9qUGZldUVSTHBnU3lmd1RlU2FH?= =?utf-8?B?di8rTnhhY2I1bE5idFBOSE85NkczSWsyVG1SU0tQMDY2VmFhNVZNUWwxbTJa?= =?utf-8?B?V2dDUGNTTE9XcWFWbGlqeERPRnpHQldaMHMxL1VYZ0U0c3hkVUxiRWtTTTlL?= =?utf-8?B?NW9ibFVJN1VlNERhVVpjaEZQOWVBUndXY0szUkVnUkhxOFZnRzVtbDFoL3JL?= =?utf-8?B?bWFMMTFjMVZ6MGg5cEZtZFN2aC9tbG02cVFCdXdwMkl0QlpFVm9mYkkrbE5q?= =?utf-8?B?OTZ6MGFLN0NIdGdlZTQyM3BjTlAzTDNQVlM0SzJGNnBLa3EyUGlIcXE4eGwz?= =?utf-8?B?UVR4em9RVkJjV0lOVkIvK1RteVN5Z2FCZ3ltVmNHbFRxeWRXcFZac0QrY3p1?= =?utf-8?B?cHBBM2xGSzNxYXFWM1BCVUp2MU5MY2JHZzBmK3h2Wm50bVB0MDhtd0VLbGM2?= =?utf-8?B?Rkk4ZHJVUHE4NDlkVkJmQnIvZElUWjJla0haQUZGVnVuODlYelJWemU4eFBm?= =?utf-8?B?SXFZcjZ1QjlWUDVCUU40ejFuVWFCQjhRYzkwSHg1TEtJVE9qOGZ0NG9iSXRq?= =?utf-8?B?bk15dUpUL2xlM3loc3ZJNC9od0VsZlMzNVhvUHlENXVWOHoyelJsU0hKOFVF?= =?utf-8?B?bUkwVWtQbFEyQUNPYUdPdU0yYWcvcVlPWnBnMThLMEdIY3NidlBQTTAzb28v?= =?utf-8?B?NmdUVGhOREFyS2VwK0NMUkREMEV4TWpkeU5nazVTMzZzQlM4Vkdvc0laTXVB?= =?utf-8?B?VWFZa0cxd1ZVYjFkUDJxeUk3MFYyRVh4ZndTUHAydGd0UHR6eFYvU201NUVy?= =?utf-8?B?NnpoRkg2Tm1GamJtRUgzbW0yUXc5T3BqaWM1a1JXT3RxWlMybGJSVDFqdi9R?= =?utf-8?B?enlBZDhzQTNUUjVNMEdmZmpGUDNXNmk0eUJqbnNIbXN0MGkzTkFCVURLQ3NL?= =?utf-8?B?bzJtSmpQVmd0ZDVPYmRjK3plK25TTzlnMTZ0YUU5c2lqN1RlS3NKdlgvTWhT?= =?utf-8?B?Uis0QUlRMGkveFRVb0JQUExSTEdSeHBVNnF0cjB5eDJYMVRzUnlGQ2NHN3l4?= =?utf-8?B?VTZzQWtMeWJIZmk4QXlyZlRNeHNUL0tQMUdMNU95bG53TTlJRHBpcmxqRVFs?= =?utf-8?B?a1U0MnZ6LzZQNFMrWjZValcvTnMvRG9jN2J4SG90Ri9JYmVucGYzNjIzc0hD?= =?utf-8?Q?4hPw4vbXvSqMHfVMTYYU?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB1251; 5:Gvan47PjTJqVGWhgbueJ9cr7OmUxyyjVV/+idb4IkonGcvzE1W4jOVzXitd9Hzcg/Rnc0izfLTn8d90CjezdegDhUEyn06tPgWHZnzwQc9+/WZv9i4nRQ8m4JtVkH66/MSQNxXJznSSNPd1xtbtYrw==; 24:yA0czsDz+8LK9UAY259BUNlZazCVTySsR4Jfi2eeIM1k/2Keon7RtJkqUlcvWo30hSVtj/s6qPQ9lgnmnxDjl9+ikv9YKMRX6cmVCS/wdj0=; 20:0iQM4LoqaoAr/f8RUy93kh7Xv/ImB0fMWQ3A3tlXb/U9wx/8c+wNI7cNdIJqNHWUCVG5mYDcrGLI64zZkr/5FO/WBfTL5oKpbUgIu+27lha6VNXY0AKONBBBxbtD8HeFCmoYgQ6+f/m85uGfNWiMAy5HQ0qZZGtnuedZU9yC4Pih11u+33eiMBEfiwKFqKycdpbJan/YqjLRmIAouLdyYHK0QLruvBZQw3TgaRVs7fN4UyQdjAFiD2AnJX8uQXeO SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2015 18:49:31.8545 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.173]; Helo=[milsmgep12.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB1251 X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB1234; 2:mriIlIDxiDzJl2xO6sVoDe2mwMVshjL6QL241hpZks2NRXGUS85yRqFKjKJA4cwhpydybVl/Fz14seRmY1gEQOhUq3hiZi8FL3jCfhJRHMoPosv4pJ/lx5gsZmlyrxTf9Jz8vuOBngcU9v0L2iKdDWrIeIGGFZqgYRRPBwn0DDs=; 23:+C1126++/XBx+/Ms2efwJiOk0lrbHAjwlxOUiOhtkbo+qRDIcPMj/3iCEqtO5QXnxu353pEf35+OjKdwDFESD0aM+1uvYJyXTZPBecWGcT0ghhxcDPqyEttxuQHxn2KhxNqs+VTBVlRSzBYgU3qJJSQptmFAtVZX7g0jULTnq+a8/KMwA1/WyTcCOV6zIBmJ X-OriginatorOrg: sandisk.com Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 On 10/06/2015 01:37 AM, Sagi Grimberg wrote: > I see now the error you are referring to. > > The issue is that the device requires the MR page array to have > an alignment (0x40 for mlx4 and 0x400 for mlx5). When I modified the > page array allocation to be non-coherent I didn't take care of > alignment. > > Taking care of this alignment may result in a higher order allocation > as we'd need to add (alignment - 1) to the allocation size. > > e.g. a 512 pages on mlx4 will become: > 512 * 8 + 0x40 - 1 = 4159 > > I'm leaning towards this approach. Any preference? > > I think this patch should take care of mlx4: > [ ... ] Hello Sagi, Thanks for the patch. But since the patch included in the previous e-mail mapped a memory range that could be outside the bounds of the allocated memory I have been testing the patch below: --- drivers/infiniband/hw/mlx4/mlx4_ib.h | 3 +++ drivers/infiniband/hw/mlx4/mr.c | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h index de6eab3..864d595 100644 --- a/drivers/infiniband/hw/mlx4/mlx4_ib.h +++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h @@ -129,6 +129,8 @@ struct mlx4_ib_cq { struct list_head recv_qp_list; }; +#define MLX4_MR_PAGES_ALIGN 0x40 + struct mlx4_ib_mr { struct ib_mr ibmr; __be64 *pages; @@ -137,6 +139,7 @@ struct mlx4_ib_mr { u32 max_pages; struct mlx4_mr mmr; struct ib_umem *umem; + void *pages_alloc; }; struct mlx4_ib_mw { diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c index fa01f75..8121c1c 100644 --- a/drivers/infiniband/hw/mlx4/mr.c +++ b/drivers/infiniband/hw/mlx4/mr.c @@ -277,12 +277,17 @@ mlx4_alloc_priv_pages(struct ib_device *device, int max_pages) { int size = max_pages * sizeof(u64); + int add_size; int ret; - mr->pages = kzalloc(size, GFP_KERNEL); - if (!mr->pages) + add_size = max_t(int, MLX4_MR_PAGES_ALIGN - ARCH_KMALLOC_MINALIGN, 0); + + mr->pages_alloc = kzalloc(size + add_size, GFP_KERNEL); + if (!mr->pages_alloc) return -ENOMEM; + mr->pages = PTR_ALIGN(mr->pages_alloc, MLX4_MR_PAGES_ALIGN); + mr->page_map = dma_map_single(device->dma_device, mr->pages, size, DMA_TO_DEVICE); @@ -293,20 +298,20 @@ mlx4_alloc_priv_pages(struct ib_device *device, return 0; err: - kfree(mr->pages); + kfree(mr->pages_alloc); return ret; } static void mlx4_free_priv_pages(struct mlx4_ib_mr *mr) { - struct ib_device *device = mr->ibmr.device; - int size = mr->max_pages * sizeof(u64); - if (mr->pages) { + struct ib_device *device = mr->ibmr.device; + int size = mr->max_pages * sizeof(u64); + dma_unmap_single(device->dma_device, mr->page_map, size, DMA_TO_DEVICE); - kfree(mr->pages); + kfree(mr->pages_alloc); mr->pages = NULL; } }