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.gnu.org (lists.gnu.org [209.51.188.17]) (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 35712C43217 for ; Thu, 1 Dec 2022 07:15:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0dn4-0005Au-5A; Thu, 01 Dec 2022 02:15:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0dmu-000577-Ky for qemu-devel@nongnu.org; Thu, 01 Dec 2022 02:15:19 -0500 Received: from szxga03-in.huawei.com ([45.249.212.189]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0dmr-0007i5-G8 for qemu-devel@nongnu.org; Thu, 01 Dec 2022 02:15:16 -0500 Received: from kwepemi500016.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NN6gx62MdzJp0c; Thu, 1 Dec 2022 15:11:41 +0800 (CST) Received: from [10.40.193.166] (10.40.193.166) by kwepemi500016.china.huawei.com (7.221.188.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 1 Dec 2022 15:15:05 +0800 Subject: Re: regression: insmod module failed in VM with nvdimm on To: Ard Biesheuvel , Marc Zyngier References: <87r0xkubcp.wl-maz@kernel.org> CC: , , , chenxiang via , "linuxarm@huawei.com" Message-ID: <706965d2-60cb-847d-b30e-6074c8ca5fe4@hisilicon.com> Date: Thu, 1 Dec 2022 15:15:04 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.40.193.166] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500016.china.huawei.com (7.221.188.220) X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.189; envelope-from=chenxiang66@hisilicon.com; helo=szxga03-in.huawei.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.257, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: "chenxiang (M)" From: "chenxiang (M)" via Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Hi Ard, 在 2022/11/30 16:18, Ard Biesheuvel 写道: > On Wed, 30 Nov 2022 at 08:53, Marc Zyngier wrote: >> On Wed, 30 Nov 2022 02:52:35 +0000, >> "chenxiang (M)" wrote: >>> Hi, >>> >>> We boot the VM using following commands (with nvdimm on) (qemu >>> version 6.1.50, kernel 6.0-r4): >> How relevant is the presence of the nvdimm? Do you observe the failure >> without this? >> >>> qemu-system-aarch64 -machine >>> virt,kernel_irqchip=on,gic-version=3,nvdimm=on -kernel >>> /home/kernel/Image -initrd /home/mini-rootfs/rootfs.cpio.gz -bios >>> /root/QEMU_EFI.FD -cpu host -enable-kvm -net none -nographic -m >>> 2G,maxmem=64G,slots=3 -smp 4 -append 'rdinit=init console=ttyAMA0 >>> ealycon=pl0ll,0x90000000 pcie_ports=native pciehp.pciehp_debug=1' >>> -object memory-backend-ram,id=ram1,size=10G -device >>> nvdimm,id=dimm1,memdev=ram1 -device ioh3420,id=root_port1,chassis=1 >>> -device vfio-pci,host=7d:01.0,id=net0,bus=root_port1 >>> >>> Then in VM we insmod a module, vmalloc error occurs as follows (kernel >>> 5.19-rc4 is normal, and the issue is still on kernel 6.1-rc4): >>> >>> estuary:/$ insmod /lib/modules/$(uname -r)/hnae3.ko >>> [ 8.186563] vmap allocation for size 20480 failed: use >>> vmalloc= to increase size >> Have you tried increasing the vmalloc size to check that this is >> indeed the problem? >> >> [...] >> >>> We git bisect the code, and find the patch c5a89f75d2a ("arm64: kaslr: >>> defer initialization to initcall where permitted"). >> I guess you mean commit fc5a89f75d2a instead, right? >> >>> Do you have any idea about the issue? >> I sort of suspect that the nvdimm gets vmap-ed and consumes a large >> portion of the vmalloc space, but you give very little information >> that could help here... >> > Ouch. I suspect what's going on here: that patch defers the > randomization of the module region, so that we can decouple it from > the very early init code. > > Obviously, it is happening too late now, and the randomized module > region is overlapping with a vmalloc region that is in use by the time > the randomization occurs. > > Does the below fix the issue? The issue still occurs, but it seems decrease the probability, before it occured almost every time, after the change, i tried 2-3 times, and it occurs. But i change back "subsys_initcall" to "core_initcall", and i test more than 20 times, and it is still ok. > > diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c > index 37a9deed2aec..71fb18b2f304 100644 > --- a/arch/arm64/kernel/kaslr.c > +++ b/arch/arm64/kernel/kaslr.c > @@ -90,4 +90,4 @@ static int __init kaslr_init(void) > > return 0; > } > -subsys_initcall(kaslr_init) > +arch_initcall(kaslr_init) > . >