From patchwork Thu Aug 29 11:34:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 172591 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2091589ily; Thu, 29 Aug 2019 04:35:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKK2A7Oa/bdaZxlUQ8MVH/hmP4rQeNEUGsHu42Sem7Yiee0w51VRBIllYk2Hf1acc/1paE X-Received: by 2002:a63:db45:: with SMTP id x5mr7810984pgi.293.1567078533594; Thu, 29 Aug 2019 04:35:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567078533; cv=none; d=google.com; s=arc-20160816; b=l1QvujvUJs8EnfEPNUtPYi+JfoM+b4YWcySOAGVLe2BovJoPBVlTQ+HHDwbtLgQ5BQ IZmgGzaMtk/z/GpdlUSBg+bOPOqJFd70h10Ey6EPPJ86KIM6qcxDZgByCiavThX3Y1n4 wSt3AD+gw70Uy9GH0DqbzPMpMrE61jNYw5XnjwAjErCyGFj6Sa8a9Y7RW3JHv7c0+nAf 2b7IF75GUOMt6ovCxaCfH8gEh2Nk4HFmrnFJkCcQf7n8OgtLlQNtsWNJblP1VCHR3uch GES3LxPBb9lIkX6YKzr8FuJhTixftJXWc4EiLZxAJ6ywf+feoaREYuMXLg1aQmI1vTnn CO8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=O+J5pz+r7c0NpS1D8X6SYhx9QHuTsDp1UjRErYyLM4s=; b=MU9BjL/JPyodB6U+mOCXdwTzflni26rshOI3FaVHd2kiv15Lz1CHhGgzzHDw21oFWp l23iA4hsahbI4+RSuoxNKK/QW+1awmMPUaKApDqhH0i4H/vzwQLcjo0IS9q+5BLSD7N8 whc8i7bjuwD2P/FcAfuH3+xz4BljRPVF8PLKI6GQWeQhwJiv/VursxczgplFVbfz/wmF pjXpvv/mr/a0QkNYFV5fmmEk3Ma1PZi796ZFOqtzszlVB0NODE5w+BnmLvlml+zsK/uw bdKcg9shDmDdNYw2E/PHpdofWUnoqje6dseLGM+SPUk7THvNijljr2AioD/e0tjbBhGC LeJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oZTPTec0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b30si1720301pla.299.2019.08.29.04.35.33; Thu, 29 Aug 2019 04:35:33 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=oZTPTec0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727362AbfH2Lfd (ORCPT + 14 others); Thu, 29 Aug 2019 07:35:33 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42079 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727320AbfH2Lfc (ORCPT ); Thu, 29 Aug 2019 07:35:32 -0400 Received: by mail-pf1-f194.google.com with SMTP id i30so1854585pfk.9 for ; Thu, 29 Aug 2019 04:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=O+J5pz+r7c0NpS1D8X6SYhx9QHuTsDp1UjRErYyLM4s=; b=oZTPTec0QCZyIdYWeoFDwwmLFP9g4lc0dbPQ/YV/Da2dsknHe6hU0UrVQ4lKyjcwHL ythaQ75viCx336XmpgjZGoZvhFyjdwlsqgHBHvQk9PBGbD8d4drBBMLFsOTWEUWhVV1T ad5FhTlYfhoP8xBkXaztzU1nDsDlDYbVbZ0uSEPlqF63pwu15tJl3IxJbzE6xsrg07M2 mAqCLPLR5a5s5AxsLhfs2ki+B/4gTV8AqSfT1mlyNowc+oBuTifKnCT1XSZAaIFJeGAi oPFzIhprwBPwaEt8QRs226mpGYFBXaFhdXyv+O2ggl7op8bq3FLoQ5KncK3dPUrJgaP2 IIHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O+J5pz+r7c0NpS1D8X6SYhx9QHuTsDp1UjRErYyLM4s=; b=MRgjcP3XVSkd0kQ6q32witFCAvzOjzeuM0UVhrlLW+VMrQHntgfE+EVJnyfJgniWBx 74GVnBq7FJkH2s0ZKCQ0n3w9RYKl/oOcRVNh7BLH5eEp1J87CucU4jZ8yGkL5O6tddxZ gkEFUwedeiz2aB5NJ6TYRQjc0FYUFMgXmJ/TH3ckOltjmiyxuZ1HW2J1WxSNpGdE80AZ fnCQc5crzib8rL8gEBOKYLwDkhchru7yS6GnA1ChbvBBqEMOEDaUdRt3z5aMTDRLLZQK vYDoUn4/Sf0axQMIs2088CC27yn+66/KeXc2FdQyd4MQeh1kOLmGtrgoEBSAMjpbAg6E YK/g== X-Gm-Message-State: APjAAAU+rFm/70TEXRoSz9/djGh3UyCi8Mgh6FiDS/GtMppU6rwEI2DM NCGVkY2MBDuHer4qG/T2zmmXfTByHcw= X-Received: by 2002:a17:90a:77c9:: with SMTP id e9mr8828325pjs.141.1567078531812; Thu, 29 Aug 2019 04:35:31 -0700 (PDT) Received: from localhost ([122.167.132.221]) by smtp.gmail.com with ESMTPSA id z16sm6800192pfr.136.2019.08.29.04.35.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Aug 2019 04:35:31 -0700 (PDT) From: Viresh Kumar To: stable@vger.kernel.org, Julien Thierry , Mark Rutland Cc: Viresh Kumar , linux-arm-kernel@lists.infradead.org, Catalin Marinas , Marc Zyngier , Will Deacon , Russell King , Vincent Guittot , mark.brown@arm.com Subject: [PATCH ARM64 v4.4 V3 15/44] arm64: Add a helper for parking CPUs in a loop Date: Thu, 29 Aug 2019 17:04:00 +0530 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Suzuki K Poulose Commit c4bc34d20273db698c51951a1951dba0a722e162 upstream. Adds a routine which can be used to park CPUs (spinning in kernel) when they can't be killed. Cc: Mark Rutland Acked-by: Will Deacon Signed-off-by: Suzuki K Poulose Signed-off-by: Catalin Marinas Signed-off-by: Viresh Kumar --- arch/arm64/include/asm/smp.h | 8 ++++++++ arch/arm64/kernel/cpufeature.c | 5 +---- 2 files changed, 9 insertions(+), 4 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h index d9c3d6a6100a..53b53a9b3e5a 100644 --- a/arch/arm64/include/asm/smp.h +++ b/arch/arm64/include/asm/smp.h @@ -69,4 +69,12 @@ extern int __cpu_disable(void); extern void __cpu_die(unsigned int cpu); extern void cpu_die(void); +static inline void cpu_park_loop(void) +{ + for (;;) { + wfe(); + wfi(); + } +} + #endif /* ifndef __ASM_SMP_H */ diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index b7f01bf47988..4adf18307568 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -868,10 +868,7 @@ void cpu_die_early(void) /* Check if we can park ourselves */ if (cpu_ops[cpu] && cpu_ops[cpu]->cpu_die) cpu_ops[cpu]->cpu_die(cpu); - asm( - "1: wfe\n" - " wfi\n" - " b 1b"); + cpu_park_loop(); } /*