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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59D56C433FE for ; Fri, 7 Oct 2022 15:34:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A58A76B0071; Fri, 7 Oct 2022 11:34:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A07A46B0073; Fri, 7 Oct 2022 11:34:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A8EA6B0074; Fri, 7 Oct 2022 11:34:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6B8B16B0071 for ; Fri, 7 Oct 2022 11:34:56 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 15700C130F for ; Fri, 7 Oct 2022 15:34:56 +0000 (UTC) X-FDA: 79994551392.04.8E082B9 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by imf02.hostedemail.com (Postfix) with ESMTP id 9663D8000F for ; Fri, 7 Oct 2022 15:34:52 +0000 (UTC) Received: by mail-lj1-f176.google.com with SMTP id j23so6009047lji.8 for ; Fri, 07 Oct 2022 08:34:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=izkHNBhuBwgvzXtx/73B8psiHiY+7QxtoQMWKis7624=; b=KfF58vzRBOJjXAOsqdXkdOMjh6mt2ZZOA98sa4zkvZ9CEBXlW9VtqlLzctloO7qkXJ bn8sH4+H4JyPdMZPqeLZoZyJOY6hFczRcCrjSvfyHCnDLFrxg2GN83DBy5e9I7MwzP1A uURFTeuvLrhg+7ADlzk5MR6INPSQnfKQ0WvKYHJsQfOGRJ9LsYSi/Um1XgGqX5Dy82t1 DHoD4wRbp66kvQ+8zuopuTtydFDxVxHiPdLNJ7JRN37rmWlWe0Z/dA7YhzeyfKAoGxwB sLLheKvr+Nf72xeFkmTS5wXqrAjICDLOC+w56Ocs2scFpGqYXbRReqkgvELcWOYY61Te gPmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=izkHNBhuBwgvzXtx/73B8psiHiY+7QxtoQMWKis7624=; b=ifwtnUeduiI28Jj34Ov0dvDayY09Em5B29Gz5sQWgCpx6T3M1gWl1/YeEVcokcO95d LLcWJ4r7a16zULz3WSlyKlgYefQKjtNgnn4d9PvcMwIpR0kDlgEtAuqpCbpMFtNwfUJl 8b++X9qHxoohhkXC3olNIrgofgyvoPDFrMT4n3KZTuV9TgBYJKQjj95jjJeDLpbcTQ/A Y/QvEPu95/Z7n8WGJpxWaaUKL0S8vc3N7lb5McpZo8l0aAq0Ib4/3dZ2k62qhq1RBgQo BOKaWZyWmJ54g4+7TcOKlv8tRhtwefDln0bzQ0oE2fkPJ/zFvD43/Hwk6lIGPI3Nt0JY n28Q== X-Gm-Message-State: ACrzQf0l8IRGR/NJGPTIbf94sxXjJwEzUFb0Po41c2XsLGnOd45/hVjJ BGfsUUNoNIl4UmHeJzYgL8I= X-Google-Smtp-Source: AMsMyM6tYkZRN/z8D2wr9+ewvo7QDcfPcbImJU3B2xDWEJLVyuILBA6MxvnEWIVUzMga+JyG5R8KSQ== X-Received: by 2002:a05:651c:222c:b0:26b:dec5:a4f0 with SMTP id y44-20020a05651c222c00b0026bdec5a4f0mr2039980ljq.359.1665156890725; Fri, 07 Oct 2022 08:34:50 -0700 (PDT) Received: from pc636 (host-90-235-26-251.mobileonline.telia.com. [90.235.26.251]) by smtp.gmail.com with ESMTPSA id f22-20020a2eb5b6000000b0026bf0d71b1esm306749ljn.93.2022.10.07.08.34.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 08:34:50 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Fri, 7 Oct 2022 17:34:47 +0200 To: David Hildenbrand Cc: Uladzislau Rezki , Alexander Potapenko , Andrey Konovalov , "linux-mm@kvack.org" , Andrey Ryabinin , Dmitry Vyukov , Vincenzo Frascino , kasan-dev@googlegroups.com Subject: Re: KASAN-related VMAP allocation errors in debug kernels with many logical CPUS Message-ID: References: <8aaaeec8-14a1-cdc4-4c77-4878f4979f3e@redhat.com> <9ce8a3a3-8305-31a4-a097-3719861c234e@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9ce8a3a3-8305-31a4-a097-3719861c234e@redhat.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665156895; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=izkHNBhuBwgvzXtx/73B8psiHiY+7QxtoQMWKis7624=; b=GkySIeNpy7TP0LtX+soefXDBlrt/9z4eLLrUB7m1Bsk9DLI4HwNHAKIC9JPnVcvlcyd5dr oBlIo32L88AYiaMvStfpGJB2u9pDCofvC7fD/wvVKgj8HQrM3kXwkfVIBFvuMmnPXA0rxx LnpnsMCN0oaJpQnVBFyq+wqzFg8rJYc= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KfF58vzR; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of urezki@gmail.com designates 209.85.208.176 as permitted sender) smtp.mailfrom=urezki@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665156895; a=rsa-sha256; cv=none; b=NToUZXWHPmTyO7eUZcrV7/3M0pOCg7w20c8u0Ulul1ab9dlNP/Q/b9KG3sl3Rk7ZgdPZHk qZG1uoxEuEEJbuam82cG0aKPoVF7oQCuaK4v6ilR0WoGnTJsc40G+/h2JJaqaP2YYm+4Yg 0cPDDJCDcy4GYJ6AFRAgF0uCyArrjIU= Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KfF58vzR; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of urezki@gmail.com designates 209.85.208.176 as permitted sender) smtp.mailfrom=urezki@gmail.com X-Stat-Signature: ufws7qbc8gfuj845zwcwm3zofmw7oa36 X-Rspamd-Queue-Id: 9663D8000F X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1665156892-699655 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > On 06.10.22 17:35, Uladzislau Rezki wrote: > > > Hi, > > > > > > we're currently hitting a weird vmap issue in debug kernels with KASAN enabled > > > on fairly large VMs. I reproduced it on v5.19 (did not get the chance to > > > try 6.0 yet because I don't have access to the machine right now, but > > > I suspect it persists). > > > > > > It seems to trigger when udev probes a massive amount of devices in parallel > > > while the system is booting up. Once the system booted, I no longer see any > > > such issues. > > > > > > > > > [ 165.818200] vmap allocation for size 2498560 failed: use vmalloc= to increase size > > > [ 165.836622] vmap allocation for size 315392 failed: use vmalloc= to increase size > > > [ 165.837461] vmap allocation for size 315392 failed: use vmalloc= to increase size > > > [ 165.840573] vmap allocation for size 2498560 failed: use vmalloc= to increase size > > > [ 165.841059] vmap allocation for size 2498560 failed: use vmalloc= to increase size > > > [ 165.841428] vmap allocation for size 2498560 failed: use vmalloc= to increase size > > > [ 165.841819] vmap allocation for size 2498560 failed: use vmalloc= to increase size > > > [ 165.842123] vmap allocation for size 2498560 failed: use vmalloc= to increase size > > > [ 165.843359] vmap allocation for size 2498560 failed: use vmalloc= to increase size > > > [ 165.844894] vmap allocation for size 2498560 failed: use vmalloc= to increase size > > > [ 165.847028] CPU: 253 PID: 4995 Comm: systemd-udevd Not tainted 5.19.0 #2 > > > [ 165.935689] Hardware name: Lenovo ThinkSystem SR950 -[7X12ABC1WW]-/-[7X12ABC1WW]-, BIOS -[PSE130O-1.81]- 05/20/2020 > > > [ 165.947343] Call Trace: > > > [ 165.950075] > > > [ 165.952425] dump_stack_lvl+0x57/0x81 > > > [ 165.956532] warn_alloc.cold+0x95/0x18a > > > [ 165.960836] ? zone_watermark_ok_safe+0x240/0x240 > > > [ 165.966100] ? slab_free_freelist_hook+0x11d/0x1d0 > > > [ 165.971461] ? __get_vm_area_node+0x2af/0x360 > > > [ 165.976341] ? __get_vm_area_node+0x2af/0x360 > > > [ 165.981219] __vmalloc_node_range+0x291/0x560 > > > [ 165.986087] ? __mutex_unlock_slowpath+0x161/0x5e0 > > > [ 165.991447] ? move_module+0x4c/0x630 > > > [ 165.995547] ? vfree_atomic+0xa0/0xa0 > > > [ 165.999647] ? move_module+0x4c/0x630 > > > [ 166.003741] module_alloc+0xe7/0x170 > > > [ 166.007747] ? move_module+0x4c/0x630 > > > [ 166.011840] move_module+0x4c/0x630 > > > [ 166.015751] layout_and_allocate+0x32c/0x560 > > > [ 166.020519] load_module+0x8e0/0x25c0 > > > > > Can it be that we do not have enough "module section" size? I mean the > > section size, which is MODULES_END - MODULES_VADDR is rather small so > > some modules are not loaded due to no space. > > > > CONFIG_RANDOMIZE_BASE also creates some offset overhead if enabled on > > your box. But it looks it is rather negligible. > > Right, I suspected both points -- but was fairly confused why the numbers of > CPUs would matter. > > What would make sense is that if we're tight on module vmap space, that the > race I think that could happen with purging only once and then failing could > become relevant. > > > > > Maybe try to increase the module-section size to see if it solves the > > problem. > > What would be the easiest way to do that? > Sorry for late answer. I was trying to reproduce it on my box. What i did was trying to load all modules in my system with KASAN_INLINE option: #!/bin/bash # Exclude test_vmalloc.ko MODULES_LIST=(`find /lib/modules/$(uname -r) -type f \ \( -iname "*.ko" -not -iname "test_vmalloc*" \) | awk -F"/" '{print $NF}' | sed 's/.ko//'`) function moduleExist(){ MODULE="$1" if lsmod | grep "$MODULE" &> /dev/null ; then return 0 else return 1 fi } i=0 for module_name in ${MODULES_LIST[@]}; do sudo modprobe $module_name if moduleExist ${module_name}; then ((i=i+1)) echo "Successfully loaded $module_name counter $i" fi done as you wrote it looks like it is not easy to reproduce. So i do not see any vmap related errors. Returning back to the question. I think you could increase the MODULES_END address and shift the FIXADDR_START little forward. See the dump_pagetables.c But it might be they are pretty compact and located in the end. So i am not sure if there is a room there. Second. It would be good to understand if vmap only fails on allocating for a module: diff --git a/mm/vmalloc.c b/mm/vmalloc.c index dd6cdb201195..53026fdda224 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1614,6 +1614,8 @@ static struct vmap_area *alloc_vmap_area(unsigned long size, va->va_end = addr + size; va->vm = NULL; + trace_printk("-> alloc %lu size, align: %lu, vstart: %lu, vend: %lu\n", size, align, vstart, vend); + spin_lock(&vmap_area_lock); -- Uladzislau Rezki