Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1064478rdb; Mon, 19 Feb 2024 03:11:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWvfvVQv3jyzsld0S9nJbNCfokYeSOzygTyO3zIG3pGjJW5BhSxJFpq7mY6umzQCemU+uj/CpAJLAQrRDAkoiE5jpPiKn0IxnuWzjrqQQ== X-Google-Smtp-Source: AGHT+IEnE+A0mGWeK05EIrRTNTS9jKpgTn0R90pNeMwn0gORnuQJnRBn/HR/WoHXyHNIqG+5LDmT X-Received: by 2002:a05:6358:841c:b0:176:5a5e:4d85 with SMTP id b28-20020a056358841c00b001765a5e4d85mr13892615rwk.4.1708341118044; Mon, 19 Feb 2024 03:11:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708341118; cv=pass; d=google.com; s=arc-20160816; b=GRkuJ2ku2zcIsZ03Ns2hb9S2AXQ2G9ea/uKIl7hT5cGckaX7ibdpYuDf70zMDKkKsI mrF/hKM33nY13rhIRWmSr/vEY9GmdlJB7hpKmf6nheLjJCPip9esRLbqxGLw37FbKGYo hB3QoflfOfRVUx7IWnuvGxiXjsLxI0MS91f8kjkdQAfr+iLKAmmNw6Z1Fea2ESRh8fBc qd6/lfNkoS6WPdug6fRouBPETX+w1hIycUMp83gk3QveOD/esdwbT62gABJx/I0cNczJ N5JK9ZeENv0tHAuaG9l2LOr1FM2EqFpvfsQTn8eakvPGuQQk/rLKr+fCZ6OrN5xSBcr+ oyJA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=LRh05+5lvCTPWKWoq3hTFsY8DpEaK+SuUN5woeyhLaA=; fh=PbXNnTNi1kG6kAAP+g0Ib3xRRkBbr35nMAMWula6hkg=; b=NN4ZZLEsTppvQa9q1ZEg/ftbRZnzFDGNoOuhDqWXyp3aC3iDDP7QZwSZvb/S8TDQRD D4b+4lEMjPYXvPmKhikRSiOvQMOcIj8PH05ZYqjCQoCGJQ/eXz8xTpiGxj4urD0hTGMW Pgco4wn7e/WgDE3gEJeKMpC4GCOI5LAzMBI+3Qr5AEhkIKhDu7L0iS9VSw9WRvKO3SSg HBAS+qvxtu9aC5JbhcdLkIWpuWiR/lUrHG2yoUzPIUWPZG9JO4lQwD37vDbyXoxXT9hJ jjTs9jW7tVkY9xdBnj6oOjXZ+9xHnKZrlxjO5cAagxoBvKk/x9Cgxf9ZNf3xU03fzlSF 6X4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KfGmEqw8; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=DiU3lG6I; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-71174-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71174-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id z24-20020a637e18000000b005dc13a2e7c1si4207369pgc.117.2024.02.19.03.11.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 03:11:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71174-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KfGmEqw8; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=DiU3lG6I; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-71174-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71174-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6B56BB221D5 for ; Mon, 19 Feb 2024 11:11:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7ECDB2C190; Mon, 19 Feb 2024 11:11:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="KfGmEqw8"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="DiU3lG6I" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57F5D200C8 for ; Mon, 19 Feb 2024 11:11:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708341104; cv=none; b=L/L2ipJtgP/vRTchRleZOCXxTBznU+YklzcN5j65oGPlcwWfwhEn6wofQpt10Yqh3EhfKkLQNrLhHD4k1uSGYE4JINpLk4POdwOSapki22HEB5/KTPk1Dwr526x1t5SoR5waykbHuxSw4VkrIF+vifwKYd+j/xMHDCGthbOLIz4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708341104; c=relaxed/simple; bh=aWgrvypctQzziYl6KvOgN6Chq4da39LD3mgvplvAuJc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=sB8VHn9BrTPMJz9fjyFpsWckijuhXEVOPj9rPq6zSxz+QIlli1UTbXdCnQ7gz3H49cPvqWlMxdflf4B7T3z8XpvVCGjE5f7pOz33INRqpRSXbFm7YHxLI3uOBeKRpRjwEcdQqMUO4FULfvN0tTehRdVDLVwRHGt2Lte2Sxt1048= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=KfGmEqw8; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=DiU3lG6I; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708341101; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LRh05+5lvCTPWKWoq3hTFsY8DpEaK+SuUN5woeyhLaA=; b=KfGmEqw8EHv9R9t6G7gkc1EPSs4UZH0DG0nusBvDc1kEdPoUedO1eqC2/kILzI6DNLGUhz 3jKtkRbiyMqdrJfpSvAiXR9Ff0opbotrKH6AVE3GCHRzFeq6eZa2Ezr9t7UOAyWXXCWojE 6PDxshgW+l9fpjxCqBkgrmNQFU3CDS1eWON+dP6lK4Jb/vL/bSro+NLY2m4hlG3BjvcIQV Erq2hSlXWg5c8N6t8gnBHYFzNLwv1Jvsjx6w0bqiVBaxLNxZvkacrJMXd7oMQxuLVfvYkY Ben8EJadHz1uCNELChysv8ykef7kehgtrxNNh1TSAPel4oo/4KaORfRReFIGHg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708341101; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LRh05+5lvCTPWKWoq3hTFsY8DpEaK+SuUN5woeyhLaA=; b=DiU3lG6IgRqefdfaWZcqFh1wSpWsBv8222Uaw8LjFx7Noed2uIgx5vnE6HlIxF/TgF9Aem 07SnmYJ+lfuoAxCQ== To: Waiman Long , Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng Subject: Re: [PATCH printk v2 26/26] lockdep: Mark emergency section in lockdep splats In-Reply-To: <6d8f5126-3595-4abd-9b05-b19a659d1cea@redhat.com> References: <20240218185726.1994771-1-john.ogness@linutronix.de> <20240218185726.1994771-27-john.ogness@linutronix.de> <6d8f5126-3595-4abd-9b05-b19a659d1cea@redhat.com> Date: Mon, 19 Feb 2024 12:17:20 +0106 Message-ID: <878r3gbtev.fsf@jogness.linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2024-02-18, Waiman Long wrote: > On 2/18/24 13:57, John Ogness wrote: > lockdep.c has multiple functions that print stuff to the console, like > > =C2=A0- print_circular_bug_header() > =C2=A0- print_bad_irq_dependency() > =C2=A0- print_deadlock_bug() > =C2=A0- print_collision() > =C2=A0- print_usage_bug() > =C2=A0- print_irq_inversion_bug() > =C2=A0- print_lock_invalid_wait_context() > =C2=A0- print_lock_nested_lock_not_held() > =C2=A0- print_unlock_imbalance_bug() > =C2=A0- print_lock_contention_bug() > =C2=A0- print_freed_lock_bug() > =C2=A0- print_held_locks_bug() > =C2=A0- lockdep_rcu_suspicious() > > So what is special about print_usage_bug() that it needs this > emergency treatment but not the other ones? I do not expect to be able to identify all "emergency printing" paths in the kernel from the beginning. This series initially marks some sections that are IMHO interesting for the feature. As you are implying, for lockdep probably all printing should be considered emergency. Is it preferred to place the markers outside the high-level print functions, for example: diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 00465373d358..7a4e4f4a9156 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -2182,10 +2182,12 @@ check_noncircular(struct held_lock *src, struct hel= d_lock *target, *trace =3D save_trace(); } =20 + nbcon_cpu_emergency_enter(); if (src->class_idx =3D=3D target->class_idx) print_deadlock_bug(current, src, target); else print_circular_bug(&src_entry, target_entry, src, target); + nbcon_cpu_emergency_exit(); } =20 return ret; Or is it preferred to put them directly around the various pr_warn() blocks (as the patch in this series is doing)? John Ogness