All of lore.kernel.org
 help / color / mirror / Atom feed
From: xuwei5@hisilicon.com (Wei Xu)
To: linux-arm-kernel@lists.infradead.org
Subject: KVM guest sometimes failed to boot because of kernel stack overflow if KPTI is enabled on a hisilicon ARM64 platform.
Date: Thu, 21 Jun 2018 00:33:21 +0800	[thread overview]
Message-ID: <5B2A81D1.6070507@hisilicon.com> (raw)
In-Reply-To: <20180620162845.GD27776@arm.com>

Hi Will,

On 2018/6/21 0:28, Will Deacon wrote:
> On Thu, Jun 21, 2018 at 12:25:05AM +0800, Wei Xu wrote:
>> Hi James,
>>
>> On 2018/6/20 23:54, James Morse wrote:
>>> Hi Wei,
>>>
>>> On 20/06/18 16:52, Wei Xu wrote:
>>>> On 2018/6/20 22:42, Will Deacon wrote:
>>>>> Hmm, I wonder if this is at all related to RAS, since we've just enabled
>>>>> that and if we take a fault whilst rewriting swapper then we're going to
>>>>> get stuck. What happens if you set CONFIG_ARM64_RAS_EXTN=n in the guest?
>>>> I will try it now.
>>> It's not just the Kconfig symbol, could you also revert:
>>>
>>> f751daa4f9d3 ("arm64: Unconditionally enable IESB on exception entry/return for
>>> firmware-first")
>>>
>>>
>>> (reverts and build cleanly on 4.17)
>> Thanks to point out this!
>> I have disabled CONFIG_ARM64_RAS_EXTN and reverted that commit.
>> But I still got the stack overflow issue sometimes.
>> Do you have more hint?
> [...]
>
>>      [    0.076797] pstate: 604003c5 (nZCv DAIF +PAN -UAO)
>>      [    0.081727] pc : el1_sync+0x0/0xb0
>>      [    0.085217] lr : kpti_install_ng_mappings+0x120/0x214
> Please run:
>
> $ ./scripts/faddr2line vmlinux kpti_install_ng_mappings+0x120/0x214

Thanks for your kindly guide :)
The output is as below:

     joyx at Turing-Arch-b:~/plinth-kernel-v200$ ./scripts/faddr2line 
../kernel-dev.build/vmlinux kpti_install_ng_mappings+0x120/0x214
     kpti_install_ng_mappings+0x120/0x214:
     cpu_set_reserved_ttbr0 at arch/arm64/include/asm/mmu_context.h:52
     47      /*
     48       * Set TTBR0 to empty_zero_page. No translations will be 
possible via TTBR0.
     49       */
     50      static inline void cpu_set_reserved_ttbr0(void)
     51      {
     52              unsigned long ttbr = 
phys_to_ttbr(__pa_symbol(empty_zero_page));
     53
     54              write_sysreg(ttbr, ttbr0_el1);
     55              isb();
     56      }
     57
     (inlined by) cpu_uninstall_idmap at 
arch/arm64/include/asm/mmu_context.h:123
     118      */
     119     static inline void cpu_uninstall_idmap(void)
     120     {
     121             struct mm_struct *mm = current->active_mm;
     122
     123             cpu_set_reserved_ttbr0();
     124             local_flush_tlb_all();
     125             cpu_set_default_tcr_t0sz();
     126
     127             if (mm != &init_mm && !system_uses_ttbr0_pan())
     128                     cpu_switch_mm(mm->pgd, mm);
     (inlined by) kpti_install_ng_mappings at 
arch/arm64/kernel/cpufeature.c:922
     917
     918             remap_fn = (void 
*)__pa_symbol(idmap_kpti_install_ng_mappings);
     919
     920             cpu_install_idmap();
     921             remap_fn(cpu, num_online_cpus(), 
__pa_symbol(swapper_pg_dir));
     922             cpu_uninstall_idmap();
     923
     924             if (!cpu)
     925                     kpti_applied = true;
     926
     927             return;

Thanks!

Best Regards,
Wei

> as the GDB output wasn't helpful (it only showed local variable
> declarations?!).
>
> Will
>
> .
>

