Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754975AbbKWVEd (ORCPT ); Mon, 23 Nov 2015 16:04:33 -0500 Received: from mail-by2on0062.outbound.protection.outlook.com ([207.46.100.62]:36016 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752566AbbKWVE3 (ORCPT ); Mon, 23 Nov 2015 16:04:29 -0500 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; dev.mellanox.co.il; dkim=none (message not signed) header.d=none;dev.mellanox.co.il; dmarc=bestguesspass action=none header.from=sandisk.com; X-AuditID: ac160a69-f79f76d000007db2-d7-56537f59c3e9 Subject: Re: [PATCH 2/9] IB: add a proper completion queue abstraction To: Jason Gunthorpe , Christoph Hellwig References: <1447422410-20891-1-git-send-email-hch@lst.de> <1447422410-20891-3-git-send-email-hch@lst.de> <20151113182513.GB21808@obsidianresearch.com> <564640C4.3000603@sandisk.com> <20151113220636.GA32133@obsidianresearch.com> <20151114071344.GE27738@lst.de> <20151123203712.GB5640@obsidianresearch.com> CC: Bart Van Assche , , , , , From: Bart Van Assche Message-ID: <56537F59.4080708@sandisk.com> Date: Mon, 23 Nov 2015 13:04:25 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151123203712.GB5640@obsidianresearch.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphkeLIzCtJLcpLzFFi42JZI8azSDeyPjjMoGGKjsX/PcfYLFauPspk 8f2GqcXlXXPYLJ4d6mWx6L6+g83i9fGnTA7sHtNnbGL1mNj8jt1j980GNo/vO3oZPT5vkgtg jeKySUnNySxLLdK3S+DKePNsL3PBVZGK35uWMjYwLhXoYuTkkBAwkbhw/TIrhC0mceHeerYu Ri4OI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BKNTAmZOvlpzxYuGW1JOfcdr30zzM+tm7k jGDubFh6IfPpew/h5z6OmeU2teEedsZvtu12jjg2N7n4jnS8nUFBA0eM2htV19iwRyYuPOWc ++a3VgU9CXy04C5D4bamnFPyN0Srv/E8yDGxd1t1SvjK/D09T9tL9kzQ6VKLCFBzy993IiAs fH2GpRJLcUaioRZzUXEiAH/dbxQhAgAA X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD014;1:o1SdaRctSXW3EERwNi1flAopOkuJMCEM5wzE3RGOratR6jvHwx/aBwgozS2kc9VGUIIL7jdNnSs6unh1TwXsp1e8V4fadI4Xp8dPTewPtlH7H2eGRBrtCnRYnpeZCg415KrkUBWy9Qoc2MMheiR1mSXPbqj+3+q8O3+4jh3f6dTmNMi+QRtQ/pEhA6kT346z9zkv8yycRfd+neb5zlDhmAHfxd9g/s31oobtVZlLgDsQxPLDk07GBkyx4ba/RCpGbltulAf0yp7gIPTc3ctYGmBkBgdsR9TqmY8VNP3qcIlgoyNzt+QhJP+jTRNBv/Dne2Gk1gJlMQfZXAFyOeEUNqRit2VkTC0W/9LDCXh9yX3LOOnXJv1LleAQ1f/QwmW5eGRxuIuej497eX8b4zWpqRGqy8VsO8CNgLj7GsqINXg= X-Forefront-Antispam-Report: CIP:63.163.107.173;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(479174004)(189002)(377454003)(199003)(54094003)(24454002)(50986999)(106466001)(86362001)(11100500001)(189998001)(64126003)(5007970100001)(65956001)(99136001)(47776003)(5001770100001)(81156007)(586003)(65806001)(69596002)(5001960100002)(4001350100001)(93886004)(59896002)(87936001)(80316001)(36756003)(77096005)(50466002)(76176999)(83506001)(5008740100001)(97736004)(54356999)(65816999)(2950100001)(230700001)(33656002)(87266999)(92566002)(23746002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0201MB0826;H:milsmgep12.sandisk.com;FPR:;SPF:Pass;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0201MB0826;2:72d6USciK1Rg06A1ughdccIuM26OURXyAl3RuzbqWSAbXWVQcObw7Gh5zyWPx8W2hVXe0+/gABIIUCEeCdGDAlJ83knMUx40miERA2cs9W0QGHy3drFWbULWm9Pj9lF+7Tsv7FZjdYYVjg3mY7vwpLNuc96iLP3Zi7F+twKaSoI=;3:dHPmw/amHk9ikMalXYsVOTrg+eb40SpFgruz6TnVBLks/jOCOzYkS5p03LLgCBXb5sGelmS9xOFuEZmdi1jD0zBY8FSsxtbm30d51r1PmebPmVwnw3HY9QaQCMfP8JHGuJsapnTMXKqiGWr4OtM8NOlLn8ZAZKVlAW03r6C5fynjapmiB5+GlqDkBFLOMYZR9mesaK2z+zgubyAlzYDxfJS8LIUFrhaiLP0nLeWm2d266h1ZGO93SU0MfteHE7+s4+GutroQoZM89O+VoMf4Fg==;25:WJbE49h2Ryqh7HExN1FtCUtw6pypF9BikebNw8mubDvEmpUi0+A8ehld5ba1KLkGWbN08SPWuVrhSShh/unjvnmAdj7y6lRkStNEXbMasrne4wOwO1zbhplzALj+3BJuuVvuRSDi0sie3ZxIcbbsLWC77OYExYPgrWhIhsEcbnyLMDIEUadL8RWLBA225yVRMaQZobbw7Qnyaf8n2mg5fctAJRdB2inNlPa/azsDvhaODikrCwTscqx3/CN4TFqvRlmm77mvRi205srdycr6nQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(8251501001);SRVR:CY1PR0201MB0826; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0201MB0826;20:JFpAMWlzNyuYnmzb1V4nnMTG4eo+QU+NlPyHKSe6kf8NVyS4IAI6CoWQI5ERsO7Vm0BE7QII+GOBvNNPzB5AeJWWnqvY3J2rSUmVQkM2Xmc9dkJfYpzGDwXePrWHzlpoMP1yb2TEUOvkAcgWRjIjGApcNl4yUiJ2M1qPSWMgZ6PQWG4TjqMEgpl7G/2LhbAxwDdmTIDgN+IhffS1HAc82BGgDzyfdKx9TwbxZz/oJBtJjSi1AzSonVB41kvHwXLq9Ps0I85nl2dvEoXOv1lY4MsWhib9fJfWNOHYY55T+wRoQ6ELYKRF8sV18B8hAz48W0VWAPJgun6w5zWmLZGK1QfcVjWmNEZN5dIRSZGBLoyePfVpKylWkCvbPB6Yd11mupxeSjUMoaZOHK7uZrftp84/nkvWQTrEjBIUK39h1zQ3omFdW57rz8DV+9//R1S7IWzlz7j+iNROfh4z765+0RFGl/bLfZ11fO6vJkQFntUfLAQfvOaVXN+JI8+mUjW4;4:hr96/lpir77LkHvV3lPvPzYriwUUHzd6Q1qvpHgnsKoGhv8RsbhZprmzMgzCGG2SFE0wHg8lxRxocxLw5Y1Wgn5yG99vySMgZKyztUa22R/3Xm9fjM8CZea01KGLNeFD74yIKATov8irgzV8S8nwzfv9Iuz3ZjJ1jwi8zqJp+2HWFImlr72xkjhJuCmaQ5mJOvQrp+8hw77oCCxRpQN9tdRLPhjJDO0tY3dF3pnlFRh6Iy4v/tzN/s18Ba2DN9Z2wrAw6VBPbAyXR7hOQWL7HDMqJX68f2z/5eHiNlgfZyjt+FTBJuhUvLg1WPKvmo46sVL6elzECuSjEJMM1jLVaN7sx32sIa2S44us1ENBoPudSeLddjIJIvZWnEBfPZzL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(10201501046);SRVR:CY1PR0201MB0826;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0201MB0826; X-Forefront-PRVS: 07697999E6 X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;CY1PR0201MB0826;23:X6UJNdjYq3SHipHoxjQGOsOWUEYYlLmbs4/?= =?Windows-1252?Q?UkrV1/3Ufz/NKyF7Y61OapmiUBUrXCBydPY/z4YLF6UTOjKo//b7lE+d?= =?Windows-1252?Q?NVeDw88QTuUDCRxCnyifi30vwBa9h7NS1p0MQrCDNVCvnevpDP/mbFcP?= =?Windows-1252?Q?HInm1PG6vdHUa6nou+siITuPA/xiTw9S0qSBuqA98YaaSd/nk8a0JfvT?= =?Windows-1252?Q?BVtZM9jaBE2KWhf8zsSCDEVI1HXK0L46DcdZ8Jzb9cZ+lboikveB0dXU?= =?Windows-1252?Q?p6+gPtAkdQ4ihR9Xm8hgAs2VbDVvzlTEdE8SzyncQX7Fw0MNswesDOrV?= =?Windows-1252?Q?dhsPT4WJCqTvzfd/9HAHNrVJRcXnBR+k9UYWuP7fjsN7gkdMCtQK0B6y?= =?Windows-1252?Q?5qVu+CSh396iuyP0jVqeEAjPgZwUVplnBClmBh/gSP+u44YzANQ/Gd+P?= =?Windows-1252?Q?nuo+YVjkkFNsro25kPadgsCW1A5YZEHbfV7m9zy21PaFafiwMPc0X3RN?= =?Windows-1252?Q?G4lAr1zgDstorvhtO3I7joWBE0YeYhk4RLynJYsUzUI628erpXma5okc?= =?Windows-1252?Q?6BEtub9SR8KwIB1NAEZwyprIzEX6SNk2tW12ry3jpYqdZuHvDmcTZmyM?= =?Windows-1252?Q?Ur5UKnU35/onODEJVO5P6t2V1dsHzGjE55Ygz72GTMNJ/Qx0ychQyFKy?= =?Windows-1252?Q?QDrLVb2VuPwnCk0RSb+yDrUCepEwgTx0XM0JNqS7LZA18AiHt0VXn0a6?= =?Windows-1252?Q?r+/r0PZh/hAZx2Q/J9jKRypceViVMsrTp39pxbr//UTYTQLBzwknw4C5?= =?Windows-1252?Q?M+eYGRC+gojT9Yvfwa9unpUscDX8BDsqBaUZWCf/GHXznrhJ+S1DgBjK?= =?Windows-1252?Q?0mCMQsXJ/s8qqsw63RNOIWhoERi1bciwnQSzGWL8ER8pSctTvpWDT72C?= =?Windows-1252?Q?CzuxcnBTGYwZeA/pcUCcL0Pq0SSgZWrY6XNCaLfqv04dauYrrEHJlTqD?= =?Windows-1252?Q?ESvWlN4N2g5kr8cfQdjdIDSmHRahzTyZUa1bbQGRlcuFMwSo2+ldJWNR?= =?Windows-1252?Q?9VEUdxbJMzU3+U9rtdLKvxdPXRPYZiNuJBVpG4AMgzGav6oDNSlHW2k5?= =?Windows-1252?Q?2j17sqYEdxNdnerUAuhYfp+DDHpFmS0Vx9LKDRvTuLMxL4hAqzoOQ+ps?= =?Windows-1252?Q?FIAhg4ScYbxQ1sHtIlpMxD4Zsk2lG+gcDlQHhhQtbOc213hr9avv8EGC?= =?Windows-1252?Q?upAfBU6Y1RxZNVTSFigxcpEEppGYIv3856t6Z/Hg=3D?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR0201MB0826;5:GvyqJLT12obdYnFJgljUYngI5eLyXDwYcjO5uy1RKIIMu3pua5r22lvITK/k7ySERgqZhcQHRjWfwW/CHD7ZLtyBcLBqcXgrJGIBlKPD5oNU0E6QeNiaHDaaCi2Wp24UQFFqnwAJ3mq4shelH/YzCw==;24:n/uhH1IeUgH+FDJdohugyjSjpPsQJW5cBZ0sCGNms4Hn0lyIboaTPfW9V1bsN7gqOe8VVinm4Rf/5UXolRXFZfEBbTHUzOIZkH1Xi1DK/OI=;20:xdM0xmTeWZtDLujn5Rxun+duFPk3wfb0HMggAWeM1n22IX9NlgSvU+D8Zr0oUL468yBSmtTuHBqxwG5V9feebtZONruK495f3+QDe0q+vQXaMsndpSr5v3/bSeF00RxAj9TX+OJIPsGTKs2zKu94vex/b3p82B+vY2DZ8RFjS7QzDUttmHmaZ1agOpO+2hoL4eh0QpMlusfMCus5M56gqyr7PZmGZRQAFxcn3c0cDOsJtlH/lKu5MVolodFFtMpD SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2015 21:04:25.8155 (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: CY1PR0201MB0826 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2833 Lines: 62 On 11/23/2015 12:37 PM, Jason Gunthorpe wrote: > On Sat, Nov 14, 2015 at 08:13:44AM +0100, Christoph Hellwig wrote: >> On Fri, Nov 13, 2015 at 03:06:36PM -0700, Jason Gunthorpe wrote: >>> Looking at that thread and then at the patch a bit more.. >>> >>> +void ib_process_cq_direct(struct ib_cq *cq) >>> [..] >>> + __ib_process_cq(cq, INT_MAX); >>> >>> INT_MAX is not enough, it needs to loop. >>> This is missing a ib_req_notify also. >> >> No. Direct cases _never_ calls ib_req_notify. Its for the case where >> the SRP case polls the send CQ only from the same context it sends for >> without any interrupt notification at al. > > Hurm, okay, that is not at all what I was thinking this was for.. > > So the only use of this function is to drain a send cq, in a state > where it is guarenteed no new entries can be added, and only if the cq > is not already event driven. I'd stick those notes in the comment.. > > Hum. I wonder if this is even a reasonable way to run a ULP. It is > important that rx completions are not used to drive reaping of > resources that are still committed to the send queue. ie do not > trigger send buffer reuse based on a rx completion. > > So, if a ULP uses this API, how does it handle the sendq becoming > full? As above, a ULP cannot use recvs to infer available sendq > space. It must directly reap the sendq. So a correct ULP would have to > spin calling ib_process_direct_cq until it makes enough progress to > add more things to the sendq. I don't obviously see that in SRP - so > I'm guessing it has buggered up sendq flow control? > > NFS had similar problems lately too, I wrote a long explanation to > Chuck on this subject. > > That said, the demand poll almost seems like a reasonable way for a > ULP to run the sendq, do the polls on send occasionally or when more > space is needed to better amortize the reaping overhead at the cost of > send latency. But API wise it needs to be able to switch over to a > sleep if enough progress hasn't been made. > > So.. maybe also add to the comment that ib_process_cq_direct is > deprecated and should not be used in new code until SRP gets sorted? Hello Jason, Considerable time ago the send queue in the SRP initiator driver was modified from signaled to non-signaled to reduce the number of interrupts triggered by the SRP initiator driver. The SRP initiator driver polls the send queue every time before a SCSI command is sent to the target. I think this is a pattern that is also useful for other ULP's so I'm not convinced that ib_process_cq_direct() should be deprecated :-) Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/