Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1014615imm; Wed, 19 Sep 2018 10:30:48 -0700 (PDT) X-Google-Smtp-Source: ANB0VdanmWK0XdUYFl7QpRLVvYD63RSMXiXJjz3KlYvNaxqYr8YldNo37UAf9K6Y5CeBfnYErYIK X-Received: by 2002:a62:464f:: with SMTP id t76-v6mr37129078pfa.118.1537378248114; Wed, 19 Sep 2018 10:30:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537378248; cv=none; d=google.com; s=arc-20160816; b=uYDMw/G2m2YFevsQa63+p9PepzbhVdbKcrPnltBHBOx7SrIahneGflg4oQ9qwFM51y dc3XvM+zvSqqwN52AhjfWVHs/VT0MjBPE/BuyK1omDFgqKQF9nMXdahrGzFrx2LkloYS cdZrftGIQFDe4hFoUz9RHMw+DFLNIma8RJFLpgtLJ6eTGLD7rgsFx5FynE8lP7lPtmaZ 6Ih0XiqnsUcFlX2m2HZbikRbPGZ6/fVcQ38vIk+9mRrBjDwXDGgRrp7EXXlB58h6Poxx x6jxWTxloLgpYslPowjwMFJEgxY69jSNWogNFWaYq8JJj0VSxlDm+M3ElUjCvDsr3ZXu 79Gw== 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=nYL+5xLj8MCbSUJ1e5wfF5Jd4r5gt6wKcvY9tlRFe5s=; b=I7IVmfCNjz6O2xjC5I672xGMZN2zzdzbHkjHM+2lEgM09vk1WMmKB9ueNNJ/+5sIXV ZAqyO806mmHbaNbhqYWftUEBK6ybSUcONAqz6j4Z/idN/CjVhDzF18u1WL2OgOkOpYmL 9mHrj81Uqrc1voCplDRxaVoibws3zAJ5nTXfKa3dHIBRhxtwq4UPZQ77CyALdtxWP2dr vBACjQP/9gyK9WGAOe8oRExSHQHkcofrqGtx9t4hhORm0uwfDXqp4acsFp+Z4gEftpq0 90jA44Hl0+s9Q1tw8iEiSNhB40p84sJ5zZiWeKE6hiSoKi2pDkWO1KsKprmdR+GLZ8f8 +SsA== 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 k7-v6si23285716pfb.309.2018.09.19.10.30.32; Wed, 19 Sep 2018 10:30:48 -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 S1733032AbeISXJA (ORCPT + 99 others); Wed, 19 Sep 2018 19:09:00 -0400 Received: from mga05.intel.com ([192.55.52.43]:33317 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733000AbeISXI7 (ORCPT ); Wed, 19 Sep 2018 19:08:59 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2018 10:30:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,394,1531810800"; d="scan'208";a="87551434" Received: from rchatre-s.jf.intel.com ([10.54.70.76]) by fmsmga002.fm.intel.com with ESMTP; 19 Sep 2018 10:30:02 -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 V5 4/6] x86/intel_rdt: Create required perf event attributes Date: Wed, 19 Sep 2018 10:29:09 -0700 Message-Id: <1822f6164e221a497648d108913d056ab675d5d0.1537377064.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 | 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; -- 2.17.0