Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp323044pxb; Thu, 27 Jan 2022 23:11:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzEtUAopmyutlFGdyYmRpC8P+U7ONh3AznLE+Dl4aKN0fz4dp+pkfN/kSOHn2c0cCKQjAbb X-Received: by 2002:a05:6402:254a:: with SMTP id l10mr6767516edb.318.1643353873516; Thu, 27 Jan 2022 23:11:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643353873; cv=none; d=google.com; s=arc-20160816; b=bk0FLaLD8qyPxYyI8C7nFAGaLTbGVny2ecH7KH7dwjifNSy6VruHAUJE+Z1rFvchIB 5fb28OAJqWvqafrplfudSAZ1P43kPrrUhmXTvNroRTLA3AI+NTeyz7I2CrmnWzS/yHpf 1H9CwqB8RW6j1Ie1QIkrsjXxotwqW2Lqex5KV1HxFfaeR4Uk2zvHuM2ZjFu0QhEPgs1d Jn49mA3qKkAVEAanTTj6orBpHwbKfJj9KQ58eECKWM0V43W7mXUAaFIUex910FlsNde0 A484uMHH/vRL88q+p/tWG02n9UlmbEuNmSesB/Xrow49qDbcGKTO6KxB+dVJs7NaAxz6 Mi1A== 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=VmFKl1JRf6VnoVBKpirJQ1wmAaQ33BFHMRqpetuEs2s=; b=LPMXEzeqfybFARJijoN0TnNJD1+RVijaRz6qNj7jTrFtYZUxp1lREsON33TUDMBa9I tj86LlDedTxrXpbjQFQjl0tHrvWpFe/+ZRt663unmNPE+AnFR7W7JqCaujRJ3+oagXDw urpf2lA7ZxTdIQ2Y4H7OJLxaOI+bvdGjzIUVo5wHmW87I03RyRrzw9mBVGRoUFXYpLQs hoxKmrd6I+omj9deuRNIU24rVREoBpFXKh9YB4WVpUIEqiuSFm/7cfdKuAzDh1A+TdIH lAiRU/Z34TdRUS6jb3198co3yhsn8pye2mAMo/knennPzyl2ZhOTXnfZrmmtwEJvAfhg S6lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=sJzhUBm3; 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 cr18si1930225ejc.858.2022.01.27.23.10.48; Thu, 27 Jan 2022 23:11:13 -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=sJzhUBm3; 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 S242756AbiA0PDu (ORCPT + 99 others); Thu, 27 Jan 2022 10:03:50 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:44830 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233428AbiA0PDt (ORCPT ); Thu, 27 Jan 2022 10:03:49 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 91DB11F385; Thu, 27 Jan 2022 15:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1643295828; 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=VmFKl1JRf6VnoVBKpirJQ1wmAaQ33BFHMRqpetuEs2s=; b=sJzhUBm3gnTABewOh8sswATXRhOr9WRO5dzBp3lvDZENzYItUOjodoTBkQXf/3BJmUfXo8 OvrqZ0j1Mi2rxRqcO/SEKIAs70a6RpOKhGDKVEOorp4A2S+5tLJ8bdmePa43FmReTwoeV3 hhtXqg+YDVXurCLYZFPsoFr7FONxeNI= 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 338BBA3B83; Thu, 27 Jan 2022 15:03:48 +0000 (UTC) Date: Thu, 27 Jan 2022 16:03:46 +0100 From: Petr Mladek To: John Ogness Cc: Stephen Brennan , Sergey Senozhatsky , Arnd Bergmann , Steven Rostedt , Andrew Morton , Sebastian Reichel , Andy Shevchenko , Luis Chamberlain , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/4] printk: Drop console_sem during panic Message-ID: References: <20220126230236.750229-1-stephen.s.brennan@oracle.com> <20220126230236.750229-5-stephen.s.brennan@oracle.com> <87fsp9pm6q.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87fsp9pm6q.fsf@jogness.linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2022-01-27 10:28:53, John Ogness wrote: > On 2022-01-26, Stephen Brennan wrote: > > --- a/kernel/printk/printk.c > > +++ b/kernel/printk/printk.c > > @@ -2759,7 +2782,7 @@ void console_unlock(void) > > * flush, no worries. > > */ > > retry = prb_read_valid(prb, next_seq, NULL); > > - if (retry && console_trylock()) > > + if (retry && !abandon_console_lock_in_panic() && console_trylock()) > > As Sergey suggested [0], I would like to see the call to > abandon_console_lock_in_panic() move inside console_trylock(). This will > help to avoid the race between NMI CPU halt and the internal sema.lock > spinlock. I would prefer if it is done as a followup patch. The code in this patch is still needed. It helps when the non-panic CPU is busy with pushing many pending messages. Also it is a more conservative approach. Always failing console_trylock() on non-panic CPU makes sense as well. But it affects many more users. It is likely safe because it is trylock. But the entire effect is not fully clear to me. So, I suggest to do it in a separate patch. It might help with bisection. Best Regards, Petr