Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp394734imm; Thu, 27 Sep 2018 23:48:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV62Hmynoc4DA0KgbSRU9Ps0gfWzDh8NkuMPsDLhejhJ8jQEGrBQZTIJEAzu3LSzKR88nEHed X-Received: by 2002:a17:902:8b8c:: with SMTP id ay12-v6mr3465928plb.163.1538117338020; Thu, 27 Sep 2018 23:48:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538117337; cv=none; d=google.com; s=arc-20160816; b=o10k48mGNIxIEM30yybTZuYj+32xLNT5tbiRXJ1XHvd5qCc9i5rwEnpj8ofdxz7d51 yuwIGYDS2f2CTwAykcmTJkIoZYZiblj3BwzNl/Yq8xqw8cRxqXXkeUenvJ/aLSxgtKhw IuZpgdbBaeOklhZ/5HUNHwucBwjivQuf0a3qlQUv1bj49kQocvU/dfzqyUZ7y5jszOZm FSpWBCfL1C+xGtLwRKcHmHVnrJB61vVNSRL+KKuoL0Z9NHLNBoGekciOT9eCYilxbvdp SVQZ4VYjLCLt9+cNsGptrqOB4dIFhxLKzxqD2eFRp93+eKzGvCXYetVXilU3opNYvzFb rOwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7lEK32bpyfZBbvzr+AgaMH3E2lcp0Tdtbfmv5MlM7pE=; b=NDsXTr8lVScBUHVeyH8t2bWAkH6b9TajvfSLHPYmGSaqX6jgITn/9KokdMnqM78vX3 nsfMOmUAojozUGwq8eExTRvsBWDmTNpJK5Uz5JSROsgSiLJVWPozR+BzPBvDMwJK1a4b REeG9Z0y4LC0M+D7CYhvkvlNy3s3LxgjAff2bbWE0Orn3eAOkese6IFyWuhJDR6ECF8T NTUGSW0lNHkTG+yN295P34ztHn45pegDkBoRdgT2n2uG+EHLqmqC3q0vo6pDZGNvK0PY c97buZe6+Mp9zdemDnsTsI9tVyiX7NvzxSP6cjWOeU6DnBEQb3yASaVMeVlqg22r1Q7r 0fBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kk2MuAr2; 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 c15-v6si4052007plo.357.2018.09.27.23.48.42; Thu, 27 Sep 2018 23:48:57 -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=Kk2MuAr2; 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 S1729056AbeI1NKd (ORCPT + 99 others); Fri, 28 Sep 2018 09:10:33 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:40587 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726473AbeI1NKd (ORCPT ); Fri, 28 Sep 2018 09:10:33 -0400 Received: by mail-pf1-f193.google.com with SMTP id s5-v6so3624633pfj.7 for ; Thu, 27 Sep 2018 23:48:18 -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 :mime-version:content-transfer-encoding; bh=7lEK32bpyfZBbvzr+AgaMH3E2lcp0Tdtbfmv5MlM7pE=; b=Kk2MuAr2ZxQGAFTckoI4a3OJjqCm/d1ykOA9ozVI2d5mQlhjrcGdC9cRGkw13D3b5+ luxQvhuNtGsEi3sx4uVzGEz+tkO982AHPYPk2EFmfsZAQmC6Xwqt/4DxGwu7a7IsX9bz fTR41f4878GBeepJZeruzkxW8PtyUjdFaHlW8= 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=7lEK32bpyfZBbvzr+AgaMH3E2lcp0Tdtbfmv5MlM7pE=; b=NXNRtCdhb01Qoq3ARJ+SdiLA82plJNefxGSqM/OaMronory5oteHmG0NDhd7h8CMbV gMhd67vg0UcpdrlkSbU7R1pMTj66E1f2HyZsU2RyR9er3FQHo1pwAjIjPZ1Yx6P0WbJo pL+sflvCx+62Z39CjKggfYfostFmFyEmJbzLrODiCRfsgamJSPsDJe6yHgrQL8THrIdR 22AZGgNrIrH0TbYdplKMWVAotR5QN2BE11okO0RmX3EL84XyU8EvKh4zsI9Lpkxtmq07 dy8N3SbQ9b2v9XLtSJa4YR9uzHuylfyDi/8rydND57XCKgMmpV8DjgjKbEWJTanv9ouf eirQ== X-Gm-Message-State: ABuFfogL7iQ5O35FADO77IvdsF+w0qcuQoOK4mKTbNSDMtzfSoFg1efn KmvRWU9SR/pzsVgGnXjJSuUhng== X-Received: by 2002:a17:902:9045:: with SMTP id w5-v6mr14943273plz.10.1538117298309; Thu, 27 Sep 2018 23:48:18 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id h12-v6sm5847448pfo.135.2018.09.27.23.48.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Sep 2018 23:48:17 -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 v15 05/16] kexec_file: kexec_walk_memblock() only walks a dedicated region at kdump Date: Fri, 28 Sep 2018 15:48:30 +0900 Message-Id: <20180928064841.14117-6-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180928064841.14117-1-takahiro.akashi@linaro.org> References: <20180928064841.14117-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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(-) 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 -- 2.19.0