Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4526899pxb; Tue, 25 Jan 2022 12:18:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJzC91QOtgAyHdvn2kJJQw+oOHKVrWAWaeFoVMg1YvKf56RHrchtjA8soI9cewV7xu8wGrvU X-Received: by 2002:a63:6b81:: with SMTP id g123mr16724671pgc.140.1643141891207; Tue, 25 Jan 2022 12:18:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643141891; cv=none; d=google.com; s=arc-20160816; b=QZTPS3mrNfkHmKZCpyQigz7yRbHZ62d/5+ZKLcyt4crovhH2rid+AIsGhoL13RQvqg EOG7E+LckPkpy284UOb5m+BYMeRDVr+bb4OBHYQzhQxdZs5Q1rO56O9wFRmQwgZYP09x YbvPyFUcjnnb979srYL/OF4cq888YM8WzSZ/1AL6lekKenCzlJY1s1MGiakLO8p+7smu 0LYv+Kb7xgk9aauYZsUE4fXSLp9Kk3LYKSBpluNyDYgCT4l7bAXoXOf57efwlvxvmFoa 9xvtwKKq2pI8ijI3qX8dLGqoHbp+qG1faNCK2qjGKIGZuC5rQkSdGU/Z6fz73sGwdS0d b+qw== 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=1oi05nJVTpmax0XEzzHo6/1zPl+3C8kP4fs5h/613xY=; b=H1JvqNDAi05IaXDwveY2MXLQEHalldDLaSSi6twW8Jm3NZcHKrqyMce1Fi5iQsbels 2WOMRqk5MyUES8sPpuNc4MMeWBTdIhfIiVuOYGqNobJdCvsMsylrLN1J0rKZzxJiJcyT ZsSyKdl9iyMLenMy12ojyx+o5w0S2XajMZkBVTU4GMP3sLIHiXUlZs0SrpcC5DD2iNVD 7zbXmfWUrRJFSp34DtBjNQSlvu/rLYfWcW4C8GbjFRYNsR9op3zKo+dINrnZHT0srV4R ymLE1A/6es7ckimZqJC5KN7khbtm836GBOGehD895XkNPPzle/aav6BM4JGQ5Ny7D4Ya 3yAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=SnjLKHeN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x2si13416263pgl.693.2022.01.25.12.17.58; Tue, 25 Jan 2022 12:18:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=SnjLKHeN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242009AbiAYOcV (ORCPT + 99 others); Tue, 25 Jan 2022 09:32:21 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:46264 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1578140AbiAYOZ4 (ORCPT ); Tue, 25 Jan 2022 09:25:56 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 5178421127; Tue, 25 Jan 2022 14:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1643120753; 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=1oi05nJVTpmax0XEzzHo6/1zPl+3C8kP4fs5h/613xY=; b=SnjLKHeN30YEpkobUUiYRMnnS+j3DA8NsdXLwryHgr6wxASDFmmR4doZ2wZrLoJd1nYcfV lHsaNPh9pZ8M4O+WNF8uYTqVK/wTigmHG2j+GZr+IwFadeIvgUB1aKiKkOieeLPyjdSibv 9TsGP2h57K1zp2RD2CxVZ+cDgUeqCZM= Received: from suse.cz (unknown [10.100.216.66]) (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 1117EA3B97; Tue, 25 Jan 2022 14:25:53 +0000 (UTC) Date: Tue, 25 Jan 2022 15:25:49 +0100 From: Petr Mladek To: Stephen Brennan Cc: Sergey Senozhatsky , Steven Rostedt , John Ogness , Sergey Senozhatsky , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] printk: Avoid livelock with heavy printk during panic Message-ID: References: <20220121190222.572694-1-stephen.s.brennan@oracle.com> <20220121190222.572694-4-stephen.s.brennan@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220121190222.572694-4-stephen.s.brennan@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2022-01-21 11:02:21, Stephen Brennan wrote: > During a panic(), if another CPU is writing heavily the kernel log (e.g. > via /dev/kmsg), then the panic CPU may livelock writing out its messages > to the console. Note when too many messages are dropped during panic and > suppress further printk, except from the panic CPU. I would add something like: "It might cause that some useful messages are lost. But messages are being lost anyway and this at least avoids the possible livelock." > --- > kernel/printk/printk.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index 20b4b71a1a07..ca253ac07615 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -2667,6 +2678,8 @@ void console_unlock(void) > if (console_seq != r.info->seq) { > console_dropped += r.info->seq - console_seq; > console_seq = r.info->seq; > + if (panic_in_progress() && panic_console_dropped++ > 10) > + suppress_panic_printk = 1; It would be great to let the user know, something like: pr_warn("Too many dropped messages. Supress messages on non-panic CPUs to prevent livelock.\n"); > } > > if (suppress_message_printing(r.info->level)) { Otherwise, it looks good to me. Best Regards, Petr