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 012B9E81813 for ; Tue, 26 Sep 2023 02:55:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 69BAE6B019B; Mon, 25 Sep 2023 22:55:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6249A6B019C; Mon, 25 Sep 2023 22:55:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C5316B019E; Mon, 25 Sep 2023 22:55:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 3632F6B019B for ; Mon, 25 Sep 2023 22:55:40 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id F1D1740DD2 for ; Tue, 26 Sep 2023 02:55:39 +0000 (UTC) X-FDA: 81277233198.11.F6108E5 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf30.hostedemail.com (Postfix) with ESMTP id 44DFA80011 for ; Tue, 26 Sep 2023 02:55:36 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=ZXkvRB7X; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf30.hostedemail.com: domain of zhangpeng.00@bytedance.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=zhangpeng.00@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695696938; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=FrQ2Nq84VzrtnFGziz71CiExgTFO4ujxz6F6FWLEQKE=; b=Y6D7zz30faaF6z84yu601jCXhwRpnpZ8e6iIltIFMCTgctxBsU1sA4KfzWlfCL2XT3ah02 Pj8fL+/OSAsNZSxPEbSG5Vwgr6nVLzhTBkTd7P7dRXevyy2lrBzGZWYhcyPFiyjn+L82XH 1f474piLUgSmN0P3W7ULrBZ643pTAiU= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=ZXkvRB7X; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf30.hostedemail.com: domain of zhangpeng.00@bytedance.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=zhangpeng.00@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695696938; a=rsa-sha256; cv=none; b=3NZ2xu79DCkTkfUox9RcDKkcblpiRHA0qLHUj7TeiRmU2GdKezJ6dGsjJzmbYtVU4Jndwf auXZh/fa6Vs6zuV4IWJWzt5GBlXq1HJCo1mhSZXkQB+WUA4dOVfmqAz6iWLCbIw6cvkWEm LGizEsk2xA+SgPzto6jEkk2K5QB+tQU= Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1c5bbb205e3so70189205ad.0 for ; Mon, 25 Sep 2023 19:55:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1695696935; x=1696301735; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:references:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=FrQ2Nq84VzrtnFGziz71CiExgTFO4ujxz6F6FWLEQKE=; b=ZXkvRB7XyrHQiq+StC4AbPQwHP4FXofI9a4h9vvi5hSlGp404Mv2hJ0YYC1J4ihL78 JlXzI+B+SlRivkFj234nASoKgwpI47O7yRCYUJ06N87RsvQXlPrHOZozcZOY4zYVbpt7 qOUls+ngmf9L6In6LrurYM42CspJTj+yamcXHA4ijsxRbYDTgq7VYBtuAOlN72l/SX+G j2FTjRAcPmaTBQ9MRndaOGsoAdJqCBho+gB7so5w02BwtPfMciQDObRj/7UtXQ/hFGMC WojrqU0DSiqtFp+aAPkDFZVeNeWPT/50Nx25Jt6N0Q7g9MeO+NYGU8tQIFg001Vxmqee aFxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695696935; x=1696301735; h=content-transfer-encoding:in-reply-to:from:references:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=FrQ2Nq84VzrtnFGziz71CiExgTFO4ujxz6F6FWLEQKE=; b=KEmWf1xgUwnu3UMIWam+gh5E95Dbe8J2TzB5WVlYwLinKHPBZb0tDokURGgD5iYZ76 V5xLBFw1QjUINbjvaLAjfRj2A0i15aGZZc99YTsPD3wZt17GhUTKzSvx9OhUG3YXZ165 Ew1if90C8kGGw5gLji86iLuWdxjQqcZj6f1jA+xnkfwHqGGw0logpLZxf59qjzdu9o4u 7xYxgR5xdfeOqNemQ18P+z6jjqg94mmiOFm5OuyM/YAJeVE6qGEJx9vGAeB9Iyzysrwd qNNym03woZcibwAjPUiov5DleJEJ2fW2F1s5pK2ttsp7bKKHZbcwE2tXCgYBo6QDYrSh a/0w== X-Gm-Message-State: AOJu0Yw1NAZE7qZXw4lW3jXpkL0GSILNKAdd4hO6eeabG6r3okBdkVxq mgw3CocsG/zKePBXDl2mmmYG+A== X-Google-Smtp-Source: AGHT+IFRjE7PoccokAyS+idzJy1C3sfLW4xKzMk1dOJKth/RNh3wZv7eCbzbFTyvK2j+5pvj66S70A== X-Received: by 2002:a17:902:b284:b0:1c3:3dae:5869 with SMTP id u4-20020a170902b28400b001c33dae5869mr8423829plr.63.1695696934952; Mon, 25 Sep 2023 19:55:34 -0700 (PDT) Received: from [10.254.245.222] ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id jh5-20020a170903328500b001bb9bc8d232sm9699340plb.61.2023.09.25.19.55.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Sep 2023 19:55:34 -0700 (PDT) Message-ID: Date: Tue, 26 Sep 2023 10:55:27 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [linux-next:master] [maple_tree] 2041864a22: BUG:sleeping_function_called_from_invalid_context_at_include/linux/sched/mm.h To: "Liam R. Howlett" , Peng Zhang , jason.sim@samsung.com, kernel test robot , "oe-lkp@lists.linux.dev" , "lkp@intel.com" , Linux Memory Management List , Andrew Morton , Matthew Wilcox , Suren Baghdasaryan , "maple-tree@lists.infradead.org" References: <202309242123.7ebe65b5-oliver.sang@intel.com> <20230925123907epcms1p82db5bc72fa25e390986f2e195a58b362@epcms1p8> <08cffec5-a3ae-f02a-ca97-d93f7a17eaee@bytedance.com> <20230925152353.zoezenruphilf2kc@revolver> From: Peng Zhang In-Reply-To: <20230925152353.zoezenruphilf2kc@revolver> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 44DFA80011 X-Stat-Signature: wk1g9o1y4qo9uyctu6whczp9f5ns3d78 X-Rspam-User: X-HE-Tag: 1695696936-39070 X-HE-Meta: U2FsdGVkX1+Mkohrn170TOjfX+/8oEF2xX4b0Q/+arttBB74+9kVUMfsNW/8YUx2jJYBPO89MSwVUErM1pAxG99ZobwcW3K1bSxEk+NxbCa+X7rGLxm/X2QWm9IBV/J8N6FCvNX94S2QhERaSVWP0aKkTPA+u412+RIscQ3EwnkNGLGmnSpDazZ9Fx1No+WZ+4GaEmbZfBmJR6D2VDN5vzMaQBeC2CDszJVohU3aGhkLdTdLWMa1QrtiFJR57D1rmQj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yTJp+hQIu0+dCiojf0dr9U6wwKt+bl6ZQFvLU6M0I0TSsHqvUIQ/T2nDerkGmGpiV+hUVC4F+QOfuHhMBfzKzWZ9uhksm8PHRmN5gQS/9kCdsAxlQ85eqRbcb4IeSi3iWCOXiquaVGEjyax3RQfSfjplVGWK3JxypmQgceMq0c0Itczo/vlHjJOeFWGdQ4eFITgJY2j+ne5/pinMwIgFcJIOZXVyUXfedxhvacdr7ufMPtI37G+BkVF1T9N1RBdAkw== 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: 在 2023/9/25 23:23, Liam R. Howlett 写道: > * Peng Zhang [230925 08:47]: >> >> >> 在 2023/9/25 20:39, Jaeseon Sim 写道: >>>> Hello, >>>> >>>> kernel test robot noticed "BUG:sleeping_function_called_from_invalid_context_at_include/linux/sched/mm.h" on: >>>> >>>> commit: 2041864a22d4f4e900d0a3def4985432a21d8e6d ("maple_tree: use mas_node_count_gfp() in mas_expected_entries()") >>>> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master >>>> >>>> [test failed on linux-next/master 940fcc189c51032dd0282cbee4497542c982ac59] >>>> >>>> in testcase: boot >>>> >>>> compiler: gcc-9 >>>> test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G >>>> >>>> (please refer to attached dmesg/kmsg for entire log/backtrace) >>>> >>>> >>>> >>>> If you fix the issue in a separate patch/commit (i.e. not just a new version of >>>> the same patch/commit), kindly add following tags >>>> | Reported-by: kernel test robot >>>> | Closes: https://lore.kernel.org/oe-lkp/202309242123.7ebe65b5-oliver.sang@intel.com >>>> >>>> >>>> [ 113.582828][ T1] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306 >>>> [ 113.583602][ T1] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1, name: swapper/0 >>>> [ 113.584246][ T1] preempt_count: 1, expected: 0 >>>> [ 113.584613][ T1] RCU nest depth: 0, expected: 0 >>>> [ 113.584983][ T1] 1 lock held by swapper/0/1: >>>> [ 113.585344][ T1] #0: ffffc9000001fc10 (&mt->ma_lock){+.+.}-{2:2}, at: check_forking+0x1e0/0x5c0 >>> Dear Liam, >>> >>> mas_expected_entries() in check_forking() tried to sleep while holding spinlock, and panic occurred. >>> I think mas_expected_entries() in lib/test_maple_tree.c need to be modified to align with commit 2041864a22d4f. >>> Do you have any idea for it? or Could you give some guide? > > There are two ways we could fix this: one is to pass through the GFP > flag and use different flags in the test module, the other is to move > the testing out of the module and into the userspace tests. Actually, there is a third method that can be used to solve this problem, which is to use an externally sleepable lock, such as rw_semaphore. > > Adding the GFP flag to the interface might be needed in the future but > there's no need for that now. I was concerned about too large of a > change to the existing code, and this would increase the runtime code > changes - although not a lot. > > I think the best thing would be to move the forking test out of the > module into the userspace testing (tools/testing/radix-tree/maple.c) > >> This is just a test module. The work[1] I'm doing modifies this place >> and it will fix this bug. > > Thanks Peng. This is a temporary fix for upstream, but is needed for > the LTS kernels as well. I've mentioned your patches to others, so > don't think they aren't noticed - they are eagerly awaited. > > Since your patch adds the necessary GFP flag, we could move the > check_forking test back in your update, (patch 7/9 [1]) which avoids the > GFP_KERNEL flag (thanks!), if it is moved. I think it's worth while to > do since you already have a lot of userspace tests as well that uses > GFP_KERNEL (4/9 [2]) and it's good to keep as much in the kernel module > as possible. > > By the way Peng, I have gotten complaints (I cannot find a reference > quickly) from older CPUs taking a long time on the test module. You are > making things faster, but I just wanted you to be aware of that in case > you add tests in the future that cause complaints :) I still think it > is worth keeping as much as possible in that module - it's a more valid > test scenario and it still runs from the userspace testing. I understand this now, and I will take this into consideration when adding tests in the future. > > ... > >> Thanks. >> >> [1] https://lore.kernel.org/lkml/20230925035617.84767-1-zhangpeng.00@bytedance.com/ > > ... > > Thanks, > Liam > > [1] https://lore.kernel.org/lkml/20230925035617.84767-8-zhangpeng.00@bytedance.com/ > [2] https://lore.kernel.org/lkml/20230925035617.84767-5-zhangpeng.00@bytedance.com/ > >