Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2228004imm; Thu, 19 Jul 2018 15:56:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfeuIHUvrTRTQDYa5ycusktjxxH2ZidYEyS83WVEYT0t7Nw30ArcGVDJSTzAuwhe5xGm0kB X-Received: by 2002:a62:4704:: with SMTP id u4-v6mr11334772pfa.76.1532041008244; Thu, 19 Jul 2018 15:56:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532041008; cv=none; d=google.com; s=arc-20160816; b=jOozFLJXP29y+aSjaIjjWIAEkOqkENAqwFfKxhrq4XgRzX2huZDH9oU9DaHyvXX2n+ BseFYDGUp/+iVo+ikqXgeqKVmSxZnOWk4HdfLwwDKAG+BiyM5iKNve4bnQ/i5iqzfQDm ZmYc5f56GitlaHbEYnHgxc/so2cA6jVWfkKpPR2ulWp1k7Pf/Cq1cHp8mjliQXQ2B9jK eIDLgnHW0SD0vkIA0/PQOmYhAQsF5e1CuQ1+ROWtv9DWalLTssx8EpWOfhGXiWQZ0fGw +ZZHzHGLYMWj1oHcnfuFiInyMgl58g2GisjtuV7ylU0/YsEbwwZAlIvxl+ZDwXbIBW2v QPGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=7JzTgoxSHj8NXwJcn4MBYWwjY/bHOb0/fS+gg+hwDJI=; b=YGcftH8mBIX73tAKy8Ix4HmJAdS7cI0knv9Q7JIV9vXVAmQX3J+Dz4yj3ZLiWIp5Kk etiFlEzzfhLmY0mGTY0Bt+2nD3DXGJtIr2cWBVEoxGFOb8JfgvQD/BrRE1U7vRgmf/my WkxClr3cAC+UESoQr57zLU1mFQVAfba4Z8PpuF7gh6L0Ix/XWDV9u9xa/VFemOYquXHD SQucJKZxsaT1xE0wXXo/YUn6TaAXnwUr2470lCc8c+Hsa+D5Z+0MEPxIKDbsxyyvm4P4 plxr1GFqOmiTHdJ6dC/AJF3pmHWxpaZ6Eu+O76/luTSnCxuvJcg56TgWvbkKVVuKXblZ dV3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=UAwOb8qN; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9-v6si328975pfi.99.2018.07.19.15.56.31; Thu, 19 Jul 2018 15:56:48 -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=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=UAwOb8qN; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730469AbeGSXlJ (ORCPT + 99 others); Thu, 19 Jul 2018 19:41:09 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:35446 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729919AbeGSXlJ (ORCPT ); Thu, 19 Jul 2018 19:41:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7JzTgoxSHj8NXwJcn4MBYWwjY/bHOb0/fS+gg+hwDJI=; b=UAwOb8qNBsQ7LyLMdWhDym9W0 MRICKOjJSZPwF19kkijace3bf7X08igZhhFxvIeMnJirfxjnRuplkyTBS8aKpRWAIGhwfailQeoJB aue22LQbWwgAvrEXQiJUtPH1d/9TZpsaRtpYYfdYFxaqTpCV4A3RcjEisbDbxVrt0Td6Q=; Received: from n2100.armlinux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:36038) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1fgHpn-0008CR-31; Thu, 19 Jul 2018 23:55:43 +0100 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.90_1) (envelope-from ) id 1fgHpk-0000vD-1u; Thu, 19 Jul 2018 23:55:40 +0100 Date: Thu, 19 Jul 2018 23:55:38 +0100 From: Russell King - ARM Linux To: Venkata Narendra Kumar Gutta Cc: linux-arm-kernel@lists.infradead.org, tsoni@codeaurora.org, ckadabi@codeaurora.org, rishabhb@codeaurora.org, linux-kernel@vger.kernel.org, robh@kernel.org, hoeun.ryu@gmail.com, adobriyan@gmail.com, zhizhouzhang@asrmicro.com, suzuki.poulose@arm.com, mark.rutland@arm.com, james.morse@arm.com, will.deacon@arm.com, catalin.marinas@arm.com, Abhimanyu Kapur Subject: Re: [PATCH] ARM64: smp: Fix cpu_up() racing with sys_reboot Message-ID: <20180719225538.GN17271@n2100.armlinux.org.uk> References: <1532038726-3376-1-git-send-email-vnkgutta@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1532038726-3376-1-git-send-email-vnkgutta@codeaurora.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 19, 2018 at 03:18:46PM -0700, Venkata Narendra Kumar Gutta wrote: > Nothing stops a process from hotplugging in a CPU concurrently > with a sys_reboot() call. In such a situation we could have > ipi_cpu_stop() mark a cpu as 'offline' and _cpu_up() ignore the > fact that the CPU is not really offline and call the > CPU_UP_PREPARE notifier. When this happens stop_machine code will > complain that the cpu thread already exists and BUG_ON(). > > CPU0 CPU1 > > sys_reboot() > kernel_restart() > machine_restart() > machine_shutdown() > smp_send_stop() > ... ipi_cpu_stop() > set_cpu_online(1, false) > local_irq_disable() > while(1) > > cpu_up() > _cpu_up() > if (!cpu_online(1)) > __cpu_notify(CPU_UP_PREPARE...) > > cpu_stop_cpu_callback() > BUG_ON(stopper->thread) > > This is easily reproducible by hotplugging in and out in a tight > loop while also rebooting. > > Since the CPU is not really offline and hasn't gone through the > proper steps to be marked as such, let's mark the CPU as inactive. > This is just as easily testable as online and avoids any possibility > of _cpu_up() trying to bring the CPU back online when it never was > offline to begin with. Based on the similar patchset by for arm > targets 040c163( "ARM: smp: Fix cpu_up() racing with sys_reboot)" You really need to use 12 digit commit IDs to refer to commits to avoid: $ git log 040c163 fatal: ambiguous argument '040c163': unknown revision or path not in the working tree. because 7 digits are just too short and given the size of the kernel, result in conflicting references. I can find no trace of "040c163" touching arch/arm/kernel/smp.c, nor can I find a commit with "racing with sys_reboot" touching the same file. The commit you reference doesn't seem to be in mainline. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 13.8Mbps down 630kbps up According to speedtest.net: 13Mbps down 490kbps up