From patchwork Sat May 7 02:54:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henry Wang X-Patchwork-Id: 12841832 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5973CC433EF for ; Sat, 7 May 2022 02:55:13 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.323536.545249 (Exim 4.92) (envelope-from ) id 1nnAam-0003pd-Rx; Sat, 07 May 2022 02:54:48 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 323536.545249; Sat, 07 May 2022 02:54:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nnAam-0003pW-Ox; Sat, 07 May 2022 02:54:48 +0000 Received: by outflank-mailman (input) for mailman id 323536; Sat, 07 May 2022 02:54:47 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nnAal-0003pQ-7r for xen-devel@lists.xenproject.org; Sat, 07 May 2022 02:54:47 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 0cc602d5-cdb1-11ec-a406-831a346695d4; Sat, 07 May 2022 04:54:45 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 73E8914BF; Fri, 6 May 2022 19:54:44 -0700 (PDT) Received: from a015966.shanghai.arm.com (a015966.shanghai.arm.com [10.169.190.24]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 883673F800; Fri, 6 May 2022 19:54:40 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0cc602d5-cdb1-11ec-a406-831a346695d4 From: Henry Wang To: xen-devel@lists.xenproject.org Cc: Henry Wang , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu , Wei Chen , Henry Wang Subject: [PATCH v3 0/2] Adjustment after introducing ASSERT_ALLOC_CONTEXT Date: Sat, 7 May 2022 10:54:32 +0800 Message-Id: <20220507025434.1063710-1-Henry.Wang@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 With the enhanced ASSERT_ALLOC_CONTEXT, calling request_irq before local_irq_enable on secondary cores on Arm will lead to (XEN) Xen call trace: (XEN) [<000000000021d86c>] alloc_xenheap_pages+0x74/0x194 (PC) (XEN) [<000000000021d864>] alloc_xenheap_pages+0x6c/0x194 (LR) (XEN) [<0000000000229e90>] xmalloc_tlsf.c#xmalloc_pool_get+0x1c/0x28 (XEN) [<000000000022a270>] xmem_pool_alloc+0x21c/0x448 (XEN) [<000000000022a8dc>] _xmalloc+0x8c/0x290 (XEN) [<000000000026b57c>] request_irq+0x40/0xb8 (XEN) [<0000000000272780>] init_timer_interrupt+0x74/0xcc (XEN) [<000000000027212c>] start_secondary+0x1b4/0x238 (XEN) [<0000000084000200>] 0000000084000200 (XEN) (XEN) (XEN) **************************************** (XEN) Panic on CPU 4: (XEN) Assertion '!in_irq() && (local_irq_is_enabled() || num_online_cpus() <= 1)' failed at common/page_alloc.c:2212 (XEN) **************************************** on systems without a big enough pool for xmalloc() to cater the requested size. To solve this issue, this series introduces two patches. The first one defers the calling of request_irq on secondary CPUs after local_irq_enable on Arm. The second one moves the definition of ASSERT_ALLOC_CONTEXT to header and uses the ASSERT_ALLOC_CONTEXT to replace the original assertion in xmalloc(). Also take the chance to enhance the assertion in xmalloc_tlsf.c. Henry Wang (2): xen/arm: Defer request_irq on secondary CPUs after local_irq_enable xen/common: Use enhanced ASSERT_ALLOC_CONTEXT in xmalloc() xen/arch/arm/smpboot.c | 12 +++++++++--- xen/common/page_alloc.c | 7 ------- xen/common/xmalloc_tlsf.c | 10 +++++++--- xen/include/xen/irq.h | 7 +++++++ 4 files changed, 23 insertions(+), 13 deletions(-)