Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2657728imm; Thu, 16 Aug 2018 13:17:58 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzFOQD2ZRO/N1MnSBr+EpZ1OCw+IIGEKlyQsbWybVthTEfM5ufDPIkfUBsYY+BOTUWM6aid X-Received: by 2002:a17:902:b786:: with SMTP id e6-v6mr1015291pls.185.1534450678258; Thu, 16 Aug 2018 13:17:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534450678; cv=none; d=google.com; s=arc-20160816; b=eXEtggKIwUTR68cZT+pyngAtX0KenyRgE6YL1tMlxdxMEJkzPxnfwWpuVB7v12lRUe 3F6X3iwVU1yDrHMXy2hyMQwn28+Yy31aseWWstl/UqmC8lxdZXKuSMGQjQ/7CFoe47M7 CjGWG9MNKKNaFJVXuu7SwP9Kpg5y7Zmqy4kuy6UKveWNJn0MvqR6VAaDayKfbwF6pPX6 XbFWgGLj/s81b8em0MABy7JhypJHeSievQN+bQUo1n9MHtYofFSau+ft8B04TJH6PZmC hD1anen37/63w/htBtrtFZJ9du+lfXndgEFWhX5bC2uHexoJhBDHXeAwkMZfw3wGHtvz RZMQ== 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 :arc-authentication-results; bh=tCUFXd5zbnFK1Bl3qiZOec604qYngzNL2TCJv4OjVls=; b=YZL2qCSI4seXma+K0wHrj9Zr+OEvXCIF2Ap40tYH6RkcGHvHAIsPZTNreLOq79/s65 MiDd6xV02FCMe8aOY5u7ZEXsAXBa62SF4T82qEuLk0Yo2LkmzWDY4QN6XzWC+eLaQ6tb UFDsxqBmoXYi/05elFSLviQ0PSLoDqwdWtZYvgcnegnniFQP0n/mCB/Fm8UfkV7mdk+o O+3ulePUsyMaWzkV+22rEf3lgUBAPveIucfoXl1dnbCmc2xCNwK8BieZpDbprbYyKmtM fl7CBHS/Tk+yrh/8DshxJ+MVP06g5aTpHgnHU6iARl+FD77m10JgsulQiK/+Q3dki96a sl5w== 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 b10-v6si198307pgi.416.2018.08.16.13.17.41; Thu, 16 Aug 2018 13:17:58 -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 S1726269AbeHPXRF (ORCPT + 99 others); Thu, 16 Aug 2018 19:17:05 -0400 Received: from mga17.intel.com ([192.55.52.151]:43390 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726103AbeHPXRE (ORCPT ); Thu, 16 Aug 2018 19:17:04 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Aug 2018 13:16:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,248,1531810800"; d="scan'208";a="225248285" Received: from rchatre-s.jf.intel.com ([10.54.70.76]) by orsmga004.jf.intel.com with ESMTP; 16 Aug 2018 13:16:34 -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, vikas.shivappa@linux.intel.com 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 V2 3/6] x86/intel_rdt: Create required perf event attributes Date: Thu, 16 Aug 2018 13:16:06 -0700 Message-Id: <1cd63f9d4b335c7101c32b4f1755c7bb72d3aa29.1534450299.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 f46c8afe7875..ab93079e9e5b 100644 --- a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c +++ b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c @@ -917,6 +917,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