Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3759312ybg; Mon, 28 Oct 2019 18:56:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBI4fdVL/GtGbFS1tofLAuvv3KkBx6PdGvWPb3I0iwUS6rNpJe8rYtgeg73A0q3jyDK1dN X-Received: by 2002:a17:906:48c5:: with SMTP id d5mr861919ejt.167.1572314180429; Mon, 28 Oct 2019 18:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572314180; cv=none; d=google.com; s=arc-20160816; b=Ag/fBg805RdkqT0OH+qWKtcXiOpE6t2589z6xEj6nyulQzYegiRyefGO92zHehMIKw qQJLh91sUVoAv9SXkUBJ0G0iJ82BVrC/wlRBsn6ZoWF53CyM+dHUy6qS8nfMPtTDhla/ uuN0ghZGSnHNfEjLWc5s+vhLmbg1oImnnaWe5+lcpNxXWLaeSzM4MApl/XwC7ZEz8SaV r5unU/m9TEBnsDK6KDZtKPhglHrosQWLvETaa9gfJfRwP4Dl7HWyNrnXk6oLfjiNw4+m CBmkUMimGqw9/lZu4qo5Lapk9+SVOWU8nrruTVDxxihCU0+tIcV8yWDIr82o7uZ5wc9v aPZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=vWS0ueZIFlOL8lXJJuM3uneAExpwxf8FlTitO5q6epM=; b=Eucaw4sbWDG6HNV2WtGRC9LSHretslyNeRWJ7oLbZ2vIX65d9MwoH+zOxOuGlzcyOz jnL+UD6lRmiq2BBfipoXnVmKIU/Taa6gb2gNSK02WRHpq8o1hv6pp15rDSKBNZthBWr+ gqn5+v6oCdUPdeZ7YwdDE/t95A34CMajfUB6wi/gqSv7+bg7GlXHdfVQLF07bYBVlzWS cY25aeyfbki8vOPvfhcMxfu/O4MzPe7lcsrEPiyc5fMFsYZ9bHjkP+IHNClDU3pOMknj 3M0k9Ei4WgbwvGBU7pYJgpnd5CNveeE7yusLXvU3OZiGnUU4UM5lqX7mX3/y2MNnxVik 5oew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pw18si4598377ejb.252.2019.10.28.18.55.57; Mon, 28 Oct 2019 18:56:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389492AbfJ1Mng (ORCPT + 99 others); Mon, 28 Oct 2019 08:43:36 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:44674 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389395AbfJ1Mnc (ORCPT ); Mon, 28 Oct 2019 08:43:32 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iP4Mi-0002Nj-M4; Mon, 28 Oct 2019 13:43:20 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 593761C0482; Mon, 28 Oct 2019 13:43:20 +0100 (CET) Date: Mon, 28 Oct 2019 12:43:20 -0000 From: "tip-bot2 for Alexey Budankov" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/core, perf/x86: Introduce swap_task_ctx() method at 'struct pmu' Cc: Alexey Budankov , "Peter Zijlstra (Intel)" , Alexander Shishkin , Arnaldo Carvalho de Melo , Arnaldo Carvalho de Melo , Ian Rogers , Jiri Olsa , Kan Liang , Linus Torvalds , Mark Rutland , Namhyung Kim , Song Liu , Stephane Eranian , Thomas Gleixner , Vince Weaver , Ingo Molnar , Borislav Petkov , linux-kernel@vger.kernel.org In-Reply-To: <9a0aa84a-f062-9b64-3133-373658550c4b@linux.intel.com> References: <9a0aa84a-f062-9b64-3133-373658550c4b@linux.intel.com> MIME-Version: 1.0 Message-ID: <157226660008.29376.17028800323168322771.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: fc1adfe306b71e094df636012f8c0fed971cad45 Gitweb: https://git.kernel.org/tip/fc1adfe306b71e094df636012f8c0fed971cad45 Author: Alexey Budankov AuthorDate: Wed, 23 Oct 2019 10:11:04 +03:00 Committer: Ingo Molnar CommitterDate: Mon, 28 Oct 2019 12:50:59 +01:00 perf/core, perf/x86: Introduce swap_task_ctx() method at 'struct pmu' Declare swap_task_ctx() methods at the generic and x86 specific pmu types to bridge calls to platform specific PMU code on optimized context switch path between equivalent task perf event contexts. Signed-off-by: Alexey Budankov Signed-off-by: Peter Zijlstra (Intel) Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Arnaldo Carvalho de Melo Cc: Ian Rogers Cc: Jiri Olsa Cc: Kan Liang Cc: Linus Torvalds Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Song Liu Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Link: https://lkml.kernel.org/r/9a0aa84a-f062-9b64-3133-373658550c4b@linux.intel.com Signed-off-by: Ingo Molnar --- arch/x86/events/perf_event.h | 8 ++++++++ include/linux/perf_event.h | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index ecacfbf..5384317 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -683,6 +683,14 @@ struct x86_pmu { atomic_t lbr_exclusive[x86_lbr_exclusive_max]; /* + * perf task context (i.e. struct perf_event_context::task_ctx_data) + * switch helper to bridge calls from perf/core to perf/x86. + * See struct pmu::swap_task_ctx() usage for examples; + */ + void (*swap_task_ctx)(struct perf_event_context *prev, + struct perf_event_context *next); + + /* * AMD bits */ unsigned int amd_nb_constraints : 1; diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 4f77b22..011dcbd 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -410,6 +410,15 @@ struct pmu { */ size_t task_ctx_size; + /* + * PMU specific parts of task perf event context (i.e. ctx->task_ctx_data) + * can be synchronized using this function. See Intel LBR callstack support + * implementation and Perf core context switch handling callbacks for usage + * examples. + */ + void (*swap_task_ctx) (struct perf_event_context *prev, + struct perf_event_context *next); + /* optional */ /* * Set up pmu-private data structures for an AUX area