Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp557814imm; Wed, 1 Aug 2018 01:08:07 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc2x9RMK/q1TuhvDgi3OOXcqp17YdUjLPu8J+rRNBCbwBc8tKDj/zOHHDEEpF8BBeBYvU9a X-Received: by 2002:aa7:87d0:: with SMTP id i16-v6mr25657013pfo.82.1533110887241; Wed, 01 Aug 2018 01:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533110887; cv=none; d=google.com; s=arc-20160816; b=FTAc/mK2ACmgsGWREXIO5S4523C9robySFTSvICafnREmFekWOFjfAseCBYJpWbZgF Pvbwd2yN3r96fZXiRj0pF3tzq6Z9zALaou0ioqg3qLSH0CbWTsXYOiZPfmq0m0AWXrX8 ei3F2nKUYVVPHlOSTyebqrOUvsxctqLziGFwiwcUG4tdQlCZYNR+tl2ZfAH54KcPtXUH XV9Et7aF7ueCdTPczqWmvmQmC4ewayl8QFTTwXNqGxII5Oy22H03ZuTWIJnB3X5UqogA ACL9vPTdQSQdJ1m039PjfemRkMQf1L5abzpcgTEoXfD2Rm1VeHoNAq08XlyEF1bpXIkW JWAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=OL2R9I4jozG+YAXYiq29rN2vB3u/v5GvyRbYHd2+EAs=; b=HOSrH+yIc6DUktfr8yq/WyWXS8ZdfAgxCGwiCkB8OTJn02sa8BHjrhPFpMOXn2+lJN xBIdLhjpx08vIpVWWWAFvf0H5pbqYbiAoA7ZCQJlJ3g9xQeO1M+8ZDxsEiJja3loIKFY k7eqZ9ivc1SuxwnUQvB1C8co5rRRAQE1KS9YIgmtDMcVCeLuoUUoM0CoCrsm+ly9sF8n V4FV8cYrHPVVVQCHyZ+alXdFrwrxcsuerrOk3PagOYCMsOVwjeGRNgiU4EFMCIcYeasf c7qwxAjkJm9Q5n1j5VLjgJESQ7hPS4tYiFNSy61PXCX0saS+v8sV4oL87q1LbIC7VkYV 21Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="m/NQA0DF"; dkim=pass header.i=@codeaurora.org header.s=default header.b=UxRwfLq0; 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 p5-v6si14998543pgb.598.2018.08.01.01.07.52; Wed, 01 Aug 2018 01:08:07 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b="m/NQA0DF"; dkim=pass header.i=@codeaurora.org header.s=default header.b=UxRwfLq0; 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 S2387673AbeHAJvc (ORCPT + 99 others); Wed, 1 Aug 2018 05:51:32 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39666 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733173AbeHAJvc (ORCPT ); Wed, 1 Aug 2018 05:51:32 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0C376606AC; Wed, 1 Aug 2018 08:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1533110824; bh=DvRWMWTLnHP1lQ6Sh0uCi6L8rkneR069gy+uSJrzukc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=m/NQA0DFBn4nZvGy2rggYdU3GZPLQVnfB1uRV/IZ18M3BHG0goUfzegi16g86HFWQ wucIqyLWaj6N9OoyGjkVZ153u8gFVl0lPX7AdTNDis9zPf+8PdIQF6iDpfjk96IqHh XIAX2UTUyWTmQkdH45D183HFLqK84phXt8HrbLx8= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 1A3B1606AC; Wed, 1 Aug 2018 08:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1533110823; bh=DvRWMWTLnHP1lQ6Sh0uCi6L8rkneR069gy+uSJrzukc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UxRwfLq0YUKKvhI7M5BNsKhK/fx9anSbTwaSragAY0nYrfOXcJ7q0aaV36qn0g0k6 hRbZ17EKv+XpIyxSis57FPaNeM44Utrnt3oyqPDbsGzpyfMkGWUs7hu+EByYCL5qO2 Pjb6owYSChqwJGOOR4fPgiw2j+xLhp1u6eHgLlB8= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 01 Aug 2018 01:07:03 -0700 From: Sodagudi Prasad To: Peter Zijlstra Cc: Thomas Gleixner , Sebastian Andrzej Siewior , isaacm@codeaurora.org, matt@codeblueprint.co.uk, mingo@kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, pkondeti@codeaurora.org, stable@vger.kernel.org Subject: Re: [PATCH] stop_machine: Disable preemption after queueing stopper threads In-Reply-To: <20180730210728.GQ2494@hirez.programming.kicks-ass.net> References: <1531856129-9871-1-git-send-email-isaacm@codeaurora.org> <20180724062350.nlem2suuy5wlxpts@linutronix.de> <20180730112140.GH2494@hirez.programming.kicks-ass.net> <109d0e70606ccd34861a80525d6d11aa@codeaurora.org> <20180730210728.GQ2494@hirez.programming.kicks-ass.net> Message-ID: <52a34ed365cd560457e9abf5877c5b37@codeaurora.org> X-Sender: psodagud@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-07-30 14:07, Peter Zijlstra wrote: > On Mon, Jul 30, 2018 at 10:12:43AM -0700, Sodagudi Prasad wrote: >> How about including below change as well? Currently, there is no way >> to >> identify thread migrations completed or not. When we observe this >> issue, >> the symptom was work queue lock up. It is better to have some timeout >> here >> and induce the bug_on. > > You'd trigger the soft-lockup or hung-task detector I think. And if > not, > we ought to look at making it trigger at least one of those. > >> There is no way to identify the migration threads stuck or not. > > Should be pretty obvious from the splat generated by the above, no? Hi Peter and Thomas, Thanks for your support. I have another question on this flow and retry mechanism used in this cpu_stop_queue_two_works() function using the global variable stop_cpus_in_progress. This variable is getting used in various paths, such as task migration, set task affinity, and CPU hotplug. For example cpu hotplug path, stop_cpus_in_progress variable getting set with true with out checking. takedown_cpu() --stop_machine_cpuslocked() ---stop_cpus() ---__stop_cpus() ----queue_stop_cpus_work() setting stop_cpus_in_progress to true directly. But in the task migration path only, the stop_cpus_in_progress variable is used for retry. I am thinking that stop_cpus_in_progress variable lead race conditions, where CPU hotplug and task migration happening simultaneously. Please correct me If my understanding wrong. -Thanks, Prasad > >> --- a/kernel/stop_machine.c >> +++ b/kernel/stop_machine.c >> @@ -290,6 +290,7 @@ int stop_two_cpus(unsigned int cpu1, unsigned int >> cpu2, >> cpu_stop_fn_t fn, void * >> struct cpu_stop_done done; >> struct cpu_stop_work work1, work2; >> struct multi_stop_data msdata; >> + int ret; >> >> msdata = (struct multi_stop_data){ >> .fn = fn, >> @@ -312,7 +313,10 @@ int stop_two_cpus(unsigned int cpu1, unsigned int >> cpu2, >> cpu_stop_fn_t fn, void * >> if (cpu_stop_queue_two_works(cpu1, &work1, cpu2, &work2)) >> return -ENOENT; >> >> - wait_for_completion(&done.completion); >> + ret = wait_for_completion_timeout(&done.completion, >> msecs_to_jiffies(1000)); >> + if (!ret) >> + BUG_ON(1); >> + > > That's a random timeout, which if you spuriously trigger it, will take > down your machine. That seems like a cure worse than the disease. -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, Linux Foundation Collaborative Project