From patchwork Fri Mar 9 16:48:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 7194 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 4D9A423E13 for ; Fri, 9 Mar 2012 16:48:57 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 086CEA187D4 for ; Fri, 9 Mar 2012 16:48:56 +0000 (UTC) Received: by iage36 with SMTP id e36so3230342iag.11 for ; Fri, 09 Mar 2012 08:48:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=lSRNVASJ374xm7/ZBf8jhaJxW53WrA8IWh5d2OOdL6s=; b=o7C+aSiGg08xmUjQAd3y5wzWVzSKvPGbjlZmC5HyOhSzjtn2WkaE20PE6NqzJ6hKqw /h882d6HxjSBewV56sRz30plUAHL/2nsVNSjglIWZ6A4ay+TY/Z403VMFQqmjgJUMWcQ CU/IgVFUwp0fqLTVmaj5UyUoeIlTwhC2LY4GtXPpI+/+J2LIAkh6R0PMzuTLVTxM2zAR UauZLvY3H2gTkHIy41iWRXApbzbd+QBcl6Jf2MnfOtOgT9BvSfSb5JfnBJYcKFcIkfgN iCbZTVxBWUUtc9SAei7XNyrVEgDMBJEyWPAc5FxafhDtEN85eUp1a+jZur05ZjvN0Y41 q+9g== Received: by 10.50.184.228 with SMTP id ex4mr3343029igc.50.1331311736474; Fri, 09 Mar 2012 08:48:56 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.53.18 with SMTP id k18csp36282ibg; Fri, 9 Mar 2012 08:48:55 -0800 (PST) Received: by 10.213.13.82 with SMTP id b18mr337078eba.168.1331311735288; Fri, 09 Mar 2012 08:48:55 -0800 (PST) Received: from eu1sys200aog120.obsmtp.com (eu1sys200aog120.obsmtp.com. [207.126.144.149]) by mx.google.com with SMTP id e8si3325689eea.174.2012.03.09.08.48.52 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 09 Mar 2012 08:48:55 -0800 (PST) Received-SPF: neutral (google.com: 207.126.144.149 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.149; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.149 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob120.postini.com ([207.126.147.11]) with SMTP ID DSNKT1o0bLr/YGjyjHpG3SXXxhrrwrn1jdQN@postini.com; Fri, 09 Mar 2012 16:48:55 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 059821C6; Fri, 9 Mar 2012 16:48:29 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 343682603; Fri, 9 Mar 2012 16:48:29 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 93788A8072; Fri, 9 Mar 2012 17:48:22 +0100 (CET) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 9 Mar 2012 17:48:28 +0100 From: Linus Walleij To: Cc: Jonas Aaberg , Peter Zijlstra , , Linus Walleij Subject: [PATCH] ARM: smp_twd: Only wait for reprogramming on active cpus Date: Fri, 9 Mar 2012 17:48:21 +0100 Message-ID: <1331311701-32071-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.8 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmJCMpHB6bKdRRZWOg/tpid0SlZ6OdtBAR6f4J5RNxL50YQsGjIlmIJsEnDZf0dNpE5VbMM From: Jonas Aaberg During booting of cpu1, there is a short window where cpu1 is online, but not active where cpu1 is occupied by waiting to become active. If cpu0 then decides to schedule something on cpu1 and wait for it to complete, before cpu0 has set cpu1 active, we have a deadlock. Typically it's this CPU frequency transition that happens at this time, so let's just not wait for it to happen, it will happen whenever the CPU eventually comes online instead. Cc: Peter Zijlstra Cc: stable@kernel.org Signed-off-by: Jonas Aaberg Reviewed-by: Rickard Andersson Signed-off-by: Linus Walleij --- This situation occurs as discussed here: https://lkml.org/lkml/2012/2/29/141 We're also testing this patch from Peter: https://lkml.org/lkml/2011/12/15/255 --- arch/arm/kernel/smp_twd.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index 7a79b24..692afa4 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c @@ -115,10 +115,14 @@ static int twd_cpufreq_transition(struct notifier_block *nb, * The twd clock events must be reprogrammed to account for the new * frequency. The timer is local to a cpu, so cross-call to the * changing cpu. + * + * Only wait for it to finish, if the cpu is active to avoid + * deadlock when cpu1 is spinning on while(!cpu_active(cpu1)) during + * booting of that cpu. */ if (state == CPUFREQ_POSTCHANGE || state == CPUFREQ_RESUMECHANGE) smp_call_function_single(freqs->cpu, twd_update_frequency, - NULL, 1); + NULL, cpu_active(freqs->cpu)); return NOTIFY_OK; }