Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp324047pxb; Thu, 27 Jan 2022 23:12:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwGq2+KWIOUnWs6VjfWRj4JDyUjT31dkuqL4QS5TLrnDaeQnWAGgZoBZE7vzWPmr70Wb2+A X-Received: by 2002:a17:907:3da4:: with SMTP id he36mr5736146ejc.617.1643353977864; Thu, 27 Jan 2022 23:12:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643353977; cv=none; d=google.com; s=arc-20160816; b=EHhyX1y2CitTVPWxM3AuJr4xYMI/PEaGrW4V9uQIy1imiCRC3BYevZOIcIeLYGD3hu 4DJ9xncNtAg7E0g0yA3v1GkKx47WIsgVSQdslIXC30DuA6WycyhVP8uAgAEsEySBL6Ww 4Q4c21d/+/3wjPq0orO6D4Sxc1WAiGwu8SW5OJqFWr2DPsOHkkzjv5QUptvkQg7rt1XQ 5QyALoRF/G4amXjx6SekG7A8PQeoO1fm2XwH0hzU7JG4RpG7O5ROPOtLa6JxJ+jqqdsX ciT2/TRhTHorlagoEGZXy9x0NH8owFwFf9kLOQUt+eRyy2OmEr0h9FQL9X2yP7UiftV1 ID4w== 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=fvL1YYl5W4GI9g+co4qNQ7x00M2JFYmNkhWDE8SBozw=; b=G/u5BOQV4lPk5bwqlS3tS9zc/KjKAWJXOrKjeM8YCS4/DPlJGKia2U6yLegvCT5mS1 G0FbtsaO+wJnWBifEAdRKsAQW/0/L86d1f6EeKyuO3Rsj9QES4dm+bIh2r8VpGL9RXwE rhPeGIasmy+/m3aBRskhdrBya4hOIZXm9i8d6SchsApvmpvtoiNLLW/ztrzHRqIhJYkS IOzJUGedvL4FkIFl+1zNeJoX7aISDvQjhQZp49vPduzoS2pGNu6kbW3abg+U6/v70m/8 jBs5AaV0DWDl7rLrPfJnUNe2hviV2mt/cjBpSN8KsTzJltHv8qh6+bkrdjJg1Hp7XPUA rl/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=L6R7ceTq; 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 c20si2527318eds.546.2022.01.27.23.12.33; Thu, 27 Jan 2022 23:12:57 -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=L6R7ceTq; 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 S237394AbiA0PNC (ORCPT + 99 others); Thu, 27 Jan 2022 10:13:02 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:45792 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232879AbiA0PNB (ORCPT ); Thu, 27 Jan 2022 10:13:01 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id AE54F1F3A9; Thu, 27 Jan 2022 15:13:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1643296380; 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=fvL1YYl5W4GI9g+co4qNQ7x00M2JFYmNkhWDE8SBozw=; b=L6R7ceTqkPzvfThlwNqs7lUAIM26anfYGwC7FhNrYrpZt19OoJM+c02/JR8H/M1DZz38KC 0cIKui/Pf4wfAFS/slczwWQwG5xd3yTdDf22fsL7tu3djXIQq5BTX+EacR7zFS1cOuMNBk j6ydMtzKxAcrgm1SpWKBztV8JVhDdiE= 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 6F474A3B81; Thu, 27 Jan 2022 15:13:00 +0000 (UTC) Date: Thu, 27 Jan 2022 16:12:58 +0100 From: Petr Mladek To: Stephen Brennan Cc: Sergey Senozhatsky , Arnd Bergmann , Steven Rostedt , Andrew Morton , Sebastian Reichel , John Ogness , 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220126230236.750229-5-stephen.s.brennan@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2022-01-26 15:02:36, Stephen Brennan wrote: > If another CPU is in panic, we are about to be halted. Try to gracefully > abandon the console_sem, leaving it free for the panic CPU to grab. > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index 18107db118d4..572363ff716f 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -2742,6 +2761,10 @@ void console_unlock(void) > if (handover) > return; > > + /* Allow panic_cpu to take over the consoles safely */ > + if (abandon_console_lock_in_panic()) > + break; Hmm, it makes some sense to have it before cond_resched(). But I would like to have it at the beginning of the cycle so that console_unlock() might leave quickly without processing any single message. We could have it in both (three) locations. But it might be over cautious. Anyway, the beginning is more important. Sleeping with console_sem is less risky from the panic and races point of view. Best Regards, Petr