Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4333917imm; Tue, 11 Sep 2018 10:15:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbhSfTqsd2fKs8BJcAvHITzgcPX/VxKwIZmCDVD7eWmijJrKsN3wzn1obystTz5ym3mRxhD X-Received: by 2002:a63:fa0c:: with SMTP id y12-v6mr29812997pgh.177.1536686150430; Tue, 11 Sep 2018 10:15:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536686150; cv=none; d=google.com; s=arc-20160816; b=OX5TAmxEqF7XgpspWULGpEQh8WkF9nEbHI9+3ov15bhIx4zWH60baXEndqxRqq2f7X Mx7HF+rl6ub//l/ogImhETiP/farCnXZ9Kak47eZ7DH6ZM6FcoAD7WLR6PckVzeSCsRP ihDC2q5RxEp8NKOnJYzhTFjVH+lx/rs0PuQ8jlykCE/PnkR4BAfULo2HT2D3/Atn0Gt2 wifTPtrB1feBWhNIH6sNwDYQMc/winT9g2UCHl2pYcAK1ARddkuTEN+sJkfjSA0V+4SF JjXDKm7frME2+wPM9XGdEkIjuTTYhwLyayRaKO/GRCy2BF4effTwxh/fmgRuuCYusI59 i2TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from; bh=mo4bfu5UKhjDoSifZTLmqAv8qlSE0FLrjf8MttQca2E=; b=tnCj+3tRzINJxtMX8ZUKYra82UdvsEPL5mxEbWbS5AqohA8oLAueckti6yICwyoH1i FK5oJiWNXoUAp/mwaXS8v5bIAiy19XU/pI2v2GUD/fzFKgl8LL6Ajw+KUFn9uOIH2QE1 upu6CKvijpOnpN5P/oUHg5NsOcOL+gOPZ8gtSuF8ChARDf9ff6bQooBCMHWsYCkad94P LUNb4KRWfhtXBn9W3HAnxIMRHXWuBuQWG2dKmNEP0DiGL+aC0HehHrS6xPUKOXQsCG7l 990ka8yxTJrMkOb2Mv2SXvZq79zL6mtJdcPUXdPc+3ca68oanR14/l359/6bvQSJHjy6 ImXA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u37-v6si1268150pgl.78.2018.09.11.10.15.35; Tue, 11 Sep 2018 10:15:50 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728324AbeIKWPQ (ORCPT + 99 others); Tue, 11 Sep 2018 18:15:16 -0400 Received: from mga02.intel.com ([134.134.136.20]:31116 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728235AbeIKWPP (ORCPT ); Tue, 11 Sep 2018 18:15:15 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Sep 2018 10:14:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,361,1531810800"; d="scan'208";a="79642214" Received: from rchatre-s.jf.intel.com ([10.54.70.76]) by FMSMGA003.fm.intel.com with ESMTP; 11 Sep 2018 10:14:58 -0700 From: Reinette Chatre To: tglx@linutronix.de, fenghua.yu@intel.com, tony.luck@intel.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org Cc: gavin.hindman@intel.com, jithu.joseph@intel.com, dave.hansen@intel.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, Reinette Chatre Subject: [PATCH V3 4/6] x86/intel_rdt: Create required perf event attributes Date: Tue, 11 Sep 2018 10:14:35 -0700 Message-Id: <060c5fa0a1f227e6119841b3b617c3f0cc9d5da1.1536685533.git.reinette.chatre@intel.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c | 25 +++++++++++++++++++++ 1 file changed, 25 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..2191623f1f27 100644 --- a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c +++ b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c @@ -915,6 +915,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; -- 2.17.0