Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1613990imm; Sat, 29 Sep 2018 00:04:31 -0700 (PDT) X-Google-Smtp-Source: ACcGV63YqnRwnu4W5Wmj449mgdBaWS/+eFHpqGealkAYqY0jNMlvsLT83PRzTXaQVS2HzXJcQGS8 X-Received: by 2002:a63:de05:: with SMTP id f5-v6mr1778991pgg.292.1538204671685; Sat, 29 Sep 2018 00:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538204671; cv=none; d=google.com; s=arc-20160816; b=vlEb6V+nBRCDkd3Bu4rY+xdMPilfRXm/uLzMTG3Oq3nCcLVH31KKqc39g1IX8tsbHi MvWjjFryKP7XwBRzO499YzrvA2cVkWauoTVnNdrrXi1JGKcdBEycdHbN7bmIDyP+iDD+ kmdV9c6ODWxXlScSSI7Ogo7g+oN1VqUPcjc0SU7I3c2iayBGt4ytoAgr5jBKckDsICSI QTq4QbPwpAVYK3Yw9JC0PpPJ+zlBN8ILW8g5Inm8x3VZGGyZrNQYujsZOcdJygIzqaH+ 82JiQImtAaq3PqoK99RpZF4X/IS1D4PSlpkx0I0NhiJx5qCG8Lb5jKwEoanpDg8tC6fZ p4Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=XcBFSdDE1F080jpB/F8tKDsAXr+QgFCw4vPWtnhGozE=; b=AljS5YOnw277XX7rhDCVKipdigUf9lsV9Wua5bhRc1w5puFY+njZN/GfHiv9ZCAgno ll69xV/CiV5i0RjpF57qxwcHrbdw24fr44K8YJdkllZwQ2zQCq6jBhypBpvatEpbB8ev 58mfUYabSN8lUvNxQqQhVlArX2o4V/mfqakbsrfbcS5Bbieil/sckFjwQcjix3heepxV PxcwFU4xD5g29SXoEtrCTfD42/s0UswhQNz7VpFAc5OVFcp6NYJSgfiNmX4msM7+OcCC bTPrwhrqpj9XRmB3vN5hUKcmW2m367DE1fXCuH/F8J43kD8GcMxSGFK93znqr65R20RI kN8Q== 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 i21-v6si6572797pgj.51.2018.09.29.00.03.47; Sat, 29 Sep 2018 00:04:31 -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 S1727661AbeI2N3b (ORCPT + 99 others); Sat, 29 Sep 2018 09:29:31 -0400 Received: from terminus.zytor.com ([198.137.202.136]:54259 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727393AbeI2N3b (ORCPT ); Sat, 29 Sep 2018 09:29:31 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w8T71uX5726385 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 29 Sep 2018 00:01:56 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w8T71uwR726382; Sat, 29 Sep 2018 00:01:56 -0700 Date: Sat, 29 Sep 2018 00:01:56 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Reinette Chatre Message-ID: Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, reinette.chatre@intel.com, peterz@infradead.org, hpa@zytor.com, mingo@kernel.org Reply-To: peterz@infradead.org, reinette.chatre@intel.com, tglx@linutronix.de, hpa@zytor.com, mingo@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <1822f6164e221a497648d108913d056ab675d5d0.1537377064.git.reinette.chatre@intel.com> References: <1822f6164e221a497648d108913d056ab675d5d0.1537377064.git.reinette.chatre@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/cache] x86/intel_rdt: Create required perf event attributes Git-Commit-ID: 0a701c9dd5351cbaef1677a0c8d37950e158cd55 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=0.3 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_12_24 autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 0a701c9dd5351cbaef1677a0c8d37950e158cd55 Gitweb: https://git.kernel.org/tip/0a701c9dd5351cbaef1677a0c8d37950e158cd55 Author: Reinette Chatre AuthorDate: Wed, 19 Sep 2018 10:29:09 -0700 Committer: Thomas Gleixner CommitDate: Fri, 28 Sep 2018 22:48:27 +0200 x86/intel_rdt: Create required perf event attributes A perf event has many attributes that are maintained in a separate structure that should be provided when a new perf_event is created. In preparation for the transition to perf_events the required attribute structures are created for all the events that may be used in the measurements. Most attributes for all the events are identical. The actual configuration, what specifies what needs to be measured, is what will be different between the events used. This configuration needs to be done with X86_CONFIG that cannot be used as part of the designated initializers used here, this will be introduced later. Although they do look identical at this time the attribute structures needs to be maintained separately since a perf_event will maintain a pointer to its unique attributes. In support of patch testing the new structs are given the unused attribute until their use in later patches. Signed-off-by: Reinette Chatre Signed-off-by: Thomas Gleixner Acked-by: Peter Zijlstra (Intel) Cc: fenghua.yu@intel.com Cc: tony.luck@intel.com Cc: acme@kernel.org Cc: gavin.hindman@intel.com Cc: jithu.joseph@intel.com Cc: dave.hansen@intel.com Cc: hpa@zytor.com Link: https://lkml.kernel.org/r/1822f6164e221a497648d108913d056ab675d5d0.1537377064.git.reinette.chatre@intel.com --- arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c index 8ad83eb3fc89..33d7968f152a 100644 --- a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c +++ b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -915,6 +916,31 @@ static int measure_cycles_lat_fn(void *_plr) return 0; } +/* + * Create a perf_event_attr for the hit and miss perf events that will + * be used during the performance measurement. A perf_event maintains + * a pointer to its perf_event_attr so a unique attribute structure is + * created for each perf_event. + * + * The actual configuration of the event is set right before use in order + * to use the X86_CONFIG macro. + */ +static struct perf_event_attr __attribute__((unused)) perf_miss_attr = { + .type = PERF_TYPE_RAW, + .size = sizeof(struct perf_event_attr), + .pinned = 1, + .disabled = 0, + .exclude_user = 1, +}; + +static struct perf_event_attr __attribute__((unused)) perf_hit_attr = { + .type = PERF_TYPE_RAW, + .size = sizeof(struct perf_event_attr), + .pinned = 1, + .disabled = 0, + .exclude_user = 1, +}; + static int measure_cycles_perf_fn(void *_plr) { unsigned long long l3_hits = 0, l3_miss = 0;