Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1989840rwp; Thu, 13 Jul 2023 21:46:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlHUe0P9sEpiFWuv/c105ZZIe96DdC7hU891fZEAEAgCs29RHV7vMWuP//BB+WcWkc2+gwCE X-Received: by 2002:a05:6808:3095:b0:3a4:45b7:ae06 with SMTP id bl21-20020a056808309500b003a445b7ae06mr32502oib.56.1689309979603; Thu, 13 Jul 2023 21:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689309979; cv=none; d=google.com; s=arc-20160816; b=liBrfh8jgWIJSy+ygFQir/L0n33J4GpX90hfJXPwKCts8Trgr1dmM7H9FQYfFZPuc2 X0QHJrAeJGQ4C1GPSa3TqPN1/p28peZ+KDWcegXJd7vDdqjR95+Qm81MFSYhknhYAsF4 6WSFLtFnyRGP11hM/BW8ilcHRi3wDyTrfVLyxFHO2o3fSdHrkYbfIvcDtjKdwIfBA89F IeW1Dcfs0H28zBrgCy5sN8NKHVSiL1VZNNmgDn01jAfDJEmNFKDq6m5+kqmJdytMPh38 TZisaYQgb1v7GYYTrl3+iqn+y13ZogSCJU5Y2i91+yJxVPVPc8KpJNyuUE6c3GG1zqXP RGnA== 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=xTZJyJNrNsnTJoZ6pMSnfeTnYDCP+/B8VhZBixHLWGI=; fh=nKoYetPUS4gPI2+x3BkQLMLOB3Em8ZuKw3tjPUCbXrc=; b=KCKLn33jIQoi5tc97erZGyJ2R7iQH3oqdv6TZeHO/AvHmCd0cabWk15JEFiHg1L7rt yeMUOBWGdWh5TAYV0pSLy9107g1r5kf0GIMDY+6gStzAaF/3++n3MujGuD3sUY+sT4hG WDTZx4qQHNlm0WMxX7g2hZ691ECKpx5n5mM9SAvWn6YwkiDpwqa0XZ/CH+h9fAp4tAO1 CDNarC8OOJ6+7wZ/ttleTsimeaqYXAibkX1lyVv9bmwINWzJf6KNLqiSq0RcM+D24qTC jYpbvVEwYZE46HzdsK5m2JyStO6H8uTwKXI60SMeijQizg4/NX6IK2Q6sqPP75NzVEcf Bk1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JdJesVTo; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020a63e855000000b0054157c06b5fsi6324110pgk.258.2023.07.13.21.46.07; Thu, 13 Jul 2023 21:46:19 -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; dkim=pass header.i=@chromium.org header.s=google header.b=JdJesVTo; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234919AbjGNEBB (ORCPT + 99 others); Fri, 14 Jul 2023 00:01:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234697AbjGNEA5 (ORCPT ); Fri, 14 Jul 2023 00:00:57 -0400 Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CF31172C for ; Thu, 13 Jul 2023 21:00:57 -0700 (PDT) Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-564e4656fecso1017159eaf.0 for ; Thu, 13 Jul 2023 21:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689307256; x=1691899256; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=xTZJyJNrNsnTJoZ6pMSnfeTnYDCP+/B8VhZBixHLWGI=; b=JdJesVToWjK7nwS/DLOk6n0JQRPhcQM27Jx08NI/Ctm5K4BPo0i7S6Nzi8M4HT7Z3d zc1NJ4E/oJkBw+K/0Rf8EgqjgAYtgMiA2Wqj1r/4dP1dvmDtso/bYldPfBpApIBqrVjq 4scllsOHNgqPHZVQhp+nFe1+4eBUTNGW6Ql0I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689307256; x=1691899256; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xTZJyJNrNsnTJoZ6pMSnfeTnYDCP+/B8VhZBixHLWGI=; b=PCvMwpXQIvHmtMVX49/QA+O3DJfz9w0o0ebJBR3MjOA9T+ICYeKECH3gN0fv/c86BK s7evbIpcAER8p42+B1Giq3NziP+fn2Cf0evjxx2E4Olcl1pwdSD6pUMOUh+fumN3mYqw JA/oUF4kvvldiGhfSJZLWZZbxUS6GgF1l4pSEkedlXRNd3CaNMkyWT1k2IE3wywIM9Ef oe22Ommg9P4I5HhFYlH3RINnGzURGaOB8BiY1KzsWTAsDpCSxIVpxP6X4MHIjt2rpSd/ S0pYYnLAQKBzYeEgg60bgzrGa0umcAW/nwrRnlWDbOBwYoJQKomiqgc72X8RBkH6sNSP yVWA== X-Gm-Message-State: ABy/qLYB+xnH9S30Dfu79jgjR3n3c4TwPS1vvD+9RPArLLgrjlS8mBAa M/6rDVKZMlUId4jklmWrNDmeKA== X-Received: by 2002:a05:6358:280d:b0:12f:2573:45b4 with SMTP id k13-20020a056358280d00b0012f257345b4mr4457182rwb.26.1689307256206; Thu, 13 Jul 2023 21:00:56 -0700 (PDT) Received: from google.com ([110.11.159.72]) by smtp.gmail.com with ESMTPSA id g8-20020aa78188000000b00678afd48250sm6071772pfi.218.2023.07.13.21.00.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 21:00:55 -0700 (PDT) Date: Fri, 14 Jul 2023 13:00:49 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: John Ogness , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH printk v2 2/5] printk: Add NMI safety to console_flush_on_panic() and console_unblank() Message-ID: <20230714040049.GA81525@google.com> References: <20230710134524.25232-1-john.ogness@linutronix.de> <20230710134524.25232-3-john.ogness@linutronix.de> <878rbkrg16.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FSL_HELO_FAKE, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 On (23/07/13 16:43), Petr Mladek wrote: > > Simple removal of console_trylock() in console_flush_on_panic() would > cause that other CPUs might still be able to take it and race. > The problem is avoided by checking panic_in_progress() in console_lock() > and console_trylock(). They will never succeed on non-panic CPUs. > In theory, we also can have non-panic CPU in console_flush_all(), which should let panic CPU to take over the next time it checks abandon_console_lock_in_panic() (other_cpu_in_panic() after 5/5), but it may not happen immediately. I wonder if we somehow can/want to "wait" in console_flush_on_panic() for non-panic CPU handover?