WARNING: multiple messages have this Message-ID (diff)
From: Wei Xu <xuwei5@hisilicon.com>
To: Will Deacon <will.deacon@arm.com>
Cc: James Morse <james.morse@arm.com>, <catalin.marinas@arm.com>,
	<suzuki.poulose@arm.com>, <dave.martin@arm.com>,
	<mark.rutland@arm.com>, <marc.zyngier@arm.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, Linuxarm <linuxarm@huawei.com>,
	Hanjun Guo <guohanjun@huawei.com>, <xiexiuqi@huawei.com>,
	huangdaode <huangdaode@hisilicon.com>,
	"Chenxin (Charles)" <charles.chenxin@huawei.com>,
	"Xiongfanggou (James)" <james.xiong@huawei.com>,
	"Liguozhu (Kenneth)" <liguozhu@hisilicon.com>,
	Zhangyi ac <zhangyi.ac@huawei.com>, <jonathan.cameron@huawei.com>,
	Shameerali Kolothum Thodi  <shameerali.kolothum.thodi@huawei.com>,
	John Garry <john.garry@huawei.com>,
	Salil Mehta <salil.mehta@huawei.com>,
	Shiju Jose <shiju.jose@huawei.com>,
	"Zhuangyuzeng (Yisen)" <yisen.zhuang@huawei.com>,
	"Wangzhou (B)" <wangzhou1@hisilicon.com>,
	"kongxinwei (A)" <kong.kongxinwei@hisilicon.com>,
	"Liyuan (Larry, Turing Solution)" <Larry.T@huawei.com>,
	<libeijian@hisilicon.com>
Subject: Re: KVM guest sometimes failed to boot because of kernel stack overflow if KPTI is enabled on a hisilicon ARM64 platform.
Date: Thu, 21 Jun 2018 00:33:21 +0800	[thread overview]
Message-ID: <5B2A81D1.6070507@hisilicon.com> (raw)
In-Reply-To: <20180620162845.GD27776@arm.com>

Hi Will,

On 2018/6/21 0:28, Will Deacon wrote:
> On Thu, Jun 21, 2018 at 12:25:05AM +0800, Wei Xu wrote:
>> Hi James,
>>
>> On 2018/6/20 23:54, James Morse wrote:
>>> Hi Wei,
>>>
>>> On 20/06/18 16:52, Wei Xu wrote:
>>>> On 2018/6/20 22:42, Will Deacon wrote:
>>>>> Hmm, I wonder if this is at all related to RAS, since we've just enabled
>>>>> that and if we take a fault whilst rewriting swapper then we're going to
>>>>> get stuck. What happens if you set CONFIG_ARM64_RAS_EXTN=n in the guest?
>>>> I will try it now.
>>> It's not just the Kconfig symbol, could you also revert:
>>>
>>> f751daa4f9d3 ("arm64: Unconditionally enable IESB on exception entry/return for
>>> firmware-first")
>>>
>>>
>>> (reverts and build cleanly on 4.17)
>> Thanks to point out this!
>> I have disabled CONFIG_ARM64_RAS_EXTN and reverted that commit.
>> But I still got the stack overflow issue sometimes.
>> Do you have more hint?
> [...]
>
>>      [    0.076797] pstate: 604003c5 (nZCv DAIF +PAN -UAO)
>>      [    0.081727] pc : el1_sync+0x0/0xb0
>>      [    0.085217] lr : kpti_install_ng_mappings+0x120/0x214
> Please run:
>
> $ ./scripts/faddr2line vmlinux kpti_install_ng_mappings+0x120/0x214

Thanks for your kindly guide :)
The output is as below:

     joyx@Turing-Arch-b:~/plinth-kernel-v200$ ./scripts/faddr2line 
../kernel-dev.build/vmlinux kpti_install_ng_mappings+0x120/0x214
     kpti_install_ng_mappings+0x120/0x214:
     cpu_set_reserved_ttbr0 at arch/arm64/include/asm/mmu_context.h:52
     47      /*
     48       * Set TTBR0 to empty_zero_page. No translations will be 
possible via TTBR0.
     49       */
     50      static inline void cpu_set_reserved_ttbr0(void)
     51      {
     52              unsigned long ttbr = 
phys_to_ttbr(__pa_symbol(empty_zero_page));
     53
     54              write_sysreg(ttbr, ttbr0_el1);
     55              isb();
     56      }
     57
     (inlined by) cpu_uninstall_idmap at 
