Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp357331rdb; Fri, 6 Oct 2023 05:51:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEU7izPVRlvZxTBpp3uRGjW28y0qa1jJeOWUUwKtDetACwm2Nougx1ah5ZL/7Yz6Chq3Jyi X-Received: by 2002:a05:6358:5e12:b0:143:9b25:c021 with SMTP id q18-20020a0563585e1200b001439b25c021mr5637373rwn.1.1696596700539; Fri, 06 Oct 2023 05:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696596700; cv=none; d=google.com; s=arc-20160816; b=Rrwlbm7Z55tb059CqeL9SbUm+Iy/iXnmraq2Q4FEZhrxAvBy4uBItlYrpNtT7GuU6P CPoFyZQ4MeC9qv9DwBQfu3A+tVdaEUTl6Y7DzIuX2h7l3mdofVsCf6Vi47g1Ois8H3ji xxZiVqPoXpXYVYUqpeMlXuya7TFnr0ZCizP9NuEV+cXQWGKXGzopuIgML0gkqb4ybDxB N4kpl+TgHCeRaWydeOxiVa9rPSF3IvSA22/i+cbWi52FCFQBed65ai/5asLRvq0dCFnt ldMgTU+MmdpZxa49lg58AOahLcMcflOr/OWUyDzY0PZ2a65g9jp6f+TLEX8uEDDMFrkH KSkw== 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:dkim-signature; bh=WygjZDNlYJVIYSTvhziaRFrytx9402lmuEnc9DPEY5g=; fh=T9VKCl0Ppm30gx9lQfMQ2aUeZhDNLmq6BNwiKx9E8/w=; b=vBF+fQnio/R3C1VrtREVhlrXVe3LepG+h2skONjGH5amjYhX5SoP9npshPa6NRuGqd KpMf+yu9VqZcVy11ja3Wo/Cw3XyhWeKUOmSE9auNGeDTQEVJFPg0j9iTvy7OdJe4mM0b RaM4013MaiOCoiwwZLvuvsp6d1MxbKGATNdo2a3ckQ3FztqaJMylQQoNpRPCzOQb8hhD 5awLXEcaxmVFXGD/syV26griUvbS14pTXtqnQ8nsjmLRLFXZvx0mHaxQx9yt0x+L8Gkj /1/Jmx5CzPoNQqQFQkb720EfDO1qDuqT0WkJHfGhfHvknV0ynTJ2GJe5x7DuUYwgc9LZ G8bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=QmNwhKVA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id ay36-20020a056a00302400b00690d9cd7b56si1435755pfb.66.2023.10.06.05.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 05:51:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=QmNwhKVA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 888AF80C8DE6; Fri, 6 Oct 2023 05:51:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232123AbjJFMvW (ORCPT + 99 others); Fri, 6 Oct 2023 08:51:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231817AbjJFMvV (ORCPT ); Fri, 6 Oct 2023 08:51:21 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09AC783 for ; Fri, 6 Oct 2023 05:51:18 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id AFAD921879; Fri, 6 Oct 2023 12:51:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1696596677; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WygjZDNlYJVIYSTvhziaRFrytx9402lmuEnc9DPEY5g=; b=QmNwhKVAjZ3WRmZPz3HGzCxgi6NwuQziqFRt/RSQ3vHG4C8r4VYoVHwCuI2rx7xWRtfjif G16uJqkH8YlfT44dbb5Z/lpxGM3JjqzN9E2fB2N4FPMlMznt2aHUgF8qSWGy0QjMPqYojG 5cyKGA3fKPInVGtsz8a4pvPSWP6EPkw= Received: from suse.cz (pmladek.udp.ovpn1.nue.suse.de [10.163.31.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 7B1B22C142; Fri, 6 Oct 2023 12:51:16 +0000 (UTC) Date: Fri, 6 Oct 2023 14:51:16 +0200 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: panic context: was: Re: [PATCH printk v2 04/11] printk: nbcon: Provide functions to mark atomic write sections Message-ID: References: <87h6n5teos.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87h6n5teos.fsf@jogness.linutronix.de> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 06 Oct 2023 05:51:37 -0700 (PDT) X-Spam-Level: ** Adding Linus into Cc. I would like to be sure about the flushing of atomic consoles in panic context. > During the demo at LPC2022 we had the situation that there was a large > backlog when a WARN was hit. With current mainline the first line of the > WARN is put into the ringbuffer and then the entire backlog is flushed > before storing the rest of the WARN into the ringbuffer. At the time it > was obvious that we should finish storing the WARN message and then > start flushing the backlog. This talks about the "emergency" context (WARN/OOPS/watchdog). The system might be in big troubles but it would still try to continue. Do we really want to defer the flush also for panic() context? I ask because I was not on LPC 2022 in person and I do not remember all details. Anyway, the deferred flush works relatively well for the "emergency" context: + flushed from nbcon_atomic_exit() + printk kthread might emit the messages while they are being added But it is tricky in panic(), see 8th patch at https://lore.kernel.org/r/20230919230856.661435-9-john.ogness@linutronix.de + nbcon_atomic_exit() is called only in one code path. + nbcon_atomic_flush_all() is used in other paths. It looks like a "Whack a mole" game to me. + messages are never emitted by printk kthread either because CPUs are stopped or the kthread is not allowed to get the lock[*] I see only one positive of the explicit flush. The consoles would not delay crash_exec() and the crash dump might be closer to the point where panic() was called. Otherwise I see only negatives => IMHO, we want to flush atomic consoles synchronously from printk() in panic(). Does anyone really want explicit flushes in panic()? [*] Emitting messages is explicitly blocked on non-panic CPUs. It increases the change that panic-CPU would be able to take the console lock the safe way. Best Regards, Petr