From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BCCCC433F5 for ; Wed, 17 Nov 2021 11:12:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2158C610D1 for ; Wed, 17 Nov 2021 11:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236676AbhKQLP4 (ORCPT ); Wed, 17 Nov 2021 06:15:56 -0500 Received: from muru.com ([72.249.23.125]:57208 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236674AbhKQLPz (ORCPT ); Wed, 17 Nov 2021 06:15:55 -0500 Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 8A3CB80F0; Wed, 17 Nov 2021 11:13:32 +0000 (UTC) Date: Wed, 17 Nov 2021 13:12:53 +0200 From: Tony Lindgren To: Ard Biesheuvel Cc: Arnd Bergmann , "Russell King (Oracle)" , Guillaume Tucker , linux-omap , Linux ARM , Nicolas Pitre , Kees Cook , Keith Packard , Linus Walleij , Nick Desaulniers , "kernelci@groups.io" Subject: Re: [PATCH v3 7/7] ARM: implement support for vmap'ed stacks Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org * 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! Regards, Tony From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87E0BC433F5 for ; Wed, 17 Nov 2021 11:14:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4EE3061544 for ; Wed, 17 Nov 2021 11:14:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4EE3061544 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=atomide.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=R/5EpM4wddHucxu60wDfI+e9xcbuT9Re381qGWp+l2A=; b=Fi1nWKBeNluFOB hOqXwXISdGRHuL8+KbGpjo8X9sWiee+xzs4CmijPQmbo1DxdelNgSRp9F4WomJoM4GEXL/GwQu/ga lQAoaeDN+xhAKvnouCS7VusAzcIVzvtJ5ye3Y+nRaCHQRccR/7qs9Jdnzf3sr48gnpnokEYooHZN4 XQPAwBL1AMymA9lgBGjHJnMYLDO/wqwS9FBPuG/nwAWWggbq0Jd3EnYGlCDaVgcS181xexFEtiYIr EPpqOO6w6ZELX5IoaXACnu+phstvXMEhd6kLd2pfkGRD7vw/lxhbcgtkhqj0C5KbbnOPdBHeOyiL7 Dnb5oq69zxbKsNjnOwUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnIs9-004Ypy-C1; Wed, 17 Nov 2021 11:13:01 +0000 Received: from muru.com ([72.249.23.125]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnIs5-004Ypd-6k for linux-arm-kernel@lists.infradead.org; Wed, 17 Nov 2021 11:12:58 +0000 Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 8A3CB80F0; Wed, 17 Nov 2021 11:13:32 +0000 (UTC) Date: Wed, 17 Nov 2021 13:12:53 +0200 From: Tony Lindgren To: Ard Biesheuvel Cc: Arnd Bergmann , "Russell King (Oracle)" , Guillaume Tucker , linux-omap , Linux ARM , Nicolas Pitre , Kees Cook , Keith Packard , Linus Walleij , Nick Desaulniers , "kernelci@groups.io" Subject: Re: [PATCH v3 7/7] ARM: implement support for vmap'ed stacks Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211117_031257_336629_43BE0B65 X-CRM114-Status: GOOD ( 29.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org * 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! Regards, Tony _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel