Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1610311

Re: [PATCH v5 08/13] powerpc/perf: PMU functions for Core IMC and hotplugging

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v5 08/13] powerpc/perf: PMU functions for Core IMC and hotplugging
Date Tue, 28 Mar 2017 07:40:01 +0200
Message-ID <tpS1j-2ZP-9@gated-at.bofh.it> (permalink)
References <tlyaR-3mF-5@gated-at.bofh.it> <tlyaT-3mF-57@gated-at.bofh.it> <toaOL-2Hz-49@gated-at.bofh.it>
X-Original-To ego@linux.vnet.ibm.com
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
MIME-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Tm-As-Mml disable
X-Cbid 17032804-0048-0000-0000-0000021797D7
X-Ibm-Av-Detection SAVI=unused REMOTE=unused XFE=unused
X-Cbparentid 17032804-0049-0000-0000-000047C368C5
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:,, definitions=2017-03-28_04:,, signatures=0
X-Proofpoint-Spam-Details rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703280043
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 100
Organization linux.* mail to news gateway
X-Original-Cc mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Hemant Kumar <hemant@linux.vnet.ibm.com>, Balbir Singh <bsingharora@gmail.com>, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Paul Mackerras <paulus@samba.org>, Anton Blanchard <anton@samba.org>, Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>, Michael Neuling <mikey@neuling.org>, Stewart Smith <stewart@linux.vnet.ibm.com>, Daniel Axtens <dja@axtens.net>, Stephane Eranian <eranian@google.com>, Anju T Sudhakar <anju@linux.vnet.ibm.com>
X-Original-Date Tue, 28 Mar 2017 10:11:51 +0530
X-Original-Message-ID <5aaf098d-5919-e7c6-b4a6-0acbb5baa222@linux.vnet.ibm.com>
X-Original-References <1489649707-8021-1-git-send-email-maddy@linux.vnet.ibm.com> <1489649707-8021-9-git-send-email-maddy@linux.vnet.ibm.com> <20170323130947.GB4897@in.ibm.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1610311

Show key headers only | View raw



On Thursday 23 March 2017 06:39 PM, Gautham R Shenoy wrote:
> Hi Maddy, Hemant, Anju,
>
> On Thu, Mar 16, 2017 at 01:05:02PM +0530, Madhavan Srinivasan wrote:
>
> [..snip..]
>
>> +
>> +static void core_imc_change_cpu_context(int old_cpu, int new_cpu)
>> +{
>> +	if (!core_imc_pmu)
>> +		return;
>> +	perf_pmu_migrate_context(&core_imc_pmu->pmu, old_cpu, new_cpu);
>> +}
>> +
>> +
>> +static int ppc_core_imc_cpu_online(unsigned int cpu)
>> +{
>> +	int ret;
>> +
>> +	/* If a cpu for this core is already set, then, don't do anything */
>> +	ret = cpumask_any_and(&core_imc_cpumask,
>> +				 cpu_sibling_mask(cpu));
>> +	if (ret < nr_cpu_ids)
>> +		return 0;
>> +
>> +	/* Else, set the cpu in the mask, and change the context */
>> +	cpumask_set_cpu(cpu, &core_imc_cpumask);
>> +	core_imc_change_cpu_context(-1, cpu);
> So, in the core case, we are ok as long as any cpu in the core is
> present in the imc_cpumask. It need not have to be the smallest online
> cpu in the core.
>
> Can the same logic be applied to the earlier nest case ?

Yes. This makes sense. Let me look at this.

Thanks for review
Maddy

>
> We can have a single function for cpu_offline and cpu_online which
> implements these checks and sets the cpu bit if required.
>
> ppc_entity_imc_cpu_offline(unsigned int cpu, cpumask_t
> 			   entity_imc_mask,
> 			   entity_imc_change_cpu_context_fn)
> {
> 	.
> 	.
> 	.
> 	
> }
>
>
> static ppc_nest_imc_cpu_offline(unsigned int cpu)
> {
> 	return ppc_entity_imc_cpu_offline(cpu, nest_imc_mask,
> 					  nest_imc_change_cpu_context);
> }
>
> And similar ones for core imc and thread imc.
>
> Does this sound reasonable ?

>> +	return 0;
>> +}
>> +
>> +static int ppc_core_imc_cpu_offline(unsigned int cpu)
>> +{
>> +	int target;
>> +	unsigned int ncpu;
>> +
>> +	/*
>> +	 * clear this cpu out of the mask, if not present in the mask,
>> +	 * don't bother doing anything.
>> +	 */
>> +	if (!cpumask_test_and_clear_cpu(cpu, &core_imc_cpumask))
>> +		return 0;
>> +
>> +	/* Find any online cpu in that core except the current "cpu" */
>> +	ncpu = cpumask_any_but(cpu_sibling_mask(cpu), cpu);
>> +
>> +	if (ncpu < nr_cpu_ids) {
>> +		target = ncpu;
>> +		cpumask_set_cpu(target, &core_imc_cpumask);
>> +	} else
>> +		target = -1;
>> +
>> +	/* migrate the context */
>> +	core_imc_change_cpu_context(cpu, target);
>> +
>> +	return 0;
>> +}
>> +
> --
> Thanks and Regards
> gautham.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v5 00/13] IMC Instrumentation Support Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2017-03-16 08:40 +0100
  [PATCH 13/13] powerpc/perf: Enable/disable core engine during cpuhotplug Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2017-03-16 08:40 +0100
  [PATCH 11/13] powerpc/powernv: Add device shutdown function for Core IMC Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2017-03-16 08:40 +0100
  [PATCH v5 10/13] powerpc/perf: Thread IMC PMU functions Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2017-03-16 08:40 +0100
  [PATCH v5 01/13] powerpc/powernv: Data structure and macros definitions Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2017-03-16 08:40 +0100
  [PATCH v5 04/13] powerpc/perf: Add event attribute and group to IMC pmus Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2017-03-16 08:40 +0100
  [PATCH v5 03/13] powerpc/powernv: Detect supported IMC units and its events Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2017-03-16 08:40 +0100
  [PATCH v5 08/13] powerpc/perf: PMU functions for Core IMC and hotplugging Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2017-03-16 08:40 +0100
    Re: [PATCH v5 08/13] powerpc/perf: PMU functions for Core IMC and  hotplugging Gautham R Shenoy <ego@linux.vnet.ibm.com> - 2017-03-23 14:20 +0100
      Re: [PATCH v5 08/13] powerpc/perf: PMU functions for Core IMC and  hotplugging Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2017-03-28 07:40 +0200
  [PATCH v5 09/13] powerpc/powernv: Thread IMC events detection Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2017-03-16 08:40 +0100

csiph-web