Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3532101pxb; Mon, 24 Jan 2022 11:33:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIreO+k+bM1U0NaDtWOnXV8v0B0FdW27hNKrkPhD2tZ5dGLtUIr5fZNq255Jz674udf3xa X-Received: by 2002:a63:5611:: with SMTP id k17mr835199pgb.88.1643052834749; Mon, 24 Jan 2022 11:33:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643052834; cv=none; d=google.com; s=arc-20160816; b=KH5u1QPos+R0aIpRA4RMz5AvMoEEntS4z0HVqQ29ELiVhTajo0h5GJSrw30tKJjikL b3qxCeHo+sYHY9s4hVW6ZcYaUWztjwLGsxWE9z5S5CjrsFZZ5Q0OJE/kJDsLVXWKSJU+ lR1gNaTQmWaL06dtThtZZkgHuwZqH3W6hujoPjc11kqGbQEL3lHTupZpcc26tBOuD97P 34yofkCtFmL0bQXJavAacrihENFnFEiNsCJdH6K5s7urkKCSKeG0f9mM0YBX6xsoA/55 U2hCVeozKa8LuzbRIiRN9kpglO54eHN9ezFtH+Dca0dLQviqpA1tX2xJ++1n6jcZ3xE3 iXBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=jooe9jBPXibapFbfnxQ9Av5bLAmMuo5zROFe8iN25sY=; b=adKTMJRLBenF31E30cMgO/vNgc2Iwa7bzFNgVlQgE29kLE1pD0Clvpap42pu45uJ+b c8SiazIuD4g8zsktS6nEZ3paHmEyc/lBPxEZ7v+m/Y06agviVoD/MUGNxuuFJcBbOrb3 GjFbe0w4uVevGGU9S4uW5QLmBxFkrMM5ogJ/nPXqVDQpqmWTvB0vxavi4j8ZHR90bLK2 k/Yjtl54CxwrZy1PGZ6kDa60FgvrCMGsbNPryM0duLXahUhTpz7w7t3zq1Ca7cWAW2/1 26wkSNIPWBzmTZ08LsNs6xySd1n7lExX++qiKsp0qDvkuYEVC5E1eW3D3n2Ibi3xmLHG VJKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=iFsT4KKm; dkim=neutral (no key) header.i=@linutronix.de header.b=6dzMQhWU; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si13456616pll.62.2022.01.24.11.33.34; Mon, 24 Jan 2022 11:33:54 -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=@linutronix.de header.s=2020 header.b=iFsT4KKm; dkim=neutral (no key) header.i=@linutronix.de header.b=6dzMQhWU; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243718AbiAXQ0d (ORCPT + 99 others); Mon, 24 Jan 2022 11:26:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241129AbiAXQ0a (ORCPT ); Mon, 24 Jan 2022 11:26:30 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AB8AC06173B for ; Mon, 24 Jan 2022 08:26:30 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1643041587; h=from:from:reply-to:subject:subject: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=jooe9jBPXibapFbfnxQ9Av5bLAmMuo5zROFe8iN25sY=; b=iFsT4KKmlgDvY2sYKUcXLLyhxqrq1Q7RKdyP39BiRc3sfQgRDuidwLq867y1P5clkBsry1 00Oigt05jpcHFVOIxHBdzTeq5WBV/vwzcRZX7oMbiyS1lx/Uw3W9lwekXxtBXSyLC60GYz aWg+jpQz9K1bk4cRrGOWIyvYjTkzNHwmJ+2ywWUAHwYXGqWXnrBo7PbebH6h+Z9S7FJx3M CFyFq++qZitMkmdxD2Yts8QtjK0r7687PzKekQxUa1yA9/qiAQuGlzoTwp4YgBShiRhpOG 7acPyNAEcttIGD9x9OJ01cgIez44A/J2vs6SeYstU+9r60Ow04i77aP54gzCwQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1643041587; h=from:from:reply-to:subject:subject: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=jooe9jBPXibapFbfnxQ9Av5bLAmMuo5zROFe8iN25sY=; b=6dzMQhWUss8oyS0GWwz2l/IXUPpbT8WqibCSs2Oh7xUYiw43zIcmpXnPFE+jF2mIfWF2FX 6uHGqZAG5Ztl7EDg== To: Stephen Brennan , Petr Mladek , Sergey Senozhatsky , Steven Rostedt Cc: Stephen Brennan , Sergey Senozhatsky , linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] printk: Drop console_sem during panic In-Reply-To: <87pmoh3yf9.fsf@jogness.linutronix.de> References: <20220121190222.572694-1-stephen.s.brennan@oracle.com> <20220121190222.572694-5-stephen.s.brennan@oracle.com> <87pmoh3yf9.fsf@jogness.linutronix.de> Date: Mon, 24 Jan 2022 17:32:27 +0106 Message-ID: <87mtjl3xsc.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-01-24, John Ogness wrote: > Something like: > > @@ -2731,7 +2731,8 @@ void console_unlock(void) > * there's a new owner and the console_unlock() from them will do the > * flush, no worries. > */ > - retry = prb_read_valid(prb, next_seq, NULL); > + retry = (pcpu != raw_smp_processor_id()) && > + prb_read_valid(prb, next_seq, NULL); > if (retry && console_trylock()) > goto again; > } Sorry, that hunk is obviously garbage. I meant something like: @@ -2731,7 +2731,10 @@ void console_unlock(void) * there's a new owner and the console_unlock() from them will do the * flush, no worries. */ - retry = prb_read_valid(prb, next_seq, NULL); + if (panic_in_progress()) + retry = (pcpu == raw_smp_processor_id()) && prb_read_valid(prb, next_seq, NULL); + else + retry = prb_read_valid(prb, next_seq, NULL); if (retry && console_trylock()) goto again; } I'm sure there is a cleaner way to code that. John