Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp434094rdh; Wed, 7 Feb 2024 08:53:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGiALqy3abKSjbBfq+nK0/atcbuhSkEaRdsIjjFoueTcK5sqF+87AmYQzzYwLCgcOhrcz4 X-Received: by 2002:a25:6849:0:b0:dc5:f51e:6a60 with SMTP id d70-20020a256849000000b00dc5f51e6a60mr5297775ybc.6.1707324815298; Wed, 07 Feb 2024 08:53:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707324815; cv=pass; d=google.com; s=arc-20160816; b=bo5Cs/kgIEGxWIGx/Smpn4HmUD1C8HEfwjvYO0KQe3CX1UCm1Q4iUEt2yjpCokJ15f wGPCcQVAdgLf4VjAM7Al6FF96h8HmO8MlXc+EQNI7PE1zudN413En4J9XS4xcyU+zCzt 8vOuWWypIUHN4z5dk1jD6H9AJr81wBIyQJzEaFvg+Z91H8bVVJfZs5fx5RzuvPXsbxpz MsLR3sm8S1/Yv8YQwY7kHSPBzqHrlPioA9jxChZD+//dUnyg5TrFG0ZOprauj4os4k3m u+FszE+7TKBZsQpb1FZ89CDBuQ4Mvy8jYrJCpCHdrF0+573MFKvoDAdv5bJUcewsdkPA QH4g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=g2BN2yRMNi5wZHfPrYZADiXibXtctI9gouyNYRhVgwg=; fh=RhKknwaYLMWNMCyAUP+wfF33IpRQAfO1IPB/LNowiSI=; b=drXrlJjS67ekCTVcgRIWw758rMNQzsPH2iDF3wmiZZXTGV9sou9AiPk83q6uvojclG R6jMMkj/rRDQk71cs8bV9wEp91tIIsEqdZ2y5GPzhWxkqkAaj77h1FYmFb0Do0MnmlTG Kb9yEhdTOHD8p+Mrr+dpWFKUZpZa1a80ocEw5vMuRXfdODJmVMZtM0P0bMJKBzEyUqom kkQRBxs4GOC0HYiwXTTrOThOOjqJPf1kN3Xiju7dLycp61Ut5fhNuVp0PfgAmptPWlak qaF38o4C1FmbZpaHgmibrYT66i76OSaStcgTycurIE4ONevCkepZuvNrBnJ/jbHWSdyv WPLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=EGA1ZxPe; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-56795-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56795-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com X-Forwarded-Encrypted: i=2; AJvYcCVEawCFi1uz1ILUiWOBnvMvFmRyS9xoECjJdK0MRK69yuRCY6l6FoReMAd/fpA1FJ2iZAIEK7M/v81P1C3TYsTcr2w1PUr6TIQTHOXjCA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f17-20020ac85d11000000b0042c268a9666si1512161qtx.799.2024.02.07.08.53.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 08:53:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56795-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=EGA1ZxPe; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-56795-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56795-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C8E621C21897 for ; Wed, 7 Feb 2024 16:53:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6091B81ADB; Wed, 7 Feb 2024 16:53:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="EGA1ZxPe" Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDBD1823AC for ; Wed, 7 Feb 2024 16:53:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707324809; cv=none; b=e4muWFCInBzNzrkULCrzQiaO76u0cF2+frzjxRrEv4w0B+6pGn5DYPFjBv78vSzx96jfK4+PqqJJvCo4qapgnLzIN8rlWLgvJp2t8C/Vz4iZeOpFX2SmyDwq54e3Aw1iT46kExADfeJccDzjNsSmeFvk3OqryR1ZO/YEu0Cwu4o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707324809; c=relaxed/simple; bh=n/o4MonGS1PrploNP/7IkYMhiWZNltaEGfYClBTgrwY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PaHb/GSqrBUKwM+gLEe9T6sQkbZdHnDunHL13df18oTBTv+NIUYiX5/tm2jxaQtwYy0EF+vcxbZmuaHUfjc3Zd3NOU4dPOztkAV38BIiBKj0rwPeQjhsWKch3UIjHHDw+wRfv37eg5+9WSYq9+u7IGs4FC+uzR7YaM5ZdRvTBN8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=EGA1ZxPe; arc=none smtp.client-ip=209.85.218.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a389ea940f1so33646266b.3 for ; Wed, 07 Feb 2024 08:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1707324805; x=1707929605; darn=vger.kernel.org; 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=g2BN2yRMNi5wZHfPrYZADiXibXtctI9gouyNYRhVgwg=; b=EGA1ZxPeBzLPNALJJo49Zj5eITepy/gU3HM1yglB0sezHqK8eGne8cTx0CJ+twqAqA I0IBQw1LEmprbdPN69PN4VDYOH1rBTN6b0ABzM/adbPw1/EhQoZNkt6qoun+qrkw/7f2 KgfZvhqdzlsk/Lf/oe+046gyB3onjdtIDcGNsf693aDdWi8HT/bLg5iZMaW+N9UC8m2F v8aMWYOYYpMWkvwjJBGDXPBNae69IF2oQln3VMrBRMX/CZ/Wti/Bq6AwztmYKpYJEe7Z 7BXyOleHE1nSCNC98/paulRjQRJ3kUpyEUOE5ScIKzHhEJIoSvKfjGaTT6zYfcCNOqUh bPmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707324805; x=1707929605; 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=g2BN2yRMNi5wZHfPrYZADiXibXtctI9gouyNYRhVgwg=; b=NH9zsw7niIuIEBbSNpfCYsu0BjkfHeJ/ZbmYIHdo6xT758azj+5UH+H3ohZRLZlgIn ZuCGj9s/u8mI5fZdC2TErqC+g3DyNrru+RTyU5F73XEbtUy/F9buYG01qy9Mv/RtxPkZ Rq0hSqw80PXucsmLIN4WqkoxB5MbAasP0bQPGh9JTqDKkuxM8fOVYOR/yw9q0vOVKqHb WWQ9HNlbpxyF3rwCECMQyqywAj/LIIEggbc/uPJB5bV7ZDeCsg4lqDiBJpNBAFQREvFn c5Wz3iNZhErVhTp02wvPJwuxMmMEQuZ9FpvNBIV3s+kM+eG5STz/K85XEAFrEsyispTV Cn+w== X-Gm-Message-State: AOJu0YwV23aCVkSi9VcOdgWrATEyeQPSn9How70GJEbII6621KO32GU1 0wtBl0kr3hsILFzwG2zlrzKwwRuIpmaiRLD5HBooE2Y7Dpw9+F+e+pLrkAzqF1s= X-Received: by 2002:a17:906:1c6:b0:a38:1ba8:4609 with SMTP id 6-20020a17090601c600b00a381ba84609mr3946999ejj.13.1707324805093; Wed, 07 Feb 2024 08:53:25 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCV3RzTHzCn5WQcqy5t82NWtoo6EqeDAMKA88yRwQUQ8EIZsGSnhYIWAP/kPW6xKf+P4tUBZWi1s6upbPd00iG1MvaAdX4nOEry5rtAXBQaIZ6at7cuvSuySt2OyosSlYpFwdZnVmATd8TxzR2f9a2ZoCKauaujksF02V47X/eNB9efHY5uv3rlZYlZ3C+v4/MtPxRqaZgd120A8c0LtORBGMRid8JgFc0qMzTl0AfbEcGF5NGlmOsCceU4j5x+GgUsXtNFFea0nYyalzrlJI67Cny8G0ghWW56KqpGK82NyEITjbcI95m9PEEeXeK/OPKFfLW+fKZJL0183+fTo3VpuHkYDKeprxgnjyHbYGRghTQ4C+Xj3nYpXcnYHC7/OZc0RFce9LEdErqd+WGw4CwOhH1CLQw9pheA= Received: from alley ([176.114.240.50]) by smtp.gmail.com with ESMTPSA id oq2-20020a170906cc8200b00a3845a75eb7sm939663ejb.189.2024.02.07.08.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 08:53:24 -0800 (PST) Date: Wed, 7 Feb 2024 17:53:23 +0100 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Mukesh Ojha , Andrew Morton , Josh Poimboeuf , "Peter Zijlstra (Intel)" , Ingo Molnar , Kefeng Wang , Arnd Bergmann , Uros Bizjak , "Guilherme G. Piccoli" Subject: Re: [PATCH printk v4 00/14] fix console flushing Message-ID: References: <20240207134103.1357162-1-john.ogness@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed 2024-02-07 17:18:38, Petr Mladek wrote: > On Wed 2024-02-07 14:46:49, John Ogness wrote: > > Hi, > > > > While testing various flushing scenarios, I stumbled on a few > > issues that cause console flushing to fail. While at LPC2023 in > > Richmond, I sat down with Petr Mladek and we reviewed the > > v2 [0] series. This series is the result of that offline > > discussion. v3 is here [1]. > > > > This series addresses the following issues: > > > > 1. The prb_next_seq() optimization caused inconsistent return > > values. Fix prb_next_seq() to the originally intended > > behavior but keep an optimization. > > > > 2. pr_flush() might not wait until the most recently stored > > printk() message if non-finalized records precede it. Fix > > pr_flush() to wait for all records to print that are at > > least reserved at the time of the call. > > > > 3. In panic, the panic messages will not print if non-finalized > > records precede them. Add a special condition so that > > readers on the panic CPU will drop records that are not in > > a consistent state. > > > > 4. It is possible (and easy to reproduce) a scenario where the > > console on the panic CPU hands over to a waiter of a stopped > > CPU. Do not use the handover feature in panic. > > > > 5. If messages are being dropped during panic, non-panic CPUs > > are silenced. But by then it is already too late and most > > likely the panic messages have been dropped. Change the > > non-panic CPU silencing logic to _immediately_ silence > > non-panic CPUs during panic. This also leads to clean panic > > output when many CPUs are blasting the kernel log. > > > > 6. If a panic occurs in a context where printk() calls defer > > printing (NMI or printk_safe section), the printing of the > > final panic messages rely on irq_work. If that mechanism is > > not available, the final panic messages are not seen (even > > though they are finalized in the ringbuffer). Add one last > > explicit flush after all printk() calls are finished to > > ensure all available messages in the kernel log are printed. > > > > 7. When dumping the stacktrace from panic(), do not use the > > printk_cpu_sync because it can deadlock if another CPU holds > > and is unable to release the printk_cpu_sync. > > > > This series also performs some minor cleanups to remove open > > coded checks about the panic context and improve documentation > > language regarding data-less records. > > > > Because of multiple refactoring done in recent history, it > > would be helpful to provide the LTS maintainers with the proper > > backported patches. I am happy to do this. > > The series seems to be ready linux-next from my POV. I am going > to push it there so that it gets as much testing before > the merge window as possible. JFYI, it has been committed into printk/linux.git, branch rework/console-flushing-fixes. Let's keep our fingers crossed. Best Regards, Petr