From patchwork Thu Nov 15 05:52:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 10683537 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 CC66114DB for ; Thu, 15 Nov 2018 05:54:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B819E2C140 for ; Thu, 15 Nov 2018 05:54:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB7982C15A; Thu, 15 Nov 2018 05:54:19 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5E4BE2C140 for ; Thu, 15 Nov 2018 05:54:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VY+wmPVOvv4HVwd1HlYqfdnH046F+0+dYMGmMAqQ58I=; b=DcdQDzQij4NQIT 2xo9ZovZBiUmA957p2pg8WG7w92UyowXYNHFt6TWgKhsQFeqAdo/jczRrNBLfWYeesng8y1qEeVtQ 7txVLZhhCTMvGnpz3mLMCA7hscZu72QylFsC7xSY7kkt6Vtju+0ESL9QG0QBLsDjQo04Kv+rjuoIH ax8Xd9JVaiyub74GZS3d0ieRdt3w9FN+1OSjopezWEiZErONc5vw5F6S8VXXmE8xEdzGSE24/EIbe w4zHUMwMjDn0WOrdO4Dp3D9EJy5+3+CDPH++jEy5lGz7mCgHfT8rg5Ft+EUcO33UjrYo/E91ZxkP1 l4a5qg97suKd2bVOx9RA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNAba-00077F-RD; Thu, 15 Nov 2018 05:54:18 +0000 Received: from mail-yb1-xb43.google.com ([2607:f8b0:4864:20::b43]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNAa5-0005Xc-Qy for linux-arm-kernel@lists.infradead.org; Thu, 15 Nov 2018 05:52:47 +0000 Received: by mail-yb1-xb43.google.com with SMTP id g9-v6so7911031ybh.7 for ; Wed, 14 Nov 2018 21:52:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q/fq5bZ27j9TjpABnmRVQDUsaoFNf4lBmEvm436b7+U=; b=NlwwTDBlmA0fPIJo73KUlSBR/mJEba1O118YChkrG+s1/ZraNj0Y01Tr0TFVBwvcqE b3VP3vfW5vtlKY/Yaut01gBNk/g90XX5pObDWWY1scgLt7FWnLNwf0k/f/ZJAMsfodDT 75tdAFCP5GXJcGbY8269qap+A6eZpP3OQmtvA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q/fq5bZ27j9TjpABnmRVQDUsaoFNf4lBmEvm436b7+U=; b=V5+7+Wp9Ww3AApDE7P1vhunmkEA8osxvF/K5AXN/KPk7AZ8q6+Q5ViAYPjsqVRon5u Y+YDI8AqFBCqYWTtL84pzI6Gn4frUFBYneJOfCEgIcIfH3GbXlkBlwkrMzYptyDs4mYY cvHxqn5e3pbfw4fu4z44OcV2JGrFz/GcwjBDwbJoHCidhakOOFQCQ0OMlHeaIzmVUjjx 8R45f2DEro1Cs+cwZaiNxcKeqsDfqyLoQjvnH33MG82/LTNbB3t3xATWWJ+Vv/HYbno3 KzNtguK9JaZDZOeTr6v3GgVUQHcPbZkZj2WwaYdL3JwmdR8+Th5vz0IQLmHoDjVTuHs+ ftKw== X-Gm-Message-State: AGRZ1gK8OpQai5goia4/sJ3bjQ8WMVxH0XrLLCqJs67iuAR0vzNFKv3r 5RA85WsHw2g2Vb1yyLaUkgVQGw== X-Google-Smtp-Source: AJdET5dV1cECJynsv29Nko5CWSDppNLoqAh4iDzCukPadApvjHVw3IyQVZdv0pPSnKHwEVXokEeW1A== X-Received: by 2002:a25:5983:: with SMTP id n125-v6mr4130285ybb.209.1542261154572; Wed, 14 Nov 2018 21:52:34 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id 207-v6sm7416843ywo.87.2018.11.14.21.52.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 21:52:33 -0800 (PST) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, dyoung@redhat.com, bhe@redhat.com, arnd@arndb.de, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com Subject: [PATCH v16 05/16] kexec_file: kexec_walk_memblock() only walks a dedicated region at kdump Date: Thu, 15 Nov 2018 14:52:44 +0900 Message-Id: <20181115055254.2812-6-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181115055254.2812-1-takahiro.akashi@linaro.org> References: <20181115055254.2812-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181114_215245_882515_C81C4D79 X-CRM114-Status: GOOD ( 12.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ard.biesheuvel@linaro.org, bhsharma@redhat.com, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, prudo@linux.ibm.com, AKASHI Takahiro , james.morse@arm.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In kdump case, there exists only one dedicated memblock region as usable memory (crashk_res). With this patch, kexec_walk_memblock() runs a given callback function on this region. Cosmetic change: 0 to MEMBLOCK_NONE at for_each_free_mem_range*() Signed-off-by: AKASHI Takahiro Acked-by: Dave Young Cc: Vivek Goyal Cc: Baoquan He --- kernel/kexec_file.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index d03195a8cb6e..f1d0e00a3971 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -515,8 +515,11 @@ static int kexec_walk_memblock(struct kexec_buf *kbuf, phys_addr_t mstart, mend; struct resource res = { }; + if (kbuf->image->type == KEXEC_TYPE_CRASH) + return func(&crashk_res, kbuf); + if (kbuf->top_down) { - for_each_free_mem_range_reverse(i, NUMA_NO_NODE, 0, + for_each_free_mem_range_reverse(i, NUMA_NO_NODE, MEMBLOCK_NONE, &mstart, &mend, NULL) { /* * In memblock, end points to the first byte after the @@ -530,8 +533,8 @@ static int kexec_walk_memblock(struct kexec_buf *kbuf, break; } } else { - for_each_free_mem_range(i, NUMA_NO_NODE, 0, &mstart, &mend, - NULL) { + for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE, + &mstart, &mend, NULL) { /* * In memblock, end points to the first byte after the * range while in kexec, end points to the last byte