Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2715347imu; Tue, 6 Nov 2018 21:02:57 -0800 (PST) X-Google-Smtp-Source: AJdET5epkf+5e6Wb+VovYzo3JxNeYbOyKuRhFDNznchIRY7gM4GYIhFTS1FGwtJoUaSJeYxD+jHG X-Received: by 2002:a63:6045:: with SMTP id u66mr435654pgb.204.1541566977183; Tue, 06 Nov 2018 21:02:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541566977; cv=none; d=google.com; s=arc-20160816; b=bMjBCYRZNOK5C9WRuXIj1iXNfg4I4sCBIQ6cJVYqEqfjOyHDdSoNc1Ai9Fe3u+/2vp 2o+8Jhbp0wVxQgrysz8t3GlnzXP14PQMmbdn1VaEdmupbyLLe3fWKIU3yVq2HrkuUt+Y YDsKQRsnwDq4orkAGC/d5LYr2VrogY3lz7B9Sm+O8cbuSlLn3DxMZVsotrhxcfYCFfiD UIJbnbYehTzLS9VuRdgEAjdd98qmuvTGJnUnnXrttJTrhSpEOn2nRrmZ3n8VHGY4SG9v +eBLpG0Zzh/xlZ5H5ot8qlZ6F9kVcjcxJYssP1vxMLuO+rqkDVp0zLA0MPv0shIKW+7Z QTlg== 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=XBSXTqcFfSWwIV4M/hvTm8fCwum+5/cwdPs+t+PRY30=; b=OG6bAyI7caY9x6FJ5b+nRKzoW2bucIBEJBzRod0cskc6CbRPUuFTrEQ6FX5ASxpXR8 V2LBxpuzNC/NUZJCTURh0Eta4EvFpxCLjJ0QzFFGbqEmoVcmJg5BwmksUgf5nWeey+kS qvTrtjZvsMT8QiDwzK7+uOmYRxijXSzCDWGDEPuZP11ZG44bg6wp4SxvoJcoPBOqSGy6 uTQAGHn7QBPCPk0MW5ZxRO49KnVD65TssGRpsZ3YK9SUY1UXlynZre9zdLFiLZy6biVg cfn0eZg+5WzbayJIg5m/ZecAygGPP3jbMgdo9bvHB9L0DKRY93enfCw5BjsyO26DW2vd EplA== 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 a10-v6si11596216pfh.223.2018.11.06.21.02.42; Tue, 06 Nov 2018 21:02:57 -0800 (PST) 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 S2388971AbeKGO3c (ORCPT + 99 others); Wed, 7 Nov 2018 09:29:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44272 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387848AbeKGO3c (ORCPT ); Wed, 7 Nov 2018 09:29:32 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE0A03082E07; Wed, 7 Nov 2018 05:00:48 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-12-97.pek2.redhat.com [10.72.12.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5B0F1711B; Wed, 7 Nov 2018 05:00:33 +0000 (UTC) From: Lianbo Jiang To: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org, x86@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, akpm@linux-foundation.org, dyoung@redhat.com, bhe@redhat.com Subject: [PATCH 1/2 v5] x86/kexec_file: add e820 entry in case e820 type string matches to io resource name Date: Wed, 7 Nov 2018 13:00:18 +0800 Message-Id: <20181107050019.6663-2-lijiang@redhat.com> In-Reply-To: <20181107050019.6663-1-lijiang@redhat.com> References: <20181107050019.6663-1-lijiang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 07 Nov 2018 05:00:49 +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 50895c2f937d..4c1fe4f8db1e 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -1011,7 +1011,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 b3a3a1fc499e..6285a6b4de6c 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -366,6 +366,7 @@ static int find_next_iomem_res(resource_size_t start, resource_size_t end, res->end = min(end, p->end); res->flags = p->flags; res->desc = p->desc; + res->name = p->name; return 0; } -- 2.17.1