Subject: Re: [PATCH v3 7/7] ARM: implement support for vmap'ed stacks References: From: "Guillaume Tucker" Message-ID: Date: Wed, 17 Nov 2021 14:03:59 +0000 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-ID: To: Ard Biesheuvel , Tony Lindgren Cc: Arnd Bergmann , "Russell King (Oracle)" , linux-omap , Linux ARM , Nicolas Pitre , Kees Cook , Keith Packard , Linus Walleij , Nick Desaulniers , "kernelci@groups.io" On 17/11/2021 11:13, Ard Biesheuvel wrote: > On Wed, 17 Nov 2021 at 12:12, Tony Lindgren wrote: >> >> * Ard Biesheuvel [211117 10:49]: >>> On Wed, 17 Nov 2021 at 10:08, Ard Biesheuvel wrote: >>>> >>>> On Wed, 17 Nov 2021 at 10:07, Arnd Bergmann wrote: >>>>> >>>>> On Wed, Nov 17, 2021 at 10:03 AM Arnd Bergmann wrote: >>>>>> >>>>>> On Wed, Nov 17, 2021 at 9:36 AM Tony Lindgren wrote: >>>>>>> * Ard Biesheuvel [211117 08:29]: >>>>>>>> >>>>>>>> Thanks Tony, that is very helpful. I have a Beaglebone white somewhere >>>>>>>> so I'll try and reproduce it locally as well. >>>>>>> >>>>>>> I think with Beaglebone you may hit this only with suspend/resume if at >>>>>>> all. On am335x cpuidle is not shutting down the CPU. And only some models >>>>>>> will suspend to deeper idle states as it depends on the PMIC. >>>>>>> >>>>>>> If you have some test patch to try, just let me know. >>>>>> >>>>>> I looked at how the sleep code is called and found that cpu_suspend()/ >>>>>> __cpu_suspend() has interesting manipulation of the stack pointer to >>>>>> call the platform specific function with a simple 1:1 page table, >>>>>> I would expect the problem somewhere in there, haven't pinpointed >>>>>> the exact line yet, but if any of that code tries to local the physical >>>>>> address of the stack using virt_to_phys or its asm equivalent, this >>>>>> fails for a vmap stack. >>>>> >>>>> and just after sending this I see >>>>> >>>>> void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr) >>>>> { >>>>> *save_ptr = virt_to_phys(ptr); >>>>> >>>>> 'ptr' is a pointer to the stack here. It might not be the only place that >>>>> needs fixing, but this clearly has to do a page table walk like >>>>> vmalloc_to_page() does to get to the correct physical address. >>>>> >>>> >>>> I had just arrived at the same conclusion. I'll fix this up and drop >>>> it in kernelci. >>> >>> Updated branch here: >>> https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git/commit/?h=arm-vmap-stacks-v4 >> >> Great that branch boots for me! >> > > Thanks for testing! Tested-by: "kernelci.org bot" https://staging.kernelci.org/test/plan/id/6194fd2f85155923f71760ce/ Guillaume