Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp414659rdh; Wed, 7 Feb 2024 08:18:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8Za+0fDsLOfDWPIHdPtF40aWTqhF/CEibjb93vNCgUHlRd5WliLyEWmrZqKwUcoQzTVsY X-Received: by 2002:a17:906:bcf8:b0:a38:104b:40c1 with SMTP id op24-20020a170906bcf800b00a38104b40c1mr4349733ejb.17.1707322731795; Wed, 07 Feb 2024 08:18:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707322731; cv=pass; d=google.com; s=arc-20160816; b=vVJR8zy7AaAaE6RpRGaiNZFA7xfeJAV8OkY2et7M1PVlRYMvg9X4WduMLXNXHJ9V4w /ZMr4BiimNJj3o8pUml/0d435kGDaHPAl3KSIwcBHTu2L5ZnZfGL+2XqENWwC3CK+nxg +Cl5+BfftjS3IQMHr4cLZuphkY1pwU8ce/KJbpf6C5CdNYovJ99/HH2hbxhCJBHt1Ond aP/eK5XcmIlnCwXbHuc8fpSttlBPNHONuw8qCT+eCUlpZNlnVpSb8stg67Qn3790vYfZ oiXFGe9l9JYTU/GOFY+FzwgVcp6uToZxlG0CcF2M3bzRSz3RxZmilyeAH2J0rKyF/LK3 l6lQ== 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=oFVoWznFM6unJk0TCliav4VmM1lXuzkYTMWn4cMSxPo=; fh=cqQhhMrJuzTRp+KGuO3HRbRWtm0dUUtq1SU9v0BHkg0=; b=W+EaytSYjjq7GWHWOWn2ckAo6mqWIW34jrBX0PCykx2+74lGETICaA++LAFQ3ZOMfV TZZ+sbZ81xgqzjukQU/CBbthSzGOB59oEJqKmvYbIRgYrfxIrnZLvBbg68JqeMyg0O1e eOAznT9DjDx/lePu/wWt1/rwNJM18FdIZJp0k6X2AS1JBHBDTnD5DCt1mYy/o735+znw +sxXnmV8LLl9NVickX+gjT+3M0mUAuWmEEg8j6665PlqCTc7tCg9GSILoqWT4nFw2pJB E4wEOU63ubpq3WJ4nTiFSTdYrNuG3/4MceY0kRDTfYRbhUzfqeKU0pWRRGRnX0VGWUok C3Jg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=UiZ2f+6A; 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-56761-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56761-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; AJvYcCV2FVtBpoDkBmEMFKduUbEsQ2DvdymuK8/x6ktUBtxLM2G+Qe+mtOrbUnTOj2SUneKFZVhwk2rfUyDclu3r2tLmSPvMkqK8YRmI4y90FA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cd16-20020a170906b35000b00a379678903esi1133535ejb.849.2024.02.07.08.18.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 08:18:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56761-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=UiZ2f+6A; 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-56761-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56761-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 597A41F21BFB for ; Wed, 7 Feb 2024 16:18:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FF8780BEF; Wed, 7 Feb 2024 16:18:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="UiZ2f+6A" Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.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 21D518063F for ; Wed, 7 Feb 2024 16:18:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707322722; cv=none; b=JcCDT3E1x0zsZmPZVeH6xaSOhitXdbyIy9ioZAji80ax7pmzUHzpc1nU+VX1/EptI22kobmDjEBMbpC5fc1F6as95uSmmbY21r+7NwiDjCld0YH9fkjK6U9Q3low311YcqQ6oEnRWUfVsUiUjn9U5n2AEo+fPJEEn0nvvKzXhYk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707322722; c=relaxed/simple; bh=sVOPThi/QUfRkmH39G9zIkjQB9aCGiSiIwNnPdKz7AI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=vEmIe1Bbnsep6uIcB3/jsI1EHENwUCC3OVOtNTz+grhVxSQWzF3s52007fOrmGVHim4rPExZzgHeWamUR8SY+6yc6Qj3r08gxm81MlW5k6i/1rAkJms8tCrweWYwRnU7TGxzZsfzYzhhXbhcZzcLpv99NPQUWCeLrUfsV9v1pmY= 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=UiZ2f+6A; arc=none smtp.client-ip=209.85.208.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-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-56077dd7936so1010817a12.2 for ; Wed, 07 Feb 2024 08:18:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1707322718; x=1707927518; 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=oFVoWznFM6unJk0TCliav4VmM1lXuzkYTMWn4cMSxPo=; b=UiZ2f+6A4WCyIfIAddlguVRoSgj6tOsUUt6rFznxcO4ttPkyGMedEFPJo62YXJNH4Q u3cNNM7Q9XKm5+do5gUdDQ5H6x9SpM1EArPeZ15iwSkiDmi2JNrEYFr6zVaS1OAASbHm sWMJhou7BXUZUHibiXnKze4PFeXMi74uFvdwaM/QlF7sIZirCRK4jQOnWaKjQ5/AzSy4 yuMblwBRw+ixbzwKLNhBuHMjyhgJgLbTxo5S/ypoBjRpKny/iW4ahtYZZVmOFq17iA2a Qju1ByKFNzs/nA6EJAql5HimOa1QGM7V4V7D9jtQBn0xXxBKUnl1PZNmt80BpdanaSi/ yWxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707322718; x=1707927518; 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=oFVoWznFM6unJk0TCliav4VmM1lXuzkYTMWn4cMSxPo=; b=HogHJmwiz71iBuyDnRm15YXCdi0mFR/fN6/FCcQYgevMSYqKfp+yXYq9h6uBPgxXWn 6K9Gy3ULh4dm2BDBeuJTNY6KYPdcNyzxLPCbPzO+ne0olsSlUwLDJjBMkGVL7Ra6yO+J faldW4ZG7EGAMlg+jkGjQnTO7FrKKIZizGRV0F9vvP7u35BcRmk/tluZM0Adn/COKutv oN+8ONCP5o2/SAJMtdOjTCDRf6dohgs/tDNF0pKhzEY8k7q4zFlr+YmhqPDpDvCm9lKs o1LS5wjRBdpBtBZHVJsnb3RpvX5jzZY6A6hwX0oG5gH/LB9ku4LiQbhuVCF+B6zhLvLB UDew== X-Gm-Message-State: AOJu0Yx7LHOHQKE2v80e3Cit6UwXNUVebqfmShtl4vMGz3wxZBMdJqZU TF+YCCRJAzmRxexwmj22yKzl6BiEoT2czbaoCDUM7xFVF3WYWuy2jvXQE0HZl+c= X-Received: by 2002:a17:907:9116:b0:a38:3af4:a70a with SMTP id p22-20020a170907911600b00a383af4a70amr3125078ejq.60.1707322718368; Wed, 07 Feb 2024 08:18:38 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUcTMKqqqLN7bzUOlV9EasExfOoRNHlobbgeoEPy82pUtythwF4HBihHdNQbvMVYIu3crzrKLcjeaTG8KiApPuAZjJITFf/xY0bm39DoF5qEUEl+8ZIWFjaAAgNA+7Mbc4gCrZqj/nhDb8DsbP3i+fdjydIZS8Sqpq0bG233Eas+H/ILkzk70GGBZ27hXTo2ry1HMCCkdG/a+SF3E1pAzB0QfRQVLNZx26Hqg/XxKisK+QH66YgKEsjtoAFc+98ZB4jcvAYBmDRHqOwaQe6idzy9x+HlU6BkZf0cK2DTVWRvD3lPbPQjp42jC9567LjsGzEUu9wmf2CCXa9oGVMBoy5yqV2hlyRrp11zFXx4ixoyjdtI4KjEDy9zJpZWMMdW2u9S2a5Z78QuNTmr7wCiSrsDUhcLggSSy8= Received: from alley ([176.114.240.50]) by smtp.gmail.com with ESMTPSA id oz14-20020a170906cd0e00b00a38620c3b3dsm902526ejb.198.2024.02.07.08.18.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 08:18:38 -0800 (PST) Date: Wed, 7 Feb 2024 17:18:36 +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: <20240207134103.1357162-1-john.ogness@linutronix.de> 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. Best Regards, Petr