From patchwork Fri Dec 7 12:47:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 153151 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp456381ljp; Fri, 7 Dec 2018 04:46:52 -0800 (PST) X-Google-Smtp-Source: AFSGD/VR9BlSjZ3tcTScAdHxkMLoupsfIahGfZXz1XBaSEwachypzwCLs1Gm6Rr3InVI9s8esYQq X-Received: by 2002:a17:902:654a:: with SMTP id d10mr1979706pln.324.1544186812191; Fri, 07 Dec 2018 04:46:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544186812; cv=none; d=google.com; s=arc-20160816; b=ROgwDD6rGdh+9JUQKbjUatdZifwDpqMbSbKwZDTYPQyZJYPuBAkvexrPaeNEuEBngA m771oBoEJMy6eKpji4votHiZziOgUYx8fsBMD/c60HofHaisT/FUUKU7CtNoEIb/3aeH bL5P53E5xqKQtmZZJFZS7CXrKCox6yaIMHNy/ptZi9V/g04cQsuL9k7Neve+5V9BMvXV S4iz2X5ea1obrNeYIVm/sB2E9nzuKYjVP5ZBjtoqLG0YshCCmdNyjyBgNfuKdQ/EBx9G w2xS+Mvdh8LihpLBLVvOc3n8mYzmPWZy1Xd1n9uAt0WK2ovutRNsbgkK5AvOAGIB2l/I eh6g== 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=QIoHkaTpj9kR+S7sXghayY9xlRu0I8VVq4EaUUYzb4s=; b=DxbOTMaeI61Qn2D+8ZGJd8TV6hi9F/jEgiDHUUd0LAfZ+P3927rrJingc7tRu7dA4G frRWKTdIeDbDnUE//H+4WHM5Mae2N6lz6fmqYHFRSUYyKluwQtm9VAseyelo5pvHXQQk 1hDqgcPGajiJA96A/OjyzDjHIsytucixMin5dl2rQ7eE7vDAL09d0/Y6oW1GY58AwVhh oUiZzdJQxjCpkt2MqTFmbK54B22fvSsUHS6sMaQU685Qqiwy8SZw5ovvZcX3GePt7nDy O/wV4pWn3Id16698oBS5JHKu7PBoUhUiOPSj9GUlwU1JyVAdRdqVHQ2CCBPdZEJdP/6k nJSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 t12si2843273plq.190.2018.12.07.04.46.51; Fri, 07 Dec 2018 04:46:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725997AbeLGMqv (ORCPT + 15 others); Fri, 7 Dec 2018 07:46:51 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:43678 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725994AbeLGMqv (ORCPT ); Fri, 7 Dec 2018 07:46:51 -0500 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 ABD79EBD; Fri, 7 Dec 2018 04:46:50 -0800 (PST) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7C2B43F5AF; Fri, 7 Dec 2018 04:46:50 -0800 (PST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id DE4821AE0C03; Fri, 7 Dec 2018 12:47:11 +0000 (GMT) From: Will Deacon To: catalin.marinas@arm.com Cc: linux-arm-kernel@lists.infradead.org, james.morse@arm.com, hayashi.kunihiko@socionext.com, Will Deacon , Subject: [PATCH] arm64: hibernate: Avoid sending cross-calling with interrupts disabled Date: Fri, 7 Dec 2018 12:47:10 +0000 Message-Id: <1544186830-27934-1-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Since commit 3b8c9f1cdfc50 ("arm64: IPI each CPU after invalidating the I-cache for kernel mappings"), a call to flush_icache_range() will use an IPI to cross-call other online CPUs so that any stale instructions are flushed from their pipelines. This triggers a WARN during the hibernation resume path, where flush_icache_range() is called with interrupts disabled and is therefore prone to deadlock: | Disabling non-boot CPUs ... | CPU1: shutdown | psci: CPU1 killed. | CPU2: shutdown | psci: CPU2 killed. | CPU3: shutdown | psci: CPU3 killed. | WARNING: CPU: 0 PID: 1 at ../kernel/smp.c:416 smp_call_function_many+0xd4/0x350 | Modules linked in: | CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.20.0-rc4 #1 Since all secondary CPUs have been taken offline prior to invalidating the I-cache, there's actually no need for an IPI and we can simply call __flush_icache_range() instead. Cc: Fixes: 3b8c9f1cdfc50 ("arm64: IPI each CPU after invalidating the I-cache for kernel mappings") Reported-by: Kunihiko Hayashi Tested-by: Kunihiko Hayashi Tested-by: James Morse Signed-off-by: Will Deacon --- arch/arm64/kernel/hibernate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.1.4 diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c index 6b2686d54411..29cdc99688f3 100644 --- a/arch/arm64/kernel/hibernate.c +++ b/arch/arm64/kernel/hibernate.c @@ -214,7 +214,7 @@ static int create_safe_exec_page(void *src_start, size_t length, } memcpy((void *)dst, src_start, length); - flush_icache_range(dst, dst + length); + __flush_icache_range(dst, dst + length); pgdp = pgd_offset_raw(allocator(mask), dst_addr); if (pgd_none(READ_ONCE(*pgdp))) {