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 EBC84C47092 for ; Tue, 1 Jun 2021 06:58:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C504D613A9 for ; Tue, 1 Jun 2021 06:58:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233040AbhFAHAi (ORCPT ); Tue, 1 Jun 2021 03:00:38 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:59100 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231139AbhFAHAg (ORCPT ); Tue, 1 Jun 2021 03:00:36 -0400 From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1622530734; 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=8qy5Dlvl3KVfi8a+CNTca0GFXKGaZXfGUgkLF8E1qAI=; b=r9UMyCOHdPczrCWrhXhSkQUgSkZZWfaZh1/hiRSfo1KUgL0oFSVKUvZsq2uzOaIzByS9Du DVrr/m8Fko2tqOQcj5WR2trUpn+BXN8aF9pQtcptz58e7ImPuvs5pRmRHT0FQfEcVA+guo CXF2GcEiG1ixoO+tbOvtkPCOyUQZhgq08Doqz0g7P5/AlgP6pjOvIAJKRnt2LNBei0aTVu n9kh//1o+K86AB1ny+phIaWkYsk/gtrC+4l5gYSqi3dzophK+1zrbTUe6VnTPUsaO+Fg+O iVBw9G7FFvIUNYZTL9GvYu2KIj4wiORaUytxNj3ixGf69IXZxFaaZD6Ubh+5PQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1622530734; 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=8qy5Dlvl3KVfi8a+CNTca0GFXKGaZXfGUgkLF8E1qAI=; b=bim+vB2xoBoTCb5W8JTOH2ih2VtenI8UuncyMXjFUJdTs2OjjJIzn8KOTHPkLdttT8C1yr dhAn2ggLiAm4s4BQ== 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: References: <20210531162051.2325-1-john.ogness@linutronix.de> <20210531162051.2325-2-john.ogness@linutronix.de> Date: Tue, 01 Jun 2021 08:58:54 +0200 Message-ID: <87y2bu2hqp.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, Sergey Senozhatsky wrote: > On (21/05/31 18:20), John Ogness wrote: >> +void printk_cpu_lock(unsigned int *cpu_store, unsigned long *flags) >> +{ >> + unsigned int cpu; >> + >> + for (;;) { >> + cpu = get_cpu(); >> + >> + *cpu_store = atomic_read(&printk_cpulock_owner); >> + >> + if (*cpu_store == -1) { >> + local_irq_save(*flags); > > 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.) John Ogness