From patchwork Mon Nov 20 17:46:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 13461816 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 D2D74C5AE5B for ; Mon, 20 Nov 2023 17:47:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47AE36B032A; Mon, 20 Nov 2023 12:47:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D7756B032C; Mon, 20 Nov 2023 12:47:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2788A6B032F; Mon, 20 Nov 2023 12:47:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id EBFB66B032C for ; Mon, 20 Nov 2023 12:47:31 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C719CA095C for ; Mon, 20 Nov 2023 17:47:31 +0000 (UTC) X-FDA: 81479064702.08.BCBF2B1 Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) by imf06.hostedemail.com (Postfix) with ESMTP id E6787180004 for ; Mon, 20 Nov 2023 17:47:28 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="bR/I30d5"; spf=pass (imf06.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.183 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700502449; a=rsa-sha256; cv=none; b=3cgpInNiOA9IbQH5+fOzVyjMb6OOCHz9c7N2wq7Zq0GyEiZjnwusHu5UkEg+MqOQC6mlUl bvxd/SoNaI+se+XRsiZkhTDZyL5BGyFdtwq+7TY0ZG7UWWbiwfHKVgXe6cdyxSMLCOQgYg Y5zmE0W3O43SiynKQBSLiwyyWcUCcy8= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="bR/I30d5"; spf=pass (imf06.hostedemail.com: domain of andrey.konovalov@linux.dev designates 95.215.58.183 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700502449; 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=9mwqfN/pqk9HRQ931HoPPP333OlumxbY++YPCTeY76U=; b=foD5a90xRewX63QKuNdG4kg87Fu7Kn3FQd+H6EsVa7EwUOaNJSLzFunRuRlVd5xZqRZEwB GzAOkWDY6MO4PsbZG7pwEpbd8KasM2KEeIVdi9x2g3LLdLZowjoMRrpPBoOOxOf2IuDo4B END6yzWjgknIXGVOQibpkAyU03vnVFg= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1700502447; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9mwqfN/pqk9HRQ931HoPPP333OlumxbY++YPCTeY76U=; b=bR/I30d5ng/lYBtNQqgdoGfH5paO2CtcP21wojJGbtHFG33q9OSF6VODY4kRaiORiokLQo iZpd9D4Xa29yBgsAA1WjhOAcCg0lSOCGSH3njrApHXcLDY08VxXeaX0yqJ6yzjAbR1DXy7 0Hwm3iz+UTEkMpPA3RFCPkvRL0wjaJM= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Oscar Salvador , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH v4 01/22] lib/stackdepot: print disabled message only if truly disabled Date: Mon, 20 Nov 2023 18:46:59 +0100 Message-Id: <73a25c5fff29f3357cd7a9330e85e09bc8da2cbe.1700502145.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: E6787180004 X-Stat-Signature: h1aedyny1n6p6jo4ydtehpdz81r5p6tw X-Rspam-User: X-HE-Tag: 1700502448-914579 X-HE-Meta: U2FsdGVkX19OUjbljdsGylBMZko/x2yHFMmY2JnhlcNTuS8fU2IxM8XHti2dwOL1mrTUEMWVgO/1/QZLTyMzVbcXxYAmcReGYYTmH592RAXs0QVj7XMW1trhtWmnnZjRgMA3/JAEhYD1rIxvqrB52zt6ILatcnmwWGgs+IsF+LItCkkPoX4IAo/kz5dvAhen2NxN/CtGvRxLKMiUM8prrI+O9oHXD7AE4P9g1nvi/iUaLa7OgyqU7xenoAPS+ECba6L08zD8OVlGkVMmY7BHo+QC3q6+QSq0/4xvko063aqxlDOmDiI/4ZnfrK/tzxtsHobie3SHFDRCS/viQ2UVwhmEIv2sAndLUAnBBwWs9ZgMP56znk3d32+P1s5GLaBPpTy6K8lKKLVpWGjKmXTqv2I4Q2RdGFp4Lv12rAt4Xj4BYtcMwydwpxXP/4lDKRDauvVTbGKuV7Jaciz8M6Bc78Oi0juxtBxeRrG5eC+6J0Q8Nwen0iOcseohnV6s7JrLSWeI8G4DPLsrEEQ8aXhmAnjkbrryfrVNu1tynhasAdeKqBlx252tCf5SARJBRpUry31uiNes5VhF2b8zdi2O4nwDAr316ZJq+hzUN/nv7xCXvLGPrFSJNJrKFsAdbKDcyGNcKDnVNmJEf8ghGCnhw4vg6PIUvrFmx2GRde62QJeELafbV2ald3oigG+a4Kz9IKpBQQze5a4yzc0no4WzQanYXRUZaQgtfyBKMps+tgNMd9Ne/uBDkxSXC3b5nvn+9z5bASJOsZ847YI6zjme6o9tPeyrwy4LWKw49uX+yC0TUFAMGlhE8ZyxYk4XNDBvnWasHiqz14SWzxKP3TgVnbgPg9Y7aAZznOn5gOsXab629SDvxDFPps01gthm5QA/q4Zj97OMID850Y3LX+9NeHTkXgtNTRgFzJJQvWdz9BfmmxTjEd9/FUbOGmYND4k9YBTErNJJyskea8iIUKR rbj4BzZD db4TJ7TJrh1r5Zx2taJskX3JJmS7WGqbuO8AXX/SXa+evmOmcXq+5+4/SQI4QF6kukj4C 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: From: Andrey Konovalov Currently, if stack_depot_disable=off is passed to the kernel command-line after stack_depot_disable=on, stack depot prints a message that it is disabled, while it is actually enabled. Fix this by moving printing the disabled message to stack_depot_early_init. Place it before the __stack_depot_early_init_requested check, so that the message is printed even if early stack depot init has not been requested. Also drop the stack_table = NULL assignment from disable_stack_depot, as stack_table is NULL by default. Fixes: e1fdc403349c ("lib: stackdepot: add support to disable stack depot") Reviewed-by: Marco Elver Signed-off-by: Andrey Konovalov Reviewed-by: Oscar Salvador --- lib/stackdepot.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/stackdepot.c b/lib/stackdepot.c index 2f5aa851834e..0eeaef4f2523 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -101,14 +101,7 @@ static int next_pool_required = 1; static int __init disable_stack_depot(char *str) { - int ret; - - ret = kstrtobool(str, &stack_depot_disabled); - if (!ret && stack_depot_disabled) { - pr_info("disabled\n"); - stack_table = NULL; - } - return 0; + return kstrtobool(str, &stack_depot_disabled); } early_param("stack_depot_disable", disable_stack_depot); @@ -130,6 +123,15 @@ int __init stack_depot_early_init(void) return 0; __stack_depot_early_init_passed = true; + /* + * Print disabled message even if early init has not been requested: + * stack_depot_init() will not print one. + */ + if (stack_depot_disabled) { + pr_info("disabled\n"); + return 0; + } + /* * If KASAN is enabled, use the maximum order: KASAN is frequently used * in fuzzing scenarios, which leads to a large number of different @@ -138,7 +140,11 @@ int __init stack_depot_early_init(void) if (kasan_enabled() && !stack_bucket_number_order) stack_bucket_number_order = STACK_BUCKET_NUMBER_ORDER_MAX; - if (!__stack_depot_early_init_requested || stack_depot_disabled) + /* + * Check if early init has been requested after setting + * stack_bucket_number_order: stack_depot_init() uses its value. + */ + if (!__stack_depot_early_init_requested) return 0; /*