From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753116AbdEHHXc (ORCPT ); Mon, 8 May 2017 03:23:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39564 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750797AbdEHHXb (ORCPT ); Mon, 8 May 2017 03:23:31 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3B28F80056 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=xpang@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3B28F80056 Reply-To: xlpang@redhat.com Subject: Re: [PATCH v3 2/2] x86_64/kexec: Use PUD level 1GB page for identity mapping if available References: <1493862171-8799-1-git-send-email-xlpang@redhat.com> <1493862171-8799-2-git-send-email-xlpang@redhat.com> <20170505065253.s5yv7c2cxgfcf4i3@gmail.com> <590C2A96.3090106@redhat.com> <20170505092046.2qu72pdherfxjmec@gmail.com> <590C5912.80202@redhat.com> <20170508062932.bzg6ck5efarvzqlt@gmail.com> To: Ingo Molnar , xlpang@redhat.com Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org, akpm@linux-foundation.org, Eric Biederman , Dave Young , x86@kernel.org, Borislav Petkov , Thomas Gleixner , Yinghai Lu , "H. Peter Anvin" , Andy Lutomirski From: Xunlei Pang Message-ID: <59101D3B.2030606@redhat.com> Date: Mon, 8 May 2017 15:24:43 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20170508062932.bzg6ck5efarvzqlt@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 08 May 2017 07:23:30 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/08/2017 at 02:29 PM, Ingo Molnar wrote: > * Xunlei Pang wrote: > >> On 05/05/2017 at 05:20 PM, Ingo Molnar wrote: >>> * Xunlei Pang wrote: >>> >>>> On 05/05/2017 at 02:52 PM, Ingo Molnar wrote: >>>>> * Xunlei Pang wrote: >>>>> >>>>>> @@ -122,6 +122,10 @@ static int init_pgtable(struct kimage *image, unsigned long start_pgtable) >>>>>> >>>>>> level4p = (pgd_t *)__va(start_pgtable); >>>>>> clear_page(level4p); >>>>>> + >>>>>> + if (direct_gbpages) >>>>>> + info.direct_gbpages = true; >>>>> No, this should be keyed off the CPU feature (X86_FEATURE_GBPAGES) automatically, >>>>> not set blindly! AFAICS this patch will crash kexec on any CPU that does not >>>>> support gbpages. >>>> It should be fine, probe_page_size_mask() already takes care of this: >>>> if (direct_gbpages && boot_cpu_has(X86_FEATURE_GBPAGES)) { >>>> printk(KERN_INFO "Using GB pages for direct mapping\n"); >>>> page_size_mask |= 1 << PG_LEVEL_1G; >>>> } else { >>>> direct_gbpages = 0; >>>> } >>>> >>>> So if X86_FEATURE_GBPAGES is not supported, direct_gbpages will be set to 0. >>> So why is the introduction of the info.direct_gbpages flag necessary? AFAICS it >>> just duplicates the kernel's direct_gbpages flag. One outcome is that hibernation >>> won't use gbpages, which is silly. >> boot/compressed/pagetable.c also uses kernel_ident_mapping_init() for kaslr, at >> the moment we don't have "direct_gbpages" definition or X86_FEATURE_GBPAGES >> feature detection. >> >> I thought that we can change the other call sites when found really needed. > Ok, you are right - I'll use the original patches as submitted, with the updated > changelogs. Thanks! Regards, Xunlei