Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1113442imm; Wed, 1 Aug 2018 10:24:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcn/T17gqEt6/yj3LChCytFjzNEwKVgOVQSi214plu2Plqu7fZLApMpLRO9l6nIj54KufrM X-Received: by 2002:a17:902:ac96:: with SMTP id h22-v6mr25448470plr.17.1533144240704; Wed, 01 Aug 2018 10:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144240; cv=none; d=google.com; s=arc-20160816; b=n/5jKP4h1F5wJUUDZAYrFlQokVUtw8Rywg7sRHh0MnlwnRirL9ByXH4ppPBfdFGzqW IkKBR1eFaz7JL8nblKE+V8RBWC5j36yh/bPzO5G6qxt+YDu6gIhq5MyIsM+05+DrvR57 UcxYQdzy6pbimTVUXqsBl20nVrpK/AZ+1bB51GESqD0+nIg9sGxqYPhWzE35rXwYYKai 4Fn165Q0sSQsqAgmOUdGZYpshCiDq/Wc10h+GzK7MXFTx2SPUAuTBMyM17RW5ZGkgb4O PqoEpTJYu6Qq5DQGQUWIaYwodc+WyBgdH3d2duUFbHchAOc4ztey/RY15qa8TaTrxm8p XYAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=FIjXdqej8KQCjKu/QxloyOTQt7NHnLQztlvoVTnJbJU=; b=injzLfGTl2AQeaddQATmtxjeAQsnJNGZyCeAGDdLNq+dbPRdyM095HEc+fkw2ydh0T BAQAVtoIoS1I4Yo4ueg4ytmyLdM2EWMtQjJXQ47t7lvVP8WTfmL7nwLsCx54sKXsp46f lcwwD94FPhdFHEQ6dX9dpy92yECUst/IzlOut4wJYU0tHIkyGnmT/MnWWz7bca1O2Wbv 0VSLK6hh2iE1Ll94Ui3jLemN8GjD0ZlYNXjHsLG9xkJ/DLEEvPhZiDOftXg++FVqeo06 De8Q1qVcLasbLT6Cma1YlgirWyY6jARbBWxbvHyhx6w2loj9g+oQrQkLed0OiK5wmqAd nccQ== 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 v16-v6si16586929pgb.96.2018.08.01.10.23.45; Wed, 01 Aug 2018 10:24:00 -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 S2390263AbeHATHg (ORCPT + 99 others); Wed, 1 Aug 2018 15:07:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49228 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389677AbeHATHf (ORCPT ); Wed, 1 Aug 2018 15:07:35 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 85430CE6; Wed, 1 Aug 2018 17:20:53 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Sebastian Andrzej Siewior , Sasha Levin Subject: [PATCH 4.14 181/246] stop_machine: Use raw spinlocks Date: Wed, 1 Aug 2018 18:51:31 +0200 Message-Id: <20180801165020.387588667@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Gleixner [ Upstream commit de5b55c1d4e30740009864eb35ce4ed856aac01d ] Use raw-locks in stop_machine() to allow locking in irq-off and preempt-disabled regions on -RT. This also documents the possible locking context in general. [bigeasy: update patch description.] Signed-off-by: Thomas Gleixner Signed-off-by: Sebastian Andrzej Siewior Link: https://lkml.kernel.org/r/20180423191635.6014-1-bigeasy@linutronix.de Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- kernel/stop_machine.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -37,7 +37,7 @@ struct cpu_stop_done { struct cpu_stopper { struct task_struct *thread; - spinlock_t lock; + raw_spinlock_t lock; bool enabled; /* is this stopper enabled? */ struct list_head works; /* list of pending works */ @@ -81,13 +81,13 @@ static bool cpu_stop_queue_work(unsigned unsigned long flags; bool enabled; - spin_lock_irqsave(&stopper->lock, flags); + raw_spin_lock_irqsave(&stopper->lock, flags); enabled = stopper->enabled; if (enabled) __cpu_stop_queue_work(stopper, work, &wakeq); else if (work->done) cpu_stop_signal_done(work->done); - spin_unlock_irqrestore(&stopper->lock, flags); + raw_spin_unlock_irqrestore(&stopper->lock, flags); wake_up_q(&wakeq); @@ -237,8 +237,8 @@ static int cpu_stop_queue_two_works(int DEFINE_WAKE_Q(wakeq); int err; retry: - spin_lock_irq(&stopper1->lock); - spin_lock_nested(&stopper2->lock, SINGLE_DEPTH_NESTING); + raw_spin_lock_irq(&stopper1->lock); + raw_spin_lock_nested(&stopper2->lock, SINGLE_DEPTH_NESTING); err = -ENOENT; if (!stopper1->enabled || !stopper2->enabled) @@ -261,8 +261,8 @@ retry: __cpu_stop_queue_work(stopper1, work1, &wakeq); __cpu_stop_queue_work(stopper2, work2, &wakeq); unlock: - spin_unlock(&stopper2->lock); - spin_unlock_irq(&stopper1->lock); + raw_spin_unlock(&stopper2->lock); + raw_spin_unlock_irq(&stopper1->lock); if (unlikely(err == -EDEADLK)) { while (stop_cpus_in_progress) @@ -461,9 +461,9 @@ static int cpu_stop_should_run(unsigned unsigned long flags; int run; - spin_lock_irqsave(&stopper->lock, flags); + raw_spin_lock_irqsave(&stopper->lock, flags); run = !list_empty(&stopper->works); - spin_unlock_irqrestore(&stopper->lock, flags); + raw_spin_unlock_irqrestore(&stopper->lock, flags); return run; } @@ -474,13 +474,13 @@ static void cpu_stopper_thread(unsigned repeat: work = NULL; - spin_lock_irq(&stopper->lock); + raw_spin_lock_irq(&stopper->lock); if (!list_empty(&stopper->works)) { work = list_first_entry(&stopper->works, struct cpu_stop_work, list); list_del_init(&work->list); } - spin_unlock_irq(&stopper->lock); + raw_spin_unlock_irq(&stopper->lock); if (work) { cpu_stop_fn_t fn = work->fn; @@ -554,7 +554,7 @@ static int __init cpu_stop_init(void) for_each_possible_cpu(cpu) { struct cpu_stopper *stopper = &per_cpu(cpu_stopper, cpu); - spin_lock_init(&stopper->lock); + raw_spin_lock_init(&stopper->lock); INIT_LIST_HEAD(&stopper->works); }