From patchwork Fri Sep 7 07:56:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 146194 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp860291ljw; Fri, 7 Sep 2018 00:58:06 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbA0ZkkZIDrqD2E0kB8SZv0M0jEA3t33fbjHHuprSGjLQ4NnZaJ9LvkF/IjpionIx4DvYmW X-Received: by 2002:a17:902:b282:: with SMTP id u2-v6mr6491525plr.123.1536307085881; Fri, 07 Sep 2018 00:58:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536307085; cv=none; d=google.com; s=arc-20160816; b=nN6/XgeGuf/GOg7unBPEdH0wf2+Fs8j6ZPEKwe5+Av08IQgUmJrqnphr1WDpKMSQQG 20lfmBR2iKSq2hq3Kodg06rHdrPG69fUYquJ1S8bVq/tQyQ4molzadoXvHzXiaAqTmJn 7owepmDvTaGDgCwoUmIFyin7vF4imkER6d4OOZ7QbgMuqxpqUZf+kWaW0tWZeqyfEUag OlL1XIAmk/nIo/k+3uIypIcOZqbUXVdsL7mY8m3bN+PrR4LjKOFuN30u31ceM+Hdx9LB qeQDJMPsSSRnkuAISpDEjIclJ9npkxx2dL1q5gm0gO2AW8JppMACnMQgGnu8FlUyFks/ 64Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=jeWHjhWZzqcn992r+CjxadoTg1glUklXZIt+KkbfGzY=; b=E4pMhGPkJIILhL5oz9kbfiXhgVdDU8hdx1ITcvP6UH7A0i+Mo/1LUR8EbP8B43HfrC t4jskEvWF5yp0HbAmk7rWbOsMwl+uF8x1bTFM1dprGAl7anXyx+5i7/j5+H8cD/m4Jp8 o2Cn/eGeiDzwRgh8Xb86if3phdv5kjlSfeIX6cwQJnq9clmRBE8Z+NvLkqT+De7VmdL0 DNuU5k+BxG+9RfZVkoLq/BfqFhjL2Zd8OLgTqmAIklxy2rWqngDh+OOWFCtM4oZ9hL2Q /fnpQw2BZX06IG+b+vksNMBbU/mc1Isio2M7h3W7RSaUnRwIs7i3povpLuf3x5VZK5kj Wmlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Iw6FIM/U"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u10-v6si7057841plu.506.2018.09.07.00.58.05; Fri, 07 Sep 2018 00:58:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Iw6FIM/U"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728068AbeIGMhr (ORCPT + 32 others); Fri, 7 Sep 2018 08:37:47 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:45087 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726596AbeIGMhq (ORCPT ); Fri, 7 Sep 2018 08:37:46 -0400 Received: by mail-pf1-f193.google.com with SMTP id i26-v6so6615379pfo.12 for ; Fri, 07 Sep 2018 00:58:02 -0700 (PDT) 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; bh=jeWHjhWZzqcn992r+CjxadoTg1glUklXZIt+KkbfGzY=; b=Iw6FIM/UTbLuebPjiA4jQVIGzj1ZOSMVexZ11oWFVNDZ/ufvkYBdyX+BbPZ/5aYKuB r7XPHSCEgPMikmy/gv+Bo0F7HsfeRIQE/WRc+OOPgtR5GjEeC+1fc0e67z4kIxqGHvFI 9s44tc/wjbhJiYdjVD0GmiWIk9iV8rl4OPZWo= 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; bh=jeWHjhWZzqcn992r+CjxadoTg1glUklXZIt+KkbfGzY=; b=qRA9/44oUflzGjDqIM5WSRZMR/Je07E9yMra7flDKA7G+TRv99p8QIwA7v4f+xK8bW 8m7rZYYF7BUQZUibXIX4iKsQ/aPvgPbcmTbOR3wJOz2f3iF9f1arYzFjvg/+4EKS30// 0dg8R4AloVRmr4jWILhj7sdDfaUHG1L3mpJnoShIIcXz5aAw8JtRbVcjoXLm32W1VKU9 VJBVanpDA4931p8PT6vaM16lx8K3bY8UeESwRGAnBxALkojPmS/B3+V6doOhDX1GV8RT 4k15tadB75ar0h1FvfYSzc8k+y/wqtgTb4w7ShI5WnQvjzZSc95/RFIRzJnoIAyF8o05 5cdg== X-Gm-Message-State: APzg51AO3X+EUJPI2UVBadbOukE9DJTYvuLVeoln0erMQYuUwAMDlGq/ CFdjK/35gJW0J1SatBnbthBz5Q== X-Received: by 2002:a62:56d9:: with SMTP id h86-v6mr7152853pfj.229.1536307082476; Fri, 07 Sep 2018 00:58:02 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id l185-v6sm18675979pga.5.2018.09.07.00.58.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 00:58:01 -0700 (PDT) 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 Cc: prudo@linux.ibm.com, ard.biesheuvel@linaro.org, james.morse@arm.com, bhsharma@redhat.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AKASHI Takahiro Subject: [PATCH v14 05/16] kexec_file: kexec_walk_memblock() only walks a dedicated region at kdump Date: Fri, 7 Sep 2018 16:56:42 +0900 Message-Id: <20180907075653.4696-6-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180907075653.4696-1-takahiro.akashi@linaro.org> References: <20180907075653.4696-1-takahiro.akashi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Dave Young Cc: Vivek Goyal Cc: Baoquan He --- kernel/kexec_file.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.18.0 diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 370d7eab49fe..2f615a7968dd 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -511,8 +511,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 @@ -526,8 +529,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