From patchwork Fri Sep 28 06:48:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 147771 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp371109lji; Thu, 27 Sep 2018 23:48:22 -0700 (PDT) X-Google-Smtp-Source: ACcGV62kPbTv7elPsI3rQCd6Bo/BFczqQKBzYS7/pqTRuBLx/7C3/kDutOeKEfIeNCN57NrmkbFm X-Received: by 2002:a63:906:: with SMTP id 6-v6mr13316828pgj.92.1538117301978; Thu, 27 Sep 2018 23:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538117301; cv=none; d=google.com; s=arc-20160816; b=FNeieM6fvrOL+TC/QTb7JC/vA7PQYecdrt0waaJeulzRfNy1QPa3JKhpqMEfofoh8M nPaYvJRe4Iu98C+rdzSZjfku+cMaKhEzAjMRNhXrLxzGfu3MLu1VZ7ocQFugQq+QdJGc tUSozlnoSROo4yh66Iwn49UWgg18R2StgrGMf6qU93CvH0p7zMvoazhF7Q01M2m4kD+r 8h8snlnx1EPzzAKBKmvBWJs3HFb8x5xYT1yhA/zhkIP00j79isBhJF8kQdS+WSeGH1rq 4wpQ7+CPUK/ntccv+C7B9R1nVp3w32h6jgq+z/KaZbP89B4zY+6twobANdevwhPN7CH0 H50g== 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 62-v6si4223799plc.96.2018.09.27.23.48.21; Thu, 27 Sep 2018 23:48:21 -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 S1729062AbeI1NKd (ORCPT + 32 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 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.19.0 Acked-by: Dave Young 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