From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63754C433FE for ; Fri, 28 Jan 2022 03:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:Cc:To:Subject:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=0MPpiC0bQVx0OV9HtiSioSgX1D70+V8GphFHFOavVlM=; b=UtxIEdgBkuuR5AOcaGg4IC/zIc xYg4hSB0JToBoOUcBvqzjP7zQc/lC0eo8XDU8Cj3emZ4I9oLWCf3MAYSAe5Em/DycjDO16HZljKt/ Ddkmg8/2yklMhyo3kdfDVdLqsIGmqmWCYd8oMO4Yurozhmi561001r02d28VzqfP15ubxXwqBZreS pG8vOjh4zjAm9Oy3ZevMnipio6OGd8tDTRnVTGnjOKnmR8SVjKmic2eY4UypCQL1oKe8xDY/YtZa4 SFvG2Gs5/BSSFuwAbKeXUfy47O5RIhUDqn8tmDh52CSMYbrgLts3JVgTdsEtOENpjEwczpxJ7NtVk OXnG+Ssg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nDHv0-000BKr-2P; Fri, 28 Jan 2022 03:27:22 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nDHun-000BGA-RU for linux-arm-kernel@lists.infradead.org; Fri, 28 Jan 2022 03:27:11 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8DC5A113E; Thu, 27 Jan 2022 19:27:05 -0800 (PST) Received: from [10.163.44.75] (unknown [10.163.44.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5DA4F3F793; Thu, 27 Jan 2022 19:27:01 -0800 (PST) From: Anshuman Khandual Subject: Re: [RFC V1 05/11] arm64/perf: Detect support for BRBE To: Rob Herring Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Mark Rutland , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , linux-perf-users@vger.kernel.org References: <1642998653-21377-1-git-send-email-anshuman.khandual@arm.com> <1642998653-21377-6-git-send-email-anshuman.khandual@arm.com> Message-ID: <71181375-c36e-d3a6-d244-a2bbfd4004fc@arm.com> Date: Fri, 28 Jan 2022 08:57:06 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220127_192709_982367_E98A7C7C X-CRM114-Status: GOOD ( 22.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 1/26/22 10:48 PM, Rob Herring wrote: > On Mon, Jan 24, 2022 at 10:00:47AM +0530, Anshuman Khandual wrote: >> CPU specific BRBE entries, cycle count, format support gets detected during >> PMU init. This information gets saved in per-cpu struct pmu_hw_events which >> later helps in operating BRBE during a perf event context. > > Another NOP commit. The subject says 'arm64' and that we detect BRBE > support. This patch neither touches arm64 code nor detects anything. Right, this is a NOP at this point but it will have functionality when the driver gets added later on. I will correct the arm64 part and also update the message saying - it just adds the infrastructure for BRBE detection not the actual function. > >> >> Cc: Will Deacon >> Cc: Mark Rutland >> Cc: linux-arm-kernel@lists.infradead.org >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual >> --- >> drivers/perf/arm_pmu_platform.c | 34 +++++++++++++++++++++++++++++++++ >> 1 file changed, 34 insertions(+) >> >> diff --git a/drivers/perf/arm_pmu_platform.c b/drivers/perf/arm_pmu_platform.c >> index 513de1f54e2d..800e4a6e8bc3 100644 >> --- a/drivers/perf/arm_pmu_platform.c >> +++ b/drivers/perf/arm_pmu_platform.c >> @@ -172,6 +172,36 @@ static int armpmu_request_irqs(struct arm_pmu *armpmu) >> return err; >> } >> >> +static void arm_brbe_probe_cpu(void *info) >> +{ >> + struct pmu_hw_events *hw_events; >> + struct arm_pmu *armpmu = info; >> + >> + /* >> + * Return from here, if BRBE driver has not been >> + * implemented for this PMU. This helps prevent >> + * kernel crash later when brbe_probe() will be >> + * called on the PMU. >> + */ >> + if (!armpmu->brbe_probe) >> + return; >> + >> + hw_events = per_cpu_ptr(armpmu->hw_events, smp_processor_id()); >> + armpmu->brbe_probe(hw_events); >> +} >> + >> +static int armpmu_request_brbe(struct arm_pmu *armpmu) >> +{ >> + int cpu, err = 0; >> + >> + for_each_cpu(cpu, &armpmu->supported_cpus) { >> + err = smp_call_function_single(cpu, arm_brbe_probe_cpu, armpmu, 1); >> + if (err) >> + return err; >> + } >> + return err; >> +} >> + >> static void armpmu_free_irqs(struct arm_pmu *armpmu) >> { >> int cpu; >> @@ -229,6 +259,10 @@ int arm_pmu_device_probe(struct platform_device *pdev, >> if (ret) >> goto out_free_irqs; >> >> + ret = armpmu_request_brbe(pmu); >> + if (ret) >> + goto out_free_irqs; >> + >> ret = armpmu_register(pmu); >> if (ret) { >> dev_err(dev, "failed to register PMU devices!\n"); >> -- >> 2.25.1 >> >> _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel