From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B754FC43387 for ; Fri, 11 Jan 2019 18:24:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9137921841 for ; Fri, 11 Jan 2019 18:24:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="qI6iU4IY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388155AbfAKSYe (ORCPT ); Fri, 11 Jan 2019 13:24:34 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:59712 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388152AbfAKSYe (ORCPT ); Fri, 11 Jan 2019 13:24:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=QlJ1zwV417zWJFGC+GahrSftXjGZAzP/OwNXrHeeqTs=; b=qI6iU4IYleKSx12aJH2ORkJs3 Za8SJI3Z1Vd3TwhlbZdiBuD5hFKoh5FDnOFRISWznbBi/lbcoxo9T+gWnGZpXg3cw2sp9T3QPng4U iEI7/zd2ND+B3MDrWDwe6Kj/YwCeqQ2rhL895018i2KMm8ari15xy+PudsSYjFnxkyLKeg1dcRM6M tzyc456rvk02BwcaZtq+gjAQztSxTtg9BIFSZAR4lMXpDtrK03lohumWxXO2es41nSD2+kKt/090x YsE09p5pfZbb7CjjopPsN3sTm0keq8kTbsNw6XX8KRaTV2cCHWsbbB1abqd5cFL4XSFumbA2COkM0 SckND6jXg==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gi1Tt-0004hD-6I; Fri, 11 Jan 2019 18:24:33 +0000 Date: Fri, 11 Jan 2019 10:24:33 -0800 From: Christoph Hellwig To: Tyrel Datwyler Cc: Christoph Hellwig , james.bottomley@hansenpartnership.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, brking@linux.vnet.ibm.com, stable@vger.kernel.org Subject: Re: [PATCH] ibmvscsi: use GFP_ATOMIC with dma_alloc_coherent in map_sg_data Message-ID: <20190111182432.GA5469@infradead.org> References: <1547089136-20264-1-git-send-email-tyreld@linux.vnet.ibm.com> <20190110150703.GA26696@infradead.org> <1214b6b5-92f2-7789-7530-36a0d16323c5@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1214b6b5-92f2-7789-7530-36a0d16323c5@linux.vnet.ibm.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Thu, Jan 10, 2019 at 12:11:53PM -0800, Tyrel Datwyler wrote: > This allocation isn't a single use allocation. The driver is just lazy about allocating our ext_list area for large SG lists (ie. SG_ALL). When the driver was first written it only supported up to 10 indirect SRP buffers. James Bottemley added the large SG support back in 2005 with the commit referenced here in the fixes tag "4dddbc26c389". We only allocate the ext_list when we come across a SG list requiring more than 10 indirect buffers. Once allocated we will reuse if already allocated. I think the right fix is to just allocate the buffer for the ext_list as part of the scsi command using the .cmd_size field in the host template, and then dma map it in queuecommand and unmap it on completion.