From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DEBFC04A6A for ; Fri, 4 Aug 2023 15:02:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231902AbjHDPCh (ORCPT ); Fri, 4 Aug 2023 11:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231888AbjHDPCa (ORCPT ); Fri, 4 Aug 2023 11:02:30 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1B284C0C; Fri, 4 Aug 2023 08:02:16 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E6C0921888; Fri, 4 Aug 2023 15:02:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1691161334; h=from:from:reply-to: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=VNWjSzFu/PyMqv6O223Z6nS9JKkdr9V4bRYfAQix7nk=; b=lk1XMNHdUBmmPgv2SbCy1HPgNADs5W9jPaKQk5f95D0ji/Kgs8ioTEuIp8biBXwjs1qmZ1 DiFaVY7HQOUrW/Ni/kuVUUuHlF9fOwxllYFqY0tab1QiufzfgVh4ZneVj/CAfbnw8UZCx8 C9Flw2p3O6/4ZMw5+YhH870Kk2vgfAg= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B586B133B5; Fri, 4 Aug 2023 15:02:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id o4i3K/YSzWSpRwAAMHmgww (envelope-from ); Fri, 04 Aug 2023 15:02:14 +0000 Date: Fri, 4 Aug 2023 17:02:14 +0200 From: Michal Hocko To: Doug Anderson Cc: Andrew Morton , Petr Mladek , Arnd Bergmann , Borislav Petkov , Christophe Leroy , "Darrick J. Wong" , Dave Hansen , "David S. Miller" , Gaosheng Cui , "Gautham R. Shenoy" , Greg Kroah-Hartman , "Guilherme G. Piccoli" , Guo Ren , "H. Peter Anvin" , Huacai Chen , Ingo Molnar , "Jason A. Donenfeld" , Jianmin Lv , Jinyang He , Josh Poimboeuf , Kees Cook , Lecopzer Chen , Marc Zyngier , Mark Rutland , Michael Ellerman , Nicholas Piggin , "Paul E. McKenney" , Peter Zijlstra , Pingfan Liu , Qing Zhang , "Rafael J. Wysocki" , Russell King , Stephen Rothwell , Thomas Bogendoerfer , Thomas Gleixner , Tom Rix , Ulf Hansson , Valentin Schneider , WANG Xuerui , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, sparclinux@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v3 1/2] nmi_backtrace: Allow excluding an arbitrary CPU Message-ID: References: <20230803160649.v3.1.Ia35521b91fc781368945161d7b28538f9996c182@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 04-08-23 06:56:51, Doug Anderson wrote: > Hi, > > On Fri, Aug 4, 2023 at 12:50 AM Michal Hocko wrote: > > > > On Thu 03-08-23 16:07:57, Douglas Anderson wrote: > > > The APIs that allow backtracing across CPUs have always had a way to > > > exclude the current CPU. This convenience means callers didn't need to > > > find a place to allocate a CPU mask just to handle the common case. > > > > > > Let's extend the API to take a CPU ID to exclude instead of just a > > > boolean. This isn't any more complex for the API to handle and allows > > > the hardlockup detector to exclude a different CPU (the one it already > > > did a trace for) without needing to find space for a CPU mask. > > > > > > Arguably, this new API also encourages safer behavior. Specifically if > > > the caller wants to avoid tracing the current CPU (maybe because they > > > already traced the current CPU) this makes it more obvious to the > > > caller that they need to make sure that the current CPU ID can't > > > change. > > > > Yes, this looks like the best way forward. > > > > It would have been slightly safer to modify arch_trigger_cpumask_backtrace > > by switching arguments so that some leftovers are captured easier. > > I'm not sure I understand. Oh, you're saying make the prototype of > arch_trigger_cpumask_backtrace() incompatible so that if someone is > directly calling it then it'll be a compile-time error? exactly. bool to int promotion would be too easy to miss while the pointer to int would complain loudly. > I guess the > hope is that nobody is calling that directly and they're calling > through the trigger_...() functions. Hope is one thing, being preventive another. > For now I'm going to leave this alone. If you are going to send another version then please consider this. Not a hard requirement but better. -- Michal Hocko SUSE Labs