From patchwork Sat Oct 12 21:31:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 11187033 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 212E01668 for ; Sat, 12 Oct 2019 21:31:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BCC3321655 for ; Sat, 12 Oct 2019 21:31:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="vu47EcJe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BCC3321655 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 41AA78E0001; Sat, 12 Oct 2019 17:31:12 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3CC9E6B0005; Sat, 12 Oct 2019 17:31:12 -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 2E1E48E0001; Sat, 12 Oct 2019 17:31:12 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0200.hostedemail.com [216.40.44.200]) by kanga.kvack.org (Postfix) with ESMTP id 0FE5A6B0003 for ; Sat, 12 Oct 2019 17:31:12 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 89BCA6D7B for ; Sat, 12 Oct 2019 21:31:11 +0000 (UTC) X-FDA: 76036428342.11.beast84_7ec7f449ed901 X-Spam-Summary: 2,0,0,3b68e2c602caf0c3,d41d8cd98f00b204,rppt@kernel.org,:akpm@linux-foundation.org:aford173@gmail.com:catalin.marinas@arm.com:hch@lst.de:festevam@gmail.com:l.stach@pengutronix.de:etnaviv@lists.freedesktop.org:linux-arm-kernel@lists.infradead.org:linux-kernel@vger.kernel.org::rppt@linux.ibm.com,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1431:1437:1534:1542:1711:1730:1747:1777:1792:2393:2559:2562:2693:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3874:4250:4321:5007:6261:6653:7514:7576:7903:8603:9592:10004:10128:11026:11473:11658:11914:12043:12297:12438:12517:12519:12555:12679:12895:13221:13229:14093:14096:14181:14394:14721:21080:21451:21627:30003:30054:30069,0,RBL:error,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: beast84_7ec7f449ed901 X-Filterd-Recvd-Size: 3914 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Sat, 12 Oct 2019 21:31:11 +0000 (UTC) Received: from aquarius.haifa.ibm.com (nesher1.haifa.il.ibm.com [195.110.40.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2863A20700; Sat, 12 Oct 2019 21:31:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570915870; bh=OHyj5bDPQVGUT3OAq33STpc0n0zo2JvrtJXGizaQcDY=; h=From:To:Cc:Subject:Date:From; b=vu47EcJeCFg9jYw+oumKYKxLlJhGtj+LBscpj0cCbgcfqWendWjFUBnPb9d7UXyU8 fozUFlb1gn+IEfL0TkG5M9th+YM1wqEDBdX2xjWVXFis+BaWkID414k8OGXdcLV0sd z1fL/pyGWzYUI4MjFbxiEEIq3qPcDEc/7TTmhbR0= From: Mike Rapoport To: Andrew Morton Cc: Adam Ford , Catalin Marinas , Christoph Hellwig , Fabio Estevam , Lucas Stach , etnaviv@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport Subject: [PATCH] mm: memblock: do not enforce current limit for memblock_phys* family Date: Sun, 13 Oct 2019 00:31:01 +0300 Message-Id: <1570915861-17633-1-git-send-email-rppt@kernel.org> X-Mailer: git-send-email 2.7.4 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: From: Mike Rapoport Until commit 92d12f9544b7 ("memblock: refactor internal allocation functions") the maximal address for memblock allocations was forced to memblock.current_limit only for the allocation functions returning virtual address. The changes introduced by that commit moved the limit enforcement into the allocation core and as a result the allocation functions returning physical address also started to limit allocations to memblock.current_limit. This caused breakage of etnaviv GPU driver: [ 3.682347] etnaviv etnaviv: bound 130000.gpu (ops gpu_ops) [ 3.688669] etnaviv etnaviv: bound 134000.gpu (ops gpu_ops) [ 3.695099] etnaviv etnaviv: bound 2204000.gpu (ops gpu_ops) [ 3.700800] etnaviv-gpu 130000.gpu: model: GC2000, revision: 5108 [ 3.723013] etnaviv-gpu 130000.gpu: command buffer outside valid memory window [ 3.731308] etnaviv-gpu 134000.gpu: model: GC320, revision: 5007 [ 3.752437] etnaviv-gpu 134000.gpu: command buffer outside valid memory window [ 3.760583] etnaviv-gpu 2204000.gpu: model: GC355, revision: 1215 [ 3.766766] etnaviv-gpu 2204000.gpu: Ignoring GPU with VG and FE2.0 Restore the behaviour of memblock_phys* family so that these functions will not enforce memblock.current_limit. Fixes: 92d12f9544b7 ("memblock: refactor internal allocation functions") Reported-by: Adam Ford Tested-by: Adam Ford #imx6q-logicpd Signed-off-by: Mike Rapoport --- mm/memblock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/memblock.c b/mm/memblock.c index 7d4f61a..c4b16ca 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1356,9 +1356,6 @@ static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size, align = SMP_CACHE_BYTES; } - if (end > memblock.current_limit) - end = memblock.current_limit; - again: found = memblock_find_in_range_node(size, align, start, end, nid, flags); @@ -1469,6 +1466,9 @@ static void * __init memblock_alloc_internal( if (WARN_ON_ONCE(slab_is_available())) return kzalloc_node(size, GFP_NOWAIT, nid); + if (max_addr > memblock.current_limit) + max_addr = memblock.current_limit; + alloc = memblock_alloc_range_nid(size, align, min_addr, max_addr, nid); /* retry allocation without lower limit */