All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xunlei Pang <xpang@redhat.com>
To: Ingo Molnar <mingo@kernel.org>, xlpang@redhat.com
Cc: Yinghai Lu <yinghai@kernel.org>,
	x86@kernel.org, kexec@lists.infradead.org,
	linux-kernel@vger.kernel.org, Borislav Petkov <bp@alien8.de>,
	Eric Biederman <ebiederm@xmission.com>,
	Andy Lutomirski <luto@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	akpm@linux-foundation.org, Dave Young <dyoung@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v3 2/2] x86_64/kexec: Use PUD level 1GB page for identity mapping if available
Date: Fri, 5 May 2017 18:50:58 +0800	[thread overview]
Message-ID: <590C5912.80202@redhat.com> (raw)
In-Reply-To: <20170505092046.2qu72pdherfxjmec@gmail.com>

On 05/05/2017 at 05:20 PM, Ingo Molnar wrote:
> * Xunlei Pang <xpang@redhat.com> wrote:
>
>> On 05/05/2017 at 02:52 PM, Ingo Molnar wrote:
>>> * Xunlei Pang <xlpang@redhat.com> 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.

Regards,
Xunlei


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

WARNING: multiple messages have this Message-ID (diff)
From: Xunlei Pang <xpang@redhat.com>
To: Ingo Molnar <mingo@kernel.org>, xlpang@redhat.com
Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
	akpm@linux-foundation.org, Eric Biederman <ebiederm@xmission.com>,
	Dave Young <dyoung@redhat.com>,
	x86@kernel.org, Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Yinghai Lu <yinghai@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH v3 2/2] x86_64/kexec: Use PUD level 1GB page for identity mapping if available
Date: Fri, 5 May 2017 18:50:58 +0800	[thread overview]
Message-ID: <590C5912.80202@redhat.com> (raw)
In-Reply-To: <20170505092046.2qu72pdherfxjmec@gmail.com>

On 05/05/2017 at 05:20 PM, Ingo Molnar wrote:
> * Xunlei Pang <xpang@redhat.com> wrote:
>
>> On 05/05/2017 at 02:52 PM, Ingo Molnar wrote:
>>> * Xunlei Pang <xlpang@redhat.com> 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.

Regards,
Xunlei

  reply	other threads:[~2017-05-05 10:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-04  1:42 [PATCH v3 1/2] x86/mm/ident_map: Add PUD level 1GB page support Xunlei Pang
2017-05-04  1:42 ` Xunlei Pang
2017-05-04  1:42 ` [PATCH v3 2/2] x86_64/kexec: Use PUD level 1GB page for identity mapping if available Xunlei Pang
2017-05-04  1:42   ` Xunlei Pang
2017-05-05  6:52   ` Ingo Molnar
2017-05-05  6:52     ` Ingo Molnar
2017-05-05  7:32     ` Xunlei Pang
2017-05-05  7:32       ` Xunlei Pang
2017-05-05  9:20       ` Ingo Molnar
2017-05-05  9:20         ` Ingo Molnar
2017-05-05 10:50         ` Xunlei Pang [this message]
2017-05-05 10:50           ` Xunlei Pang
2017-05-08  6:29           ` Ingo Molnar
2017-05-08  6:29             ` Ingo Molnar
2017-05-08  7:24             ` Xunlei Pang
2017-05-08  7:24               ` Xunlei Pang
2017-05-08  8:01   ` [tip:x86/urgent] x86/kexec/64: Use gbpages for identity mappings " tip-bot for Xunlei Pang
2017-05-08  8:01 ` [tip:x86/urgent] x86/mm: Add support for gbpages to kernel_ident_mapping_init() tip-bot for Xunlei Pang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=590C5912.80202@redhat.com \
    --to=xpang@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=hpa@zytor.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xlpang@redhat.com \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.