From patchwork Mon Aug 5 04:25:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 18761 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CC4DC2486D for ; Mon, 5 Aug 2013 04:25:17 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id 15sf4097446vea.9 for ; Sun, 04 Aug 2013 21:25:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to:date:from :to:cc:subject:in-reply-to:message-id:references:user-agent :mime-version:x-gm-message-state:x-removed-original-auth :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=hcZPWxcg0/OY9/43SsRIqecGjCL9buNSUHISk0hpbzQ=; b=XSM3kjiXSAZLvaO4uQRDgvdgDrqT6Ly9TTF3daF9wIFbRUlBMb6SFPaKSkSaOxboM5 /LqxUjAzvIRiGQrzQljxb5y9+JPAbC64omn/Ux6uYsv2R9QV8ang8ffeZRxAvj69tQNq ui55WckYvr/h+K738w1nj0duo+iffpjtIzzAbiUcfkGCILN3rbL6G6hZTAEw1LVkYqMJ XJCBsWzXC1eKstcZUwdq6H60CMkS7aGMYYZTO4jz6RK/CqVGql+Zs+SOyfSKomxJFE4J vPk8M5E4UTz8OfMxOAxp3ge+A++BpFcJE0CCRjLFCx/IJvz2c8a0W1qZp7vfF/JY1dq2 uPVw== X-Received: by 10.236.133.19 with SMTP id p19mr7808878yhi.54.1375676717058; Sun, 04 Aug 2013 21:25:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.59.74 with SMTP id x10ls2392825qeq.9.gmail; Sun, 04 Aug 2013 21:25:16 -0700 (PDT) X-Received: by 10.221.51.206 with SMTP id vj14mr5218471vcb.17.1375676716930; Sun, 04 Aug 2013 21:25:16 -0700 (PDT) Received: from mail-vb0-f44.google.com (mail-vb0-f44.google.com [209.85.212.44]) by mx.google.com with ESMTPS id ta3si4598610vcb.71.2013.08.04.21.25.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 04 Aug 2013 21:25:16 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.44 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.44; Received: by mail-vb0-f44.google.com with SMTP id e13so2381123vbg.3 for ; Sun, 04 Aug 2013 21:25:16 -0700 (PDT) X-Received: by 10.52.26.76 with SMTP id j12mr383926vdg.48.1375676716669; Sun, 04 Aug 2013 21:25:16 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.11.8 with SMTP id pc8csp67496vcb; Sun, 4 Aug 2013 21:25:16 -0700 (PDT) X-Received: by 10.224.97.66 with SMTP id k2mr26303631qan.109.1375676715658; Sun, 04 Aug 2013 21:25:15 -0700 (PDT) Received: from mail-qc0-f177.google.com (mail-qc0-f177.google.com [209.85.216.177]) by mx.google.com with ESMTPS id k2si9520538qan.56.2013.08.04.21.25.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 04 Aug 2013 21:25:15 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.216.177 is neither permitted nor denied by best guess record for domain of nicolas.pitre@linaro.org) client-ip=209.85.216.177; Received: by mail-qc0-f177.google.com with SMTP id e11so1416844qcx.8 for ; Sun, 04 Aug 2013 21:25:15 -0700 (PDT) X-Received: by 10.229.118.133 with SMTP id v5mr1682234qcq.93.1375676715319; Sun, 04 Aug 2013 21:25:15 -0700 (PDT) Received: from xanadu.home (modemcable044.209-83-70.mc.videotron.ca. [70.83.209.44]) by mx.google.com with ESMTPSA id i1sm989406qas.10.2013.08.04.21.25.14 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 04 Aug 2013 21:25:14 -0700 (PDT) Date: Mon, 5 Aug 2013 00:25:13 -0400 (EDT) From: Nicolas Pitre To: Lorenzo Pieralisi cc: "linux-arm-kernel@lists.infradead.org" , "dave.martin@linaro.org" , "patches@linaro.org" Subject: Re: [PATCH 11/13] ARM: bL_switcher: veto CPU hotplug requests when the switcher is active In-Reply-To: <20130731103025.GC6583@e102568-lin.cambridge.arm.com> Message-ID: References: <1374550289-25305-1-git-send-email-nicolas.pitre@linaro.org> <1374550289-25305-12-git-send-email-nicolas.pitre@linaro.org> <20130731103025.GC6583@e102568-lin.cambridge.arm.com> User-Agent: Alpine 2.03 (LFD 1266 2009-07-14) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnx+4Ua0VgAYhrNepdSPhorAg6NGG/KOhZU7e7wZPZGJM7WaKKyTc32jHxIf/oq5Agxtvfx X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: nicolas.pitre@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.44 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Wed, 31 Jul 2013, Lorenzo Pieralisi wrote: > On Tue, Jul 23, 2013 at 04:31:27AM +0100, Nicolas Pitre wrote: > > Trying to support both the switcher and CPU hotplug at the same time > > is quickly becoming very complex due to ambiguous semantics. So let's > > simply veto any hotplug requests when the switcher is active for now. > > > > This restriction might be loosened eventually. > > > > Signed-off-by: Nicolas Pitre > > --- > > arch/arm/common/bL_switcher.c | 21 +++++++++++++++++++++ > > 1 file changed, 21 insertions(+) > > > > diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c > > index 704c4b4ef3..2fe3911601 100644 > > --- a/arch/arm/common/bL_switcher.c > > +++ b/arch/arm/common/bL_switcher.c > > @@ -528,6 +528,25 @@ static int __init bL_switcher_sysfs_init(void) > > > > #endif /* CONFIG_SYSFS */ > > > > +/* > > + * Veto any CPU hotplug operation while the switcher is active. > > + * We're just not ready to deal with that given the trickery involved. > > + */ > > +static int bL_switcher_hotplug_callback(struct notifier_block *nfb, > > + unsigned long action, void *hcpu) > > +{ > > + switch (action) { > > + case CPU_UP_PREPARE: > > + case CPU_DOWN_PREPARE: > > + if (bL_switcher_active) > > + return NOTIFY_BAD; > > This is a bit of a sledgehammer. It implies that S2R can't be implemented when > the switcher is active. Are we really sure that hotplug, given MCPM HW > CPUs awareness, is incompatible with the switcher as it stands ? > > What are the main issues that have to be tackled ? It's about semantics. Let's say the switcher pairs CPU0 with CPU2 and CPU1 with CPU3, effectively keeping only logical CPUS 0 and 1 active. Obviously, we must disallow hotplugging CPUs 2 and 3. But what if CPU0 is removed, and then the switcher is disabled? Should we bring up CPU2 or not? What if right before the disabling of the switcher, logical CPU0 was switched to CPU2? Etc. So I decided that there is no right answer, and maybe we shouldn't care that much about those semantic issues around the runtime disabling of the switcher. So I've replaced this patch with the following one: ----- >8 [PATCH] ARM: bL_switcher: filter CPU hotplug requests when the switcher is active Trying to support both the switcher and CPU hotplug at the same time is tricky due to ambiguous semantics. So let's at least prevent users from messing around with those logical CPUs the switcher has removed and those which were not active when the switcher was activated. Signed-off-by: Nicolas Pitre diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c index 0e4fb3e5e9..335ff76d4c 100644 --- a/arch/arm/common/bL_switcher.c +++ b/arch/arm/common/bL_switcher.c @@ -554,6 +554,26 @@ static int __init bL_switcher_sysfs_init(void) #endif /* CONFIG_SYSFS */ +/* + * Veto any CPU hotplug operation on those CPUs we've removed + * while the switcher is active. + * We're just not ready to deal with that given the trickery involved. + */ +static int bL_switcher_hotplug_callback(struct notifier_block *nfb, + unsigned long action, void *hcpu) +{ + if (bL_switcher_active) { + int pairing = bL_switcher_cpu_pairing[(unsigned long)hcpu]; + switch (action & 0xf) { + case CPU_UP_PREPARE: + case CPU_DOWN_PREPARE: + if (pairing == -1) + return NOTIFY_BAD; + } + } + return NOTIFY_DONE; +} + static bool no_bL_switcher; core_param(no_bL_switcher, no_bL_switcher, bool, 0644); @@ -566,6 +586,8 @@ static int __init bL_switcher_init(void) return -EINVAL; } + cpu_notifier(bL_switcher_hotplug_callback, 0); + if (!no_bL_switcher) { ret = bL_switcher_enable(); if (ret)