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 53E26C7115B for ; Thu, 19 Jun 2025 15:09:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EA9826B008C; Thu, 19 Jun 2025 11:09:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E5A466B0092; Thu, 19 Jun 2025 11:09:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D60BB6B0095; Thu, 19 Jun 2025 11:09:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C28E86B008C for ; Thu, 19 Jun 2025 11:09:00 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8A058101181 for ; Thu, 19 Jun 2025 15:09:00 +0000 (UTC) X-FDA: 83572482840.03.01A588A Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.4]) by imf28.hostedemail.com (Postfix) with ESMTP id 0B7A5C0002 for ; Thu, 19 Jun 2025 15:08:56 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=163.com header.s=s110527 header.b="py/zawz7"; dmarc=pass (policy=none) header.from=163.com; spf=pass (imf28.hostedemail.com: domain of 00107082@163.com designates 220.197.31.4 as permitted sender) smtp.mailfrom=00107082@163.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750345739; a=rsa-sha256; cv=none; b=gVt9V3MzSsbgXIG9NGl71ahbblI9rO9qYP9SUcMZTikSjnP36j2cACvz+d8GntgCtwtYJf hD6aIwQuCZmnKBKZD4N/7iIWfNNt/cR39qmcBw57UMwwnBqKd98KC///ihczCYDb9T4CGE F21Oys6NMfeg++kogLx/I60RE7pfzCI= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=163.com header.s=s110527 header.b="py/zawz7"; dmarc=pass (policy=none) header.from=163.com; spf=pass (imf28.hostedemail.com: domain of 00107082@163.com designates 220.197.31.4 as permitted sender) smtp.mailfrom=00107082@163.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1750345739; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dnI0saL/VnDxGEyhN0bnHVZ0uSc84Fgmk+s6JH/vwuo=; b=6BuXD/v7lB/Y0IciQlWB+4rQPEf5TLElN8v4IwjOlJRyKpN8csZ4XCUoavtRW5K2Bopjgz MCZ8N4pCOYQ1iDtcFtUlZ1jDvHb2GmT5R7jo31b84kVSzxP6KUGIj8hw+DqOYLRxSbY5MY RJ74w+QIuJ/sV1xlXHzMQ3fThfcK4XA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=dn I0saL/VnDxGEyhN0bnHVZ0uSc84Fgmk+s6JH/vwuo=; b=py/zawz7Cz6Ky77cGm ZWZW3s0GIz19TnAIgYlLoWTKOhx2Eun0i/arArOM+8Xlmxi/eYDwLwpIOVNFguUD zaukyoxwKXo5Vhfyv1sphdNtizuWyuT3ibeE5xigv0pDZvgeo95NbbKKfdMizHMR t0sjJPZge+0p3mJhNErBkIzNQ= Received: from localhost.localdomain (unknown []) by gzga-smtp-mtada-g1-3 (Coremail) with SMTP id _____wAnLZ_dJ1RoTEbnAQ--.28406S4; Thu, 19 Jun 2025 23:08:29 +0800 (CST) From: David Wang <00107082@163.com> To: harry.yoo@oracle.com, surenb@google.com, cachen@purestorage.com Cc: ahuang12@lenovo.com, akpm@linux-foundation.org, bhe@redhat.com, hch@infradead.org, kent.overstreet@linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, lkp@intel.com, mjguzik@gmail.com, oe-lkp@lists.linux.dev, oliver.sang@intel.com, urezki@gmail.com Subject: Re: Kernel crash due to alloc_tag_top_users() being called when !mem_profiling_support? Date: Thu, 19 Jun 2025 23:08:09 +0800 Message-Id: <20250619150809.69482-1-00107082@163.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:_____wAnLZ_dJ1RoTEbnAQ--.28406S4 X-Coremail-Antispam: 1Uf129KBjvJXoW7Kr4rJr48tF4kZw13ZF4Utwb_yoW8uF47pF WrX34UGFZ8Jry7CFs2gr12vry0ga1UJw15KF4Y9ryF9rnIvF4UWrWrtrWaqFyxuF98K3Za qrsFyFyjk34UZaUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07U6WlkUUUUU= X-Originating-IP: [111.35.191.131] X-CM-SenderInfo: qqqrilqqysqiywtou0bp/xtbBkBtxqmhUJTFZJAAAsF X-Rspam-User: X-Stat-Signature: tdcbz9of3ahhmhmpo3cs584dkb3wez9u X-Rspamd-Queue-Id: 0B7A5C0002 X-Rspamd-Server: rspam02 X-HE-Tag: 1750345736-801321 X-HE-Meta: U2FsdGVkX18yKelWhxicMNU4X/uZwOFv9VEon6Jihj7rhmar1oijfxk4rLspA72xz5IzTxIMUIM5GCijZb3HvSYi2DTr+n0Vi6oD77C1qgx7RnrksVM0qd6u0FvtvTmS+LLrf8mgpe1HZOpXgvETsMa2bgxqtfaVFcGiOyU50QRYzuEML2SfGgQxtM6JHa94jivxn4OZjrw3vH1qsM20zZIzGv5LHjpiJUwbpnfcsMYilSzFuUZwO4vSq3oBmVAprrNa5D4p47RvOHItqYgqvN2yQfmS9e0lvy0iIsK8/TIN+e0r8f7eZ0/heV+3xIEZSWbMoz3cP/TNuMg9BHtBqAoQ7AhQAgCwApaIQdNcznvn+7Mg7grOGwUws4pdIR6BeLwfrkHDTrS77Wa9OHhuQDEM/aZXYDD3HkjgrQ9O9qrzFnS8BwGiJbDt1gkXSsmVD3+VtbyuRWYMrKNQOyT7v0hIUNRV/N1bGTbxov+RX/kPyG13ZcDAIrxLf42xvmdZehJOrP0mLNN6+RqtfO6UG2FSmUtCabWCW3NIjJrl0wvyRkGS40I1yElJAxv947TXFEAiCeUqh2/dTB/SJuqwdMpyWiJ9/Oz+mUs8B8MJxlhyafNw/r6j2Vq4+oO/+2sxqBZBsTSKQslutQ1b47Xb5PhDGD7P5ZhJe5nOC5cCLkwSv1dhdrrd2H8iEp3n0el5DptyBwzS1Lya09uoOrrnNw4DfbO1pp0KGwu4KGrjPPoJz+UNS1Z5dYKXc4RXEsy59eR6fBZTVCvLVDF4YdVYFLLihqTAjbCSad13r+PmpctdKwy7ps9E3KcKVWgGYjnGfgQsoYr/ngI41YsxhjB+ksjYMSUwC8SAfvPvU3CTp2dF7baYnZWcNzCHXwhKCWj/Cg/MS/p4PKqoprVMPKTAegPGa9Gl8ntzV9b4xkUqFzllASTDOjT+jXbvGn1KV+vUO8JhzaINIo4XKLbpLOq mY+dUXLG sux0WNhKL+pyCCKrIX1R719Auksi3NVBnolWkfGC6NvwhfYV4RsoSyn4xqz8ibqTwC+jSH+HsL7Lu//qVPAGK3nSIHq654cMPx1Wdflq7vpGgowI8lBrgOsQnSFghLPrvri+zl6D0Bz35uEQ0tushnYoenXsGdhSj88nPDFplWHP8dbukT2PvrTQ2QuUnPDdXSS0W3B1x8Fz/vz6Q4o24DNc/J7lAaPfUton3QI0jgbZLX1LOBruads4NPA== 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: List-Subscribe: List-Unsubscribe: > On Wed, Jun 18, 2025 at 02:25:37PM +0800, kernel test robot wrote: > > > > Hello, > > > > for this change, we reported > > "[linux-next:master] [lib/test_vmalloc.c] 7fc85b92db: Mem-Info" > > in > > https://lore.kernel.org/all/202505071555.e757f1e0-lkp@intel.com/ > > > > at that time, we made some tests with x86_64 config which runs well. > > > > now we noticed the commit is in mainline now. > > (Re-sending due to not Ccing people and the list...) > > Hi, I'm facing the same error on my testing environment. > > I think this is related to memory allocation profiling & code tagging > subsystems rather than vmalloc, so let's add related folks to Cc. > > After a quick skimming of the code, it seems the condition > to trigger this is that on 1) MEM_ALLOC_PROFILING is compiled but > 2) not enabled by default. and 3) allocation somehow failed, calling > alloc_tag_top_users(). > > I see "Memory allocation profiling is not supported!" in the dmesg, > which means it did not alloc & inititialize alloc_tag_cttype properly, > but alloc_tag_top_users() tries to acquire the semaphore. > > I think the kernel should not call alloc_tag_top_users() at all (or it > should return an error) if mem_profiling_support == false? > > Does the following work on your testing environment? > > (Only did very light testing on my QEMU, but seems to fix the issue for me.) > > diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c > index d48b80f3f007..57d4d5673855 100644 > --- a/lib/alloc_tag.c > +++ b/lib/alloc_tag.c > @@ -134,7 +134,9 @@ size_t alloc_tag_top_users(struct codetag_bytes *tags, size_t count, bool can_sl > struct codetag_bytes n; > unsigned int i, nr = 0; > > - if (can_sleep) > + if (!mem_profiling_support) > + return 0; > + else if (can_sleep) > codetag_lock_module_list(alloc_tag_cttype, true); > else if (!codetag_trylock_module_list(alloc_tag_cttype)) > return 0; I think you are correct, this was introduced/exposed by commit 780138b1 ("alloc_tag: check mem_profiling_support in alloc_tag_init") (Before the commit, the BUG would only be triggered when alloc_tag_init failed) David