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: 10619059 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 B2BAC174A for ; Fri, 28 Sep 2018 07:00:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A30D02B005 for ; Fri, 28 Sep 2018 07:00:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9726F2B00C; Fri, 28 Sep 2018 07:00:37 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 C2F882B005 for ; Fri, 28 Sep 2018 07:00:33 +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=VnHBWioLT0aD7857xJTclTmJCHM8DrMEVJw0ijZHFzM=; b=iOe4laB7JCmMck A0VjyIhFAMWG0utYfnQvmeoTRv/XlwKeuIjd6XtQ9M5XqF5pUNsV2MWh0tj4Ueu3dH85dkfYa7klM BmhL7V89EaPXAw2Ev+2qcmYbb/KcO0+g+AQDNLOpyFbf2n5jqF15G1PAF4VPMibbRumGPgrTDMnO/ CVUQMSzuZlkvNb8iUcPmR5hAeIFtpSSPiZ4DWaiCDIk5og/l4joYPsmse6YWjEZqmKYqeEkapJdVo 7RQW/GNabJuJSZiEEBcdQR/nlr04di6NvSC1FdKu5afAOCxIDGIk9dnFqmEep02c97aN6jL6916c7 reV238sxg1KYespguauA==; 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 1g5mlJ-0004Dw-KD; Fri, 28 Sep 2018 07:00:29 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5ma0-0004fi-UJ for linux-arm-kernel@lists.infradead.org; Fri, 28 Sep 2018 06:48:55 +0000 Received: by mail-pf1-x444.google.com with SMTP id b7-v6so3640051pfo.3 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=JP8jWrJ1nXuh4jHHsHZPs9/I/7XibH02lQIa8EiC0cE2jQpjeznbiX8vSMrqsK+G2A dAn09pWtbL6/x//5DXAl27810zZa85DFTV/WTFA1D+JMxZBN2HjCoKun8NnSTKA0kKaj 9bZil4S+s2QaPWlZwTwwZaxxpj8liBGxXhk4Bugo23d5QyIJSOYewfQk2hQ6ivjB7bzg AH1hP7+HnqROW4bdVyQOFvcze+iL7IUqIBkgbFmDkKzVQe8W9fnG1/1lO8IzlxoXFOtK 2hnkQ1sgd4fADIJ8nryUAKFqLph2y2HzrmhkvLOGBlTMIzRpmdKjxUpYcsplqt/fCxu0 ZZmg== X-Gm-Message-State: ABuFfohMvxgFT2XrLbrhC193xzs8Jm5YSV4REIp3HmQvdnjYyZzrcSE6 gGbwtajbLxg0MVYvTkvN4MVmug== X-Google-Smtp-Source: ACcGV60sTkh7k8gMS6cAMiFFQ89lfpIQtHaRo1p9d7THHcKbHldE5LM41g64aklBZ3NQ4VGGQtkkpQ== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180927_234849_062460_97CEA7C2 X-CRM114-Status: GOOD ( 13.04 ) 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 Cc: Dave Young Cc: Vivek Goyal Cc: Baoquan He Acked-by: Dave Young --- 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