Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp406677imu; Thu, 8 Nov 2018 22:53:48 -0800 (PST) X-Google-Smtp-Source: AJdET5dYOZIpxJwTFcqxwRXjDoSx2297dKbWStDLZxf/OB3VK2/sk7ett57GC8LTWWIVLunAO+nx X-Received: by 2002:a62:8647:: with SMTP id x68-v6mr8154779pfd.252.1541746428212; Thu, 08 Nov 2018 22:53:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541746428; cv=none; d=google.com; s=arc-20160816; b=rO0ZQltqFy0dPV3w7+Ie4qtsuPb/OJekknHcLR9c4Q2NYHdhOUaFm9M2/GqhEC+GIl KgY9IrABtidbeeC/sBzRaJqH3ZNBYXPHdBds2u0dePbuT3AnC3sRfg8HoNGSGdFebQMU M26G9is0tfv+KKfQCxHilhy+I6BljCQGFrB0eLXp7pIj6jLVntck+GU/ZV9qY/X1y4C8 AMNeucIEmm6AUUHEGzbuDv3Bd9QlZm0vPjRjJgH4oAB+IEPYLBA5OxxkZUm7bYtQIAdd e2yN55ksnY6bXPBIq6KE9xlWsKpNl8h5ziyWxXdKEkjeWjPvLSebAkzBnPUX9Tcg4Akf a/XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=3mvW4xYFY+KlVgsqbqVIt/AP5p6zzMiHKiJQa0xNzOk=; b=Wrphia8fBZfD0N0GmctAbwQ0/ENkrYUciVQdKBCg5uKKoz2O32WiVB2pM8Q37bHCfw 2U+WCVUxfH0kNA2oBuqxi2BD/CQuI5EJDWUG/94e/m9y1YXZYf93HdUKwagN+rOwJ+/v ifumUmVaiLM3GYK+z/ogyT5tNsdCTW4tby4ozjFEWrDKcVBr+pzw3PuF8D/xYphYOEoK J6EmjGWTH2sZStdJYzJWzJEjinWyLCauzQczA9sgmm92WriiMowBEvqtL2Zv9q4jQ5FE jG5tXi9U6EXTVeGmtuqsmT3GVYnyYhzmpIcC/dRnMGM10boNpFwcCDwZjGwtXsP1P8zc gIrg== 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 b18si6409386pgj.399.2018.11.08.22.53.31; Thu, 08 Nov 2018 22:53:48 -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 S1727869AbeKIQbC (ORCPT + 99 others); Fri, 9 Nov 2018 11:31:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55074 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727668AbeKIQbC (ORCPT ); Fri, 9 Nov 2018 11:31:02 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 434ED307CDE6; Fri, 9 Nov 2018 06:51:52 +0000 (UTC) Received: from localhost (ovpn-8-16.pek2.redhat.com [10.72.8.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7EEF1601A2; Fri, 9 Nov 2018 06:51:49 +0000 (UTC) Date: Fri, 9 Nov 2018 14:51:46 +0800 From: Baoquan He To: lijiang Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org, x86@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, akpm@linux-foundation.org, dyoung@redhat.com Subject: Re: [PATCH 2/2 v5] x86/kexec_file: add reserved e820 ranges to kdump kernel e820 table Message-ID: <20181109065146.GD31064@MiWiFi-R3L-srv> References: <20181107050019.6663-1-lijiang@redhat.com> <20181107050019.6663-3-lijiang@redhat.com> <20181107052345.GQ27491@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 09 Nov 2018 06:51:52 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/07/18 at 05:10pm, lijiang wrote: > In fact, these patches are really simple. As the subject mentioned, this patch > [PATCH 2/2] adds the reserved e820 ranges to kdump kernel e820 table, and the > first patch [PATCH 1/2] helps to exactly add the e820(E820_TYPE_RESERVED) type > to kdump kernel e820 table, that is to say, it will filter out some unnecessary > type(E820_TYPE_RAM/E820_TYPE_UNUSABLE/E820_TYPE_RESERVED_KERN). > > At present, when we use the kexec to load the kernel image and initramfs(for > example: kexec -s -p xxxx), the latest kernel does not pass the e820 reserved > ranges to the second kernel, which might produce two problems: > > The first one is the MMCONFIG issue, although which does not make the system > crash or hang, this issue is still a potential risk, because my test can't > cover all cases due to resource constraints(Machine), and i'm not sure what > it will happen on other machine. > > The second issue is that the e820 reserved ranges do not setup in kdump kernel, > which will cause some functions which are related to the e820 reserved ranges > to become invalid. For example: > > early_memremap()-> > early_memremap_pgprot_adjust()-> > memremap_should_map_decrypted()-> > e820__get_entry_type() > > Please focus on these functions, early_memremap_pgprot_adjust() and memremap_should_map_decrypted(). > > In the first kernel, these ranges sit in e820 reserved ranges, so the memremap_should_map_decrypted() > will return true, that is to say, the reserved memory is decrypted, then the early_memremap_pgprot_adjust() > will call the pgprot_decrypted() to clear the memory encryption mask. > > In the second kernel, because the e820 reserved ranges are not passed to the second kernel, these ranges > don't sit in the e820 reserved ranges, so the the memremap_should_map_decrypted() will return false, that > is to say, the reserved memory is encrypted, and then the early_memremap_pgprot_adjust() will also call the > pgprot_encrypted() to set the memory encryption mask. > > Obviously, in the second kernel, the e820 reserved memory is still decrypted, it has gone wrong. So, if > don't fix, kdump won't work when we use the command(kexec -s -p xxx) to load the kernel image and initramfs. Yes, this looks better. In fact, I searched cover-letter and both patch lg, didn't find anything to tell what will happen without these patchset. We should at least tell the patch is for cleanup/improvement/fix/feature. This "if don't fix, kdump won't work ..." is the sentence I first saw telling the sequence or the problem. Please do not misunderstand those questions from me with unfriendly tone, words are cold and can't express emotions exactly, and appearance. Those questions are just meaning that people may get confusion from those places. What: describe the problem you met. Why: tell the root cause How: how you fix it This is what I usually use to write patch log. Just for your reference. Thanks Baoquan