Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6620450rwb; Wed, 18 Jan 2023 07:25:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXuaaGN2wWEi5DBWgrJBgA0UkG8xao8n6n1MraBjzWqlJVNb4xvBjyuBJsuofXmbWjj2xxpB X-Received: by 2002:a05:6a20:ba92:b0:b8:c4dd:82bc with SMTP id fb18-20020a056a20ba9200b000b8c4dd82bcmr6329222pzb.37.1674055518631; Wed, 18 Jan 2023 07:25:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674055518; cv=none; d=google.com; s=arc-20160816; b=xIb41SvMJwIMur5yJAMOs8n77ReVf2fWoP38f6rNby2s5mPrApmuOnyflKOpH5HlfJ voCTsxEzu2+HuivxzMn0RRYxV73JFbKcl49EXgUWQrTNdQ6kSnnhhm71E3RdQQZVJSVi enjUPJpAhZEZ9Jazk+792YsWVVAU7qvEz1KD/jsoBVYFmyIFAZ7jf6ADcsrnPDmD7cpG V6gaXQy9IgUTWhXQtnOeiTSWT0KEFnD5AUyEUZcBQKvC3O+7rWIu9TsxdUd9C/aozLUL e5Ex+7dnjpzsOLHV0eBtTd4PHEx4HatBFT3/gCE7KqbtAy+Ylq12C+MifejS4lh8hJIS eK/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=JfBTvkeJOx9tx0quLYYGYfVQ7IO/sB2UijFdb8/ibpM=; b=sNieLo3iW5sQDIKwzFJyfNnf5yrQbsDnbro08LgYCOOrEwXkxf+ENmSWgyIH8szQ9F o3lMem+I3k8zbEi9KjpvYWWZk9L5qK+OVyEm6bmSKRf9qxdT6oQmMZMJP4DDjAS776dx W42+kBXRwdJzs9jWnkZ+0aZVUTbQArYoyGN6ydSqWcBLjFsYx7WWQm/V40idjY4Yr5IB byYL5xU63Qnvny/n1V0Ju4vBylLJY6zavmyul9KTqRLe7bDdLR5+8QfnxjxA5sUhuyvA sAMa+3MiS27fBWzbBMydlbye2TPd+TGx2EYa1ERXoitOqGcCsaoB288vGndIdPaM/kAL S43A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e18-20020a63ee12000000b004b6db45d035si23288843pgi.232.2023.01.18.07.25.13; Wed, 18 Jan 2023 07:25:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231362AbjAROnm (ORCPT + 45 others); Wed, 18 Jan 2023 09:43:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231395AbjAROnH (ORCPT ); Wed, 18 Jan 2023 09:43:07 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47DDE4DBD1 for ; Wed, 18 Jan 2023 06:34:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0181DB81D6A for ; Wed, 18 Jan 2023 14:34:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4A43C433D2; Wed, 18 Jan 2023 14:34:33 +0000 (UTC) Date: Wed, 18 Jan 2023 14:34:30 +0000 From: Catalin Marinas To: "zhaoyang.huang" Cc: Andrew Morton , Vlastimil Babka , Nathan Chancellor , Peter Zijlstra , Zhaoyang Huang , linux-mm@kvack.org, linux-kernel@vger.kernel.org, ke.wang@unisoc.com, Mirsad Todorovac Subject: Re: [PATCHv3] mm: use stack_depot_early_init for kmemleak Message-ID: References: <1674007655-23016-1-git-send-email-zhaoyang.huang@unisoc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1674007655-23016-1-git-send-email-zhaoyang.huang@unisoc.com> X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 18, 2023 at 10:07:35AM +0800, zhaoyang.huang wrote: > Mirsad report bellow error which caused by stack_depot_init failed in kvcalloc. > Solve this by having stackdepot use stack_depot_early_init. [...] > diff --git a/mm/kmemleak.c b/mm/kmemleak.c > index 762b91f..ddc1ddf 100644 > --- a/mm/kmemleak.c > +++ b/mm/kmemleak.c > @@ -2070,8 +2070,10 @@ static int __init kmemleak_boot_config(char *str) > return -EINVAL; > if (strcmp(str, "off") == 0) > kmemleak_disable(); > - else if (strcmp(str, "on") == 0) > + else if (strcmp(str, "on") == 0) { > kmemleak_skip_disable = 1; > + stack_depot_want_early_init(); > + } Does this fix still work if kmemleak is default on and no option passed on the kernel command line? I thought we also need something like: diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 881c3f84e88a..80c69d026890 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -754,6 +754,7 @@ config DEBUG_KMEMLEAK select KALLSYMS select CRC32 select STACKDEPOT + select STACKDEPOT_ALWAYS_INIT if !DEBUG_KMEMLEAK_DEFAULT_OFF help Say Y here if you want to enable the memory leak detector. The memory allocation/freeing is traced in a way -- Catalin