From patchwork Wed Aug 1 07:58:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 143251 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp549048ljj; Wed, 1 Aug 2018 01:00:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd2RAsmxuZBXTvseq8GiV1+IkGqucpyV2h+dHyoYguFX+0Km9aBrZmqSm3ohJdrKcX/UaSX X-Received: by 2002:a65:60cf:: with SMTP id r15-v6mr23458801pgv.41.1533110412872; Wed, 01 Aug 2018 01:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533110412; cv=none; d=google.com; s=arc-20160816; b=x1C4hG8SJhHefdEz07jizsU1wId8Fnf0jQOYnYaE/lUKdQXZjLe6pdAJv+KmxlcWbI t5KLxLlwPToaGnr57/POG3X1h4l0mZATdxU4Q83z2VFcPTZ0Hd1GprUyaTfVeaCrKvc8 TBn7TzQ2o4Hix6JM5RvKVhK0a20tyyd0LiEKa1hYSXLrhryGi53MhBIisVLe5X00Exk0 EGb+0EPAHhBWiqGaVEw9lTYoXgfXYZuvnDZIUQCbXmzNya5upAWOtf1BzC9gGvXwM7TL MkwRjXab1qCsvOZorODAHiNfEuDWFdHljKUnHUoMsEjCE0ONJKf/a4bh29PaZFGOuVLe 0U9w== 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:arc-authentication-results; bh=H9V/pRhzf1RnH7rtjNBLRuYtR4l5xIhl8He5yhS2iQg=; b=mq1ViGKRBNwAjLaZyOR5qALDKdzwDkaVVNogUtKKZmslZAEb7QJVFjZyFi/gv3S3By UdeNGvgiA4uRUNNpoCdd+rggb4qgDWpADEX/nPOH7AuYJi3cd5u3VSnA0YjHf4YRmEss 5HZsBazqs/mCjwaJ3FtC9YtobawTwMaBnuc9t06womaH+XM5dwCWZLjYmU7uVCirCPuj pc9+dQ0fr7lDLIFjFkMxejsTIJzZ+WstN/9eLhY9ztyh9G7nHKcTR+GUo1sMALGQcyj0 jNFLCTxZN5pIm4dldreExDmIUcTLiiYMkeOlxC3GxmrYj4WekoyfJVYGlLRJ+sWj60JF IaWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dv6Ao5gb; 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 d10-v6si14094782pla.140.2018.08.01.01.00.12; Wed, 01 Aug 2018 01:00:12 -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=Dv6Ao5gb; 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 S2387987AbeHAJog (ORCPT + 31 others); Wed, 1 Aug 2018 05:44:36 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36736 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387647AbeHAJof (ORCPT ); Wed, 1 Aug 2018 05:44:35 -0400 Received: by mail-pf1-f195.google.com with SMTP id b11-v6so2254075pfo.3 for ; Wed, 01 Aug 2018 01:00:09 -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=H9V/pRhzf1RnH7rtjNBLRuYtR4l5xIhl8He5yhS2iQg=; b=Dv6Ao5gbCEtv75PDFcno/cC/X0jP0Kp+YSXjdpVy2ycLWc28q9h03Q+dW3/n3iDhi0 WzYC/SbZjSVaYgsCyAp3rEq3HxWR1dl8CJD6iLTGOYG1WdBTT3Y1Sw3PQJGYMbFDj1va 4y0hNmbkjjjgQt24IaFB+VzuDY/MYvhdnsC4o= 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=H9V/pRhzf1RnH7rtjNBLRuYtR4l5xIhl8He5yhS2iQg=; b=bjH1dnQLVAHtZyHNYpB/CX/rdaTGnosfcjDdw0I0y/ABoTyQYIhXZEANyXa0izMphe QRFUcOuPclX/RcM7Do/3k+0FSUDF85PeT90YLYWFAMl6iMow17dPLk/jfAg26RRMq0A1 wHqAfW02/YOeACGsOVzN1zvkZ0ocvQlecyEvSZdPRFMHVr1KCSeaAwb6ZNlEGRnJZpln j+7UmyvDAl1TRlGqkfZQpjgIjT/1KzQm7emS9BKplBN5ElmXyMXP2GxfJZ4gqUmOhQkD NwWfnEaj58DHvsHxgHwBzCYQrU1fCo94NKvavdiwgcV2BJwQKUKI/Qig0KPqu9+Mz+Z5 M07g== X-Gm-Message-State: AOUpUlE4Oopg86iY9Hgr8lkYW3M0IVobox2vo/QQlKWjNbYVs3CUWS9L D3ftbEgoKxtnWfNo+pYBBaN68g== X-Received: by 2002:a65:6398:: with SMTP id h24-v6mr23529895pgv.245.1533110409558; Wed, 01 Aug 2018 01:00:09 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id h130-v6sm34714091pgc.88.2018.08.01.01.00.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Aug 2018 01:00:09 -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 v13 05/16] kexec_file: kexec_walk_memblock() only walks a dedicated region at kdump Date: Wed, 1 Aug 2018 16:58:09 +0900 Message-Id: <20180801075820.3753-6-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801075820.3753-1-takahiro.akashi@linaro.org> References: <20180801075820.3753-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 1073ef56a95d..370d7d8ff27f 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