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=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_NEOMUTT autolearn=ham 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 93093C31E51 for ; Tue, 18 Jun 2019 12:47:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 691A420679 for ; Tue, 18 Jun 2019 12:47:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="l58aggw2"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="J7s6Mffq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 691A420679 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6TFLFwT83bZYEDMnNIHJOJhO09SRrwLV2JyK2AkCzQg=; b=l58aggw21IRq/P 0picK25C5G+Kk/uyYKG8VzfYBUYUnjLn+/e76vcmABCQ3+HqPRYR6mZsja9S4kOjLwgFMkF1/3KHT UFuQZNt0zQF8Dq6rFLfJz8QNrdUxt7VbXhX0+GfB4Fg3yGOI4PgPhmGZbF6CXxS2WQsrjg/7v96Ak xQ7pjACI957eGAu7X9TNZmY1D5ndPLoraZoQo0nIr1ag3XTV4tXifDlfLTl2mshgDKlI4pXyJEbyx XnBbbmZ5nTLcyUk/jHELJ0zcYR/aHYHPHGR/jTxK7/vDfcfhwUrquQBW4yvgQ5+bB4RQ60V4HbrkO lIeIj9nKWiPl/uD6L2oQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdDWY-000723-1e; Tue, 18 Jun 2019 12:47:42 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdDVL-0006eZ-VE for linux-arm-kernel@lists.infradead.org; Tue, 18 Jun 2019 12:46:31 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 096C420679; Tue, 18 Jun 2019 12:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560861984; bh=azZE7x66Pwd4/1F2pCh08R8QDQONV5S6PiUA04fafJU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=J7s6MffqFl16LfzeqWkLVhkrzGMXF6+TE4C6pjT1lx4YnJUe+At3VVJ9WH/FRZpc4 LLOceNx+u5IP75fW7WaM4QBN32W4Fp856R6YDrGn5qW67yHwRg34yORfnw/7ctsHKX 4GukgwNScilzQ1hSRNJeBh2MsS1GlJ8RE8pi2D0M= Date: Tue, 18 Jun 2019 13:46:19 +0100 From: Will Deacon To: Cristian Marussi Subject: Re: [PATCH] arm64: smp: fix smp_send_stop() behaviour Message-ID: <20190618124619.ybyyno3cii5v6zyd@willie-the-truck> References: <20190613122146.45459-1-cristian.marussi@arm.com> <20190617180913.GN30800@fuggles.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190618_054629_244734_2101F3F6 X-CRM114-Status: GOOD ( 18.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, catalin.marinas@arm.com, Will Deacon , james.morse@arm.com, dave.martin@arm.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jun 18, 2019 at 10:41:32AM +0100, Cristian Marussi wrote: > On 17/06/2019 19:09, Will Deacon wrote: > >> diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c > >> index bb4b3f07761a..c7d604427883 100644 > >> --- a/arch/arm64/kernel/smp.c > >> +++ b/arch/arm64/kernel/smp.c > >> @@ -971,8 +971,14 @@ void tick_broadcast(const struct cpumask *mask) > >> void smp_send_stop(void) > >> { > >> unsigned long timeout; > >> + unsigned int this_cpu_online = cpu_online(smp_processor_id()); > >> > >> - if (num_online_cpus() > 1) { > >> + /* > >> + * If this CPU isn't fully online, it will not be counted in > >> + * num_online_cpus(): on a 2-CPU system this situation will > >> + * result in no message being sent to the other already online CPU. > >> + */ > >> + if (num_online_cpus() > this_cpu_online) { > >> cpumask_t mask; > >> > >> cpumask_copy(&mask, cpu_online_mask); > >> @@ -985,10 +991,10 @@ void smp_send_stop(void) > >> > >> /* Wait up to one second for other CPUs to stop */ > >> timeout = USEC_PER_SEC; > >> - while (num_online_cpus() > 1 && timeout--) > >> + while (num_online_cpus() > this_cpu_online && timeout--) > >> udelay(1); > >> > >> - if (num_online_cpus() > 1) > >> + if (num_online_cpus() > this_cpu_online) > >> pr_warning("SMP: failed to stop secondary CPUs %*pbl\n", > >> cpumask_pr_args(cpu_online_mask)); > > > > Whilst this looks ok to me, I'm worried about whether or not we have this > > sort of logic elsewhere. For example, do we need to fix > > crash_smp_send_stop() (and possibly machine_kexec()) too? > > I think we certainly have such logic in crash_smp_send_stop() too at least, > maybe it is just less easily exposed given the different use case of the function. > > This wanted to be just a fix only against the observed troubled panic, but I > could extend it to cover similar issues spotted by code analysis, if deemed worth. Yes, please. Makes sense to fix these all at once. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel