Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3562315imu; Mon, 14 Jan 2019 05:19:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN4HAoIOmB/qxcqndKp2mDDiWcD0KX5B6EZJGmXuet3cj5HTHEBeAi7um0ZnGkkFUoVZY4T6 X-Received: by 2002:a63:3d1:: with SMTP id 200mr22979877pgd.68.1547471968967; Mon, 14 Jan 2019 05:19:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547471968; cv=none; d=google.com; s=arc-20160816; b=GhupJiwNufvVOpDtl0RqUkwPJE6HknMr7/DnCHrADbqsvVBli/hUWhLJECWS49AmD3 IxI9oPumMPXynT8fhxvChFyRosIvXUEDYYG1ZD/8Pgy+1pPOY7x6ky08hd4ME+Iozins IOnVnh4IT+8YbD2GManSnKbmv3PCsMjhQhUho6ozOSuDP6rwjwje2WlTl/Ot/B2oHYnF uGcQT16s+iMzPI4T3QGLWKCfNlpmoKLUiNX6+/4/eVfnEYvE+ohefwE+DkRou3DsDrGP foplm2KApxrG9QhbrtuEqa/aO2M25GCuOeXjekuTr7gPiHiYtu8KFjvm6/lbB8AXeTVW 09jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=5qxlB5yVFnLIYJWYI2HjyNUfc3CosETsxxmc3JKM1w0=; b=oQXCkECU+0AuAnv8kBG/Uj6t1QSWjwxtdSypnB9md18Zs/nEYvVJAqXgz5dGIylWag 5c13mQix0UULoExzcWZ9C69D9AezJgk5OYHhTpSD9FkgyN2qkyj1cCSJNSxrh7LZXh+1 E0nxUqrqgxpp4hBQ5zj3yG/0YbNEK1K7uc/fHcvXNLj/oE3PJNGD54zK5moDyHLNQvbk bzE1bmid+ke/Al90/0KvPoM7bafcHgXQrimTulGSTD3ytCfjDMuKKcNwDBiKDz5XO9PK BPXSjslWBWpO+fxH721aCLKOe9uvlMbHl/AJMNjch41EYAoEXY/TY5j4YHx/NePtWj8C QR9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=irKXv4BD; 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 z61si324041plb.49.2019.01.14.05.19.12; Mon, 14 Jan 2019 05:19:28 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=irKXv4BD; 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 S1726570AbfANNQT (ORCPT + 99 others); Mon, 14 Jan 2019 08:16:19 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:54432 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726449AbfANNQT (ORCPT ); Mon, 14 Jan 2019 08:16:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5qxlB5yVFnLIYJWYI2HjyNUfc3CosETsxxmc3JKM1w0=; b=irKXv4BDnRUorl6Y5U1Hotgen QH1IIsc/J7YaVfstbuxE92jRuGOVRI58o2IMY8jJ7HySJZOzyz2Qmm58jK1bOvrWagPITe/z3ZDLP hsCRF6pYbfNFl0cuNAauRSwzmST80ETAyDI1dZv2c3/c0aOf8oGpoelzsZXRm9bk/RmjDCUxr7jKY xe1Af0n/roLTECU2fX1D1bP/TDLzqInSp3848cl/uXI/r7upq5BFG61873CU6BkViVfzzcM+dzIS/ haCZzmVg/4NWwkgXH+3FaCR81s1juf1k9TbdWqpzw9ebeT2yJq//UYdRj9MHZ8AbVP/XiSElSpgVP NIWAzd32w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gj26B-0007W3-D1; Mon, 14 Jan 2019 13:16:15 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6A65B200A65EE; Mon, 14 Jan 2019 14:16:13 +0100 (CET) Date: Mon, 14 Jan 2019 14:16:13 +0100 From: Peter Zijlstra To: James Morse Cc: Waiman Long , Zhenzhong Duan , LKML , SRINIVAS Subject: Re: Question about qspinlock nest Message-ID: <20190114131613.GB10486@hirez.programming.kicks-ass.net> References: <910e9fb6-d0df-4711-fe2b-244b3c20eb82@redhat.com> <20190110201217.GH2861@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 11, 2019 at 06:32:58PM +0000, James Morse wrote: > Hi Peter, > > On 10/01/2019 20:12, Peter Zijlstra wrote: > > On Thu, Jan 10, 2019 at 06:25:57PM +0000, James Morse wrote: > > > >> On arm64 if all the RAS and psuedo-NMI patches land, our worst-case interleaving > >> jumps to at least 7. The culprit is APEI using spinlocks to protect fixmap slots. > >> > >> I have an RFC to bump the number of node bits from 2 to 3, but as this is APEI > >> four times, it may be preferable to make it use something other than spinlocks. > > >> The worst-case order is below. Each one masks those before it: > >> 1. process context > >> 2. soft-irq > >> 3. hard-irq > >> 4. psuedo-nmi [0] > >> - using the irqchip priorities to configure some IRQs as NMI. > >> 5. SError [1] > >> - a bit like an asynchronous MCE. ACPI allows this to convey CPER records, > >> requiring an APEI call. > >> 6&7. SDEI [2] > >> - a firmware triggered software interrupt, only its two of them, either of > >> which could convey CPER records. > >> 8. Synchronous external abort > >> - again, similar to MCE. There are systems using this with APEI. > > > The thing is, everything non-maskable (NMI like) really should not be > > using spinlocks at all. > > > > I otherwise have no clue about wth APEI is, but it sounds like horrible > > crap ;-) > > I think you've called it that before!: its that GHES thing in drivers/acpi/apei. > > What is the alternative? bit_spin_lock()? > These things can happen independently on multiple CPUs. On arm64 these NMIlike > things don't affect all CPUs like they seem to on x86. It has nothing to do with how many CPUs are affected. It has everything to do with not being maskable. What avoids the trivial self-recursion: spin_lock(&) spin_lock(&x) ... wait forever more ... spin_unlock(&x) ? Normally for actual maskable interrupts, we use: spin_lock_irq(&x) // our IRQ cannot happen here because: masked spin_unlock_irq(&x) But non-maskable, has, per definition, a wee issue there. Non-maskable MUST NOT _EVAH_ use any form of spinlocks, they're fundamentally incompatible. Non-maskable interrupts must employ wait-free atomic constructs.