Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3771120imw; Mon, 11 Jul 2022 15:47:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vIqIr5j3t8tsfclkgDdgC0z5b3IdAXm3lRuEm6eAa7D0sGSNjLdDgZiUdn5gAbp9lbvMDI X-Received: by 2002:a17:90a:bc8f:b0:1ef:845d:d34d with SMTP id x15-20020a17090abc8f00b001ef845dd34dmr730770pjr.118.1657579630399; Mon, 11 Jul 2022 15:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657579630; cv=none; d=google.com; s=arc-20160816; b=O2By51u0Ve7DZgR+TVmjmGIvvXeBalI+t5g0yA7fJhj3zacCqg+vd8vZnVW6yIXfz/ Gg/LuIEMJwlBKxvx12s4f7p3Eou3OjvwM6DSobFTrLt4r0y1GFIu2mcK8Ao9Gwd1AtUf 5543n3IhYdyxYBXZri8H0xM2WiYiZHcTgAPcXFQLKr7AMx9c+jxuI9dufOGv1TjezETw XaP7Glpe6Gryb2fNGxU3B1pmmCVsOTRFIYcGXcc+CwF6hSCmZL98fQLaidloaLBVoB5t eCS6NeGuqANO54dLaHSm2sKLIcVg6uoyy4GN1SR19JSiDO9Haj45QsScWzwLhUS0PKfm xVwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=KC8nJVCZYlFizOhBExKnQcu8+GgOnpx88YOiuGC3UF4=; b=dGDcY6Sj9iYetKlWS638YNfJnHGRMr+UrOTo5zhmuUXfaV9kS46+ryf8T7+7gyBeA2 C9Z0aFrpIoAB5vDQkKdNA+2tJIP+xHELAQYJZg4GcJmMmqCm6Li1oP9CPaTPE0VZUwT9 Tuga1eA3O0AM/oRpiGk/rAdd/VbelyUCsZBJ2VcQkhasFwWJj5+hsXmV7kuDexHg5/k/ WbVpq9Br6lNP65O+uwqpSrn0XTvsPRbBLaNexEVxPxrlMrsvW4VSDXFH39sY4e39HlZ3 W7Ho65sc6dc7t56/lggOOYCBCXRFO3wsDtSNoanVIHPCBmjpVdOx1KrEfDZYNoIs2Mdr Z9Bw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a17090aa38500b001e891954abdsi10227765pjp.122.2022.07.11.15.46.58; Mon, 11 Jul 2022 15:47:10 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230437AbiGKW3Z (ORCPT + 99 others); Mon, 11 Jul 2022 18:29:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229743AbiGKW3Y (ORCPT ); Mon, 11 Jul 2022 18:29:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D61D728735 for ; Mon, 11 Jul 2022 15:29:23 -0700 (PDT) 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 883ACB815E6 for ; Mon, 11 Jul 2022 22:29:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 080A1C3411C; Mon, 11 Jul 2022 22:29:19 +0000 (UTC) Date: Mon, 11 Jul 2022 18:29:18 -0400 From: Steven Rostedt To: Marco Elver , "Paul E. McKenney" Cc: John Ogness , Petr Mladek , Sergey Senozhatsky , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Thomas Gleixner , Johannes Berg , Alexander Potapenko , Dmitry Vyukov , Naresh Kamboju , Linux Kernel Functional Testing Subject: Re: [PATCH -printk] printk, tracing: fix console tracepoint Message-ID: <20220711182918.338f000f@gandalf.local.home> In-Reply-To: <20220503073844.4148944-1-elver@google.com> References: <20220503073844.4148944-1-elver@google.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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, T_SCC_BODY_TEXT_LINE 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 I know I acked this, but I finally got a tree where it is included in my testing, and I hit this: INFO: NMI handler (perf_event_nmi_handler) took too long to run: 9.860 msecs ------------[ cut here ]------------ WARNING: CPU: 1 PID: 16462 at include/trace/events/printk.h:10 printk_sprint+0x81/0xda Modules linked in: ppdev parport_pc parport CPU: 1 PID: 16462 Comm: event_benchmark Not tainted 5.19.0-rc5-test+ #5 Hardware name: MSI MS-7823/CSM-H87M-G43 (MS-7823), BIOS V1.6 02/22/2014 EIP: printk_sprint+0x81/0xda Code: 89 d8 e8 88 fc 33 00 e9 02 00 00 00 eb 6b 64 a1 a4 b8 91 c1 e8 fd d6 ff ff 84 c0 74 5c 64 a1 14 08 92 c1 a9 00 00 f0 00 74 02 <0f> 0b 64 ff 05 14 08 92 c1 b8 e0 c4 6b c1 e8 a5 dc 00 00 89 c7 e8 EAX: 80110001 EBX: c20a52f8 ECX: 0000000c EDX: 6d203036 ESI: 3df6004c EDI: 00000000 EBP: c61fbd7c ESP: c61fbd70 DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 EFLAGS: 00010006 CR0: 80050033 CR2: b7efc000 CR3: 05b80000 CR4: 001506f0 Call Trace: vprintk_store+0x24b/0x2ff perf: interrupt took too long (7980 > 7977), lowering kernel.perf_event_max_sample_rate to 25000 vprintk+0x37/0x4d _printk+0x14/0x16 nmi_handle+0x1ef/0x24e ? find_next_bit.part.0+0x13/0x13 ? find_next_bit.part.0+0x13/0x13 ? function_trace_call+0xd8/0xd9 default_do_nmi+0x57/0x1af ? trace_hardirqs_off_finish+0x2a/0xd9 ? to_kthread+0xf/0xf exc_nmi+0x9b/0xf4 asm_exc_nmi+0xae/0x29c On Tue, 3 May 2022 09:38:44 +0200 Marco Elver wrote: > Petr points out [1] that calling trace_console_rcuidle() in > call_console_driver() had been the wrong thing for a while, because > "printk() always used console_trylock() and the message was flushed to > the console only when the trylock succeeded. And it was always deferred > in NMI or when printed via printk_deferred()." The issue is that we use "trace_console_rcuidle()" where the "_rcuidle()" version uses srcu, which the last I knew is not safe in NMI context. Paul, has that changed? Thus, we need to make sure that printk() is always called when "rcu is watching" and remove the _rcuidle() part, or we do not call it from nmi context. Or make srcu nmi safe. For now, I'm reverting this in my local tree. -- Steve