From patchwork Mon Dec 13 21:54:28 2021 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: 12695993 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3D5CC433F5 for ; Mon, 13 Dec 2021 22:21:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VLw0CmBa/m5cl9X5/9/NHl5hGHU9Lhg+Ri0Oj/CzVOM=; b=WWM97d0xOK+sdE MAzhKj1h5m4ydCVRGV2sOJSDW1ScqKIgwswVoZVzJOYYfuYQhgLgo98hlTxK/DFtOsmFuaEoU7Tz/ GIoA7E4z6fp064W7zktsMZCMbZAPPPT8zq8bOwLlO/nzfwq3rhz0LHW/mxBuREdEcpVqbcHU4/3HE BK+9EutG6qj1F5Ch1WFkO8fJxL4SFJ6asT0hBJDDNNomn4HH+ZvB11dQechNByFxT/7SaD/DZwAXk Igr9Plds+ERxha7l7KmPo44Id2CYoqYsGV/Hq4PQ9NdHYcA8yHplWOlmEdPK0Y+gUx1eS8ZMkt3yL EPSDH0ClrEb+9PCQxYxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwtfL-00BgW6-Uj; Mon, 13 Dec 2021 22:19:28 +0000 Received: from out0.migadu.com ([2001:41d0:2:267::]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwtHl-00BWZW-Kl for linux-arm-kernel@lists.infradead.org; Mon, 13 Dec 2021 21:55:07 +0000 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=1639432504; 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=vluHY+VQM1dpG6ccvF7RpbMooJaXSsDFIpBMIGK6fR8=; b=JnDImSkLaZ6d7uJJAqpBoqYBBE7J0wOFYTvyehFxEy4bRBF1E6C15fV9dW58vlWcg0OVqc kh1HsWxG4piAmnn1hi6+5dpNyhk8/q769Q+GniE5V6LHtL+PYs3URK4pXqeABGEwpPt8av RLMbS14ILb02u/kXoRiu8Q15pzow6KU= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko , Andrew Morton Cc: Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, linux-mm@kvack.org, Vincenzo Frascino , Catalin Marinas , Will Deacon , Mark Rutland , linux-arm-kernel@lists.infradead.org, Peter Collingbourne , Evgenii Stepanov , linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH mm v3 32/38] kasan: mark kasan_arg_stacktrace as __initdata Date: Mon, 13 Dec 2021 22:54:28 +0100 Message-Id: <7825a5fecec3626441ed3fe734090e9e3ab9a0f9.1639432170.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: andrey.konovalov@linux.dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211213_135505_904076_6C9EB2C5 X-CRM114-Status: GOOD ( 11.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Andrey Konovalov As kasan_arg_stacktrace is only used in __init functions, mark it as __initdata instead of __ro_after_init to allow it be freed after boot. The other enums for KASAN args are used in kasan_init_hw_tags_cpu(), which is not marked as __init as a CPU can be hot-plugged after boot. Clarify this in a comment. Signed-off-by: Andrey Konovalov Suggested-by: Marco Elver --- Changes v1->v2: - Add this patch. --- mm/kasan/hw_tags.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/kasan/hw_tags.c b/mm/kasan/hw_tags.c index bbcf6f914490..fb08fe1a3cf7 100644 --- a/mm/kasan/hw_tags.c +++ b/mm/kasan/hw_tags.c @@ -40,7 +40,7 @@ enum kasan_arg_stacktrace { static enum kasan_arg kasan_arg __ro_after_init; static enum kasan_arg_mode kasan_arg_mode __ro_after_init; -static enum kasan_arg_stacktrace kasan_arg_stacktrace __ro_after_init; +static enum kasan_arg_stacktrace kasan_arg_stacktrace __initdata; /* Whether KASAN is enabled at all. */ DEFINE_STATIC_KEY_FALSE(kasan_flag_enabled); @@ -116,7 +116,10 @@ static inline const char *kasan_mode_info(void) return "sync"; } -/* kasan_init_hw_tags_cpu() is called for each CPU. */ +/* + * kasan_init_hw_tags_cpu() is called for each CPU. + * Not marked as __init as a CPU can be hot-plugged after boot. + */ void kasan_init_hw_tags_cpu(void) { /*