From patchwork Fri Jun 14 13:47:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995373 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5B36C76 for ; Fri, 14 Jun 2019 13:47:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B7CA27F90 for ; Fri, 14 Jun 2019 13:47:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EC8828420; Fri, 14 Jun 2019 13:47:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D58F27F90 for ; Fri, 14 Jun 2019 13:47:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A0FD6B0003; Fri, 14 Jun 2019 09:47:45 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8521D6B000A; Fri, 14 Jun 2019 09:47:45 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 719876B000D; Fri, 14 Jun 2019 09:47:45 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by kanga.kvack.org (Postfix) with ESMTP id 3C7286B0003 for ; Fri, 14 Jun 2019 09:47:45 -0400 (EDT) Received: by mail-pl1-f197.google.com with SMTP id 71so1620622pld.17 for ; Fri, 14 Jun 2019 06:47:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=8y6h8N73FB5NENGJmXuBWpySrRWBuNuuherB6ijj6q8=; b=VGo3+AkwSLwlSO87Htg6NWYRzgitQf4kl1DhbIzvgJ5MBxGXff9x4s7luJp3Xh/R0R IAL9+SoqknfJQuG7ATKF2gGKD058fzHbbUQ9244tMQeSeAwrSCS7IkzC4bF8pECPFdz2 GL2d/WFJ5ZVx1YLaI5WMuI68SlBiAC72UJhN0eJkCbiB4VgKA1Wwrxtb6MLhU+/Kp87h em+Up2fuGRg9T2MWbd43jvSovU9YrAluVeYJhyfffTTH5BmvAh6z6ACTfeN33FLE7AqM SInzNuwbtUMDVUwKUGrKUJIKdMeZZ5jykL7C7TKgtji5PcDdY+qEO3mV5F0DiuWEW+Lu RbMQ== X-Gm-Message-State: APjAAAW4c29BbYt0TZ+tm7SQh9FZIGvsIuynbIGoc8NyQZyJZVroDt8m Hu5A3FUd6CtAcWliM9CuZJ9AgCZObKunqsO0NYGjYywTApvz6EL6mTvCTf62x0ETrTDBzJRPYp2 u0p7ZU2YafrVjY5tiMDl2PFwR/tZOXw/q8b+x5qYqHffsp0YJarhM4PTSUqMtH1A= X-Received: by 2002:a63:4a20:: with SMTP id x32mr32765561pga.107.1560520064706; Fri, 14 Jun 2019 06:47:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZmOJDFcktinAfdU57Yr5pK1bSnay/wxVqF4N4w+Yvdysj5lIv710WzB5VdVVwZcT3cVbL X-Received: by 2002:a63:4a20:: with SMTP id x32mr32765508pga.107.1560520063812; Fri, 14 Jun 2019 06:47:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520063; cv=none; d=google.com; s=arc-20160816; b=vME/1cKNjShtZCNVs2IXKQ0R5Z3Vcy1+TeN3lfExcg6Psz/SWRimmcymnDQUroG8YP TMuBqjkpmxBzA9iIMKYiIpHMjfpsDYb9E7DvDNdCFL3vkiPLhD4y9hyS6HH4hW5Ckz64 WSwvk76hebw16t9YOCr17SSnbLesIX8gy7BCjPDsfp/j8sK47GKyWyqNlOu+3gX/dKan cBifJiwbILms4d7K5IJ00pICCO1dUZvHtl/XqY1qzJzBpIdq7Wt5+FbZCbwTU/Awoiyu JudGjPMemVDSP+4hHTN5HZLE75TMSgB6SnpCpCKrEXuEJGLYeex9S70nLEI1N/TObAce a0uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=8y6h8N73FB5NENGJmXuBWpySrRWBuNuuherB6ijj6q8=; b=JKxSHhAzR2ARg/S8bv8d3UHwSV2cnXzlurjtLxApp7yCR951R62Gmjvxqn7/It9GvK EakoS7QyrSIvcY4qULK4aOKPgpFhMsas3+LfliCjhMW92HXj+iZQivi5c0AKa/OqQCCE kRsIodf2P9kXm9pboq7zsQLJpAxp+KP8zEnXEPxkGlPJEgNC5UN2sLpyXUHvlkMD438v MQdCPmyQP7aj+Zc8104Ug7nIBevfoc2K7TZUf6mQgzOuoPgSk00wDVULzMVG9+/zmFXh m24u6kBhmBAJepbU3xZfEoL4wFB6TM1/+iW5Se/+urEm48rt4EujvArU0/Ndae/ZMcPl c3gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=O+TbJCIv; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id c128si2549638pfa.221.2019.06.14.06.47.43 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:47:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=O+TbJCIv; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=8y6h8N73FB5NENGJmXuBWpySrRWBuNuuherB6ijj6q8=; b=O+TbJCIvZxITqhhJGk19PgKDVb zP/cXr3k3gVNVyNuIZZ1EUainJIi7wVTUxXsQtP55j6fTBfcF7Sa+btFSjlOoBpdFax1u6ZazzUaz FPx/YcvbrcmM0hj9iSxxr66wiPpIo2CQcbBfULKCswmUhdFlmoDtWAaHV5c6chhQgW7u9cc4uUrYi +YgK5P2yi8DIc4PxIDTgNB0H2HMyfDDjSri1AD09oFbVupeMjadiOSOnAJwBO5Fva8F5W4du1//3V PC6NEPWuGSXf3Iz9K+nbMDUlMTGN745meRSObE6d5NxDDUuRnYJGChXPFHVxfA6Pw0enVfuoGJDnu q+P8IvBA==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmYJ-0004Xw-Il; Fri, 14 Jun 2019 13:47:36 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/16] media: videobuf-dma-contig: use dma_mmap_coherent Date: Fri, 14 Jun 2019 15:47:11 +0200 Message-Id: <20190614134726.3827-2-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP dma_alloc_coherent does not return a physical address, but a DMA address, which might be remapped or have an offset. Passing this DMA address to vm_iomap_memory is completely bogus. Use the proper dma_mmap_coherent helper instead, and stop passing __GFP_COMP to dma_alloc_coherent, as the memory management inside the DMA allocator is hidden from the callers. Fixes: a8f3c203e19b ("[media] videobuf-dma-contig: add cache support") Signed-off-by: Christoph Hellwig --- drivers/media/v4l2-core/videobuf-dma-contig.c | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf-dma-contig.c b/drivers/media/v4l2-core/videobuf-dma-contig.c index e1bf50df4c70..a5942ea38f1f 100644 --- a/drivers/media/v4l2-core/videobuf-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf-dma-contig.c @@ -39,11 +39,11 @@ struct videobuf_dma_contig_memory { static int __videobuf_dc_alloc(struct device *dev, struct videobuf_dma_contig_memory *mem, - unsigned long size, gfp_t flags) + unsigned long size) { mem->size = size; - mem->vaddr = dma_alloc_coherent(dev, mem->size, - &mem->dma_handle, flags); + mem->vaddr = dma_alloc_coherent(dev, mem->size, &mem->dma_handle, + GFP_KERNEL); if (!mem->vaddr) { dev_err(dev, "memory alloc size %ld failed\n", mem->size); @@ -260,8 +260,7 @@ static int __videobuf_iolock(struct videobuf_queue *q, return videobuf_dma_contig_user_get(mem, vb); /* allocate memory for the read() method */ - if (__videobuf_dc_alloc(q->dev, mem, PAGE_ALIGN(vb->size), - GFP_KERNEL)) + if (__videobuf_dc_alloc(q->dev, mem, PAGE_ALIGN(vb->size))) return -ENOMEM; break; case V4L2_MEMORY_OVERLAY: @@ -280,7 +279,6 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, struct videobuf_dma_contig_memory *mem; struct videobuf_mapping *map; int retval; - unsigned long size; dev_dbg(q->dev, "%s\n", __func__); @@ -298,23 +296,18 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, BUG_ON(!mem); MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); - if (__videobuf_dc_alloc(q->dev, mem, PAGE_ALIGN(buf->bsize), - GFP_KERNEL | __GFP_COMP)) + if (__videobuf_dc_alloc(q->dev, mem, PAGE_ALIGN(buf->bsize))) goto error; - /* Try to remap memory */ - size = vma->vm_end - vma->vm_start; - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); - /* the "vm_pgoff" is just used in v4l2 to find the * corresponding buffer data structure which is allocated * earlier and it does not mean the offset from the physical * buffer start address as usual. So set it to 0 to pass - * the sanity check in vm_iomap_memory(). + * the sanity check in dma_mmap_coherent(). */ vma->vm_pgoff = 0; - - retval = vm_iomap_memory(vma, mem->dma_handle, size); + retval = dma_mmap_coherent(q->dev, vma, mem->vaddr, mem->dma_handle, + vma->vm_end - vma->vm_start); if (retval) { dev_err(q->dev, "mmap: remap failed with error %d. ", retval); From patchwork Fri Jun 14 13:47:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995379 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0AEA976 for ; Fri, 14 Jun 2019 13:47:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFCD427F90 for ; Fri, 14 Jun 2019 13:47:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2D6B28420; Fri, 14 Jun 2019 13:47:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82BD227F90 for ; Fri, 14 Jun 2019 13:47:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 82C1B6B000D; Fri, 14 Jun 2019 09:47:52 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 803736B000E; Fri, 14 Jun 2019 09:47:52 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CD4D6B0266; Fri, 14 Jun 2019 09:47:52 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by kanga.kvack.org (Postfix) with ESMTP id 3A7646B000D for ; Fri, 14 Jun 2019 09:47:52 -0400 (EDT) Received: by mail-pf1-f198.google.com with SMTP id j7so1812979pfn.10 for ; Fri, 14 Jun 2019 06:47:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=dFkeNCOjf/ZFyy3Yeij5x73pEQRUAveqwZi3TB+kN+8=; b=N1m/bOW6/dcfjW7DmVNzxlfayXBmIPoDwfqhLHPczllDiWFR3SYE7gDjc7dW6cEwLK g8B2MWSgfqj5gD88jFLZBjmMhIB6qsHnSm5c2SyuiMDRxTlhxBGgMQW9RIhjqV9J7NPk aDb/LtID0k/LZzjO1rXFzCptDN7P5Pg8VRYnn4xsdxu3Nnp3h5iW94drIt8bLeE69Mxh sd7dPmbLEafJ9zppNsQ6KHnr5Hlm7dSHsDPjsUuMVIrUNDIXGoFVwM+laFh7QsZ/y/D0 dCNGBkgAh7aAMIehMKHO7gAuYLZfSsV1PpTjOBqdlpXs28B/xSH82QOe8amKnVyl+t62 na3Q== X-Gm-Message-State: APjAAAWP1S9IjCJAOHsyc/kDzovhQkhtTQ8N6tfZS96uNMOUK66beiDk UmHtbQr9V7SbnyyBGulRDaKKFtjEJDAn9zdeKTHMUo6OdoyeesUuwxS81bYMqomZQ/ltbftnpPx lkRTreA8V5sckVVHkP363K85dd20Pv9VddkjCRaYOXUQ6+JyqNoNTGG1Z+7dbEW8= X-Received: by 2002:a17:902:a516:: with SMTP id s22mr53817801plq.178.1560520071870; Fri, 14 Jun 2019 06:47:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYA/J0FW1db2NDLGisC7fGDY0rFjafAGNRYxn638rkIJFSvjVqFjh2c4vZuizgigmp6UG7 X-Received: by 2002:a17:902:a516:: with SMTP id s22mr53817722plq.178.1560520070785; Fri, 14 Jun 2019 06:47:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520070; cv=none; d=google.com; s=arc-20160816; b=q0dG5ZEfWsqjHVWphLkC4ori2S1O1EfFraHY8rflYiK/zc6D0Y3GMEkDd7pK7E50C5 8PSNzNIs4CTNvQ3mAJY0A/pfA6rEzp9L1d3yMWiTNzoG4AtK33RGvIu1FoTNKfEteoGO hcBCeL60Du+dIASlv4zKogKJ32JAp4mvXUhTTkXDy27dWi+9nsUQJ0niJp/iRtnKbxOR uDUIcxHuLfWNi5ukUBn4CXqfk1C830lwu6SxZU9yfY7qQPR82uytj21nhQc5i6SNgbxu xFIIwQ4yBeyg7ss+77APWAjUXF3GVi21d1jatalRRa/dIzXOVdlHvJiLgCz/sJTSEa3Q ygUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=dFkeNCOjf/ZFyy3Yeij5x73pEQRUAveqwZi3TB+kN+8=; b=PaeRhCMjOBv7Zvb53MvgvhUO0CEj9X+p9eMjkOMYUvjJ5PKMahYJx92hArffReo3Rk x0Aerh+EE2L8H/uBEEBXEr/iEja7zTMD9WBQ5SOLgip/vptxj7G26Ij4DN22OsN/1x5H qdRONvPo+GVcx+tnsILhiwTodgaEbNmgwbw7ct2o5s/Qz3D3RSp6OuQWNyyZRWeGv/rG jiVKci2yuKRhKm6s/UJAeP97vukgP/Z2UeR82yN44SA9pq9h1R5rwsUx9g1445TtYD5h bdS8OkzgIy0hGDGFusYZ4o86qypd6sS8EBoYqzIy2rAw8qU8WfWtm1UyGWnYLjBLW8yx mmVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=VbVxXB1x; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id 126si2761258pgb.349.2019.06.14.06.47.50 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:47:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=VbVxXB1x; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=dFkeNCOjf/ZFyy3Yeij5x73pEQRUAveqwZi3TB+kN+8=; b=VbVxXB1x19VOko6tXcNmrk4Pyv SjUlfFCbw880+ikTCwEk6mC/KDydaMvSEovCcvs6F89NEqr15LLWJk4bPUUc5iIovBb+hY4GQzxDn A3nJYlB8l2SFIliuv9suZO4k9LxSid81J8gFZw2kEy67edfSbgvl1E1NL1llWCCGeD1lk2YnA7IMi DoyWUeRh9rXzQjzFAiM60S0ugdShe2YsChaMS6mNwJReLOulnpRnn7LylOoHd3K2E4aXSmo49bU+c tB2WaXRC8Uz6JNO0tiPTpByXc9BqAwWpSMjT4oTuINM5VSJ76ZEmbcuOxR6yA7jeo6IUae9c7flZ2 9rkZNqlg==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmYM-0004a2-N5; Fri, 14 Jun 2019 13:47:39 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/16] drm/ati_pcigart: stop using drm_pci_alloc Date: Fri, 14 Jun 2019 15:47:12 +0200 Message-Id: <20190614134726.3827-3-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Remove usage of the legacy drm PCI DMA wrappers, and with that the incorrect usage cocktail of __GFP_COMP, virt_to_page on DMA allocation and SetPageReserved. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/ati_pcigart.c | 27 +++++++++++---------------- include/drm/ati_pcigart.h | 5 ++++- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/ati_pcigart.c b/drivers/gpu/drm/ati_pcigart.c index 2362f07fe1fc..f66d4fccd812 100644 --- a/drivers/gpu/drm/ati_pcigart.c +++ b/drivers/gpu/drm/ati_pcigart.c @@ -41,21 +41,14 @@ static int drm_ati_alloc_pcigart_table(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info) { - gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size, - PAGE_SIZE); - if (gart_info->table_handle == NULL) + gart_info->table_vaddr = dma_alloc_coherent(&dev->pdev->dev, + gart_info->table_size, &gart_info->table_handle, + GFP_KERNEL); + if (!gart_info->table_vaddr) return -ENOMEM; - return 0; } -static void drm_ati_free_pcigart_table(struct drm_device *dev, - struct drm_ati_pcigart_info *gart_info) -{ - drm_pci_free(dev, gart_info->table_handle); - gart_info->table_handle = NULL; -} - int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info) { struct drm_sg_mem *entry = dev->sg; @@ -87,8 +80,10 @@ int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info } if (gart_info->gart_table_location == DRM_ATI_GART_MAIN && - gart_info->table_handle) { - drm_ati_free_pcigart_table(dev, gart_info); + gart_info->table_vaddr) { + dma_free_coherent(&dev->pdev->dev, gart_info->table_size, + gart_info->table_vaddr, gart_info->table_handle); + gart_info->table_vaddr = NULL; } return 1; @@ -127,9 +122,9 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga goto done; } - pci_gart = gart_info->table_handle->vaddr; - address = gart_info->table_handle->vaddr; - bus_address = gart_info->table_handle->busaddr; + pci_gart = gart_info->table_vaddr; + address = gart_info->table_vaddr; + bus_address = gart_info->table_handle; } else { address = gart_info->addr; bus_address = gart_info->bus_addr; diff --git a/include/drm/ati_pcigart.h b/include/drm/ati_pcigart.h index a728a1364e66..2ffe278ba3b3 100644 --- a/include/drm/ati_pcigart.h +++ b/include/drm/ati_pcigart.h @@ -18,7 +18,10 @@ struct drm_ati_pcigart_info { void *addr; dma_addr_t bus_addr; dma_addr_t table_mask; - struct drm_dma_handle *table_handle; + + dma_addr_t table_handle; + void *table_vaddr; + struct drm_local_map mapping; int table_size; }; From patchwork Fri Jun 14 13:47:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995391 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65A4F1395 for ; Fri, 14 Jun 2019 13:48:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53889205FD for ; Fri, 14 Jun 2019 13:48:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4792F27F90; Fri, 14 Jun 2019 13:48:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9D07284CE for ; Fri, 14 Jun 2019 13:48:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC4F16B000E; Fri, 14 Jun 2019 09:48:01 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A4F706B0266; Fri, 14 Jun 2019 09:48:01 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8EEB06B0269; Fri, 14 Jun 2019 09:48:01 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by kanga.kvack.org (Postfix) with ESMTP id 546396B000E for ; Fri, 14 Jun 2019 09:48:01 -0400 (EDT) Received: by mail-pg1-f199.google.com with SMTP id z15so1916306pgk.10 for ; Fri, 14 Jun 2019 06:48:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+xs8xEvecIN+pidhw5Y71rlRjZmb8fJOnZhp8o/DsSw=; b=gj/byjEedTfpOogHcY6w97iDw4s7XqgwgpZ9CmcBITiH6FS521OfHIQWiPImuAO+qX Wsw6qyn6Rwc+zgWBeaQFMPv2ztSunTK0dxJdFBJEezaQhrY5rkzSeiRgwbo3OKiCxOPl nKa9W7RLM3/bXr+PNJQJrVv50gmi6chK9crYo3RAJqEPupReO8xiEQjZo/pIqM/DzSTC /SUCJfZyxZcR40aaVcCANvCbAXtrKJX1q+oA1xJaWqr9cd3nc0nZRUAAOdS1jqEHQGi9 gdtZ5I1rNYFp34ye+JNRoZdrQaWPELYDf4lu1HUuDBY4cpUlIGc9lPwo3o1LWZdZjAxE UKAQ== X-Gm-Message-State: APjAAAXUgvajqw3zErGzurCSEbRiCr8erEhGvzccvheywWyuODLNejeN 8lkbCIpJHZNHaSiP7QPihT04GEZr6aSwBDq0LTgEpINTYduRkri0+Hjgbb5rw4RK4Yz+qhqQe6/ yz8rsjL2cmEnuB+ozKwBy8Pk74HGJT0rn+8L/i3KBIEVSGi3kaScSbySpde4vYB0= X-Received: by 2002:a17:90a:e397:: with SMTP id b23mr11329366pjz.117.1560520080918; Fri, 14 Jun 2019 06:48:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYQd8MCquW6wh+uFOwv3xQ5t0Gz8qpRrHn8vyPnZkTmgyKqX4Vww0pa9WXfYAnh82F0wdn X-Received: by 2002:a17:90a:e397:: with SMTP id b23mr11329295pjz.117.1560520079897; Fri, 14 Jun 2019 06:47:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520079; cv=none; d=google.com; s=arc-20160816; b=BHEy55i1xAyJkw+KvuCD+b+vB3E/Kfh2lvFc7Bf55s+GuarzvTYmbHa2VtWJ/xbmz4 O7I6WJwRSQS3d5KBZLz7P76Oy0BBuYRA5F2saxVTF9+7x8ET6JGPS9rNCbC/4+5fIKa3 kITeyHx2yVyh+Lym5MmbtPETUHR34ie5qA7o3HRcypXZDzdsLcva0Q7emNsMtP0tAQdW yEYxH758rSb1Rj0kLOEAl3xlwA2WgW2lp5xGnZOeG1uPkwjX+ejyAgH6bOakyr6/6/3z MFOiSUgXnIMmsarwEmV8H7GthW6tunz7DcWy0KDnrIAc3LEG0IV6mQTr76JtI3H71+zw XSXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=+xs8xEvecIN+pidhw5Y71rlRjZmb8fJOnZhp8o/DsSw=; b=C/E0kCMtXyWOsYTyxQL0Da4RETHvrL0likwHfSerr5kzU2QA/yHj8HQ6txUqN32xnb XiiVCXDJFSLgQ+eOz+SsoraWU18OUPeAfQq9AAncUawfam2BFXCW9bbJTN/17GFrln40 s1qskpzlhXVzzUVjLRTegj8AOtQLzNBJbEJRW78JJ90Fo7NupGePw1bJjFpDD1iKpWjw bXf4KkGvVEmXU5y8VXpBFtjiiIpP7fnHUZ27NpZWw440CP07K6UZ1VpjDk3uhiGDDSk7 CwCgfntxQR9SyI2TCvSWjOJCJpoIir/dXBhOrYmj1WXtZ/uJFySZKcW7qu29dhBgr7C9 Pb+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=LZajKbx8; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id u20si2398864plq.421.2019.06.14.06.47.59 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:47:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=LZajKbx8; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=+xs8xEvecIN+pidhw5Y71rlRjZmb8fJOnZhp8o/DsSw=; b=LZajKbx8vMWmoPyPihl3W8b1II oarEXVrrz2rxvZ0BgXTxaFSJ89DHAoMwNs46qftGPIs2iOcmI3PGUZe+ESDrKJqwk8Pn/9InuTjbe w/TkgWs39UEZl5gAqGPQNkS8QJr9eK5xRj4GSD3z1xgEem0WZvNMx/y06DWCWoiPPtMn6DV1KJtT4 3dephzfXQQJVrhS8KA9VAcX9i7Lqdp6j+6fd+Du7mG+QFzmKyVufezvRPWVqUb7kH/R5PAyOXYi6v YOEZa1MgatXouQX+rfRB0aOlbZAvy1un6+StmE3Bzk1C+2JjRxYHzmpazpOIF5cCv5pJpncKedcmm mul+NSrA==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmYQ-0004jF-5L; Fri, 14 Jun 2019 13:47:42 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/16] drm/i915: stop using drm_pci_alloc Date: Fri, 14 Jun 2019 15:47:13 +0200 Message-Id: <20190614134726.3827-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Remove usage of the legacy drm PCI DMA wrappers, and with that the incorrect usage cocktail of __GFP_COMP, virt_to_page on DMA allocation and SetPageReserved. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/i915_gem.c | 30 +++++++++++++------------- drivers/gpu/drm/i915/i915_gem_object.h | 3 ++- drivers/gpu/drm/i915/intel_display.c | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index ad01c92aaf74..8f2053c91aff 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -228,7 +228,6 @@ i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data, static int i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj) { struct address_space *mapping = obj->base.filp->f_mapping; - drm_dma_handle_t *phys; struct sg_table *st; struct scatterlist *sg; char *vaddr; @@ -242,13 +241,13 @@ static int i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj) * to handle all possible callers, and given typical object sizes, * the alignment of the buddy allocation will naturally match. */ - phys = drm_pci_alloc(obj->base.dev, - roundup_pow_of_two(obj->base.size), - roundup_pow_of_two(obj->base.size)); - if (!phys) + obj->phys_vaddr = dma_alloc_coherent(&obj->base.dev->pdev->dev, + roundup_pow_of_two(obj->base.size), + &obj->phys_handle, GFP_KERNEL); + if (!obj->phys_vaddr) return -ENOMEM; - vaddr = phys->vaddr; + vaddr = obj->phys_vaddr; for (i = 0; i < obj->base.size / PAGE_SIZE; i++) { struct page *page; char *src; @@ -286,18 +285,17 @@ static int i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj) sg->offset = 0; sg->length = obj->base.size; - sg_dma_address(sg) = phys->busaddr; + sg_dma_address(sg) = obj->phys_handle; sg_dma_len(sg) = obj->base.size; - obj->phys_handle = phys; - __i915_gem_object_set_pages(obj, st, sg->length); return 0; err_phys: - drm_pci_free(obj->base.dev, phys); - + dma_free_coherent(&obj->base.dev->pdev->dev, + roundup_pow_of_two(obj->base.size), obj->phys_vaddr, + obj->phys_handle); return err; } @@ -335,7 +333,7 @@ i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj, if (obj->mm.dirty) { struct address_space *mapping = obj->base.filp->f_mapping; - char *vaddr = obj->phys_handle->vaddr; + char *vaddr = obj->phys_vaddr; int i; for (i = 0; i < obj->base.size / PAGE_SIZE; i++) { @@ -363,7 +361,9 @@ i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj, sg_free_table(pages); kfree(pages); - drm_pci_free(obj->base.dev, obj->phys_handle); + dma_free_coherent(&obj->base.dev->pdev->dev, + roundup_pow_of_two(obj->base.size), obj->phys_vaddr, + obj->phys_handle); } static void @@ -603,7 +603,7 @@ i915_gem_phys_pwrite(struct drm_i915_gem_object *obj, struct drm_i915_gem_pwrite *args, struct drm_file *file) { - void *vaddr = obj->phys_handle->vaddr + args->offset; + void *vaddr = obj->phys_vaddr + args->offset; char __user *user_data = u64_to_user_ptr(args->data_ptr); /* We manually control the domain here and pretend that it @@ -1431,7 +1431,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, ret = i915_gem_gtt_pwrite_fast(obj, args); if (ret == -EFAULT || ret == -ENOSPC) { - if (obj->phys_handle) + if (obj->phys_vaddr) ret = i915_gem_phys_pwrite(obj, args, file); else ret = i915_gem_shmem_pwrite(obj, args); diff --git a/drivers/gpu/drm/i915/i915_gem_object.h b/drivers/gpu/drm/i915/i915_gem_object.h index ca93a40c0c87..14bd2d61d0f6 100644 --- a/drivers/gpu/drm/i915/i915_gem_object.h +++ b/drivers/gpu/drm/i915/i915_gem_object.h @@ -290,7 +290,8 @@ struct drm_i915_gem_object { }; /** for phys allocated objects */ - struct drm_dma_handle *phys_handle; + dma_addr_t phys_handle; + void *phys_vaddr; struct reservation_object __builtin_resv; }; diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 5098228f1302..4f8b368ac4e2 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -10066,7 +10066,7 @@ static u32 intel_cursor_base(const struct intel_plane_state *plane_state) u32 base; if (INTEL_INFO(dev_priv)->display.cursor_needs_physical) - base = obj->phys_handle->busaddr; + base = obj->phys_handle; else base = intel_plane_ggtt_offset(plane_state); From patchwork Fri Jun 14 13:47:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 312E413AD for ; Fri, 14 Jun 2019 13:48:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D9B8205FD for ; Fri, 14 Jun 2019 13:48:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 107D528420; Fri, 14 Jun 2019 13:48:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 544A427F90 for ; Fri, 14 Jun 2019 13:48:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B42C6B0266; Fri, 14 Jun 2019 09:48:02 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 915D56B0269; Fri, 14 Jun 2019 09:48:02 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CD696B026A; Fri, 14 Jun 2019 09:48:02 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id 1A0446B0266 for ; Fri, 14 Jun 2019 09:48:02 -0400 (EDT) Received: by mail-pg1-f198.google.com with SMTP id 21so1927480pgl.5 for ; Fri, 14 Jun 2019 06:48:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EZXX45MA5Kr/jRAVRE8+C8CWSuTwR7IM5YlBjilZCgk=; b=jcRI56J2NEPQYCxGK3CvdfP+yzoc/zA/3vxY7a/xCcP3kyObqMQH4DSRF2lYOsvQ4C 2ZJgkRKneQGg7dq172l14EN7BdpSA96nTR3r/xHq1OtLH+DasdqFwc38VfEg9DOvQt43 YBvevJ385BN8zTvgba2Phg2I9yd1fDQEWuDoP1y0wNAQjUWxhh9EvB5uSMsaoMW3vtcz KHSTQjT0j5nMyZ81SM5eQ1iBijHD1SAW791VY1SH2go1UN3t4GLNLHAfTcqJNzrgm2m2 OF34NK/tJIiloyMHgNaeOuFmIHjMPESuv9G0EIad6TE8ABQcn14XOpSyFJiaxuTmKZ8N cP/Q== X-Gm-Message-State: APjAAAWC30FAksGU0CatBarQuxbxlpzOMXO/cUWW2zgPQbzzWj2woWYl S/ewgrNzGOftmSjAfWpC9d+McrQ0Hwde7CAvy4WOChy8/oip6Btucy8D1vT0W+Rjt9emWhXb9Ed ZS5rJP77MVMuXIhFp5xhylAsJ+8MH3gl77nec0K94W3xA1FYgRD7htkMJYqPVcec= X-Received: by 2002:a63:3710:: with SMTP id e16mr35455702pga.391.1560520081579; Fri, 14 Jun 2019 06:48:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVLs/GI/ncag1BwwrwUS+ekRgMHFXTTd2sOIcemsgRFTpuFGvHSpz+5j+iLf4QGzr4ndC4 X-Received: by 2002:a63:3710:: with SMTP id e16mr35455638pga.391.1560520080644; Fri, 14 Jun 2019 06:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520080; cv=none; d=google.com; s=arc-20160816; b=VOkVSnw2PuCORuwhGk+zbt92l2Z8VJLV7wEtbSmVauLt8e6Hww4fWSpgFqemrXC0L5 zVI50SlnMC6Y6eGyjgSofCfpsTxkiyyam/dWEI7bQREGYEzMcOloQQyvBaNXE2QHVY7X MxhN8qhNRaZ8DYcVodABOXiWRchMy9HHdvYRON51ANLqalXapFgKkZJf+AcQgz+6CPO6 ywCnmCgKh+V8FPZoyQGBMK3oqmAdDCMQDX5L3e3pgyqkVoJy4MViKysrs158vLD/UXCZ 6pDr8sFcbh4hwHd0hm3ceMM8QORWgPorH73SXa+zSNgB7jYJa6blkPnA+JrGXyQWm/xf snnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=EZXX45MA5Kr/jRAVRE8+C8CWSuTwR7IM5YlBjilZCgk=; b=H/IaxS4AFW6nt8lYiJnHZQqa1bZsGtEQF27gebUb63iJzVEzAaUq1bCeRfS7kE3l0L FOCbHDY5zN4qv13QacDFFGHc19oNh81RAahXb3Lyc87q0qlK2ChmKTR+ilPTOKKx9y5E g/7XR5sQ6wx6XNhyvJl8QNjJT1mHIJ9BlKvMGjQYLhrFM4oVwKbq8dh10jYqfZbKpwhN +ou2Z5jf8c5VSofZl3zQI8HB3ghVeJf+VOdOGUyS/4rCkULSt4GwhVwRlRdFQEXr7VxP r93OCf0KTdDBC2gH/yipHssRaFkRWp7NvHjfxIAGbTCOKI4xIOV6yD2LF9C/CHmogEqI quhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=h+BXnX3J; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id l7si2623957pgl.562.2019.06.14.06.48.00 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:48:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=h+BXnX3J; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=EZXX45MA5Kr/jRAVRE8+C8CWSuTwR7IM5YlBjilZCgk=; b=h+BXnX3J4b+gwgk8yPNC/LWr1d p0nnzOOFRXth82UzpFCB2ZuQda+YSnZqn1gWN/qSy0zb/PDbkxwFXXm4UiBO6y21DGjJKIpj+/E7T t81qzz/2oo9KHsBbfxcBTc0XdOWVcD8Me/I1N4dbHkRIHmscQ3E5EqrB++XzFTrpq2R8zML45F/Ps oaAmNvGeU78znGJDV3igN+bPWzpoiS+4Hp8Fqr+cK6dinRTkZnWt3NgNbOOp66Pzk7n5TbtG2mGCw 5/Tp8vxU8u23qdHv/v9KZKGd58ml8mZRHwcNFbLAEjZXspFap861gPdI5rNvUFMPWJb+9Ka6ShI2/ EDWZG46A==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmYT-0004pk-75; Fri, 14 Jun 2019 13:47:45 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/16] drm: move drm_pci_{alloc,free} to drm_legacy Date: Fri, 14 Jun 2019 15:47:14 +0200 Message-Id: <20190614134726.3827-5-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP These functions are rather broken in that they try to pass __GFP_COMP to dma_alloc_coherent, call virt_to_page on the return value and mess with PageReserved. And not actually used by any modern driver. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/drm_bufs.c | 85 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_pci.c | 89 -------------------------------------- 2 files changed, 85 insertions(+), 89 deletions(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index bfc419ed9d6c..7418872d87c6 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -38,6 +38,91 @@ #include +/** + * drm_pci_alloc - Allocate a PCI consistent memory block, for DMA. + * @dev: DRM device + * @size: size of block to allocate + * @align: alignment of block + * + * FIXME: This is a needless abstraction of the Linux dma-api and should be + * removed. + * + * Return: A handle to the allocated memory block on success or NULL on + * failure. + */ +drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align) +{ + drm_dma_handle_t *dmah; + unsigned long addr; + size_t sz; + + /* pci_alloc_consistent only guarantees alignment to the smallest + * PAGE_SIZE order which is greater than or equal to the requested size. + * Return NULL here for now to make sure nobody tries for larger alignment + */ + if (align > size) + return NULL; + + dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL); + if (!dmah) + return NULL; + + dmah->size = size; + dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size, + &dmah->busaddr, + GFP_KERNEL | __GFP_COMP); + + if (dmah->vaddr == NULL) { + kfree(dmah); + return NULL; + } + + /* XXX - Is virt_to_page() legal for consistent mem? */ + /* Reserve */ + for (addr = (unsigned long)dmah->vaddr, sz = size; + sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) { + SetPageReserved(virt_to_page((void *)addr)); + } + + return dmah; +} + +/* + * Free a PCI consistent memory block without freeing its descriptor. + * + * This function is for internal use in the Linux-specific DRM core code. + */ +void __drm_legacy_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) +{ + unsigned long addr; + size_t sz; + + if (dmah->vaddr) { + /* XXX - Is virt_to_page() legal for consistent mem? */ + /* Unreserve */ + for (addr = (unsigned long)dmah->vaddr, sz = dmah->size; + sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) { + ClearPageReserved(virt_to_page((void *)addr)); + } + dma_free_coherent(&dev->pdev->dev, dmah->size, dmah->vaddr, + dmah->busaddr); + } +} + +/** + * drm_pci_free - Free a PCI consistent memory block + * @dev: DRM device + * @dmah: handle to memory block + * + * FIXME: This is a needless abstraction of the Linux dma-api and should be + * removed. + */ +void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) +{ + __drm_legacy_pci_free(dev, dmah); + kfree(dmah); +} + static struct drm_map_list *drm_find_matching_map(struct drm_device *dev, struct drm_local_map *map) { diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index 693748ad8b88..77a215f2a8e4 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c @@ -31,95 +31,6 @@ #include "drm_internal.h" #include "drm_legacy.h" -/** - * drm_pci_alloc - Allocate a PCI consistent memory block, for DMA. - * @dev: DRM device - * @size: size of block to allocate - * @align: alignment of block - * - * FIXME: This is a needless abstraction of the Linux dma-api and should be - * removed. - * - * Return: A handle to the allocated memory block on success or NULL on - * failure. - */ -drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align) -{ - drm_dma_handle_t *dmah; - unsigned long addr; - size_t sz; - - /* pci_alloc_consistent only guarantees alignment to the smallest - * PAGE_SIZE order which is greater than or equal to the requested size. - * Return NULL here for now to make sure nobody tries for larger alignment - */ - if (align > size) - return NULL; - - dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL); - if (!dmah) - return NULL; - - dmah->size = size; - dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size, - &dmah->busaddr, - GFP_KERNEL | __GFP_COMP); - - if (dmah->vaddr == NULL) { - kfree(dmah); - return NULL; - } - - /* XXX - Is virt_to_page() legal for consistent mem? */ - /* Reserve */ - for (addr = (unsigned long)dmah->vaddr, sz = size; - sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) { - SetPageReserved(virt_to_page((void *)addr)); - } - - return dmah; -} - -EXPORT_SYMBOL(drm_pci_alloc); - -/* - * Free a PCI consistent memory block without freeing its descriptor. - * - * This function is for internal use in the Linux-specific DRM core code. - */ -void __drm_legacy_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) -{ - unsigned long addr; - size_t sz; - - if (dmah->vaddr) { - /* XXX - Is virt_to_page() legal for consistent mem? */ - /* Unreserve */ - for (addr = (unsigned long)dmah->vaddr, sz = dmah->size; - sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) { - ClearPageReserved(virt_to_page((void *)addr)); - } - dma_free_coherent(&dev->pdev->dev, dmah->size, dmah->vaddr, - dmah->busaddr); - } -} - -/** - * drm_pci_free - Free a PCI consistent memory block - * @dev: DRM device - * @dmah: handle to memory block - * - * FIXME: This is a needless abstraction of the Linux dma-api and should be - * removed. - */ -void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) -{ - __drm_legacy_pci_free(dev, dmah); - kfree(dmah); -} - -EXPORT_SYMBOL(drm_pci_free); - #ifdef CONFIG_PCI static int drm_get_pci_domain(struct drm_device *dev) From patchwork Fri Jun 14 13:47:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995401 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 418F676 for ; Fri, 14 Jun 2019 13:48:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32577205FD for ; Fri, 14 Jun 2019 13:48:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2650728390; Fri, 14 Jun 2019 13:48:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD502205FD for ; Fri, 14 Jun 2019 13:48:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F84C6B0269; Fri, 14 Jun 2019 09:48:07 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 480CB6B026A; Fri, 14 Jun 2019 09:48:07 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 322866B026B; Fri, 14 Jun 2019 09:48:07 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id E89286B0269 for ; Fri, 14 Jun 2019 09:48:06 -0400 (EDT) Received: by mail-pg1-f197.google.com with SMTP id 14so1906626pgo.14 for ; Fri, 14 Jun 2019 06:48:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=GC9Gboqptsed7WVs/myU7Q6vnMi9vBxIwQ2uPA5D0pw=; b=asTbacolRUNuHjP/8KksCAyNyFkiIZ83uNjiwCiJKIa61MD8qJxl3uyOxUEOujGW9X FR5JuzLDku9Zvys7E2GsOi6pNzmnbpNm+hPGZBn2PpGmPlCkda/5tkz0kzaCQA7Mt/Qj GbDTnWRGJymjzwIhaZWw6QnYB22/1TGO3DxBwlgSLUQxLzOMLUAXuNi+MJZiRz4pRUZU KSTBnkTchM+S4RrcqVXXy76TbJ1LSaRP8eUfyoyFyZ/iRJBYx+OcwVOiYGX25EZU++yB wF4XS+DSKv6aAwy3lG77wR7aChNIkJqEkFdFRyDmCssHRSOdxFvvJ8GLuOMgQg979rh+ 1qpA== X-Gm-Message-State: APjAAAX1yKseAQaUad+2vQkitFBBAyupdFUQ2KCxfBsM8+jkP0r8VPlM xmYSRdJyTG6QffQdT0FxSFpffPIwI3ETsl2+03/5uAQmgg1yINnQcxZCTEp+uGALfSSgTDk2NI3 Vc4zrwBd7bMbd+6z9OGcaN0x824Z++0xfHcZWmjkBqksT/9YeVhe6Ie5UIX36L90= X-Received: by 2002:a63:f54c:: with SMTP id e12mr36043886pgk.62.1560520086499; Fri, 14 Jun 2019 06:48:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4uONsHOt2J8SAnOGDY/m/RYfyHuxTkg/MHfo4RUAH6TjhJzuK0lvl5kgHZyaPEykyE3+V X-Received: by 2002:a63:f54c:: with SMTP id e12mr36043842pgk.62.1560520085810; Fri, 14 Jun 2019 06:48:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520085; cv=none; d=google.com; s=arc-20160816; b=TwG73POjyFcKYMeyK6GxmbGNaU8tOtA4Grtd71c03oQttehMas2jfnlu4dZLXtD45t LnAcDyrSdt0tBn2V8t6VHJDuW+kEhmV17aglVI4rMjaOB6RFPvhGxPOO3fDgefuPIVZ9 KpyYJvI5cGebF1tKt9MduVTDDl+QgujMi+dkIW9zWO3g0Va6SjplpddQR5+LrwZpc9VG rCFjSC8RVtDg38kjR4Bn3hfcpzERt+JkHBZOvNRO9+jH69QX3dHicoUtP7PvIg8d9GdV vfGsT/xcCsKYNlkSzOXYH7XRh2OVVSSGZAH1tZmprOqUz80HzIwH/X6LzG3nmrGCwJBf OyTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=GC9Gboqptsed7WVs/myU7Q6vnMi9vBxIwQ2uPA5D0pw=; b=WIdmqNATr6lIZXzikbCuDYUihquGbCyDJVFjTnPM3JvmBIQwianmbmzlxgA5ZAohbh 4hjkw1IW2FpewWpSI/AH7WufQmAfEQ/gj6eGyir/As6FhR5M3qzucUc4GxNbtH89CuXE tPvIsDw/ghDreF9jrUlhxoHp+BsUFAMsjUS4t3XpgM26YfDVVcX5y8VGjIJwiNNsdyMe wM4L9KxsMLtCkUG+J9tY8eLM0nMLBpzuomOWJW/rApxmqBD0AOHjKBZQN3LDvxBHnTsw iCnBKDDVUbue1UqtUlGEXROh0HVce/aGLIa3try7Xo6m8WL4kON1KuyKroKQjofwWGcS lduQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=UntrdW5G; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id m5si2327013pls.18.2019.06.14.06.48.05 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:48:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=UntrdW5G; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=GC9Gboqptsed7WVs/myU7Q6vnMi9vBxIwQ2uPA5D0pw=; b=UntrdW5G2+b49vgfbJaGUDLN0E 6yE3PpGKvsuDOwoXcyXIdlGC5PZ5Rx2/rsrnwuL8rTHEvIhh9QW1GU17v1tVNFho0ne9tn/Z4eT54 OswJKEO4vsr1FvbWuovnG6n4mY8AwbgfvU32igpwJyhrRibTzRGYZ0pS+zdU9gFhrv4TTezoxvPTg hlLUh5YHvDGvTCdMXXQ7VhKjApYDYfxlL3VT+nNwtwNQkVPOAXwAW1qubfFu1o+AsbdCjGKbzv2rR p+QnqhNY4+X8ZCNtkVbeuJ4T0148xhaiU0PQmlP12f+mNEdx8mMY/AvPPLm2vvkGBNkm80UQVHowq 4Bj27y3g==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmYa-0004vN-2H; Fri, 14 Jun 2019 13:47:52 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/16] drm: don't pass __GFP_COMP to dma_alloc_coherent in drm_pci_alloc Date: Fri, 14 Jun 2019 15:47:16 +0200 Message-Id: <20190614134726.3827-7-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The memory returned from dma_alloc_coherent is opaqueue to the user, thus the exact way of page refcounting shall not matter either. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/drm_bufs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index b640437ce90f..7a79a16a055c 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -70,7 +70,7 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali dmah->size = size; dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size, &dmah->busaddr, - GFP_KERNEL | __GFP_COMP); + GFP_KERNEL); if (dmah->vaddr == NULL) { kfree(dmah); From patchwork Fri Jun 14 13:47:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B17D1395 for ; Fri, 14 Jun 2019 13:48:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B710205FD for ; Fri, 14 Jun 2019 13:48:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E22428390; Fri, 14 Jun 2019 13:48:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B782F205FD for ; Fri, 14 Jun 2019 13:48:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 805116B026A; Fri, 14 Jun 2019 09:48:15 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 78E316B026B; Fri, 14 Jun 2019 09:48:15 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 62FC86B026C; Fri, 14 Jun 2019 09:48:15 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by kanga.kvack.org (Postfix) with ESMTP id 2A7236B026A for ; Fri, 14 Jun 2019 09:48:15 -0400 (EDT) Received: by mail-pf1-f200.google.com with SMTP id i123so1803047pfb.19 for ; Fri, 14 Jun 2019 06:48:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=voUH/VESvtWj4I6HLsXBpYRJA1I9bz8V8FhWnyIglGY=; b=FK+nWcfcWqJf2pQ7L5e+NE26fkP1G0Qj7TzvazCEuWP5Sxv83cTZZhgAVJMRR+MjPq JD8rIg+Ma91SyvdZyfLNC/nDxrL+oxSrxACePhUNW9wMYZlmIuB0zjN2ToXomAEd/k9P +4LX6vGJtXXTNMdAzbkStZa84mrHBZekz+qkS2/AV7QPl2uYwYy4Pwd7O69nIv10cyZO 81NBuMaiGFgryH4xGem2timYtNQFka9nJpoCiHYYMTq/zTbGZhu715sEP7Qe4I5Trvil l92WILwb84WLPYsxkTgyB7A2Wkp6U+gv75nvnTQ7oJJeCnGbXfC/pL+XmGuUyowVdKzq 7PoA== X-Gm-Message-State: APjAAAU+WQEQHx8pgtHPRw5zOn/N9W/bexX1abKJ63o1WvbV/DpdhDQ5 uYNLh38FebPwwAPmPmZ4WGwTTjJOihtrwxeMReHM86NXM1mb9ZWOR7DaCogwoS/8NV5y9UjoaR2 B7/uZRtw1O+akXezDatjr4QBfTiadmQ4Juy3Nru2fwm95WNF4r3ujE+IElbuQFlk= X-Received: by 2002:a63:f70b:: with SMTP id x11mr5106439pgh.212.1560520094743; Fri, 14 Jun 2019 06:48:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcJfzQ7bc6O+BsYgJTUeSiR46b7EXJNPWPyPZ27mraowZoWi91aAQo7sueUxJ2BA/H8KvP X-Received: by 2002:a63:f70b:: with SMTP id x11mr5106376pgh.212.1560520093908; Fri, 14 Jun 2019 06:48:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520093; cv=none; d=google.com; s=arc-20160816; b=FGxfduJoR9Dr3bYvsrjRpk9BTEZo+ufGRTOYOIpaQ9CClHdWO8OIYUwjZuoIkABjRO A5IwwGAAVAEZp+PY7z+DZRoFko5GU4cjWwy/1NxA1EaAAUKOa6EaxhjccQ3X0nBs0NrK 0QCV5TRNw+BVjMenP8ziAdFOb60vyy01GlQqI3ajIivC2KBV01+xsq2jnL4SQTHPo6nJ xT/oaL4qlC1UGmQfTy4Pk/CPZEHLD3ZQqFz1jyolTyd99o+RhaneoxgifPKQSUoJB3Qz UYSekdSleyfGppNooUeM0dLw7xTfMcHLynkqUS+/tkojALyCuUZnWNGQzu8FUnSL6UN6 F3NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=voUH/VESvtWj4I6HLsXBpYRJA1I9bz8V8FhWnyIglGY=; b=MwM1t/I7qX7A03nzxTGko037DnhGPTKhV6Oad+lVAqj+NQEuPyuFHcZtyg0qylbvVs SXTAbELvb/2jVOOalXP3ApcXyWdQigZWAI+IZO780y1Wdkkk3RGAZaP0ZKWGwu7aiL2F 4/EYDt6Y+NexySOwSeF5SIeqm4Z0Yo7Hmt9Pmb0bB+nXOIpK4tk6Kl3xnFrz5gjpsXEq VYomd0FAwldcL/wAmgzpE841yQOaBfNiDXJ4A35CSJYTS86i8dS3xHax0EPsMRc8NySl DcYwzkzD49koRlcMVsH8Ph1sQi44+Js49jdXBmC8KbDRImM+IoeX56WaGyCyD3fiVe87 U7cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=uRK7ZFAn; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id j125si2594440pgc.453.2019.06.14.06.48.13 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:48:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=uRK7ZFAn; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=voUH/VESvtWj4I6HLsXBpYRJA1I9bz8V8FhWnyIglGY=; b=uRK7ZFAnjpL2rr/0CUfA2lvRvn MMA/TT67HwvKwHALsH6Yi1bK/9hQpeF2Y9WNSQiuHCQZk3pGo5Iut8pm4tAYvEGrw/6WXYNTmPxKO dAMk/oU/QBEx/xXpnJFg9G8wz5Fp9ysZOZxj3YySGlQxOS9aKURHvR4B3f1nS4JChwui9qEEY8i6X bJlC9leC1vR0nEGsTg5/vqnuj4fdWff3QX72bE0zpkRJHcgzwvQf1m9HIJwDxhhdbqgBXTTX3ixSJ 5oYDmNfDcKyAIPrOHNouEAsKLx5bVbDJIHGyKOFWk1kar/q9/gTj6w2JpvlWTWoobtck9JM+dFHSI 3wLzosZw==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmYd-00054z-8V; Fri, 14 Jun 2019 13:47:56 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/16] IB/hfi1: stop passing bogus gfp flags arguments to dma_alloc_coherent Date: Fri, 14 Jun 2019 15:47:17 +0200 Message-Id: <20190614134726.3827-8-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP dma_alloc_coherent is not just the page allocator. The only valid arguments to pass are either GFP_ATOMIC or GFP_ATOMIC with possible modifiers of __GFP_NORETRY or __GFP_NOWARN. Signed-off-by: Christoph Hellwig --- drivers/infiniband/hw/hfi1/init.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c index 71cb9525c074..ff9d106ee784 100644 --- a/drivers/infiniband/hw/hfi1/init.c +++ b/drivers/infiniband/hw/hfi1/init.c @@ -1846,17 +1846,10 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) u64 reg; if (!rcd->rcvhdrq) { - gfp_t gfp_flags; - amt = rcvhdrq_size(rcd); - if (rcd->ctxt < dd->first_dyn_alloc_ctxt || rcd->is_vnic) - gfp_flags = GFP_KERNEL; - else - gfp_flags = GFP_USER; rcd->rcvhdrq = dma_alloc_coherent(&dd->pcidev->dev, amt, - &rcd->rcvhdrq_dma, - gfp_flags | __GFP_COMP); + &rcd->rcvhdrq_dma, GFP_KERNEL); if (!rcd->rcvhdrq) { dd_dev_err(dd, @@ -1870,7 +1863,7 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) rcd->rcvhdrtail_kvaddr = dma_alloc_coherent(&dd->pcidev->dev, PAGE_SIZE, &rcd->rcvhdrqtailaddr_dma, - gfp_flags); + GFP_KERNEL); if (!rcd->rcvhdrtail_kvaddr) goto bail_free; } @@ -1926,19 +1919,10 @@ int hfi1_setup_eagerbufs(struct hfi1_ctxtdata *rcd) { struct hfi1_devdata *dd = rcd->dd; u32 max_entries, egrtop, alloced_bytes = 0; - gfp_t gfp_flags; u16 order, idx = 0; int ret = 0; u16 round_mtu = roundup_pow_of_two(hfi1_max_mtu); - /* - * GFP_USER, but without GFP_FS, so buffer cache can be - * coalesced (we hope); otherwise, even at order 4, - * heavy filesystem activity makes these fail, and we can - * use compound pages. - */ - gfp_flags = __GFP_RECLAIM | __GFP_IO | __GFP_COMP; - /* * The minimum size of the eager buffers is a groups of MTU-sized * buffers. @@ -1969,7 +1953,7 @@ int hfi1_setup_eagerbufs(struct hfi1_ctxtdata *rcd) dma_alloc_coherent(&dd->pcidev->dev, rcd->egrbufs.rcvtid_size, &rcd->egrbufs.buffers[idx].dma, - gfp_flags); + GFP_KERNEL); if (rcd->egrbufs.buffers[idx].addr) { rcd->egrbufs.buffers[idx].len = rcd->egrbufs.rcvtid_size; From patchwork Fri Jun 14 13:47:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C78576 for ; Fri, 14 Jun 2019 13:48:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C100205FD for ; Fri, 14 Jun 2019 13:48:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FE7A28420; Fri, 14 Jun 2019 13:48:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAC25205FD for ; Fri, 14 Jun 2019 13:48:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F30B96B026B; Fri, 14 Jun 2019 09:48:15 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id EBA586B026C; Fri, 14 Jun 2019 09:48:15 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D81AF6B026D; Fri, 14 Jun 2019 09:48:15 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id 9A90B6B026C for ; Fri, 14 Jun 2019 09:48:15 -0400 (EDT) Received: by mail-pf1-f197.google.com with SMTP id j7so1813565pfn.10 for ; Fri, 14 Jun 2019 06:48:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=WrqEw/kh06rUcYlXeZlC7gMu2XY6dy0Gg8ARfs+ZAOQ=; b=ayaKlBZSgcBOKg0Z8kbNg8zCtKepEe4c/X0Fzs3WpmJwQ0g30HL2w5Y+5/M4z4wgvr vvCKk0zqRs440z7iDhpICoq48U3PlOhsJGpd6tzrdHlcWFfkccX7bE5oBQzNj/iY+KgN poxDdQhpU6KTT1ojxbebyE2CHmpmPeUGI+ZFA61gF0FNLvzA4bcHG7uNfykniLLx0Cnb en3zBRKcJg/iB9oth6EdYhS288/Y7rEZuPLnUoe3Howw5eKn3EIZgomwwp/9AQHI9nOZ XChxIUmHBGOjdx2Xm3QOrYQJgYuv2WBRMTIM0xCGVGYJ3+ZqXxBkpQyGV+5RiisGUS0o 7NVg== X-Gm-Message-State: APjAAAXb3ZN3Xc5eoFd1i/u/jtF2JZwDNPzXINaEiQkBRIh1gpvBKar5 YQlSf4Ch+N3dvVxwuIBUsLU0G02PQSj2b7vFG2Qr086/7teQpaOaWxyT2Bl5TG8Lcp1TXVu7BDi 6ml+qy0Gc1HyuixI4CtW5ArJk2TW85JKEGogwAV/vyZR8lIGzOcJbvpH2N/fbBE4= X-Received: by 2002:a17:90a:1706:: with SMTP id z6mr10930721pjd.108.1560520095276; Fri, 14 Jun 2019 06:48:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwuN36V1EXZ9CBLu6qvS4BvCXb2lueAammANIkI07rHors2lrrCPP5jsehCLIOWiK035L7o X-Received: by 2002:a17:90a:1706:: with SMTP id z6mr10930652pjd.108.1560520094381; Fri, 14 Jun 2019 06:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520094; cv=none; d=google.com; s=arc-20160816; b=gPXxbz+on0QqZRneKgRLJzp16lpYt5ecXqKBMKfYYCDQxtTULUcB2zTaeu1gqaK1LB FWtpEERhoukUmFBZS0yrck9reDiLL3vBgGuo6rbSsbO+pi3m4LS7xL61J4Du+71yuJVt zezHQ2NIuSS2a3iNEiOXSlcqv+9m0laMPGyVraui7LlbGrBHrkPIgsKtz5+94vbiAVRW v33pkFWqvosbcRNDzWspEO7k+EGuuFEvL40SC8RruezJRrXwMQ2FBAbqnmy+UrWjMTh3 uPlZUiWMFVU3YInuSiyia9bcuQPFWOk53GCJC7aLZKxXXKmnis0oj3cH3QoiNBHJV4tZ WQqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=WrqEw/kh06rUcYlXeZlC7gMu2XY6dy0Gg8ARfs+ZAOQ=; b=jFE1FN0XT+hj8p1CLLr2iTN2YQ4aGTZJF8vwwjVNba6N6mkOP9o7rhWWtEirBQ4V3H qTEnwgZU9c40SqonVvPtm2fu3ACTi+dchgtkIaXJV+HaP+y+6XGvC4QEFWoTfF+oAGys /aAoRz/s/umh4KP4jMqq0sVLOEThE6OeArhH3QvRS2pwvtliMy3iwMdkJqHRDhbnO3gj clai5+Qbhu42hPovebb6ciP8s9At56cT+3hqc5pliO5OLLsYN7E5iiiXcYJGM2MMUuDd kukraNktpX86Spblxj6z6h2zickXS4VmdIajgzx1ZYNa03EbjZHxyN6s45Zz8FZ4d1tF KlwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=D9E3AJHJ; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id k38si2674982pgm.500.2019.06.14.06.48.14 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:48:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=D9E3AJHJ; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=WrqEw/kh06rUcYlXeZlC7gMu2XY6dy0Gg8ARfs+ZAOQ=; b=D9E3AJHJkUDDZwGDrICOo8xwSr Vfy2Y+1OPPXLUbN3S6PHwsqy/cmVJE6bpXLngdX6RBjQJ/8loJlNzq/VgpjqMsVb1OYqTqcJSfd/w ZTqwdyKvGBMYP+UdZr0PKY3UL+ICZo9n3syFkXle/QjrUYo22kN1OHsSkJTQETCKs6U3FbdS8UCIf 15Qj3v6xgo6FD+k3Nt1TmpLZAWT2c/I9/ZkVi1twL1+1sce+5xjQNfVhNk5NtWjFrcrhDuua7gZwL 8uwyLJmwGpEV23Kpn/3zN/KpBzDqAa5QVnZBlqDFG7exUujjmNHagTqiWfvxlzNuK2Z5Pu6tCggvd mp08sq1Q==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmYg-0005D2-H3; Fri, 14 Jun 2019 13:47:59 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/16] IB/qib: stop passing bogus gfp flags arguments to dma_alloc_coherent Date: Fri, 14 Jun 2019 15:47:18 +0200 Message-Id: <20190614134726.3827-9-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP dma_alloc_coherent is not just the page allocator. The only valid arguments to pass are either GFP_ATOMIC or GFP_ATOMIC with possible modifiers of __GFP_NORETRY or __GFP_NOWARN. Signed-off-by: Christoph Hellwig --- drivers/infiniband/hw/qib/qib_iba6120.c | 2 +- drivers/infiniband/hw/qib/qib_init.c | 20 +++----------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c index 531d8a1db2c3..d8a0b8993d22 100644 --- a/drivers/infiniband/hw/qib/qib_iba6120.c +++ b/drivers/infiniband/hw/qib/qib_iba6120.c @@ -2076,7 +2076,7 @@ static void alloc_dummy_hdrq(struct qib_devdata *dd) dd->cspec->dummy_hdrq = dma_alloc_coherent(&dd->pcidev->dev, dd->rcd[0]->rcvhdrq_size, &dd->cspec->dummy_hdrq_phys, - GFP_ATOMIC | __GFP_COMP); + GFP_ATOMIC); if (!dd->cspec->dummy_hdrq) { qib_devinfo(dd->pcidev, "Couldn't allocate dummy hdrq\n"); /* fallback to just 0'ing */ diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c index d4fd8a6cff7b..072885a6684d 100644 --- a/drivers/infiniband/hw/qib/qib_init.c +++ b/drivers/infiniband/hw/qib/qib_init.c @@ -1547,18 +1547,13 @@ int qib_create_rcvhdrq(struct qib_devdata *dd, struct qib_ctxtdata *rcd) if (!rcd->rcvhdrq) { dma_addr_t phys_hdrqtail; - gfp_t gfp_flags; - amt = ALIGN(dd->rcvhdrcnt * dd->rcvhdrentsize * sizeof(u32), PAGE_SIZE); - gfp_flags = (rcd->ctxt >= dd->first_user_ctxt) ? - GFP_USER : GFP_KERNEL; old_node_id = dev_to_node(&dd->pcidev->dev); set_dev_node(&dd->pcidev->dev, rcd->node_id); rcd->rcvhdrq = dma_alloc_coherent( - &dd->pcidev->dev, amt, &rcd->rcvhdrq_phys, - gfp_flags | __GFP_COMP); + &dd->pcidev->dev, amt, &rcd->rcvhdrq_phys, GFP_KERNEL); set_dev_node(&dd->pcidev->dev, old_node_id); if (!rcd->rcvhdrq) { @@ -1578,7 +1573,7 @@ int qib_create_rcvhdrq(struct qib_devdata *dd, struct qib_ctxtdata *rcd) set_dev_node(&dd->pcidev->dev, rcd->node_id); rcd->rcvhdrtail_kvaddr = dma_alloc_coherent( &dd->pcidev->dev, PAGE_SIZE, &phys_hdrqtail, - gfp_flags); + GFP_KERNEL); set_dev_node(&dd->pcidev->dev, old_node_id); if (!rcd->rcvhdrtail_kvaddr) goto bail_free; @@ -1622,17 +1617,8 @@ int qib_setup_eagerbufs(struct qib_ctxtdata *rcd) struct qib_devdata *dd = rcd->dd; unsigned e, egrcnt, egrperchunk, chunk, egrsize, egroff; size_t size; - gfp_t gfp_flags; int old_node_id; - /* - * GFP_USER, but without GFP_FS, so buffer cache can be - * coalesced (we hope); otherwise, even at order 4, - * heavy filesystem activity makes these fail, and we can - * use compound pages. - */ - gfp_flags = __GFP_RECLAIM | __GFP_IO | __GFP_COMP; - egrcnt = rcd->rcvegrcnt; egroff = rcd->rcvegr_tid_base; egrsize = dd->rcvegrbufsize; @@ -1664,7 +1650,7 @@ int qib_setup_eagerbufs(struct qib_ctxtdata *rcd) rcd->rcvegrbuf[e] = dma_alloc_coherent(&dd->pcidev->dev, size, &rcd->rcvegrbuf_phys[e], - gfp_flags); + GFP_KERNEL); set_dev_node(&dd->pcidev->dev, old_node_id); if (!rcd->rcvegrbuf[e]) goto bail_rcvegrbuf_phys; From patchwork Fri Jun 14 13:47:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C09B41395 for ; Fri, 14 Jun 2019 13:48:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0057205FD for ; Fri, 14 Jun 2019 13:48:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A41D728420; Fri, 14 Jun 2019 13:48:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20734205FD for ; Fri, 14 Jun 2019 13:48:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC4126B026C; Fri, 14 Jun 2019 09:48:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A27706B026D; Fri, 14 Jun 2019 09:48:16 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 853456B026F; Fri, 14 Jun 2019 09:48:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by kanga.kvack.org (Postfix) with ESMTP id 3EA886B026C for ; Fri, 14 Jun 2019 09:48:16 -0400 (EDT) Received: by mail-pl1-f198.google.com with SMTP id i3so1630600plb.8 for ; Fri, 14 Jun 2019 06:48:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=7ZdZ3kFG7vLtpGzKUifkfy5au7mGeecDZr7pOAa/mbQ=; b=Q/XIkBH3y0qt6znmIewr5agPaxCaZVKB/q1tWrc5odOFcoOBuh3jAgG807m/iMerKN PjCky5dN1IThBtWJNNdatrLV5z8wlyx5Zs1KTQt6f/KgS6lsn9yW8e2U+cmZ8W9LM/jm wwPxSaF5BDzsJ1wquOaKEbdtlLt6LM9aZY6brgNBt3b106uYjmbHhIWB8HQtfRUQIyUZ RRAG43K62d7VkWretN1L+YmcqQ10Rhv+6QnEilLY9ur1B7xI8N+eqb/coZtFTLciaogW 4jvRvCSbROEAnK4U0ljSHjbRM4R4jTeJnhvMnF8sczs9a06ezpRObyZYvScENVXzI4Qo z4VA== X-Gm-Message-State: APjAAAVlprFG3n5uKr0qNuTGD3WAYSdrjJ0uVbgquHA59smf9obuTV3x dKNTSOuQxunRZ+S6Lylkrovh10+WNAGHOEYRt6pa1O/HcTIwOXvdqoNHmMi8g6NXaAA1SKVUD39 xdF7ov6TBf4e/6YQyIquH5rg131O9SyisQcl/fFEt8cziM1DywCc8q2M/dtlNckE= X-Received: by 2002:a63:4d05:: with SMTP id a5mr33576453pgb.19.1560520095824; Fri, 14 Jun 2019 06:48:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyClw/58KQwRxGlmk6aN+ujplATb86gi20dxu0sU8pVd3pNk1oTrNF/8tIaGVeL+Y4GPws3 X-Received: by 2002:a63:4d05:: with SMTP id a5mr33576411pgb.19.1560520095120; Fri, 14 Jun 2019 06:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520095; cv=none; d=google.com; s=arc-20160816; b=jhGwebIaNYztrJnBbZdTq5ucs+kjSs76B14i8v/sl78uOVLAEfcgWlcFpNHiwka7p7 /MzWzv7Ps/elZ56BxBbZTo0HE2+imAGmYf4uCU6QLLaLKbby3+wPU6HJ9WTPqBDPgrCE 1/taCRkvXdHxdbqOUm755P91caTg/f8QqAp3W/W6Nd6VUoCDLOncfPNZ0cHj8rde6nG7 iUQf4DxttVOYNTaQOOZhVuTWT//UZp+IPb7THxAqgIJ4DT+rwKxkRk4Q9w/tLJ6Sys2i mW+1C2t4mVNOSmr71q3clZDAzaDNe+D/H7yJ70oNYlKRVupC95XKZpX6PLHcmBw9j3rr jOyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=7ZdZ3kFG7vLtpGzKUifkfy5au7mGeecDZr7pOAa/mbQ=; b=f35o0HW9OjYYp+soEuv8lb4Ws6clMfjksfKaXvpLyTVTI8MnkgA50R0MqGg81k8zlD pV6oOyAFVMM+pKnzVe2x5LxkWJCaf7LIhFdZSUQ33KqOlW2UlUek4cYGl59wG82xn63M wPe7FFpoIQ1Ia/Vdtx1UyVlgPAbc1/hpkxdTGy2+3Tp0qm8BVQCwiGmBHNtTnMGnS/zL zEsgoK9fr/2PVIHVWQachqNIQw0Ui/LkBHIqPpwhPftJpBCKtt8jmBhPn9f16fSJcsSc lhRPdn61x9ERLEszBGLq3tUbt2H6KhEN4ZNcrSlRGi1QwvdmHXYL+gGPWSCYnid302qj JtAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=fFAKLKpe; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id f1si2474991pld.78.2019.06.14.06.48.15 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:48:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=fFAKLKpe; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=7ZdZ3kFG7vLtpGzKUifkfy5au7mGeecDZr7pOAa/mbQ=; b=fFAKLKpeX1UXm3FTcf0KpVo86s TAVWErFRg7UqZpj/joIjhsfplRvSdKGAbFeP6PmZqe8B9ErySOXGc93t2ofqJ0PfW5tVLu+2bO7c7 tlkcsmUTpcJGdiZudPM+9H/J7qA++YYntqBAP5nQMfi/0VmsaFYiz8iIh+FqmdmOSIDCUkX2AxyUg 4+iPQe6FbA5imHkaPuPHdlmpbWkOZY2IPMBFcFQu5749gI0wQ18r1UkUghz38MdwIvcYqglGbv42Q OE9k8pQvOkUoTghcB7fXqj/U8J8TtUon4YKIlHWSSpbaJgmCuw3j4dq3Y7DAL3QyTY+SLK4x/iHsn p71d6N7w==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmYk-0005GV-78; Fri, 14 Jun 2019 13:48:02 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/16] cnic: stop passing bogus gfp flags arguments to dma_alloc_coherent Date: Fri, 14 Jun 2019 15:47:19 +0200 Message-Id: <20190614134726.3827-10-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP dma_alloc_coherent is not just the page allocator. The only valid arguments to pass are either GFP_ATOMIC or GFP_ATOMIC with possible modifiers of __GFP_NORETRY or __GFP_NOWARN. Signed-off-by: Christoph Hellwig --- drivers/net/ethernet/broadcom/cnic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index 57dc3cbff36e..bd1c993680e5 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c @@ -1028,7 +1028,7 @@ static int __cnic_alloc_uio_rings(struct cnic_uio_dev *udev, int pages) udev->l2_ring_size = pages * CNIC_PAGE_SIZE; udev->l2_ring = dma_alloc_coherent(&udev->pdev->dev, udev->l2_ring_size, &udev->l2_ring_map, - GFP_KERNEL | __GFP_COMP); + GFP_KERNEL); if (!udev->l2_ring) return -ENOMEM; @@ -1036,7 +1036,7 @@ static int __cnic_alloc_uio_rings(struct cnic_uio_dev *udev, int pages) udev->l2_buf_size = CNIC_PAGE_ALIGN(udev->l2_buf_size); udev->l2_buf = dma_alloc_coherent(&udev->pdev->dev, udev->l2_buf_size, &udev->l2_buf_map, - GFP_KERNEL | __GFP_COMP); + GFP_KERNEL); if (!udev->l2_buf) { __cnic_free_uio_rings(udev); return -ENOMEM; From patchwork Fri Jun 14 13:47:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 63BC576 for ; Fri, 14 Jun 2019 13:48:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 557B0205FD for ; Fri, 14 Jun 2019 13:48:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 488E028420; Fri, 14 Jun 2019 13:48:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4DC128390 for ; Fri, 14 Jun 2019 13:48:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4D3B66B026D; Fri, 14 Jun 2019 09:48:24 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 438346B026F; Fri, 14 Jun 2019 09:48:24 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 239686B0270; Fri, 14 Jun 2019 09:48:24 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by kanga.kvack.org (Postfix) with ESMTP id D74E96B026D for ; Fri, 14 Jun 2019 09:48:23 -0400 (EDT) Received: by mail-pg1-f199.google.com with SMTP id x3so1920241pgp.8 for ; Fri, 14 Jun 2019 06:48:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=OBOS8iCVbCKavrjNtD9grYbIza6qqnOVd5RpWueyj/M=; b=FFifYwuSjN3r5gS6RJZ+9clUtQmgycIEFvpt9oAoXdulGvuz3fwKOmr343VCQngAGa 3jhIp23eCSVv6RoA856IlrZnGNEU/Y8uqHFKWassrag6VveQJtze/DFitbDXul4OhnrQ iFUxcKGZ1gVW+vffiILm5zoq9BPDe0qHXyzJ35B47uqel7n47/bBJZc8k/mIT5J3zGeU pFcwdMlC91/Egj7MTpTqrr9xEyrGCEM/+h23IfP/lcLhLFCyhhGL7M8Bh57Wzy3iRCOR IM3eh+JtPvldrjX4KLtBOfxUCu9NPiYu1BX3ZeGvV6vyrxxyloGGukatcr5goI9nTR/S KRpQ== X-Gm-Message-State: APjAAAU6sEKz5OmEZKoUI+u6T4s31fcmkSIpsf5abtAaBdn4+hH6jiiL zcr3hzw1fsghrTKwW2fwYoGCo5V6XESEYPT0u656u/ubQuiUJREz5fKm8GI+SKFhHBdwpBR9iWk Ss27mNroxwGFG9jdyjYbGSinV7EPu5hBiNSkLThUcg9EGZo5gLESAeiZfWXjZVgs= X-Received: by 2002:a63:5d54:: with SMTP id o20mr34293422pgm.97.1560520103484; Fri, 14 Jun 2019 06:48:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzE0CKZ2N1CDPAoGvYVEm8UPP0TLsBam6nVX6QerMQfn7JR048x4KyPN5xC/UTtXMZ9PvfG X-Received: by 2002:a63:5d54:: with SMTP id o20mr34293366pgm.97.1560520102683; Fri, 14 Jun 2019 06:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520102; cv=none; d=google.com; s=arc-20160816; b=yDPLcDlxqkL4ZhKaLUR797q7YNdL6Ucip1aCZcqpSF3gFf402gB7J9CG6IeZIe9YCI 3UmCWhH8FT00cKiBMHL+ewJYnqj+XQJdgKYzf2BNgIszsC3h5p+0G0tQlsaNzEDue1Tj tgxvyqtaa3uhUP5VS4P2w3seU8cUXUEtPFXjmK2X0I/MlL9jwq2nWDu8Hd3uW62Bd0Vo B0zt9P2QfHcnNaUF/qbM0ITlgw+pC4d3o46eRYHG/1SVa8mkdrQ2aUF8POrb3ZqN/7N9 YPhGWfKxncgH9EjG7lqEgCv+CypcLoEDtcXcEYuxgrj41GXtdPOIIAHaMq/jKflbjAtN hcTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=OBOS8iCVbCKavrjNtD9grYbIza6qqnOVd5RpWueyj/M=; b=bHXMTyu/trV91uZ6lDSp7wN/h8yBtfjUPOvLEteuWQwwruu9Ycb/jT11ilC4OC2Twu VLGnvtAitV/HPgqUCZY2y8BV/34hn/skPpSg4Va5NBb/3jScAoJlhcQj+53JdU7wWtSu HSzt04np9QOFVkEX+HP4ygKy4ejUck7MUj6hx8vB/Fnft4NPdjBATqNHUuJcWi01t2mf Vw7PCRPJnC1FxKLnbDMziYSAibjty+I4LGdk0iZlSXZjfXtBF6ibivXbsWvNnPomBOiS mt/taWI67wm64REC5OJ6wxsWTsRER1H8dDHFuVqTbhGvhCjwJEqzK0PH07Mr3E+JCMIR llcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=ty9usQOn; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id m11si2408819pjl.64.2019.06.14.06.48.22 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:48:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=ty9usQOn; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=OBOS8iCVbCKavrjNtD9grYbIza6qqnOVd5RpWueyj/M=; b=ty9usQOn48ryjo/yA+LI46GxnP KU+hV8DMp9K1AiYIp8CEWPCsYTVt0fa2fCx5FsgZtmFG+oZvda4iGOisvCu0KEUqYodtwwPbJHVPw Db2/6G2kesXnDnAn6z45JeeW3RlmDj87Wy6HfqWc00nj35RFlVFkRRZqPO0HsFrH99HI5YZOdnRTJ tHa9SDSKcyyo8FiIMQIwPBhvOKYxNIVJw/YdoAgm7jutOjnHItVUz1dXoVckleKMabuzqyEvJHykt ISIIujsBNMPIb0GXNcbQX1pr9F5xfFC5uZwG+WNcNlp5UaVPCWtpvsAYlg/ngmgqOUWtijss40PJa oxHQO6Tw==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmYn-0005Ie-J2; Fri, 14 Jun 2019 13:48:06 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/16] iwlwifi: stop passing bogus gfp flags arguments to dma_alloc_coherent Date: Fri, 14 Jun 2019 15:47:20 +0200 Message-Id: <20190614134726.3827-11-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP dma_alloc_coherent is not just the page allocator. The only valid arguments to pass are either GFP_ATOMIC or GFP_ATOMIC with possible modifiers of __GFP_NORETRY or __GFP_NOWARN. Signed-off-by: Christoph Hellwig --- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 3 +-- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c index 5f52e40a2903..323dc5d5ee88 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c @@ -2361,8 +2361,7 @@ iwl_fw_dbg_buffer_allocation(struct iwl_fw_runtime *fwrt, u32 size) virtual_addr = dma_alloc_coherent(fwrt->trans->dev, size, &phys_addr, - GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO | - __GFP_COMP); + GFP_KERNEL | __GFP_NOWARN); /* TODO: alloc fragments if needed */ if (!virtual_addr) diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c index 803fcbac4152..22a47f928dc8 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c @@ -210,8 +210,7 @@ static void iwl_pcie_alloc_fw_monitor_block(struct iwl_trans *trans, for (power = max_power; power >= min_power; power--) { size = BIT(power); cpu_addr = dma_alloc_coherent(trans->dev, size, &phys, - GFP_KERNEL | __GFP_NOWARN | - __GFP_ZERO | __GFP_COMP); + GFP_KERNEL | __GFP_NOWARN); if (!cpu_addr) continue; From patchwork Fri Jun 14 13:47:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3670213AD for ; Fri, 14 Jun 2019 13:48:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 265E6205FD for ; Fri, 14 Jun 2019 13:48:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A1A028390; Fri, 14 Jun 2019 13:48:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90816284CE for ; Fri, 14 Jun 2019 13:48:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 40C6C6B026F; Fri, 14 Jun 2019 09:48:35 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 395FC6B0270; Fri, 14 Jun 2019 09:48:35 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 25E496B0271; Fri, 14 Jun 2019 09:48:35 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by kanga.kvack.org (Postfix) with ESMTP id E16896B026F for ; Fri, 14 Jun 2019 09:48:34 -0400 (EDT) Received: by mail-pl1-f198.google.com with SMTP id d2so1620240pla.18 for ; Fri, 14 Jun 2019 06:48:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=yT59YDuDyJ+PxdfRPqwI/alSJ84EPbJSnwgnpwBRCag=; b=fdkyues9F3cYPv86PnxgeIxTvw+izJ/0FlaA2X6OCoHi4D3rU8HgWFMBGPNPdpYTWz jD5p2DQWZQTsIccV+gXMPWOikE9CJYOaUdwK2NSu/aYY4n/klYSDadxpODT0gcSkr7ik vI+tBYRxcxIt3AfTt0+vFlTeReSLRM1SBqiElhME7Bm0+abnZlJkK0sQzQhjlJ8iZi/U NStGICHSfEsVrIetUJckYRX2j253cYGtsWAzJpPjub4200yad5bZMZ7638e8i0JmzIXL pt7ea0fY+sBTigXsThnpIWkPhJknSY7rL4hb1amJkOBB44zAhmFG4RlRYM9k8hilglR0 U1XQ== X-Gm-Message-State: APjAAAXH+nRMkuxT+zwvqPX8iW55hikMftPCogUKLGHvJaxTXmJ7rHRE 8SEFs4y3LxAzWK0UPdSPADufJNX8B9j1Oc0/t62JKu3RXiYd/iU0q4/U0v28naonu4DdE/DVpwW 6ZtIpvv1LoQkkmmiMC2s9+3w2X3Bw7DuAxbKUlCIZdaI06il+Azy+TQQkMi34Ptg= X-Received: by 2002:a63:1f04:: with SMTP id f4mr37034316pgf.423.1560520114537; Fri, 14 Jun 2019 06:48:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzsl21jLFRWJFTsw2CcVniZ8CQh/VkP3fjkdrFqEyIOot8u4T9UKVIAtzkYJQf/BFeDFGo4 X-Received: by 2002:a63:1f04:: with SMTP id f4mr37034259pgf.423.1560520113844; Fri, 14 Jun 2019 06:48:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520113; cv=none; d=google.com; s=arc-20160816; b=ZqGC2bCVnNuSUg75vPpb7wMH1MDPiDdTNyfrnXW01jq0m7+iZQXJWaU601iJoliF6O T2UhdwMrUi4J+mS2Uf6AMSgTFoijI0ajqOfl0E/IZ5spCngk7DCPT9HkcsVvVnC0IasD B2vsTnFQHkNjkjkZc/A000v4JTBeQ0VbfCuyO1z+mqVX7CcpIRfswt4RBIvvpXVdQ9Cf zC9+OzAMdKucxZNxdkui1CK3NQWikSJDDlNuDHZjtEyP34x/IFIMdqiF/kTEjV2GF4bu 2C/ShYT6woFOF/h37o+tSy7B7lFerMkXKxUdLVDeNQpaHlYoWcTYbF1tCOk69JeuqlG1 Wn0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=yT59YDuDyJ+PxdfRPqwI/alSJ84EPbJSnwgnpwBRCag=; b=rOahPpyikxjW8bW/JpicQUUT+4g/AHHbHeK2VJLCLEwSfVWJlz6t02r8gXZgF0/Zvi 5YuVJTup+stRyl7nnw6Dv7mYUt+0cES0KDETe74fYxrjT1abuDYNuYGv4zkrsaeZyrHb Zb63eqVYcpaGQ/vBBshdllsSF9rZGZF9dQ/iZsyKYvZuM3Uxqa0niT70AiPGtRWjuf7f 0MXrZc4b6Hra6p2aomfx6lgVNMeug3f5Qb++QeoiKhlWuq8SAVc4HDB97UI6ajzc1Gap Zh4sUMXXUgLMS8pFsHiqF+yBu7X1hK2ebUjCXSEPX6itCc+lIL9VYmONUpZbknEUJ1hS GK/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=owRHpuK6; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id x9si2281903plo.228.2019.06.14.06.48.33 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:48:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=owRHpuK6; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=yT59YDuDyJ+PxdfRPqwI/alSJ84EPbJSnwgnpwBRCag=; b=owRHpuK6KPpEPbej7i1YhZs6AX wN7yNoV43C+ez1kJ8mjyYksBoNb/QnO43qmDtaoXcejQN8JVymeq+ihqkSdORxH9DTolc8g44wL/n 4LSqiLNL1pznmOxp4ws/5vWu11eRtAmNuWXern/02xHfx/UTArA2cLwNsqFsJR3FHm32czvwMjXp2 7sGt2jHFZhtBCFB/p80y7vCA6bbzdpMVufvVVb+aSI6J4MNffPlYXrnmf1qIq+XF2XIQg2V9t5O5b b1wpDdk22coEH5ua9xigsjiut+9bxXp+UfE0duTuPjXZxk7HNsybWuKX1NvzSJkdd8inzEtTrVrtu gzlO+vIg==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmYq-0005Ma-VZ; Fri, 14 Jun 2019 13:48:09 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/16] s390/ism: stop passing bogus gfp flags arguments to dma_alloc_coherent Date: Fri, 14 Jun 2019 15:47:21 +0200 Message-Id: <20190614134726.3827-12-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP dma_alloc_coherent is not just the page allocator. The only valid arguments to pass are either GFP_ATOMIC or GFP_ATOMIC with possible modifiers of __GFP_NORETRY or __GFP_NOWARN. Signed-off-by: Christoph Hellwig --- drivers/s390/net/ism_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c index 4fc2056bd227..4ff5506fa4c6 100644 --- a/drivers/s390/net/ism_drv.c +++ b/drivers/s390/net/ism_drv.c @@ -241,7 +241,8 @@ static int ism_alloc_dmb(struct ism_dev *ism, struct smcd_dmb *dmb) dmb->cpu_addr = dma_alloc_coherent(&ism->pdev->dev, dmb->dmb_len, &dmb->dma_addr, - GFP_KERNEL | __GFP_NOWARN | __GFP_NOMEMALLOC | __GFP_COMP | __GFP_NORETRY); + GFP_KERNEL | __GFP_NOWARN | + __GFP_NORETRY); if (!dmb->cpu_addr) clear_bit(dmb->sba_idx, ism->sba_bitmap); From patchwork Fri Jun 14 13:47:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B3CFA13AD for ; Fri, 14 Jun 2019 13:48:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A54BD205FD for ; Fri, 14 Jun 2019 13:48:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9924428420; Fri, 14 Jun 2019 13:48:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40F4F205FD for ; Fri, 14 Jun 2019 13:48:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 59FB46B0271; Fri, 14 Jun 2019 09:48:38 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4F6626B0272; Fri, 14 Jun 2019 09:48:38 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 349A76B0274; Fri, 14 Jun 2019 09:48:38 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by kanga.kvack.org (Postfix) with ESMTP id E9F646B0271 for ; Fri, 14 Jun 2019 09:48:37 -0400 (EDT) Received: by mail-pg1-f199.google.com with SMTP id x3so1920601pgp.8 for ; Fri, 14 Jun 2019 06:48:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=uJddLBdDNaWL4wSSvZ2YhjeFWIY1bS4Okt/V8tHSUJw=; b=Kl4rRludQGjPauPhvZ9Mnx52sdF1zzGdpuXgyxHXSKbBLXna6pF89N/MPvKDbRAaRN MsMktq7QtUF71djdcZqfrL76B761fSKAlUeSmIWcXYvcZsoMXkTTj8foY5IgSuco4f3y fNlIjuAzjncKSSR+/D3nH/eEQzoNUkoYC6Js7sdfxeOhB2n/FWjwUdPADbmXQbQkjVEc S6OAZPUXzC/G2AYgVKPHWrdIEcJx4QdvIDwXuU2448f/xsUwW2ITzUocLXeZrMI8PH9O PsXh4izQolZE30gRoDBvXBpSAEBO5MCUXlvQOv/opOFDNwJpRGQzGJbVHyAv6WiJ+3xI VU9Q== X-Gm-Message-State: APjAAAWEFRBTuZsUOM5kQ1eaylgX0NnipMi67neyAO2gi8D4qSzN97Vq 0XfNoL+fTwyz7D0vlJoMCy4l+VWnAjCVCHADw3Fpj5tlqhKxGmpZpXFk8zXAshFIL73rQkoJw/m S5QQU3b85Yv26QDF1zGYBGxVYRNAk7jcd/T7l72ZMXus0jI9Te8IvlDh/BiuxsnQ= X-Received: by 2002:a65:638a:: with SMTP id h10mr5336636pgv.64.1560520117427; Fri, 14 Jun 2019 06:48:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4eHa8Nabo4iIhodtfZa29niGBId3BqRyDEPNENH8gfxH2yNRUb8wcO4wtuimnxiTnfvRY X-Received: by 2002:a65:638a:: with SMTP id h10mr5336578pgv.64.1560520116700; Fri, 14 Jun 2019 06:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520116; cv=none; d=google.com; s=arc-20160816; b=asdK8jAYLBxHpawnZljEmfar37K4eNPzGB0LNwNP0pJMoH/Fuo17ajdFH3ZjFmX87N j54tH3oIafJK1+UYO145mJkJWcCb6uZh0YA8OxuEBn9D8UALKPTg2cRHPVeOb4YvVHtM S1sTA9pEHAaxL8kN3ffjxPN3TcUfxcqVAZVLfr+nlAPP7OfmELpxiWsxwT0p7XMdi5OD 6YmxzPi4OISPkr2Qq5hB2HNAgHJensLmAR6d7mnbyinbKKlK2aPGXjPQwdx31ZJKlD1J F01O1udBSyveAe2Jw6YDCCc5QQRG5gGNvkaGABlh8rBNCts1r4VBo3+Au2mZFMTvV0Ro GuGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=uJddLBdDNaWL4wSSvZ2YhjeFWIY1bS4Okt/V8tHSUJw=; b=pEie0tuzGG1Z3UHCXrLipr+Fm/ICRKLlYl0+BsNg6u7w8A7cozHTrPJs42qdGg+UCg vVywJSZAmIlvv6tW+BZM38BUm30iD+I+P3ZxBcbEv6nlpZHlNIxzMCPnOjEFWmOE7Hdk OHjJTMDt2TEvWQzqRItgpM10jxPhHp1NHk7LQDcvZ5jHgZnoLzMzN+tpftRPMpQSX/gr XkdUCxlbhsO0tpOxaVuRb2b0tnXvbC/7Y6OLb94mbDeatLQzRXB4oSCkeGq9xghVnook 5TUT3zeiejcDBAjMy3S+3D1F9XtaW6HfRDblt5MYK41qhYsGB84ej/97sSkXcyQZ+8mZ nBuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=Tpc9x4lP; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id k7si2273375pll.145.2019.06.14.06.48.36 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:48:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=Tpc9x4lP; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=uJddLBdDNaWL4wSSvZ2YhjeFWIY1bS4Okt/V8tHSUJw=; b=Tpc9x4lPYqhK3XjIXO4GqJY9rv 9rJeQeQNbim7ZbrvzWwlYZe6uviPZA8B8PnxWsyT6JGwXhhBWJVdSZXfCFQexWetdjj9pyjlFh9xF NNuQWOD5YMIca+yt05/XIg8Wkq6pGz0Z85GD2RuHezWtfbKqQOoREoRWCESCbTHgW7AMp5BbVshrc pEh3xewVIl6LVjW2c5Fh7o0QsoPF6TFPCQBrS9GLC8RQ30e45tR99TsjbM05NZ0+J3y0gAw3KzjRt lGDsivXtuD6ZbALT0tjqUJ7bWzADYRpbOi1VBP2HP7AECc7ayAViL+6MV1bLNQPDXazLoyPeSUXcq WTLTT30Q==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmYv-0005Sj-P5; Fri, 14 Jun 2019 13:48:14 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/16] staging/comedi: mark as broken Date: Fri, 14 Jun 2019 15:47:22 +0200 Message-Id: <20190614134726.3827-13-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP comedi_buf.c abuse the DMA API in gravely broken ways, as it assumes it can call virt_to_page on the result, and the just remap it as uncached using vmap. Disable the driver until this API abuse has been fixed. Signed-off-by: Christoph Hellwig --- drivers/staging/comedi/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 049b659fa6ad..e7c021d76cfa 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 config COMEDI tristate "Data acquisition support (comedi)" + depends on BROKEN help Enable support for a wide range of data acquisition devices for Linux. From patchwork Fri Jun 14 13:47:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995457 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4237B18E8 for ; Fri, 14 Jun 2019 13:48:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32983205FD for ; Fri, 14 Jun 2019 13:48:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25F7E28420; Fri, 14 Jun 2019 13:48:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3EF5205FD for ; Fri, 14 Jun 2019 13:48:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 86D446B0272; Fri, 14 Jun 2019 09:48:38 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5E1F96B0275; Fri, 14 Jun 2019 09:48:38 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E6236B0273; Fri, 14 Jun 2019 09:48:38 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id EE3CE6B0272 for ; Fri, 14 Jun 2019 09:48:37 -0400 (EDT) Received: by mail-pg1-f197.google.com with SMTP id j26so1925776pgj.6 for ; Fri, 14 Jun 2019 06:48:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=hVPCPj1LrefwU2xq/k4nx8MUt6z5g1ttpdf31GA4t7s=; b=dCzxG3DlILn4AXQSLrZDTc8T6+k/VmuqLFbXJT4Zkzpss1/Q469ac2qgFOI+YWG4Sn SYmwnRv/ZHgYlxZlEhf2xgWY996JC0ip4hjlov/JmS4K5fwto2So14cohHQ4QZGlm+uM fjQ5iyku1V6xF/6hqDJ4HJjmOVBQQtIDSMwcEvXGYvPqxie98OAUmPImv9tKawY2MBVl 981zAc0hRVZk8B0QVxNWd67yjavfiRJwFjuap06cggLriI0Dv+HYcOp1o9ud7I2erNFe er9uPRgtLdnCmglw0ezK2qt+PwjnMOJVfhUltB+Qxf69u0QBEW6hXJ1zG/kF0fMLyBTw MP/w== X-Gm-Message-State: APjAAAXx9q0OljAmYKSZbKrE6iZ8gUSm+ImWPbzPsieWd+smPel15YkR yE9uyvg52i61vrsJ4xuhU1QRCuZ63knrFG8zC+ot/x0BxKhb0S7RpsaJZze8C64WDrz/JXrcocL nHBNXaurp5Vf7WLKRRFHm7g2XMoGw+All3kys9TcU2T1BDBwA27zyzfNTgcipKs4= X-Received: by 2002:a17:902:da4:: with SMTP id 33mr33489406plv.209.1560520117629; Fri, 14 Jun 2019 06:48:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzaybw6StxARE9dSOJjQ40gVnWqCsjtYFfFwNtTq6mrY3GUpD6m5DHzHW/5Eok7Y0J17jOy X-Received: by 2002:a17:902:da4:: with SMTP id 33mr33489362plv.209.1560520116872; Fri, 14 Jun 2019 06:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520116; cv=none; d=google.com; s=arc-20160816; b=t2iIjKhg+gKNISdOaZWvdmm1z4Rs15uM0qRPXIE5+EWV+aBEmme9f11o3XTYCNOZnr MpZjrlodeYCfZHsTbgUa4IFcJ0tO/lK5g6oDd+syESNk8ZRqVsuGp+sjXOya3st+j+Ua hivkpaVu8gl7+fOkysvL6HPT+BCJuLGDCmizsTLB06bq5e5fW7wpTLPjPLrkAswbsW64 3R/J8IAOm9moFrucrwx87/PXbJmEQ/HcR2g3WN0pKSvIZwOvQe9oRxPollOp7cFK1M1a B5xPodlhp8A1BO2f7pk8Y+Izg7fwWw9hjvCFY/XPmolB/mBu8uOA9B7Fu7eWQt7h6k8U Odiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=hVPCPj1LrefwU2xq/k4nx8MUt6z5g1ttpdf31GA4t7s=; b=saBQ24gU2GD5RHaYmv/xHPxR1KB3g7G1/A7KsHKJSehFUFbpBVFU/p8KgjGsWrQ+KU kJ8mAnvpPd5oaXqGBEgmSK2jNAjDdttgnUaPSWrXEUbPxBmbzFj5Bl4rwg7o9i+U/Pvn Eiz8zbvcOQIjdUUGo/NV5O2kbjrgM+kIviJZhNA8MDOnO2Xkp9B40xSoMKbCby/EYHqz GpM0ywsMJ5ZlYlel3cj1i/cOXahDR1hZuEu8h1Pe/AIdkGUNwxPgLf39fFnJuc7dmWUJ hA42GoC/XVw5UdbIp90MnNF1kLkwQBiGcoy2t7JSb9UoTWCQJBXdeBNARDsWfeZipC6x T0+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=R7oVdWdv; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id d191si2589451pgc.460.2019.06.14.06.48.36 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:48:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=R7oVdWdv; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=hVPCPj1LrefwU2xq/k4nx8MUt6z5g1ttpdf31GA4t7s=; b=R7oVdWdv/mZN0cFwPPhtVK4TMx UB/wqQzgkHyYoVXTIUGR/8fAw8BWFMkxfhjvQA8cZVsEfByOCf1n/fgHZGG1Ku2HbnOU7wlpCu6md kV7iFak0CwzMgcwf+1ko540TzfJZ7m8NhyKeNAafjIR+Eh02tznZJ/tUqmN1GKHmPpnm8D9T4ipEj VhsgOFo98A7OHLvTQLaE2S3jC8uxQMExeLN7wqYne/Oa8lDjeUuhj+sBM6/IpP/HI6hcndIgYuq/y Z6v4feaEGjGdbjf71aj7myD5cdjMs8C9wTELFpbzveIUWDepgbQiHeWiGh6p6pC5gwcbLSKzfWexb co9by/hQ==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmYz-0005e1-FO; Fri, 14 Jun 2019 13:48:18 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/16] mm: rename alloc_pages_exact_nid to alloc_pages_exact_node Date: Fri, 14 Jun 2019 15:47:23 +0200 Message-Id: <20190614134726.3827-14-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP This fits in with the naming scheme used by alloc_pages_node. Signed-off-by: Christoph Hellwig --- include/linux/gfp.h | 2 +- mm/page_alloc.c | 4 ++-- mm/page_ext.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index fb07b503dc45..4274ea6bc72b 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -532,7 +532,7 @@ extern unsigned long get_zeroed_page(gfp_t gfp_mask); void *alloc_pages_exact(size_t size, gfp_t gfp_mask); void free_pages_exact(void *virt, size_t size); -void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask); +void * __meminit alloc_pages_exact_node(int nid, size_t size, gfp_t gfp_mask); #define __get_free_page(gfp_mask) \ __get_free_pages((gfp_mask), 0) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d66bc8abe0af..dd2fed66b656 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4888,7 +4888,7 @@ void *alloc_pages_exact(size_t size, gfp_t gfp_mask) EXPORT_SYMBOL(alloc_pages_exact); /** - * alloc_pages_exact_nid - allocate an exact number of physically-contiguous + * alloc_pages_exact_node - allocate an exact number of physically-contiguous * pages on a node. * @nid: the preferred node ID where memory should be allocated * @size: the number of bytes to allocate @@ -4899,7 +4899,7 @@ EXPORT_SYMBOL(alloc_pages_exact); * * Return: pointer to the allocated area or %NULL in case of error. */ -void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask) +void * __meminit alloc_pages_exact_node(int nid, size_t size, gfp_t gfp_mask) { unsigned int order = get_order(size); struct page *p; diff --git a/mm/page_ext.c b/mm/page_ext.c index d8f1aca4ad43..bca6bb316714 100644 --- a/mm/page_ext.c +++ b/mm/page_ext.c @@ -215,7 +215,7 @@ static void *__meminit alloc_page_ext(size_t size, int nid) gfp_t flags = GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN; void *addr = NULL; - addr = alloc_pages_exact_nid(nid, size, flags); + addr = alloc_pages_exact_node(nid, size, flags); if (addr) { kmemleak_alloc(addr, size, 1, flags); return addr; From patchwork Fri Jun 14 13:47:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F9A31395 for ; Fri, 14 Jun 2019 13:48:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CB1F205FD for ; Fri, 14 Jun 2019 13:48:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FC9428420; Fri, 14 Jun 2019 13:48:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E56D205FD for ; Fri, 14 Jun 2019 13:48:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 680A66B0274; Fri, 14 Jun 2019 09:48:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5E2736B0275; Fri, 14 Jun 2019 09:48:42 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40C4B6B0276; Fri, 14 Jun 2019 09:48:42 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 06AB46B0274 for ; Fri, 14 Jun 2019 09:48:42 -0400 (EDT) Received: by mail-pf1-f199.google.com with SMTP id y7so1819442pfy.9 for ; Fri, 14 Jun 2019 06:48:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Gz4Xhr4GKX8cgnBiH4+BILh020IQOylUizPJRjDHE/E=; b=a3OftsEIAN3BdV3wt8J5CYVLzNv2q/McEqwy857OucbLWjOOwRuCdDDdaFzOoGTroP W2EyyvcDZ3xaAxd8pPmBCSRS7MDU1jfwvrutrJaKnxZ106aToSXhRVEfg6/G+5i/tZ3l JOEj5X/gb3uQa3ZmY+83jlcQfuVRybxuqo268bwvNvgG6q3rTYXkG/iK3jGGSovbl5Oo sMnCOK7RJtt/qmuK1X1G5eGnoCyr2/p98T2JCavKAZuTXnKz11UnckvV84Hxd+5eLJZ/ rSmH4dKHIGBlioMqxIx1D0y++qb/1LIZiL6cAZUGEtQj7dwP27nsmW7yunhTE4Nilxlx h1pw== X-Gm-Message-State: APjAAAUaHMgq6aHbKdp8XEx7ay0kn1SwKkj413R0AoRLQIc+VKjsDrWB 3yUsyH71FcHHQNE2wI1SQ/PiUQyM/TusY4mfl3kRDd2L6SNX1qKDa58XPwINBOyZU28fpazfaax NPRBONNzRbxFENoq1Kv4TewHJJ0Fpe9ddFIcUXxMoscFoZ/c6n+aUfj+lSZNGjxg= X-Received: by 2002:a63:5d45:: with SMTP id o5mr36419154pgm.40.1560520121568; Fri, 14 Jun 2019 06:48:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdopmA470xDu8fjuyeSXz2sSw74fFz6rW51aIkPMC7Z8PWU38VO5mSS1LvcXGPW3xYofBD X-Received: by 2002:a63:5d45:: with SMTP id o5mr36419090pgm.40.1560520120723; Fri, 14 Jun 2019 06:48:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520120; cv=none; d=google.com; s=arc-20160816; b=YVid7O7rKn+WAioHoJ7HwVgDa7zQckT6tLzu/JceinomFsCxuoBf5oEGS7HJL4leJF QxKnn8zbOf+9GOWA4muP5J5fJaZxW8GmU5LvYJjDuV1xmVAA4aPGeXfye8glJTTAIsCj x+lC2CKfx+ZAym5yd2cDV1hmbsAGkJlQZwM/iPI3OfVOEvM+72UpkhfQ3YpNKrh6zD4i Xlbvuyn/XmkT/cTtNLVWznYfwd2JvDfPkYfFLxIxDP0mOCuSbMkXYuh9Hhl6MUDqwz3O 6fCo+FHhNawyg2dXNX6Zb+mTPtkn/bL5YSulJ7EJ6c1p71NXeCk4/+RYq75ix/Qoff7n duEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Gz4Xhr4GKX8cgnBiH4+BILh020IQOylUizPJRjDHE/E=; b=ApxKzgqbvFBcVkd6FRB+PmcwsVV/B4VTX1Na9mBWyAZuyvznfBo41y7RLlycFrMokn cMgv+JhPHSGrtc72h7rtiZCJgCnJpbB9XGZy72U+T3SHqau42onrx4SMjEw+19u2NFO5 81pe2Qbs3T7FRpRXVhPBsk27BcO5WX8tSMFSlLLvEcPf3opqUdUOv/8CO2yfdL7Q2pDl +YXuyp7ZSRbn9RqyYzC/s5EeQ0jYOvSRpwYWsa56OLAGt2rwYg+n4yqOUDpnPb1XIhr9 hmZPv2vQ4z1Ax0Jg6iccVyPYkzjn7Av1gmLplCrjK6g/zphvlP136ROaZJq8NBbMxLTs Trlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=cf3JZA+Z; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id t7si2644104pgu.3.2019.06.14.06.48.40 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:48:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=cf3JZA+Z; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=Gz4Xhr4GKX8cgnBiH4+BILh020IQOylUizPJRjDHE/E=; b=cf3JZA+ZRH3KX860kHpnPR8oA/ bqAxf2wdh/kYQFTTiXQ/cfGIHFtkzi1Q6IAe9eh8VXYnYOyFEmHCCu4FhR+BvSXtpAx5ApdhZC2tL eqsB5EioSDc9+R5gTT7rMPzafsusILIBU05BomvsIAKlHCVNuXOq2PanGax2oHqCJpo1ef3+4E/WO eAvSS6Dx80B05dalPw/wekrBppUw3IEJLxzJHpuSGlVG4QM3kKSs6MrdGwLQEd0MHw3LaJPiqt54p Ec8ghntYydM0pKm2+mAy/RaUMsAIhlCtQMD+RUDzu5uz1USZRuoH2TqfwRFQkKEzx7x86HBrZfST/ CbsAG57g==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmZ3-0005hB-Ky; Fri, 14 Jun 2019 13:48:22 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 14/16] mm: use alloc_pages_exact_node to implement alloc_pages_exact Date: Fri, 14 Jun 2019 15:47:24 +0200 Message-Id: <20190614134726.3827-15-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP No need to duplicate the logic over two functions that are almost the same. Signed-off-by: Christoph Hellwig --- include/linux/gfp.h | 5 +++-- mm/page_alloc.c | 39 +++++++-------------------------------- 2 files changed, 10 insertions(+), 34 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 4274ea6bc72b..c616a23a3f81 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -530,9 +530,10 @@ extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); extern unsigned long get_zeroed_page(gfp_t gfp_mask); -void *alloc_pages_exact(size_t size, gfp_t gfp_mask); void free_pages_exact(void *virt, size_t size); -void * __meminit alloc_pages_exact_node(int nid, size_t size, gfp_t gfp_mask); +void *alloc_pages_exact_node(int nid, size_t size, gfp_t gfp_mask); +#define alloc_pages_exact(size, gfp_mask) \ + alloc_pages_exact_node(NUMA_NO_NODE, size, gfp_mask) #define __get_free_page(gfp_mask) \ __get_free_pages((gfp_mask), 0) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index dd2fed66b656..dec68bd21a71 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4859,34 +4859,6 @@ static void *make_alloc_exact(unsigned long addr, unsigned int order, return (void *)addr; } -/** - * alloc_pages_exact - allocate an exact number physically-contiguous pages. - * @size: the number of bytes to allocate - * @gfp_mask: GFP flags for the allocation, must not contain __GFP_COMP - * - * This function is similar to alloc_pages(), except that it allocates the - * minimum number of pages to satisfy the request. alloc_pages() can only - * allocate memory in power-of-two pages. - * - * This function is also limited by MAX_ORDER. - * - * Memory allocated by this function must be released by free_pages_exact(). - * - * Return: pointer to the allocated area or %NULL in case of error. - */ -void *alloc_pages_exact(size_t size, gfp_t gfp_mask) -{ - unsigned int order = get_order(size); - unsigned long addr; - - if (WARN_ON_ONCE(gfp_mask & __GFP_COMP)) - gfp_mask &= ~__GFP_COMP; - - addr = __get_free_pages(gfp_mask, order); - return make_alloc_exact(addr, order, size); -} -EXPORT_SYMBOL(alloc_pages_exact); - /** * alloc_pages_exact_node - allocate an exact number of physically-contiguous * pages on a node. @@ -4894,12 +4866,15 @@ EXPORT_SYMBOL(alloc_pages_exact); * @size: the number of bytes to allocate * @gfp_mask: GFP flags for the allocation, must not contain __GFP_COMP * - * Like alloc_pages_exact(), but try to allocate on node nid first before falling - * back. + * This function is similar to alloc_pages_node(), except that it allocates the + * minimum number of pages to satisfy the request while alloc_pages() can only + * allocate memory in power-of-two pages. This function is also limited by + * MAX_ORDER. * - * Return: pointer to the allocated area or %NULL in case of error. + * Returns a pointer to the allocated area or %NULL in case of error, memory + * allocated by this function must be released by free_pages_exact(). */ -void * __meminit alloc_pages_exact_node(int nid, size_t size, gfp_t gfp_mask) +void *alloc_pages_exact_node(int nid, size_t size, gfp_t gfp_mask) { unsigned int order = get_order(size); struct page *p; From patchwork Fri Jun 14 13:47:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5CD076 for ; Fri, 14 Jun 2019 13:48:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D612D28420 for ; Fri, 14 Jun 2019 13:48:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA2ED284CE; Fri, 14 Jun 2019 13:48:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 495C528390 for ; Fri, 14 Jun 2019 13:48:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C71BF6B0275; Fri, 14 Jun 2019 09:48:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BFDE96B0276; Fri, 14 Jun 2019 09:48:42 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A4D256B0277; Fri, 14 Jun 2019 09:48:42 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by kanga.kvack.org (Postfix) with ESMTP id 634A36B0276 for ; Fri, 14 Jun 2019 09:48:42 -0400 (EDT) Received: by mail-pl1-f200.google.com with SMTP id n1so1629581plk.11 for ; Fri, 14 Jun 2019 06:48:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=RVKpwDD7wUATUASeNR+XdAkTqCzdoA7nasScp5npHqs=; b=s4LaWAyJiLrpa7gfFDkkmalGBZo9/fprwu/naAkf4VFkcPPyIpatV8TnO37DVhW4Fe v8B6rQCi/B6Iqu2Zv8KC8WPFEa+9jPslSTShofYMs6Bc8hA5hyiRXHlXCEwBHGxbBg5r u+vzf+MNbJKNPksBrBKOhBZ5RYmSCTWCUSxWyeY0iRRb5GYXHnjJEsdBZiq9QpO0xxb9 1ZRBJYe4yksSWGBmk6KgNwriYBeESZccUG5i9GpNLHxin/ezAxdQuYGfb2h9z0WeQPNf 7vw5mBdu8W4hj8Pe+nPRqNz60c+wJrvaELt4dXbY8mVGOZbQiBQLf6dNt+V1+4onDshz Ju5w== X-Gm-Message-State: APjAAAXBF8CigznVNoJKSiL7qCS1SBIZFVdQw2EiBErADvTuqcG7Aqrf doDXfvLnWXtWsw62Ds+EJUK8v2EMm/oiwphrkkSR/mO6HTLC8XgftA+8VLzfkF4iryC9ZfBbXcu ctuwMURJRLL9S2t2tPPqnwqVxkyrq5xCLWS4swZIisj8VPtMSmnzZj/ogJFNkymg= X-Received: by 2002:a17:90a:d817:: with SMTP id a23mr11090950pjv.54.1560520122051; Fri, 14 Jun 2019 06:48:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyr4PO16wgnAq3F0JP1B19b11gYlQX7pOMPo9LlP+FSobVB78srteJT4vbt5jqVWUiEL6PJ X-Received: by 2002:a17:90a:d817:: with SMTP id a23mr11090884pjv.54.1560520121179; Fri, 14 Jun 2019 06:48:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520121; cv=none; d=google.com; s=arc-20160816; b=Ho+uatvE9494qoIsT//LhRc/KmYXXwfLRIFhSJcFz6Y/lkyQg1kMVYrW47cVQVru3l LLq8WoT6QmvsRxOBpWWE3DOZcIhCY5FtNLtkQQyD9qXt4W0YSA7/gZRY0WDGAtdNPwIf Jx7v0MrWoiL24fUg3cqFPkB91/mACYqgkgCDuU3oP6vTk0yBTPHBalqtxnJnc+KrZozv isTNCAFe5KaGSy4JWdmd5qFy9sNycCAt+/TvPqhAfJtODtKs5tpw2LhfSvue9NiIRQa8 7RznOkSyNdUeGCNETUK++6oQHwmF0w9F7fGl51HDZ7tk4NMdNNoMnT27csFXYoYZEJO/ oYUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=RVKpwDD7wUATUASeNR+XdAkTqCzdoA7nasScp5npHqs=; b=o4MqIJvLYTprDQV9MInUzvlqrHltLkrBnI5LB4qBIL4uj0VhotPF+8y58ieKXRswzh zEm2VaQpzs//8utVn5ymS/+r+FPWyjfIZE+ppy8u8P4MinBEtLnnOJdShzj86YcAIzji vDBo2ox5MU8h+xNSygZVMJ0osNwD9hMpyzFDHXZH9Abe4B/+c4ginEt4sHmyFDd6aecI aOlTbL/9E2w1fPViG4IRSOeVXePxYTfon9nw+DYFmD4B5mvAASreZVIqPzb93tkLKPIx 5w0vIL/vHdukr0nypPpRCV9TBsQYK1osDpUyBbhy594b4Uqo4RaOi3oGhHdpLZhCe+eO HMrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b="InfZ/wOT"; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id h4si2478035plb.206.2019.06.14.06.48.40 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:48:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b="InfZ/wOT"; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=RVKpwDD7wUATUASeNR+XdAkTqCzdoA7nasScp5npHqs=; b=InfZ/wOT5rvjRmLvAJ5YP0wj7w MnY2l6T7U9OKNQHOpXU4ecx11Q/eDpbs9QZcUEk1J6VapmhpcCqvhL8/4NsVudmklSgaa2WcxVUBe waQaOUcUb4RL/2HYzMKDhBFk0TbOCBJW2bM1HFoiaO8f2Ig4hC482NJbLtwEkvvRfYlxTkYB8GZfS F0h9hjSdleNEn2dTrk1H5znVe9s/hC3c40GaTOTSLSDPoVROxZizHibMU3rX0xz8EOQplEK9nB80Z xPVZaB3uqh4bQkuTonc69uqBuDRYzL7doJGRuaJI4LbV+3+NfJQNVhZazRojfRluUXrQDfyvbPdjZ 6hG3FXUA==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmZ7-0005kh-Ep; Fri, 14 Jun 2019 13:48:26 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 15/16] dma-mapping: clear __GFP_COMP in dma_alloc_attrs Date: Fri, 14 Jun 2019 15:47:25 +0200 Message-Id: <20190614134726.3827-16-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Lift the code to clear __GFP_COMP from arm into the common DMA allocator path. For one this fixes the various other patches that call alloc_pages_exact or split_page in case a bogus driver passes the argument, and it also prepares for doing exact allocation in the generic dma-direct allocator. Signed-off-by: Christoph Hellwig --- arch/arm/mm/dma-mapping.c | 17 ----------------- kernel/dma/mapping.c | 9 +++++++++ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 0a75058c11f3..86135feb2c05 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -759,14 +759,6 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, if (mask < 0xffffffffULL) gfp |= GFP_DMA; - /* - * Following is a work-around (a.k.a. hack) to prevent pages - * with __GFP_COMP being passed to split_page() which cannot - * handle them. The real problem is that this flag probably - * should be 0 on ARM as it is not supported on this - * platform; see CONFIG_HUGETLBFS. - */ - gfp &= ~(__GFP_COMP); args.gfp = gfp; *handle = DMA_MAPPING_ERROR; @@ -1527,15 +1519,6 @@ static void *__arm_iommu_alloc_attrs(struct device *dev, size_t size, return __iommu_alloc_simple(dev, size, gfp, handle, coherent_flag, attrs); - /* - * Following is a work-around (a.k.a. hack) to prevent pages - * with __GFP_COMP being passed to split_page() which cannot - * handle them. The real problem is that this flag probably - * should be 0 on ARM as it is not supported on this - * platform; see CONFIG_HUGETLBFS. - */ - gfp &= ~(__GFP_COMP); - pages = __iommu_alloc_buffer(dev, size, gfp, attrs, coherent_flag); if (!pages) return NULL; diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c index f7afdadb6770..4b618e1abbc1 100644 --- a/kernel/dma/mapping.c +++ b/kernel/dma/mapping.c @@ -252,6 +252,15 @@ void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, /* let the implementation decide on the zone to allocate from: */ flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM); + /* + * __GFP_COMP interacts badly with splitting up a larger order + * allocation. But as our allocations might not even come from the + * page allocator, the callers can't rely on the fact that they + * even get pages, never mind which kind. + */ + if (WARN_ON_ONCE(flag & __GFP_COMP)) + flag &= ~__GFP_COMP; + if (dma_is_direct(ops)) cpu_addr = dma_direct_alloc(dev, size, dma_handle, flag, attrs); else if (ops->alloc) From patchwork Fri Jun 14 13:47:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10995471 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE6651395 for ; Fri, 14 Jun 2019 13:48:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF32728390 for ; Fri, 14 Jun 2019 13:48:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3554284CE; Fri, 14 Jun 2019 13:48:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41FB228390 for ; Fri, 14 Jun 2019 13:48:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F35656B0276; Fri, 14 Jun 2019 09:48:43 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id EB9FA6B0277; Fri, 14 Jun 2019 09:48:43 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5BD86B0278; Fri, 14 Jun 2019 09:48:43 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by kanga.kvack.org (Postfix) with ESMTP id 8A73C6B0276 for ; Fri, 14 Jun 2019 09:48:43 -0400 (EDT) Received: by mail-pf1-f200.google.com with SMTP id f1so1831287pfb.0 for ; Fri, 14 Jun 2019 06:48:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ve9eOR0n9NYQG/06xL1T/7RN+D+EYosn1r01rGXCWe8=; b=obhYcmmUYl6pUbBjJUONd2d+4is1Iku056NgtzC1+7aMPONmiQs7e+XE2oGWKb7w/3 GeZZfzIKxpIZWyiusgW9rN1fsMMKxxSHnseg7kYgKf/joMjRL2lQJZgFR20htQ2+rgFD AleCkKKbHEZfaoLHdWG+/K5D4frKMmeLM5pCfaU5rGl7wA1NP7vpTqVcSIVDse21QfP7 h+NDrsQmJ/MnpsU0jlwv5SRZjG7t6t+MVd81iJJ7eTvBpcIC3bkeNgQgd5y9T1I/sPdC rPU5JA8bVD4tAOstW7oM/DXPY7/88eMwFcIa69DBqTcNCzClgekoZq1BPvau0A7Mt4sI cLTQ== X-Gm-Message-State: APjAAAVhxDZfnI9083AQ1U1k726zgs566FAMGKCtt7lAp8wrucDHGM7u m6Mj63zcVbgGd8hJq2AWGcQ0gEooHPGtbwQjt6D3WWVRthn5Vn76LLWiDIuZ4V8JbVwnioKn2Ds imdXL4JNUlZhfmQt6nT2FE7/eGa9TYcqp+3KuDrZj7ylHv2KryqzpbHhbTMJYt8E= X-Received: by 2002:a17:902:bd46:: with SMTP id b6mr92875168plx.173.1560520123208; Fri, 14 Jun 2019 06:48:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKg6Cr7KmeoKNFR4sahavMJDhjX+ceVnhsMAYVIKpl+ewyRCOiYIW+pp+0nA7DvLQ89yoF X-Received: by 2002:a17:902:bd46:: with SMTP id b6mr92875105plx.173.1560520122336; Fri, 14 Jun 2019 06:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560520122; cv=none; d=google.com; s=arc-20160816; b=kCGe/HW+LT3jpklTm+xkRNbpSAxPGesiGL8bfoc4SYMT8R1KeYV8YbV7KCH9bSh+KK hRHGQGotpAHRyjYzkQ6Bd/prFaEKsR752yTwipWPK1XuJKch4WgGEMRB8OO6gJrQGqDH ErAPy/FF8ORrZgvlkl69oL/CquNh88uvkjAw+qcsaZS3EskhoUXX1r7p7RnrFEFh2lKt 8aEefgNd9lGhRxG0wshFO8HLkfl90AGaOV77PqrC4wQ6H2hM73F5WZTHrNs/6Gi8tc/C e/I9BB3gsnk53UYJ4zN42AmvkT0NqrCG0CFb5co/uox388ofrYtjxCEDErFNqzaZT4m8 VX+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ve9eOR0n9NYQG/06xL1T/7RN+D+EYosn1r01rGXCWe8=; b=OQeeIKwlb9h0gGpb9vONTA6XNFvYKtGUCStAiySpWBQdXP9acl0imKqqX9N38U3ajf 4lTCQVaFWuEIt70NBy3Hsn0WoxPWYjKMEzK2UbgwPkm19UVZFSzY9F8rJHU/Lj5qD1ZC qDmcqQ7tigtn+wUlZSDgcnqZk17qtDUHBVrTU2QL4L71+ICB6jZ8QC5QKPvYD37quxgW 6/vx6sgulKSNRd6ZPRXUyHjOPle+dbsUphMujKkyugwnfHbyxKpDp/OgwHvcSAH7mcG7 aCYcuJseWRZQpyvFggtUnxl/Of8dO/A633gfwAjlQEeV1lPftln57f42A/QQm8202U9B yqPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=oOXLpQSB; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id l2si2753554pgs.315.2019.06.14.06.48.42 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 06:48:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=oOXLpQSB; spf=pass (google.com: best guess record for domain of batv+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+3311e6b5ef18d39f8a57+5773+infradead.org+hch@bombadil.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=ve9eOR0n9NYQG/06xL1T/7RN+D+EYosn1r01rGXCWe8=; b=oOXLpQSB9eTwi5cRnaIs3K9jSP U3nYifQRasO4H8c9LydLZ7aFiLS8AmMO8L7HX1fSqc06MgW+WgkhhHaoKo2MKfTDNYkKunWyK4auH sDEmoQgB8oqOU4hpKwhX2F52HvfX8JBk7RhqZQB3ZfChLLyBOjp1aO1CsWRbTm+0Fj1lVP/P78vhq Q/tTXEXgky31g4PmH9ZYyI2SmqKT0gbaGOa4wj3ZMyfwF3m6qpJz2Hgvhxr+PiNdqUsIFqqBd/Bdq t5+5nb9o2JxesKPlAa9uOOJPL3zGPLmnTYV+Z+YPjVKvRBW0T/H3FZDUMD4bcdC4PQzCFzjLGL6V3 kn/hUemg==; Received: from 213-225-9-13.nat.highway.a1.net ([213.225.9.13] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbmZB-0005nI-Ab; Fri, 14 Jun 2019 13:48:30 +0000 From: Christoph Hellwig To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ian Abbott , H Hartley Sweeten Cc: Intel Linux Wireless , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-media@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-s390@vger.kernel.org, devel@driverdev.osuosl.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 16/16] dma-mapping: use exact allocation in dma_alloc_contiguous Date: Fri, 14 Jun 2019 15:47:26 +0200 Message-Id: <20190614134726.3827-17-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614134726.3827-1-hch@lst.de> References: <20190614134726.3827-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Many architectures (e.g. arm, m68 and sh) have always used exact allocation in their dma coherent allocator, which avoids a lot of memory waste especially for larger allocations. Lift this behavior into the generic allocator so that dma-direct and the generic IOMMU code benefit from this behavior as well. Signed-off-by: Christoph Hellwig --- include/linux/dma-contiguous.h | 8 +++++--- kernel/dma/contiguous.c | 17 +++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h index c05d4e661489..2e542e314acf 100644 --- a/include/linux/dma-contiguous.h +++ b/include/linux/dma-contiguous.h @@ -161,15 +161,17 @@ static inline struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp) { int node = dev ? dev_to_node(dev) : NUMA_NO_NODE; - size_t align = get_order(PAGE_ALIGN(size)); + void *cpu_addr = alloc_pages_exact_node(node, size, gfp); - return alloc_pages_node(node, gfp, align); + if (!cpu_addr) + return NULL; + return virt_to_page(p); } static inline void dma_free_contiguous(struct device *dev, struct page *page, size_t size) { - __free_pages(page, get_order(size)); + free_pages_exact(page_address(page), get_order(size)); } #endif diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c index bfc0c17f2a3d..84f41eea2741 100644 --- a/kernel/dma/contiguous.c +++ b/kernel/dma/contiguous.c @@ -232,9 +232,8 @@ struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp) { int node = dev ? dev_to_node(dev) : NUMA_NO_NODE; size_t count = PAGE_ALIGN(size) >> PAGE_SHIFT; - size_t align = get_order(PAGE_ALIGN(size)); - struct page *page = NULL; struct cma *cma = NULL; + void *cpu_addr; if (dev && dev->cma_area) cma = dev->cma_area; @@ -243,14 +242,20 @@ struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp) /* CMA can be used only in the context which permits sleeping */ if (cma && gfpflags_allow_blocking(gfp)) { + size_t align = get_order(PAGE_ALIGN(size)); + struct page *page; + align = min_t(size_t, align, CONFIG_CMA_ALIGNMENT); page = cma_alloc(cma, count, align, gfp & __GFP_NOWARN); + if (page) + return page; } /* Fallback allocation of normal pages */ - if (!page) - page = alloc_pages_node(node, gfp, align); - return page; + cpu_addr = alloc_pages_exact_node(node, size, gfp); + if (!cpu_addr) + return NULL; + return virt_to_page(cpu_addr); } /** @@ -267,7 +272,7 @@ struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp) void dma_free_contiguous(struct device *dev, struct page *page, size_t size) { if (!cma_release(dev_get_cma_area(dev), page, size >> PAGE_SHIFT)) - __free_pages(page, get_order(size)); + free_pages_exact(page_address(page), get_order(size)); } /*