From patchwork Thu Jul 20 16:30:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Schneider X-Patchwork-Id: 13320797 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 E29CCEB64DC for ; Thu, 20 Jul 2023 16:33:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7A91028013B; Thu, 20 Jul 2023 12:33:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7307A28004C; Thu, 20 Jul 2023 12:33:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5836A28013B; Thu, 20 Jul 2023 12:33:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 44FF128004C for ; Thu, 20 Jul 2023 12:33:57 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 07FFBA01FA for ; Thu, 20 Jul 2023 16:33:56 +0000 (UTC) X-FDA: 81032536914.27.D2C5546 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf09.hostedemail.com (Postfix) with ESMTP id D8E3A140025 for ; Thu, 20 Jul 2023 16:33:54 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KUDGCOax; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf09.hostedemail.com: domain of vschneid@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=vschneid@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689870834; 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=B/1vdVWCM4YknPYZ5ppPG1wK5UcqdOcCaaYb4tQPZDs=; b=BGaWJB+Au4MtRfaYIhAak+vlxJjUWu1MNta/r9t3IfJk16rFWHJ2BAAdwh0pVtF/ObPcra bx1iwc6HtNNMGwGDim/GV+DtuQznVZYELqbkWrNs8rBec4xCVyEnr6JT/8gxwoN65I14Ko 4y0fhH+6CEQMpprSltHkJ++F0OmjwqI= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KUDGCOax; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf09.hostedemail.com: domain of vschneid@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=vschneid@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689870834; a=rsa-sha256; cv=none; b=efgkev0AYeT8YZJ3O+NFdADEj7ruk8hugjb5omBUVQRA461xWfgsZuWymLJfij7Lx8NDUa UUW9XZw8qxkLxfhm0SAMU/DEFcKbvbt8eb4ihxi+4++WkX3Is45BSj815680sNFE2GWpcs 6IqKx9NmjBK2xkB8uIz55eKFsIL0qDI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689870834; 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=B/1vdVWCM4YknPYZ5ppPG1wK5UcqdOcCaaYb4tQPZDs=; b=KUDGCOaxX4xatYbGfRJrE6hXAQ7r4LUc8cupDGS1HPvWG3gtm6TG9bqXDeL6GXLbaxOUug TIBtOZRbsu1wyQouSQwvOEyQ8LeENtMHUjOEcjePrQthaFuGdhdu+KfVFFppf2WbrPJnsX DxyVtO49mK7RTJ3MoJ3401AxrjfO2GE= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-504-yTDAMrF4N--Bk_WMn9tLGw-1; Thu, 20 Jul 2023 12:33:50 -0400 X-MC-Unique: yTDAMrF4N--Bk_WMn9tLGw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5A2A62812951; Thu, 20 Jul 2023 16:33:42 +0000 (UTC) Received: from vschneid.remote.csb (unknown [10.42.28.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C73540C206F; Thu, 20 Jul 2023 16:33:34 +0000 (UTC) From: Valentin Schneider To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, x86@kernel.org, rcu@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: Steven Rostedt , Masami Hiramatsu , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Paolo Bonzini , Wanpeng Li , Vitaly Kuznetsov , Andy Lutomirski , Peter Zijlstra , Frederic Weisbecker , "Paul E. McKenney" , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , Josh Poimboeuf , Jason Baron , Kees Cook , Sami Tolvanen , Ard Biesheuvel , Nicholas Piggin , Juerg Haefliger , Nicolas Saenz Julienne , "Kirill A. Shutemov" , Nadav Amit , Dan Carpenter , Chuang Wang , Yang Jihong , Petr Mladek , "Jason A. Donenfeld" , Song Liu , Julian Pidancet , Tom Lendacky , Dionna Glaze , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Juri Lelli , Daniel Bristot de Oliveira , Marcelo Tosatti , Yair Podemsky Subject: [RFC PATCH v2 13/20] context_tracking: Make context_tracking_key __ro_after_init Date: Thu, 20 Jul 2023 17:30:49 +0100 Message-Id: <20230720163056.2564824-14-vschneid@redhat.com> In-Reply-To: <20230720163056.2564824-1-vschneid@redhat.com> References: <20230720163056.2564824-1-vschneid@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspam-User: X-Stat-Signature: gkkxpqq89tuztq597qrjxsi9rkg3xxf3 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: D8E3A140025 X-HE-Tag: 1689870834-450574 X-HE-Meta: U2FsdGVkX184QtiHe0cmtxOu4JK/QAfETeMdV6UL+K5o3YbeeORAqHu7IWx9YodOOAzqvlBkqrLlvvGHrIHe+xJA6phE8Dzg61k2P2ei0t0k0v89ty/wh+iYt8VESZLWIg0HLmZlM3K77t7EHIThH8F83DgP1eiFgNQezbLKV1mbRwcJNzseE55lw5GX9Wg5mOzuRHOgSC2h8ylNJjgcgg1a6NyzUVEJD+iop8HyzR5ZGxGHtj8JFAGes3oQGbYWqEKdBRrRbgsNJ9mGjDzUnLCHbot+W/d3Alo3/LCs3JSEwlsM0gaRptjHHV2Y+4hMJFgbQ5as+uiFNSQBpTXqttbClkUGCXTXSaKP0vIwMJuHXktBpDZN2Hi1lRLGPHqu606losn+yNuB1TydTw/h2Qfz8OuiWV3ETHolwDc6cwHC4agerx7J0gTWOWSkHtGZhL8j9c6x5QvTd7NCPb+0S16Ck/85tsBPFQBXIJWgPnrknz0sRPSlYeRAnXTZgA5YkI2JSuP3q4deVuJdLMGH+KMcrt1ZLvMt97L7cDRkIToMbIsjD8wL6h9yagGKR2nWzcnRufVhUV+x/w6vtzu/4qhy4POF7mvtQ8pDaPAXvYLdTI0rR1TLlqooxtftCMClIhDkHob4Z8il7QBl2dFUtwpe+8I+Ux31fiSps/dE7tJzboQmcYQOqWTgRs43msP8+16PbKh7PuJsEUNBjov/6PVs8skRlQTmtTu1Fjttnlcgo08wLP12MWeesDKT7WJx4xSFy5XxM51M2WCyZJVrrWdNGVZj9jiJLQjGK4iVzxRsa/XH6zIOr3xekh9xFQJVsVHWTs+W7eh5xxMSy7caG97/tAbldeePPYH2u52jwtNpXlafeEhsU/AmB/wprrZ5mC7wyiSjxhYwrDbf1v7X65w634Pfe0xAImrAJe39uw7MssvF4MEI9dCosCPIbylF/QUA3Pxq6gDme3dpx7w 1pYzH7Zy ligx+lJy/j9XoHtP3KuZO2HG9b9f3dlE6T1BqeV6zangTKNZk5pCYDIErKsoNe4hVljsEdOGyiKtrS44lG5pcWaWcenm0aY7LSWMGLJyGGrSasqQ1D29f35ZgFKZ7Aun4gAS1zV57xfUgW05iwSS8SaeQ5UIdkvzy14oJaGns4myPwFfnc/8Xu17iarX18HIZooQhpS+AjaeQViqZeqkt+MHARLHYuTtqOKD+NCTj3J5qIirFsZLUrsktl9J3xQ4hwkWVTZdO9+qmoGCb9Qjcikbj39fxNtNSlCms 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: objtool now warns about it: vmlinux.o: warning: objtool: enter_from_user_mode+0x4e: Non __ro_after_init static key "context_tracking_key" in .noinstr section vmlinux.o: warning: objtool: enter_from_user_mode+0x50: Non __ro_after_init static key "context_tracking_key" in .noinstr section vmlinux.o: warning: objtool: syscall_enter_from_user_mode+0x60: Non __ro_after_init static key "context_tracking_key" in .noinstr section vmlinux.o: warning: objtool: syscall_enter_from_user_mode+0x62: Non __ro_after_init static key "context_tracking_key" in .noinstr section [...] The key can only be enabled (and not disabled) in the __init function ct_cpu_tracker_user(), so mark it as __ro_after_init. Signed-off-by: Valentin Schneider --- kernel/context_tracking.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c index 6ef0b35fc28c5..cc4f3a57f848c 100644 --- a/kernel/context_tracking.c +++ b/kernel/context_tracking.c @@ -432,7 +432,7 @@ static __always_inline void ct_kernel_enter(bool user, int offset) { } #define CREATE_TRACE_POINTS #include -DEFINE_STATIC_KEY_FALSE(context_tracking_key); +DEFINE_STATIC_KEY_FALSE_RO(context_tracking_key); EXPORT_SYMBOL_GPL(context_tracking_key); static noinstr bool context_tracking_recursion_enter(void)