From patchwork Wed Mar 13 11:40:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 160217 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp14203453jad; Wed, 13 Mar 2019 04:40:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwANPYcna7QU9UVVND5VdFPd3jNbisMlzOIfoHh2SnRP74oTIHRvN5uKOsNqEx6rfshuDf6 X-Received: by 2002:a17:902:1e6:: with SMTP id b93mr44757837plb.325.1552477249380; Wed, 13 Mar 2019 04:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552477249; cv=none; d=google.com; s=arc-20160816; b=0PT23Wx5NiX2JBWt5JJcnW3Hq1RhTVnPacds8XYDIs7TLZdToFfUmSRidSa1GW6aWL WKUyzjgJS3rrR/dgIQ461UOf13P3jewuRtpUlp7IDGX6qv1Z9J3BEw/qGKDlSSpxkCau RKDfC9eafIlspdNog7Pyn13Gp1B0H0awQlyFsndK+l1j/NRXP4Ot7ginFdKvt8SByCcG L2OA9ClT8aOaHCXcWLbxdCqc+PEE4RGmBcMn9OdlOqLBIOJIWEsy+jl5RKN+o3YyJOGp zWbc46igSLjCpi8u5wtBA1xAapfabcT9GLdaqbNFa9w8Ixv6DQ1bxCu98c4lPc8v755P ipTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Hj+euKPBvJkxpVnyJ6j2aGgL51DSG/FRdQC8vW3K+cU=; b=q/eYEyNvZV9dYhZCPqosNy2ZbXmnM+jqZBxj+cKRRkUt2t/vQ4J+8MWfwNYXeXbyZa R79pxjrcpGHxUd3/v0eE6+Ov6GLT63ZhnpAf8+WgsAYc+YdfN7QEypQuPXkyD3Ny9Drn 3GndxddL+i0uyJUkSRZEa0GsMLn3uMV9eS4svFw5BYhE1LFSabjJ/vNU3oI8s0I8jP0S VSD2g1jEGnRHiGHEKa1bSg4/cvG3mdy2XJk0GualorFy/xQTeTF9AZLVWvExzSXbKlm5 v3bpbJIw+yFOr3Dy0xrTnpd6ocHd/nMi7wl4ixYf0qV9NNnjTIwKLsxn/8iBwWKMfBaq sIGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si9203925pgt.390.2019.03.13.04.40.49; Wed, 13 Mar 2019 04:40:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726530AbfCMLkr (ORCPT + 31 others); Wed, 13 Mar 2019 07:40:47 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:56542 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725888AbfCMLkr (ORCPT ); Wed, 13 Mar 2019 07:40:47 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8258680D; Wed, 13 Mar 2019 04:40:46 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0779D3F71D; Wed, 13 Mar 2019 04:40:44 -0700 (PDT) From: Julien Grall To: linux-kernel@vger.kernel.org Cc: jslaby@suse.com, gregkh@linuxfoundation.org, linux-rt-users@vger.kernel.org, tglx@linutronix.de, rostedt@goodmis.org, Julien Grall , Sebastian Andrzej Siewior Subject: [PATCH v2] tty/sysrq: Convert show_lock to raw_spinlock_t Date: Wed, 13 Mar 2019 11:40:34 +0000 Message-Id: <20190313114034.12408-1-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Systems which don't provide arch_trigger_cpumask_backtrace() will invoke showacpu() from a smp_call_function() function which is invoked with disabled interrupts even on -RT systems. The function acquires the show_lock lock which only purpose is to ensure that the CPUs don't print simultaneously. Otherwise the output would clash and it would be hard to tell the output from CPUx apart from CPUy. On -RT the spin_lock() can not be acquired from this context. A raw_spin_lock() is required. It will introduce the system's latency by performing the sysrq request and other CPUs will block on the lock until the request is done. This is okay because the user asked for a backtrace of all active CPUs and under "normal circumstances in production" this path should not be triggered. Signed-off-by: Julien Grall [bigeasy@linuxtronix.de: commit description] Signed-off-by: Sebastian Andrzej Siewior Acked-by: Sebastian Andrzej Siewior --- Changes in v2: - Update commit description - Add Sebastian's acked-by --- drivers/tty/sysrq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index fa0ce7dd9e24..59e82e6d776d 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c @@ -208,7 +208,7 @@ static struct sysrq_key_op sysrq_showlocks_op = { #endif #ifdef CONFIG_SMP -static DEFINE_SPINLOCK(show_lock); +static DEFINE_RAW_SPINLOCK(show_lock); static void showacpu(void *dummy) { @@ -218,10 +218,10 @@ static void showacpu(void *dummy) if (idle_cpu(smp_processor_id())) return; - spin_lock_irqsave(&show_lock, flags); + raw_spin_lock_irqsave(&show_lock, flags); pr_info("CPU%d:\n", smp_processor_id()); show_stack(NULL, NULL); - spin_unlock_irqrestore(&show_lock, flags); + raw_spin_unlock_irqrestore(&show_lock, flags); } static void sysrq_showregs_othercpus(struct work_struct *dummy)