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 9F24AC77B7C for ; Sun, 22 Jun 2025 22:50:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3CF976B0089; Sun, 22 Jun 2025 18:50:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 380566B008C; Sun, 22 Jun 2025 18:50:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2BD3C6B00A8; Sun, 22 Jun 2025 18:50:59 -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 1B0C16B0089 for ; Sun, 22 Jun 2025 18:50:59 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 944B7104851 for ; Sun, 22 Jun 2025 22:50:58 +0000 (UTC) X-FDA: 83584533396.14.B66B0FE Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by imf11.hostedemail.com (Postfix) with ESMTP id A339640002 for ; Sun, 22 Jun 2025 22:50:56 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=QSfvF0Eb; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf11.hostedemail.com: domain of surenb@google.com designates 209.85.160.171 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750632656; a=rsa-sha256; cv=none; b=Mb/duOGqhlSd54X13xc7eZhm2yYeYlunaDNByEyoMP0FbgaREIsxYIpAgzGGowZx7vSS2B 82yldDUhsSoItjwe3WnOoaj1jvRCu7QA/mFuhtTuBSGaEw58bsNhEu1J90kvr2h66ocAed TqSOYMkYy5trLVRYGQtoDZR1s80wd8Y= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=QSfvF0Eb; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf11.hostedemail.com: domain of surenb@google.com designates 209.85.160.171 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1750632656; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=FCkkmse9j7jIkQr/HtdtMMiFnJZl5VTksMugObu1Hv8=; b=SF6rVFFLpM7dY6lfxetUO5n3f3hSM1ZiC7iyb+E/K4ajhw9gN/EPtPKFTtILgLVrSQpKB+ 3Mzrn9O7YWg2uHeBkh+KGYU1SXjD59IzDmvX4neM6fBVF3WO+2EJYuLter+qnruGS6Iim2 OAo2D33nrBCs2qh0eDD03sUn3gt0Pzc= Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-4a58197794eso240011cf.1 for ; Sun, 22 Jun 2025 15:50:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1750632656; x=1751237456; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FCkkmse9j7jIkQr/HtdtMMiFnJZl5VTksMugObu1Hv8=; b=QSfvF0EbCNFnXcawQ6uVHuId1XWS0TsyjHZ+MiGpb5cu/H5Kne7PaPWqVdhEuM0K8j ouXht/zuf+39tRgVBnaTEF+tsBfneZtVkuO0+BfHpx6TqHp2U/XiIW88hz91jgxAlgco OA9d+VOV6p1brXAY0l962+wdJSp2GvrBymRszQxDPt3ZURZxXPgcruDazx/QpQ7tZhb9 CtvwYq9Sm9QUO9xafY83/FtDmCgvvxftnjaT7l1oU1P+CMPeoKqtS5KaGY+GIIsVjrfF 1Esi3VtlVQVv9ABc5V2D41tij1HT1y9TSflsKP+jDfyXchk9qIWTgVwZ0ZNu7SsGCoyW Izkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750632656; x=1751237456; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FCkkmse9j7jIkQr/HtdtMMiFnJZl5VTksMugObu1Hv8=; b=RT1X+tFeivxwcnGgLQSYOreTaqxwiDF79RP9lH2FZFF2FiZuOsfhW5/pyGubYKMXSJ pXxV/69IIei8l/gxP8Q77Y9GaQQriWTdffUA/FxTlJ9K5Sbaebm7/iuJTyHXdrq0e6xc tvMP3TNBRpwzJvIbmTVVFKmfyorEyviDUz3iJ6yAFXzQorxHitJK3owyCxPsgrdgJqP5 Gu3PiTkx/mmH35CiIlc/FQBjeLzLe3A2Ki2HEyX2I+mhdVOp0Q1xGBqfhSb/qMpnXsJg MclT0ds/dv6tN/g8XBwJ3AnoDgRJRZonZn+JwJ9VHWmlPT87tNS3BvK5qyPgW+9OVWiZ VLbQ== X-Forwarded-Encrypted: i=1; AJvYcCXdD1mW1V8P5VD5QDfYmir0VPMOhQPVamvdsQ4p7GJVAI4UWFPZ6njzK7ZVTxJI4uoTLH4ZK2Qfrg==@kvack.org X-Gm-Message-State: AOJu0YwVMs7uitoY9lTvsoITZP5HZ9S7seDsAMfJiIYglR9FF7ORoyOJ z93SPL+3H4bu/J5Ke8p0e5lhpHy4qAhJ77OBUyQeLolG/NUvzUhwtw6rHFiIu1357HBJyzovC1D utUbqXGjR8foKHuX15KurBJubQtW+IMub7PC14Oc3 X-Gm-Gg: ASbGncteXsrsXHNps8YGlMgpROUzJncAMyUeY3ZiRN6W0VcrVgqbu4VrsTxApzhJZym npD5ovD2o7r/KlJ4s4NnH/8wyDAt7sCLhVroFj4x+oVZhz3KCske1yXzeg5/lK6Qz90Fn+5arvO 3qwa3IF61eMTBVL++y2rZc3xzuHLCoiCXidzCQ7BSeoA== X-Google-Smtp-Source: AGHT+IHVv0cByUMuTtv+78NCbFEK8nCvWjD02fb+bjcGOT1F2fltAhal6PAAqK/gJ767TYT0EG9fKYVyt5sjERXqch8= X-Received: by 2002:a05:622a:1b0b:b0:479:1958:d81a with SMTP id d75a77b69052e-4a7852db91amr5530501cf.6.1750632655398; Sun, 22 Jun 2025 15:50:55 -0700 (PDT) MIME-Version: 1.0 References: <202506181351.bba867dd-lkp@intel.com> <20250620100258.595495-1-00107082@163.com> In-Reply-To: <20250620100258.595495-1-00107082@163.com> From: Suren Baghdasaryan Date: Sun, 22 Jun 2025 15:50:44 -0700 X-Gm-Features: Ac12FXyniPz2R1npjK7ZfMtWGYaO4vFnkCBjbTvEwI2RPxVobAu7_RLwcpb6AtA Message-ID: Subject: Re: CONFIG_TEST_VMALLOC=y conflict/race with alloc_tag_init To: David Wang <00107082@163.com> Cc: oliver.sang@intel.com, urezki@gmail.com, ahuang12@lenovo.com, akpm@linux-foundation.org, bhe@redhat.com, hch@infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, lkp@intel.com, mjguzik@gmail.com, oe-lkp@lists.linux.dev, harry.yoo@oracle.com, kent.overstreet@linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Queue-Id: A339640002 X-Rspamd-Server: rspam10 X-Stat-Signature: xfxz4sefwghhw931i3akisi919p5wdcc X-HE-Tag: 1750632656-853425 X-HE-Meta: U2FsdGVkX18g8NkvNNxUMzmH3mjQ2ETM2iyZq33HT5uvb5RKEUpfbOEb/tPhC8nkiZmsTf/3ewth7DF+YIydzI3eKeGfWvXWanPX915QH1K/AbM61OVO6IrWTBn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Hg0qdwIFQL/SXGb0vbNyCj5q6cA0JaLMS79m4eYYfeJN8VKs2Gbwe6Mqv7VfyKuPzKjMR0XlSR4zxOvsOkPVeJmeIVin7u5z6ZfhKoyULjhvjEPEDgDPEh9ehweza+yNzkWEsCZzTOf7lza2Ej2ADYZQfeJdjKnClC5kPwbgxIkEND9CrwnUnoeLS+IXcQB158GBWu8n8gbtYKIeRY 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 Fri, Jun 20, 2025 at 3:03=E2=80=AFAM David Wang <00107082@163.com> wrote= : > > 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. > > > the config still has expected diff with parent: > > > > --- /pkg/linux/x86_64-randconfig-161-20250614/gcc-12/7a73348e5d4715b556= 5a53f21c01ea7b54e46cbd/.config 2025-06-17 14:40:29.481052101 +0800 > > +++ /pkg/linux/x86_64-randconfig-161-20250614/gcc-12/2d76e79315e403aab5= 95d4c8830b7a46c19f0f3b/.config 2025-06-17 14:41:18.448543738 +0800 > > @@ -7551,7 +7551,7 @@ CONFIG_TEST_IDA=3Dm > > CONFIG_TEST_MISC_MINOR=3Dm > > # CONFIG_TEST_LKM is not set > > CONFIG_TEST_BITOPS=3Dm > > -CONFIG_TEST_VMALLOC=3Dm > > +CONFIG_TEST_VMALLOC=3Dy > > # CONFIG_TEST_BPF is not set > > CONFIG_FIND_BIT_BENCHMARK=3Dm > > # CONFIG_TEST_FIRMWARE is not set > > > > > > then we noticed similar random issue with x86_64 randconfig this time. > > > > 7a73348e5d4715b5 2d76e79315e403aab595d4c8830 > > ---------------- --------------------------- > > fail:runs %reproduction fail:runs > > | | | > > :199 34% 67:200 dmesg.KASAN:null-ptr-dere= f_in_range[#-#] > > :199 34% 67:200 dmesg.Kernel_panic-not_sy= ncing:Fatal_exception > > :199 34% 67:200 dmesg.Mem-Info > > :199 34% 67:200 dmesg.Oops:general_protec= tion_fault,probably_for_non-canonical_address#:#[##]SMP_KASAN > > :199 34% 67:200 dmesg.RIP:down_read_trylo= ck > > > > we don't have enough knowledge to understand the relationship between c= ode > > change and the random issues. just report what we obsverved in our test= s FYI. > > > > I think this is caused by a race between vmalloc_test_init and alloc_tag_= init. > > vmalloc_test actually depends on alloc_tag via alloc_tag_top_users, becau= se when > memory allocation fails show_mem() would invoke alloc_tag_top_users. > > With following configuration: > > CONFIG_TEST_VMALLOC=3Dy > CONFIG_MEM_ALLOC_PROFILING=3Dy > CONFIG_MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT=3Dy > CONFIG_MEM_ALLOC_PROFILING_DEBUG=3Dy > > If vmalloc_test_init starts before alloc_tag_init, show_mem() would cause > a NULL deference because alloc_tag_cttype was not init yet. > > I add some debug to confirm this theory > diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c > index d48b80f3f007..9b8e7501010f 100644 > --- a/lib/alloc_tag.c > +++ b/lib/alloc_tag.c > @@ -133,6 +133,8 @@ size_t alloc_tag_top_users(struct codetag_bytes *tags= , size_t count, bool can_sl > struct codetag *ct; > struct codetag_bytes n; > unsigned int i, nr =3D 0; > + pr_info("memory profiling alloc top %d: %llx\n", mem_profiling_su= pport, (long long)alloc_tag_cttype); > + return 0; > > if (can_sleep) > codetag_lock_module_list(alloc_tag_cttype, true); > @@ -831,6 +833,7 @@ static int __init alloc_tag_init(void) > shutdown_mem_profiling(true); > return PTR_ERR(alloc_tag_cttype); > } > + pr_info("memory profiling ready %d: %llx\n", mem_profiling_suppor= t, (long long)alloc_tag_cttype); > > return 0; > } > > When bootup the kernel, the log shows: > > $ sudo dmesg -T | grep profiling > [Fri Jun 20 17:29:35 2025] memory profiling alloc top 1: 0 <--- alloc_ta= g_cttype =3D=3D NULL > [Fri Jun 20 17:30:24 2025] memory profiling ready 1: ffff9b1641aa06c0 > > > vmalloc_test_init should happened after alloc_tag_init if CONFIG_TEST_VMA= LLOC=3Dy, > or mem_show() should check whether alloc_tag is done initialized when cal= ling > alloc_tag_top_users Thanks for reporting! So, IIUC https://lore.kernel.org/all/20250620195305.1115151-1-harry.yoo@ora= cle.com/ will address this issue as well. Is that correct? > > > > David >