Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp327745imm; Fri, 21 Sep 2018 00:33:24 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZyqv+cmsnI+cZwMJX1tVPBGZFNcfwHnNvvLiXEsdlzgwwL61mE04SApcoxbEQbfND9jv6r X-Received: by 2002:a17:902:6b0b:: with SMTP id o11-v6mr42913931plk.214.1537515204046; Fri, 21 Sep 2018 00:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537515204; cv=none; d=google.com; s=arc-20160816; b=qzQXD4YGdQyxHNuU+AVLBit+RTsiyY+gpa6cLHkhkXpTRPxrcFv8QsZy9DcVcK5zqI 4rXE2pb886E9Zeih/8AWgrAevaGLAzfG8qafkbTloHEWuMENB5P2t2+YVaE27JJ9FDK/ H5rs/3aKvbvpXyRVCjeEh1yg7phLsAx4k1hxSrfWXjwReboXw1zGDOxsOVFfZfD1T3S1 bS3kkkQv/Wsyg32qoYhiGeEooNBkFya/ZhxpV9bhk6q8Z3NcyTIiEnPHf3ggMyvBeu1e ppAjlDmtvVJfEAYYDwbvXmV0DmkQkLIJ+8cckw/c5U7xwFz7v10NHDSKwvD8ZIpkX/Z4 y+0Q== 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; bh=CNWHrmPjfbolk8txMCYs4ZrCy9RQQeic/YFfVEou1sQ=; b=l66Bi79kOFk1bgtahPRSOcnrb7nH3aLc2VL94DsnQUO6BxAAAh+Hh6XUlEe6naseK8 9UFw7ztKw4+hbCla0xejyue8lPPJWSfBd91cyBoP+fziNZJQDjW0lqkVJqE+AAY/sy7R +uKgBA2zFWpQ5O8+/j5Iz/O3Fhx0mh0LBd/9UrRoHTwZZNHL53EFxdIe+0w5g8GwDMOY smeqIgh6TfnkHizUKHnzTHpqT4OCAkQuTXS9EWKnWvpmGEaWFIMyUgXb+WAMnxCg14yU wcWF1WhGSZMX+qRqPH72P19cePKTdEoo9lkRVB29o82oSBSfwR19Tqt9TstpIs9FPb+I zkrg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o20-v6si28055623pgn.66.2018.09.21.00.33.07; Fri, 21 Sep 2018 00:33:24 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389500AbeIUNUc (ORCPT + 99 others); Fri, 21 Sep 2018 09:20:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43182 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389398AbeIUNUc (ORCPT ); Fri, 21 Sep 2018 09:20:32 -0400 Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 874CB3082A2C; Fri, 21 Sep 2018 07:32:56 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-12-74.pek2.redhat.com [10.72.12.74]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4493589AF5; Fri, 21 Sep 2018 07:32:42 +0000 (UTC) From: Lianbo Jiang To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, akpm@linux-foundation.org, dan.j.williams@intel.com, thomas.lendacky@amd.com, bhelgaas@google.com, baiyaowei@cmss.chinamobile.com, tiwai@suse.de, bp@suse.de, brijesh.singh@amd.com, dyoung@redhat.com, bhe@redhat.com Subject: [PATCH 2/3 v3] x86/kexec_file: add e820 entry in case e820 type string matches to io resource name Date: Fri, 21 Sep 2018 15:32:10 +0800 Message-Id: <20180921073211.20097-3-lijiang@redhat.com> In-Reply-To: <20180921073211.20097-1-lijiang@redhat.com> References: <20180921073211.20097-1-lijiang@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 21 Sep 2018 07:32:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kdump uses walk_iomem_res_desc() to iterate io resources, then adds matched desc to e820 table for kdump kernel. But IORES_DESC_NONE resource type includes several different e820 types, we need add exact e820 type to kdump kernel e820 table, thus it also needs an extra checking in memmap_entry_callback() to match the e820 type and resource name. Suggested-by: Dave Young Signed-off-by: Lianbo Jiang --- arch/x86/include/asm/e820/api.h | 2 ++ arch/x86/kernel/crash.c | 6 +++++- arch/x86/kernel/e820.c | 2 +- kernel/resource.c | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/e820/api.h b/arch/x86/include/asm/e820/api.h index 62be73b23d5c..6d5451b36e80 100644 --- a/arch/x86/include/asm/e820/api.h +++ b/arch/x86/include/asm/e820/api.h @@ -42,6 +42,8 @@ extern void e820__register_nosave_regions(unsigned long limit_pfn); extern int e820__get_entry_type(u64 start, u64 end); +extern const char *e820_type_to_string(struct e820_entry *entry); + /* * Returns true iff the specified range [start,end) is completely contained inside * the ISA region. diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index f631a3f15587..ae724a6e0a5f 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -37,6 +37,7 @@ #include #include #include +#include /* Used while preparing memory map entries for second kernel */ struct crash_memmap_data { @@ -314,11 +315,14 @@ static int memmap_entry_callback(struct resource *res, void *arg) struct crash_memmap_data *cmd = arg; struct boot_params *params = cmd->params; struct e820_entry ei; + const char *name; ei.addr = res->start; ei.size = resource_size(res); ei.type = cmd->type; - add_e820_entry(params, &ei); + name = e820_type_to_string(&ei); + if (res->name && !strcmp(name, res->name)) + add_e820_entry(params, &ei); return 0; } diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index c88c23c658c1..f9761b2f7abb 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -1012,7 +1012,7 @@ void __init e820__finish_early_params(void) } } -static const char *__init e820_type_to_string(struct e820_entry *entry) +const char *e820_type_to_string(struct e820_entry *entry) { switch (entry->type) { case E820_TYPE_RESERVED_KERN: /* Fall-through: */ diff --git a/kernel/resource.c b/kernel/resource.c index f5d9fc70a04c..cc90633f35f9 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -366,6 +366,7 @@ static int find_next_iomem_res(struct resource *res, unsigned long desc, res->end = p->end; res->flags = p->flags; res->desc = p->desc; + res->name = p->name; return 0; } -- 2.17.1