Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2317538ybb; Mon, 30 Mar 2020 04:03:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtjjKmx3CGg8JBLrS4KQLt8xlqLaxrea78sCBzlUEKjoCwT6gRzApr90FFNWyQKLFGMox2x X-Received: by 2002:a9d:6303:: with SMTP id q3mr8861673otk.296.1585566227413; Mon, 30 Mar 2020 04:03:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585566227; cv=none; d=google.com; s=arc-20160816; b=J4EpMS/ZsJXhxVs7GPuiTn2r8hivQgbcWKSE/ZnfaaSj2Ev3LxiEESI1NNVDFtItQI fKY6XIRkh/D89LYhDPEpZx4zGMhJ0bPmyie4ZhxqeMOM7iGm8mwZhRJmoRP6sPuOTyWy fecCmk3v4iyJJphrGC54IfD7USYLWVcxVIy43BtipE3CLEN/SGrRj3zeQBTO74pN0EZE cXJgHTl20IxBSD5jqnLtzXb29EZRKlQAkznwUJB0S0I97jtFEZz0kR2vrzwPWHzkPSyS gbu7RHSX6E99qCfnczXIh2uODe1em5HvafHyp42yBhOOVF6FfD0MpVyWWzQtyKui7g/E DMDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OcosEihYBe+spE3GuKJaV12KeTRSak0CdVFTw4AqKfk=; b=Zcq8yyBLseUi3X8bn2W1S92vBAQMXLlL3apz7Lok3WbrDAGncUPpnW+Vgw9iTiLXq+ 9cp55WJ9WIcBYUVCdeBzfwkdTID+fdARC81HLEV+1YDncRXXgogQVEGtEZPYeynv1kYu V8MOKXPUeuXMACcChfZdfwJkNHuGhEAJmkXyl+dMuzXovq0HSc21CJpHy6NDyi3f1dzi DXPDlTuaTVxysHWcytw7nwkev7y0O8g3FqXF7R6V4+o/NCx9OCrbQCJ/DmY1w2mWesot Cy3KLTImkPb1OW38Hkda6c8jlpSBckzI3GOJOpE11f2mCbfcpK6S0ZMXdmD4SGZWg4PP IMjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=OZGUqwQe; 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 w23si6354950oti.18.2020.03.30.04.03.31; Mon, 30 Mar 2020 04:03:47 -0700 (PDT) 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=OZGUqwQe; 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 S1729689AbgC3LCt (ORCPT + 99 others); Mon, 30 Mar 2020 07:02:49 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:50288 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729640AbgC3LCt (ORCPT ); Mon, 30 Mar 2020 07:02:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=OcosEihYBe+spE3GuKJaV12KeTRSak0CdVFTw4AqKfk=; b=OZGUqwQeHml5PPhx4r8PXY6gI0 LirKSPJC9jI8tfla+5PAqPW141BlQiz4lDzHRtoF8rpGUF0f9W41P8ov5iWO9oNdsrLSKQa5Muk0b 8i6mpo9afrmglqwsJqq4V4wHM4p7KPs8KrdsKnBrFUH/A4a7O3aV6z9beaC6NISngGm4eKQ5pYyFY bHm3Rt9RfWYPXemZJnkJGoWa9g1yLhmI7ZXrjbMvSlj8cuZxcC0dZbgj8ynULFSWfBBvfGV3ZGbTf XQHScF0orkNktNFPDwQrwJYUew+SN7vVlaORxLNjgbTkMy5hf8pdCLqXKg5yfLktUqvP/1O/Curu6 3I7aEBWQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jIsBe-0000m8-9P; Mon, 30 Mar 2020 11:02:34 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id C2572303C41; Mon, 30 Mar 2020 13:02:31 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8EEDA203C0A2F; Mon, 30 Mar 2020 13:02:31 +0200 (CEST) Date: Mon, 30 Mar 2020 13:02:31 +0200 From: Peter Zijlstra To: Christophe Leroy Cc: Leonardo Bras , Ingo Molnar , Will Deacon , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Enrico Weigelt , Allison Randal , Thomas Gleixner , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 1/1] ppc/crash: Skip spinlocks during crash Message-ID: <20200330110231.GG20696@hirez.programming.kicks-ass.net> References: <20200326222836.501404-1-leonardo@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 27, 2020 at 07:50:20AM +0100, Christophe Leroy wrote: > > > Le 26/03/2020 ? 23:28, Leonardo Bras a ?crit?: > > During a crash, there is chance that the cpus that handle the NMI IPI > > are holding a spin_lock. If this spin_lock is needed by crashing_cpu it > > will cause a deadlock. (rtas_lock and printk logbuf_log as of today) > > > > This is a problem if the system has kdump set up, given if it crashes > > for any reason kdump may not be saved for crash analysis. > > > > Skip spinlocks after NMI IPI is sent to all other cpus. > > > > Signed-off-by: Leonardo Bras > > --- > > arch/powerpc/include/asm/spinlock.h | 6 ++++++ > > arch/powerpc/kexec/crash.c | 3 +++ > > 2 files changed, 9 insertions(+) > > > > diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h > > index 860228e917dc..a6381d110795 100644 > > --- a/arch/powerpc/include/asm/spinlock.h > > +++ b/arch/powerpc/include/asm/spinlock.h > > @@ -111,6 +111,8 @@ static inline void splpar_spin_yield(arch_spinlock_t *lock) {}; > > static inline void splpar_rw_yield(arch_rwlock_t *lock) {}; > > #endif > > +extern bool crash_skip_spinlock __read_mostly; > > + > > static inline bool is_shared_processor(void) > > { > > #ifdef CONFIG_PPC_SPLPAR > > @@ -142,6 +144,8 @@ static inline void arch_spin_lock(arch_spinlock_t *lock) > > if (likely(__arch_spin_trylock(lock) == 0)) > > break; > > do { > > + if (unlikely(crash_skip_spinlock)) > > + return; > > You are adding a test that reads a global var in the middle of a so hot path > ? That must kill performance. Can we do different ? This; adding code to a super hot patch like this for an exceptional case like the crash handling seems like a very very bad trade to me. One possible solution is to simply write 0 to the affected spinlocks after sending the NMI IPI thing, no?