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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5192C47080 for ; Tue, 1 Jun 2021 07:37:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C50AA6139A for ; Tue, 1 Jun 2021 07:37:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233096AbhFAHiw (ORCPT ); Tue, 1 Jun 2021 03:38:52 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:59356 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbhFAHiv (ORCPT ); Tue, 1 Jun 2021 03:38:51 -0400 From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1622533029; 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: in-reply-to:in-reply-to:references:references; bh=15u6uWhP2I1jq+oVfgJeSHw4B622FxtoWLjPeu9407Q=; b=OPsmez0N0GbK40F5PFvpAnmB8APingKGpZLb+NV3pokwR1DEKzp7403MCvsvOEni5og2yW v2IZ+SrtOyaCnqSpQR1e6eHA4AZ3CDWtbwE0npFIx5kV85OmBMNdv94SuQcwr6Ed9eWd93 527SBDp2RRlthQHcRe+nlXmkbtERAjiNMlPPMSwJDsfmv3LnDp+o+Rm03Teyb2ETlG8Nnd GHzg2bXLuGPW+DwX+kMQ+QNu2HXD0HLGQPVFAWIfctE651axxyATGyFZhSMJ/CzJAfaE2p GZQxVgYeO/haVQYK1DLMnG9k5UCpD8YBdFJMrvCNsKpe+FbI4qG3cyFWDL9Q9g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1622533029; 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: in-reply-to:in-reply-to:references:references; bh=15u6uWhP2I1jq+oVfgJeSHw4B622FxtoWLjPeu9407Q=; b=048Ya0yiZKFfSdftrXnF13TD9BkCNFoLnE1V5vQ7eLjkAU141TjkJgJDcZDT7c7d+p7n8f wSOi4BxPTBpxmjCw== To: Sergey Senozhatsky Cc: Petr Mladek , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Sergey Senozhatsky , Andrew Morton , Stephen Rothwell , Dmitry Safonov <0x7f454c46@gmail.com>, Valentin Schneider , Daniel Bristot de Oliveira , Peter Zijlstra , Stephen Boyd , Alexander Potapenko , "Paul E. McKenney" Subject: Re: [PATCH next v1 1/2] dump_stack: move cpu lock to printk.c In-Reply-To: <87y2bu2hqp.fsf@jogness.linutronix.de> References: <20210531162051.2325-1-john.ogness@linutronix.de> <20210531162051.2325-2-john.ogness@linutronix.de> <87y2bu2hqp.fsf@jogness.linutronix.de> Date: Tue, 01 Jun 2021 09:37:08 +0200 Message-ID: <87v96y2fyz.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-06-01, John Ogness wrote: >> Is there any particular reason this does >> >> preempt_disable(); >> cpu = smp_processor_id(); >> local_irq_safe(); >> >> instead of >> >> local_irq_safe(); >> cpu = raw_smp_processor_id(); >> >> ? > > If the lock is owned by another CPU, there is no need to disable > interrupts for this CPU. (The local_irq_save() is conditional.) The cpu lock implementation from dump_stack() also keeps preemption continually enabled while spinning. I used the cpu lock implementation from PREEMPT_RT. But for my v2 I will adopt the same ordering from dump_stack(), as you are suggesting. Thanks for pointing that out. John Ogness