Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp36501854rwd; Tue, 11 Jul 2023 01:41:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlFI0Q1niD7pac17y4DvF6OhmXR1MHQyM0hrGotyJBM8hayJbMZ/VmxFu+CwZXhC2p7NvIUc X-Received: by 2002:a05:6358:2785:b0:132:d0d2:7cdf with SMTP id l5-20020a056358278500b00132d0d27cdfmr17473808rwb.6.1689064865948; Tue, 11 Jul 2023 01:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689064865; cv=none; d=google.com; s=arc-20160816; b=KqsmbhxyhyJVH1aO6Fyg7r4UU6n2jc9+MuWLeSX1J0cq5nW3s8+YA02yn5/59aMToU 4Fcw0hReXbN9F3lw0TVwb8Q51zpwT3A5bkMZxXW2F6lRWtRTfDLUwDwzavlg+yT2zKIA bKwRzarwcbpJMMmYuPjO8zjR3Kgh9+x1CdRZZsczQ1cCOOpxRkLG2N0g0IV2wGnCaygp f0nsmUMc9151jx9VEJ1zzrbu0gL8FIK0zoidjXTldPpn2iQ0nV1oXAwopcM8O3FK0BN4 t3RtOSCR4Bx2SMxCpXE6VQeHNDCVDgOadFH6WkWglya1x+KbaKup/FqLFFqzBN+VjUrY Ai7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/Mpa2cNZbtMlDRNvsu0vhgj+3dSVygIdmCi5oMT8SyQ=; fh=uKDf5R1eKBEpFB2sP5rwFdsisg1sKNqEQFf4Rrsmuig=; b=OUXjUsMD9VQ0Qek86bo/DxAD2bjmA2RbK5QN5hxZPnk/EtOO6DRpiognsWKs314wBX jHhvOyTuKDiAIOpv7UgnctBKKFe+3411xs0pd/2MNeVyodkwMDgoxwj2SfvrIL+AUwXp TLLzGbeRWd1FSrRV8hVeZ8DU232ZD8rXkAifiTEiWeLrDvde2TBhjIaAzy/iuXJ+StOu 5AhS2mF251udT//0UmiUsXnydkjd+8ik6Kb7bQEMKz30RxeItRjWMgAT6Z6o0SCicGk6 BR/azUU72ADNjKsA9Wf/jCBrowLo/OnrqjCa4jlsNQq71z45nOQqW+kgRjiKldudJUVA oZzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020a634c02000000b00543c8ad57f7si1094273pga.83.2023.07.11.01.40.53; Tue, 11 Jul 2023 01:41:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231345AbjGKIZZ (ORCPT + 99 others); Tue, 11 Jul 2023 04:25:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231251AbjGKIZS (ORCPT ); Tue, 11 Jul 2023 04:25:18 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F14F5E6A; Tue, 11 Jul 2023 01:25:15 -0700 (PDT) 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 C0093D75; Tue, 11 Jul 2023 01:25:57 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.47.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9C4E23F740; Tue, 11 Jul 2023 01:25:10 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com Cc: Anshuman Khandual , Mark Brown , James Clark , Rob Herring , Marc Zyngier , Suzuki Poulose , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , linux-perf-users@vger.kernel.org Subject: [PATCH V13 - RESEND 01/10] drivers: perf: arm_pmu: Add new sched_task() callback Date: Tue, 11 Jul 2023 13:54:46 +0530 Message-Id: <20230711082455.215983-2-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230711082455.215983-1-anshuman.khandual@arm.com> References: <20230711082455.215983-1-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds armpmu_sched_task(), as generic pmu's sched_task() override which in turn can utilize a new arm_pmu.sched_task() callback when available from the arm_pmu instance. This new callback will be used while enabling BRBE in ARMV8 PMU. Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Tested-by: James Clark Acked-by: Mark Rutland Signed-off-by: Anshuman Khandual --- drivers/perf/arm_pmu.c | 9 +++++++++ include/linux/perf/arm_pmu.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index f6ccb2cd4dfc..c0475a96c2a0 100644 --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c @@ -519,6 +519,14 @@ static int armpmu_event_init(struct perf_event *event) return __hw_perf_event_init(event); } +static void armpmu_sched_task(struct perf_event_pmu_context *pmu_ctx, bool sched_in) +{ + struct arm_pmu *armpmu = to_arm_pmu(pmu_ctx->pmu); + + if (armpmu->sched_task) + armpmu->sched_task(pmu_ctx, sched_in); +} + static void armpmu_enable(struct pmu *pmu) { struct arm_pmu *armpmu = to_arm_pmu(pmu); @@ -865,6 +873,7 @@ struct arm_pmu *armpmu_alloc(void) } pmu->pmu = (struct pmu) { + .sched_task = armpmu_sched_task, .pmu_enable = armpmu_enable, .pmu_disable = armpmu_disable, .event_init = armpmu_event_init, diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index a0801f68762b..3d3bd944d630 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h @@ -102,6 +102,7 @@ struct arm_pmu { void (*stop)(struct arm_pmu *); void (*reset)(void *); int (*map_event)(struct perf_event *event); + void (*sched_task)(struct perf_event_pmu_context *pmu_ctx, bool sched_in); int num_events; bool secure_access; /* 32-bit ARM only */ #define ARMV8_PMUV3_MAX_COMMON_EVENTS 0x40 -- 2.25.1