Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5585398imb; Thu, 7 Mar 2019 20:18:21 -0800 (PST) X-Google-Smtp-Source: APXvYqwZNPijyFhfKF2TdmJG/FTK+lhPWRTvQpM/bnZ/PQPlri8PpSVqLd3OVkumwy+eJza3xJY8 X-Received: by 2002:a63:c34a:: with SMTP id e10mr14736509pgd.194.1552018701011; Thu, 07 Mar 2019 20:18:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552018701; cv=none; d=google.com; s=arc-20160816; b=VdaSnpwq519JIwPYjDMsTdTpuzyrw4QK+7eLIqdfY+jIuX3/COWRffV2Uzne85I3qB EzIMLoq2kEpR2k/yM3MlJkjXz/FPL/UB09ESCDejn/isIB6U29ssud6JsMK/vU6NKoWN FWVgwK9D2T6ARkl9zVC330OArJ2QkLMiGQQPmhx4jHuddmXzuLJ1gWGNk8NYXFNn/gu/ jrgGysUrlkA/apQI1vrdWATi3b4ZwfI//vE3KyQNyYTfIBMH9+rAQqb+Oqxn9Rg863M5 fFgnJ1SGjv4dM7GHeah25i47bARk0JApbMdynw6se9SyNbRfJDG2eI5KpaSFLqB12KIZ WRjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=eqejAwXQsiY1DNgZYzVzKqPwWxprsJr/wztdgSEl9cI=; b=EaCn6XGpw8JS+FDnx5bROpn9dm0QTaVeNrluh9QoeOoEjPifqQxgI3hk5pwHJD0CLR aRECWyAbdm5b3meMP5kbBilsn+Y63aX6YkPinnZaeEUIv+FNeTahU2oqMpj7DoniXYIr LUaE4zaBNhF/tiDE9VtP3tgRi2BHVc+Rj3xpomGenhM1KtcBt1ODthrOj1NJ6U41bAvp 4yXhj+TjgUQXv2d9BT5LAKNn3O87Pzmg9kt13sblq6QM1KknxOi295AZHW+LmwrvXHgy oAf2eBII7++BJCbyqGdcAerkBx+o84D9jOvzy3anyG6fc3+a8Wgw5VpYENbxsESIwUcn RzmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f2si5588788pgv.10.2019.03.07.20.18.05; Thu, 07 Mar 2019 20:18:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726323AbfCHERq (ORCPT + 99 others); Thu, 7 Mar 2019 23:17:46 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:59532 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbfCHERq (ORCPT ); Thu, 7 Mar 2019 23:17:46 -0500 Received: from localhost ([127.0.0.1] helo=vostro.local) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1h26x0-0000wU-9N; Fri, 08 Mar 2019 05:17:38 +0100 From: John Ogness To: Petr Mladek Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Sergey Senozhatsky , Steven Rostedt , Daniel Wang , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman , Alan Cox , Jiri Slaby , Peter Feiner , linux-serial@vger.kernel.org, Sergey Senozhatsky Subject: Re: [RFC PATCH v1 20/25] serial: 8250: implement write_atomic References: <20190212143003.48446-1-john.ogness@linutronix.de> <20190212143003.48446-21-john.ogness@linutronix.de> <20190227094655.ecdwhsc2bf5spkqx@pathway.suse.cz> <87zhqhed3u.fsf@linutronix.de> <20190227135504.gqtcsdwpy4rd7xvs@pathway.suse.cz> <87a7i6ovt3.fsf@linutronix.de> Date: Fri, 08 Mar 2019 05:17:36 +0100 In-Reply-To: <87a7i6ovt3.fsf@linutronix.de> (John Ogness's message of "Fri, 08 Mar 2019 05:05:12 +0100") Message-ID: <8736nyov8f.fsf@linutronix.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-03-08, John Ogness wrote: > If the ringbuffer was fully lockless, we should be able to have > per-console CPU-reentrant spin locks as long as the ordering is > preserved, which I expect shouldn't be a problem. If any NMI context > needed a spin lock for its own purposes, it would need to use the > CPU-reentrant spin lock of the first console so as to preserve the > ordering in case of a panic. This point is garbage. Sorry. I do not see how we could safely have multiple CPU-reentrant spin locks. Example of a deadlock: CPU0 CPU1 printk printk console2.lock console1.lock NMI NMI printk printk console1.lock console2.lock >> ... it should not be a common lock for the ring buffer and all >> consoles. > > If the ring buffer becomes fully lockless, then we could move to > per-console CPU-reentrant spin locks. A fully lockless ring buffer will reduce the scope of the one, global CPU-reentrant spin lock. But I do not see how we can safely have multiple of these. If it is part of printk, it is already implicitly on every line of code. John Ogness