Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp417078ybr; Fri, 22 May 2020 09:37:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyD3y2YEbTML7qcA1R8Es9qi7ci5OAO46PS4IJ9UZzG8mTb4XoA0E2eWVc7PVRA3Kru6XXi X-Received: by 2002:a17:906:8304:: with SMTP id j4mr8948031ejx.200.1590165457421; Fri, 22 May 2020 09:37:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590165457; cv=none; d=google.com; s=arc-20160816; b=Xgb06bCcT4rkRPGTY86IImusBKNwI6CHfeN2LeDFtzUpOhUWOak15HorGceRvkpIxx O4UcvbHd2NNUdR9xVX4dMlcm7O0zPROcm0bYePoXb2PtkhYlbynOhyGfzxpQ9VxsKyd5 JryHBHyEDiGlCN50bV9iVipfuBU+3gRX2NjCkHOz8kNU7MBxdPvhIMS5c0LH76RQ8pt9 kewMuQoAsmWiRSVrDOHkTfyiADuh18MHiNWPr+paK77vqhNLvlSL9FQZlvcR6XXyqPx8 Cr7mrSNQcuyrm0e9LXHgOly/PEiM2NZEnu/1EyfBW9w3EdHJ4+bD8oCRyAFBtmy+dQmT RDAg== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=yorX4qD+MAY7UFaM6AiNcUEHYEEJIru/3ydP8+Kx9yI=; b=cDdF4nwlvUFrvQ5yD4bLyBBjpuvOBN1XD16oeZeqTjzeIL64uPR2fnBgjvjl1QqYPf JSUo0RLKHCP1wT1j9H2DzB1K14JyPlsrnMDMWYZooz08q6jTyZadL2DfKimSoY3Xcszc W4Y1jsIz+scKcQN6qsfF3aChumKQfKQniipXVgF1bZk5Ahtu/OEZU6Rkcby4cZ7PmvOS huw3TSPdDHsCm7g4z0H/ecKLBFiQdf8cxts6hYiJ4JWSzOsc/wymcOZtmwPcl4QJy4Vt Db2xj8X6UD+8pkkjTfcHDJ+V336eUd5wBXEgo/885iAoTrfZZe6etKKO2DgshBKNTW67 X/pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b="tAUIgGL/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si4830859edq.114.2020.05.22.09.37.15; Fri, 22 May 2020 09:37:37 -0700 (PDT) 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=fail header.i=@infradead.org header.s=merlin.20170209 header.b="tAUIgGL/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730678AbgEVQfU (ORCPT + 99 others); Fri, 22 May 2020 12:35:20 -0400 Received: from merlin.infradead.org ([205.233.59.134]:44200 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726762AbgEVQfU (ORCPT ); Fri, 22 May 2020 12:35:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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; bh=yorX4qD+MAY7UFaM6AiNcUEHYEEJIru/3ydP8+Kx9yI=; b=tAUIgGL/baSjJdIjHLfWRowaxD dYNL3guBgj/n3sIzew9mHyCrcUTVm4DIUYpIH+ycSG1Qpw7ZWZhu5kQ08TQdp95Uy97HEElrtIw2b QqySyUP4sSBdmR0U4piBy1/cTpCg6j8GDwBdiu03qpOqELZ3e2PF0B2UiqXVf7fu2Eakt/FT9dJ7I PpXnFnS7jfwaQeUj7M6DHrxXEhbB/J/IuFO70z12PmUUCN+hd4Bxvhdj0IRGcb8xQK/K0vPlDMug7 Gnwpn7/+bDV3DAJq1Kr5B8ppkLByuxgw8HuoQ99zvqMSkH/dFd7sq4gyzit8pnrYWFFtFboR3pRus C6qk6DcA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jcAdW-0006DM-Dt; Fri, 22 May 2020 16:35:06 +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 EC50E306368; Fri, 22 May 2020 18:35:04 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C75A520B5D17E; Fri, 22 May 2020 18:35:04 +0200 (CEST) Date: Fri, 22 May 2020 18:35:04 +0200 From: Peter Zijlstra To: Daniel Thompson Cc: sumit.garg@linaro.org, jason.wessel@windriver.com, dianders@chromium.org, kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, patches@linaro.org, pmladek@suse.com, sergey.senozhatsky@gmail.com, Ingo Molnar , Will Deacon Subject: Re: [RFC PATCH 2/2] locking/spinlock/debug: Add checks for kgdb trap safety Message-ID: <20200522163504.GX317569@hirez.programming.kicks-ass.net> References: <20200522145510.2109799-1-daniel.thompson@linaro.org> <20200522145510.2109799-3-daniel.thompson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200522145510.2109799-3-daniel.thompson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 22, 2020 at 03:55:10PM +0100, Daniel Thompson wrote: > In general it is not safe to call spin_lock() whilst executing in the > kgdb trap handler. The trap can be entered from all sorts of execution > context (NMI, IRQ, irqs disabled, etc) and the kgdb/kdb needs to be > as resillient as possible. > > Currently it is difficult to spot mistakes in the kgdb/kdb logic > (especially so for kdb because it uses more kernel features than > pure-kgdb). Let's provide a means to bring attention to deadlock > risks in the debug code. I really dislike this thing. Also, commit: f6f48e180404 ("lockdep: Teach lockdep about "USED" <- "IN-NMI" inversions") should be able to trigger here when the kgdb traps are marked as NMI. x86 will soon have that.