Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp29245ybm; Tue, 21 May 2019 21:53:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFjW8HKygf5A4erFe/HQmS5l73atYaXxuw668+C/WfqCo9zTmINuIPDILr0T6Ud8WZRmQO X-Received: by 2002:a65:5684:: with SMTP id v4mr87571833pgs.160.1558500783230; Tue, 21 May 2019 21:53:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558500783; cv=none; d=google.com; s=arc-20160816; b=L+Uy5TDbERMD0dHrQJKCWGCuSydXt/57T05BrBklvYdepSL0RtvcfftogB+VbZzMlc kaQG6UNGSxSbLkw2hIrFiDvRErjiqpiCaTBDCVvuoMOuB3ToSUc6huIKL4rTBfWrIB6M FM7ctIS/SIut2qV2k6XbZeoN+SDLeyFbqGvQUuk5kAzBvI3Mhhie3m56Q87/zWX6gBHD v7smpdf+HLLPZJUoWqmYo+GDANqxCxNmvnlQJ0cbUj/ryW2EZrqsLhZa2Nlz6tVj5xtW zdwEAIyMiwchyUKiJa1etFZkCtnGQt1RTA8H+HCtPLK5q9Puen97gGkraiR+6UEQuSaB Uxcw== 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=VRzvJEjwIne3cAmXyurfYkCTOcTYaCSG7eKCWbHri2M=; b=Lf/PjQ4tA2nwauDZ2RRl+HoKWcS4SRTkOuk/RRPcisaROJNKMJ+vNmdsYL1cDyvvq1 QH56qylSdhPrT11DsJKZqAJWXwCtQAvZl92AFm0rB+ryLVFzRDSKbQ0JYZfVSgYfAseJ N4j1dSOAZom/dyy0ymvKb588xt7cahd4b/9PkagjVnFY2g5Ax19CTPwapVrttiwns7HV 9/T1h232AgVbDWgW+wTcSA83R87IeaBBFbJBLqYAO3x0V///92aM/p1+4D4nt/ldtoHh RH3Kl712Crto28C5PvY0EV0K3Q9PhfMRO6iPuDT+hvT4BU25dHs5QdQUMjVeivbrkazU sT7w== 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 x125si24725980pgx.355.2019.05.21.21.52.47; Tue, 21 May 2019 21:53:03 -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 S1726770AbfEVEuk (ORCPT + 99 others); Wed, 22 May 2019 00:50:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47242 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725796AbfEVEuk (ORCPT ); Wed, 22 May 2019 00:50:40 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA5013082B15; Wed, 22 May 2019 04:50:39 +0000 (UTC) Received: from localhost (ovpn-12-45.pek2.redhat.com [10.72.12.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1DD5927CD6; Wed, 22 May 2019 04:50:36 +0000 (UTC) Date: Wed, 22 May 2019 12:50:33 +0800 From: Baoquan He To: Dave Young Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@kernel.org, bp@alien8.de, hpa@zytor.com, kirill.shutemov@linux.intel.com, x86@kernel.org Subject: Re: [PATCH v4 2/3] x86/kexec/64: Error out if try to jump to old 4-level kernel from 5-level kernel Message-ID: <20190522045033.GC3805@MiWiFi-R3L-srv> References: <20190509013644.1246-1-bhe@redhat.com> <20190509013644.1246-3-bhe@redhat.com> <20190522032029.GB31269@dhcp-128-65.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190522032029.GB31269@dhcp-128-65.nay.redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 22 May 2019 04:50:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/22/19 at 11:20am, Dave Young wrote: > How about the userspace kexec-tools? It needs a similar detection, but > I'm not sure how to detect paging mode, maybe some sysfs entry or > vmcoreinfo in /proc/vmcore In usersapce, I plan to parse /proc/kcore to get the starting address of page_offset or vmalloc. You can see the different level has different value range. 4-level: ffff888000000000 | -119.5 TB | ffffc87fffffffff | 64 TB | direct mapping of all physical memory (page_offset_base) ffffc88000000000 | -55.5 TB | ffffc8ffffffffff | 0.5 TB | ... unused hole ffffc90000000000 | -55 TB | ffffe8ffffffffff | 32 TB | vmalloc/ioremap space (vmalloc_base) ffffe90000000000 | -23 TB | ffffe9ffffffffff | 1 TB | ... unused hole ffffea0000000000 | -22 TB | ffffeaffffffffff | 1 TB | virtual memory map (vmemmap_base) 5-level: ff11000000000000 | -59.75 PB | ff90ffffffffffff | 32 PB | direct mapping of all physical memory (page_offset_base) ff91000000000000 | -27.75 PB | ff9fffffffffffff | 3.75 PB | ... unused hole ffa0000000000000 | -24 PB | ffd1ffffffffffff | 12.5 PB | vmalloc/ioremap space (vmalloc_base) ffd2000000000000 | -11.5 PB | ffd3ffffffffffff | 0.5 PB | ... unused hole ffd4000000000000 | -11 PB | ffd5ffffffffffff | 0.5 PB | virtual memory map (vmemmap_base) > > > > 1 file changed, 5 insertions(+) > > > > diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c > > index 22f60dd26460..858cc892672f 100644 > > --- a/arch/x86/kernel/kexec-bzimage64.c > > +++ b/arch/x86/kernel/kexec-bzimage64.c > > @@ -321,6 +321,11 @@ static int bzImage64_probe(const char *buf, unsigned long len) > > return ret; > > } > > > > + if (!(header->xloadflags & XLF_5LEVEL) && pgtable_l5_enabled()) { > > + pr_err("Can not jump to old 4-level kernel from 5-level kernel.\n"); > > 4-level kernel sounds not very clear, maybe something like below? > > "5-level paging enabled, can not kexec into an old kernel without 5-level > paging facility"? Oops, tglx commented on this message. He suggested changing it like: "bzImage cannot handle 5-level paging mode\n" I forgot updating this part. Any one is fine to me. Will update. Thanks Baoquan