Received: by 10.192.165.156 with SMTP id m28csp1506731imm; Wed, 18 Apr 2018 10:42:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx486JOmSV9ECQzTxYHapjJFuDll269cniiFCC5IbzYjHnqbRsjPiJ7pW53dZtapKSD7EwMVT X-Received: by 10.98.214.67 with SMTP id r64mr2831866pfg.200.1524073373667; Wed, 18 Apr 2018 10:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524073373; cv=none; d=google.com; s=arc-20160816; b=zYooTruBG7V56EiGPGQ8CZmhgp073aAXThy8GGEOb09HRMEK8M3TTJNsD8BnEKWNPv FBvbpVCDVQ8OITW7T0uRxVhz3lurwM28WFuMsVVf5azgUl5QWeLQ9LqQ7L+RVE8dMGJ5 o88OF31WqBssT72jDlpU8KmSZ4kJmzkWRURktZCyZcbbXqyBidxNMAb0GOF+73bMQZCn b6+WoGU6Jpvj7NYB26oycY7ohN/ldfUi6ny0CVC1H5QpnhF0j1PcgygZMYIHBnptBm2P gZgVOLH1fhEvxeD6sWfA5wmdqPWbrmWUohZmBiE45l3dXc+8rwCwX8JmW0ND84Wu8L5X NMzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=UHNvohN/jZrQxoQcYjy320BRJdv3ntXf5BqZZurTjdw=; b=XT8mbBqLZZMngusmnKo/WlOpS2VfvAulH9U/VdzlzZ0ZIMncK2UYo+/JNosRLREqEw gBV1zXoDcxlxhtwD/0xCFW2xqIEHOeH4woAzeja052mDopU2UPsSEfRJ7Ecw7srupcYA mHlO9raAxMXgdqpXlRuzYxnet6gUDw9BzR24w3kjC/P4g+Hfxzrb5b7mxelnuacXxh06 GHVQ564bgErb0SqEyX4G6QwDPXJgXuMNGZ/Q51BSHqpr8dKtOX+BF3Iaq773wi5XS4xA HtPbw+f+8D3VPoOM5Y7ukVFoX5PpWfDjY4Vl0W0JwYroR8cgKUIRcIUlxTPKmYd57LK4 rYlQ== 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 s3si1533845pfj.50.2018.04.18.10.42.39; Wed, 18 Apr 2018 10:42:53 -0700 (PDT) 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 S1752792AbeDRRlV (ORCPT + 99 others); Wed, 18 Apr 2018 13:41:21 -0400 Received: from p3plsmtpa11-08.prod.phx3.secureserver.net ([68.178.252.109]:55685 "EHLO p3plsmtpa11-08.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751870AbeDRRlT (ORCPT ); Wed, 18 Apr 2018 13:41:19 -0400 Received: from [192.168.0.55] ([24.218.182.144]) by :SMTPAUTH: with SMTP id 8r45fOmuAJnSA8r4bfnqGt; Wed, 18 Apr 2018 10:41:17 -0700 Subject: Re: [Patch v3 2/6] cifs: Allocate validate negotiation request through kmalloc To: Long Li , David Laight , Steve French , "linux-cifs@vger.kernel.org" , "samba-technical@lists.samba.org" , "linux-kernel@vger.kernel.org" , "linux-rdma@vger.kernel.org" Cc: "stable@vger.kernel.org" References: <20180418003358.25098-1-longli@linuxonhyperv.com> From: Tom Talpey Message-ID: <568a36d2-29a1-442f-f725-58a02b8a90e5@talpey.com> Date: Wed, 18 Apr 2018 13:40:16 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfPgBWDuBD5XQ88D54yWwuS+tFovkNURzjygH0nAJ2jgMXfc5Rg71QBv1oCepxrsSjvMHsDwAeKgm1PpzEWsmm7GJRKG6nNJ7bPVbXg64IZOT1ilYVZoo t/29TK7/WJzF97iyiCK7grWDjZWVefhYC6TLoK6/q5bt82y+MzkWVKgdcQdRbVdWVUhLjP/iti+l5MSMDTgsgrLJtk1yp/lKICeSDJhDHy7OuxuIYqMzoW88 AZXa4d2lYwavHvYFsIMCoRYmeqs9VcE8RNeGebeZdU6Oj5YIIoxSKLy0GQSAJk5atyRPilUm1WJy8eOCF1xxGpt7jYWGYDVS56ErlsSDlPa+gjESaaNYwciF R68kLBEWuF0zw6suj4rLUXmFh2m/ioelY2T7I+wrRcN8dnIOVzcc6ObzIfRTOKCPBai7SGVPNU9WZw672Fk4kxzqVBZDtA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/18/2018 1:11 PM, Long Li wrote: >> Subject: Re: [Patch v3 2/6] cifs: Allocate validate negotiation request through >> kmalloc >> >> On 4/18/2018 9:08 AM, David Laight wrote: >>> From: Tom Talpey >>>> Sent: 18 April 2018 12:32 >>> ... >>>> On 4/17/2018 8:33 PM, Long Li wrote: >>>>> From: Long Li >>>>> >>>>> The data buffer allocated on the stack can't be DMA'ed, and hence >>>>> can't send through RDMA via SMB Direct. >>>> >>>> This comment is confusing. Any registered memory can be DMA'd, need >>>> to state the reason for the choice here more clearly. >>> >>> The stack could be allocated with vmalloc(). >>> In which case the pages might not be physically contiguous and there >>> is no >>> (sensible) call to get the physical address required by the dma >>> controller (or other bus master). >> >> Memory registration does not requires pages to be physically contiguous. >> RDMA Regions can and do support very large physical page scatter/gather, >> and the adapter DMA's them readily. Is this the only reason? > > ib_dma_map_page will return an invalid DMA address for a buffer on stack. Even worse, this incorrect address can't be detected by ib_dma_mapping_error. Sending data from this address to hardware will not fail, but the remote peer will get junk data. > > I think it makes sense as stack is dynamic and can shrink as I/O proceeds, so the buffer is gone. Other kernel code use only data on the heap for DMA, e.g. BLK/SCSI layer never use buffer on the stack to send data. I totally agree that registering the stack is a bad idea. I mainly suggest that you capture these fundamental ib_dma* reasons in the commit. There's no other practical reason why the original approach would not work. Tom.