arch/arm64/include/asm/mmu_context.h:123
     118      */
     119     static inline void cpu_uninstall_idmap(void)
     120     {
     121             struct mm_struct *mm = current->active_mm;
     122
     123             cpu_set_reserved_ttbr0();
     124             local_flush_tlb_all();
     125             cpu_set_default_tcr_t0sz();
     126
     127             if (mm != &init_mm && !system_uses_ttbr0_pan())
     128                     cpu_switch_mm(mm->pgd, mm);
     (inlined by) kpti_install_ng_mappings at 
arch/arm64/kernel/cpufeature.c:922
     917
     918             remap_fn = (void 
*)__pa_symbol(idmap_kpti_install_ng_mappings);
     919
     920             cpu_install_idmap();
     921             remap_fn(cpu, num_online_cpus(), 
__pa_symbol(swapper_pg_dir));
     922             cpu_uninstall_idmap();
     923
     924             if (!cpu)
     925                     kpti_applied = true;
     926
     927             return;

Thanks!

Best Regards,
Wei

> as the GDB output wasn't helpful (it only showed local variable
> declarations?!).
>
> Will
>
> .
>



  reply	other threads:[~2018-06-20 16:33 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20 14:18 KVM guest sometimes failed to boot because of kernel stack overflow if KPTI is enabled on a hisilicon ARM64 platform Wei Xu
2018-06-20 14:18 ` Wei Xu
2018-06-20 14:42 ` Will Deacon
2018-06-20 14:42   ` Will Deacon
2018-06-20 15:52   ` Wei Xu
2018-06-20 15:52     ` Wei Xu
2018-06-20 15:54     ` James Morse
2018-06-20 15:54       ` James Morse
2018-06-20 16:25       ` Wei Xu
2018-06-20 16:25         ` Wei Xu
2018-06-20 16:28         ` Will Deacon
2018-06-20 16:28           ` Will Deacon
2018-06-20 16:33           ` Wei Xu [this message]
2018-06-20 16:33             ` Wei Xu
2018-06-21  8:38         ` James Morse
2018-06-21  8:38           ` James Morse
2018-06-21  9:00           ` Marc Zyngier
2018-06-21  9:00             ` Marc Zyngier
2018-06-21  9:18           ` Will Deacon
2018-06-21  9:18             ` Will Deacon
2018-06-21 10:14             ` Wei Xu
2018-06-21 10:14               ` Wei Xu
2018-06-21 10:54               ` Will Deacon
2018-06-21 10:54                 ` Will Deacon
2018-06-22  8:33                 ` Wei Xu
2018-06-22  8:33                   ` Wei Xu
2018-06-22  9:23                   ` Will Deacon
2018-06-22  9:23                     ` Will Deacon
2018-06-22 10:45                     ` Wei Xu
2018-06-22 10:45                       ` Wei Xu
2018-06-22 11:16                       ` Will Deacon
2018-06-22 11:16                         ` Will Deacon
2018-06-22 13:18                         ` Wei Xu
2018-06-22 13:18                           ` Wei Xu
2018-06-22 13:31                           ` Will Deacon
2018-06-22 13:31                             ` Will Deacon
2018-06-22 13:46                             ` Wei Xu
2018-06-22 13:46                               ` Wei Xu
2018-06-22 14:43                               ` Will Deacon
2018-06-22 14:43                                 ` Will Deacon
2018-06-22 15:26                                 ` Wei Xu
2018-06-22 15:26                                   ` Wei Xu
2018-06-22 14:28                           ` Mark Rutland
2018-06-22 14:28                             ` Mark Rutland
2018-06-22 15:28                             ` Wei Xu
2018-06-22 15:28                               ` Wei Xu
2018-06-22 15:41                               ` Will Deacon
2018-06-22 15:41                                 ` Will Deacon
2018-06-22 16:02                                 ` Wei Xu
2018-06-22 16:02                                   ` Wei Xu
2018-06-21  9:20           ` Wei Xu
2018-06-21  9:20             ` Wei Xu
2018-06-26 17:16             ` Wei Xu
2018-06-26 17:16               ` Wei Xu
2018-06-26 17:47               ` Will Deacon
2018-06-26 17:47                 ` Will Deacon
2018-06-27  8:39                 ` James Morse
2018-06-27  8:39                   ` James Morse
2018-06-27 13:26                   ` Wei Xu
2018-06-27 13:26                     ` Wei Xu
2018-06-28  8:45                     ` James Morse
2018-06-28  8:45                       ` James Morse
2018-06-28 10:20                       ` Wei Xu
2018-06-28 10:20                         ` Wei Xu
2018-06-27 13:22                 ` Wei Xu
2018-06-27 13:22                   ` Wei Xu
2018-06-27 13:28                   ` Will Deacon
2018-06-27 13:28                     ` Will Deacon
2018-06-27 13:32                     ` Wei Xu
2018-06-27 13:32                       ` Wei Xu
2018-06-28 14:50                     ` Wei Xu
2018-06-28 14:50                       ` Wei Xu
2018-06-28 15:34                       ` Mark Rutland
2018-06-28 15:34                         ` Mark Rutland
     [not found]                         ` <etPan.5b3507f7.914aa16.1d6b@localhost>
2018-06-28 16:24                           ` 答复: " Mark Rutland
2018-06-28 16:24                             ` Mark Rutland
2018-06-29  9:59                             ` Mark Rutland
2018-06-29  9:59                               ` Mark Rutland
2018-06-29  8:47                           ` Marc Zyngier

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=5B2A81D1.6070507@hisilicon.com \
    --to=xuwei5@hisilicon.com \
    --cc=linux-arm-kernel@lists.infradead.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.