All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org,
	"Denis V . Lunev" <den@virtuozzo.com>,
	"Jan Dakinevich" <jan.dakinevich@virtuozzo.com>,
	"Roman Kagan" <rkagan@virtuozzo.com>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Arnaldo Carvalho de Melo" <acme@kernel.org>,
	"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
	"Namhyung Kim" <namhyung@kernel.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Andi Kleen" <ak@linux.intel.com>,
	"Kan Liang" <kan.liang@intel.com>,
	"Colin King" <colin.king@canonical.com>,
	"Stephane Eranian" <eranian@google.com>,
	"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Subject: Re: [PATCH RFC 0/2] ignore LBR-related MSRs
Date: Wed, 6 Dec 2017 17:23:01 +0100	[thread overview]
Message-ID: <20171206162301.GA13877@krava> (raw)
In-Reply-To: <1512560585-27263-1-git-send-email-jan.dakinevich@virtuozzo.com>

On Wed, Dec 06, 2017 at 02:43:01PM +0300, Jan Dakinevich wrote:
> w2k16 essentials fails to boot if underlying hypervisor lacks of support for 
> LBR MSRs. To workaround the issue, it suggessted to ignore these MSRs (but not 
> all).
> 
> The information, which MSRs are supported for specific platform is taken from
> perf, it is the subject of the first patch. The second patch adds ignoring for
> these MSRs to pmu_intel code of KVM.
> 
> TODO: use MSR load/store areas to make full support of LBR debug.
> 
> Jan Dakinevich (2):
>   perf/x86/intel: make reusable LBR initialization code
>   KVM: x86/vPMU: ignore access to LBR-related MSRs
> 
>  arch/x86/events/core.c            |   8 +-
>  arch/x86/events/intel/core.c      |  59 +++------
>  arch/x86/events/intel/lbr.c       | 272 +++++++++++++++++++++++++-------------
>  arch/x86/events/perf_event.h      |  27 +---
>  arch/x86/include/asm/kvm_host.h   |   2 +
>  arch/x86/include/asm/perf_event.h |  11 ++
>  arch/x86/kvm/pmu_intel.c          |  33 +++++
>  7 files changed, 250 insertions(+), 162 deletions(-)

unrelated, but while looking on this, dont we miss task_ctx_data
allocation for child context? like in attached change

jirka


---
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 494eca1bc760..7c5de1160545 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10699,6 +10699,7 @@ const struct perf_event_attr *perf_event_attrs(struct perf_event *event)
 	      struct perf_event_context *child_ctx)
 {
 	enum perf_event_state parent_state = parent_event->state;
+	void *task_ctx_data = NULL;
 	struct perf_event *child_event;
 	unsigned long flags;
 
@@ -10719,6 +10720,19 @@ const struct perf_event_attr *perf_event_attrs(struct perf_event *event)
 	if (IS_ERR(child_event))
 		return child_event;
 
+
+	if ((child_event->attach_state & PERF_ATTACH_TASK_DATA) &&
+	    !child_ctx->task_ctx_data) {
+		struct pmu *pmu = child_event->pmu;
+
+		task_ctx_data = kzalloc(pmu->task_ctx_size, GFP_KERNEL);
+		if (!task_ctx_data) {
+			free_event(child_event);
+			return NULL;
+		}
+		child_ctx->task_ctx_data = task_ctx_data;
+	}
+
 	/*
 	 * is_orphaned_event() and list_add_tail(&parent_event->child_list)
 	 * must be under the same lock in order to serialize against
@@ -10729,6 +10743,7 @@ const struct perf_event_attr *perf_event_attrs(struct perf_event *event)
 	if (is_orphaned_event(parent_event) ||
 	    !atomic_long_inc_not_zero(&parent_event->refcount)) {
 		mutex_unlock(&parent_event->child_mutex);
+		/* task_ctx_data is freed with child_ctx */
 		free_event(child_event);
 		return NULL;
 	}

WARNING: multiple messages have this Message-ID (diff)
From: Jiri Olsa <jolsa@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org,
	"Denis V . Lunev" <den@virtuozzo.com>,
	"Jan Dakinevich" <jan.dakinevich@virtuozzo.com>,
	"Roman Kagan" <rkagan@virtuozzo.com>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Arnaldo Carvalho de Melo" <acme@kernel.org>,
	"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
	"Namhyung Kim" <namhyung@kernel.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Andi Kleen" <ak@linux.intel.com>,
	"Kan Liang" <kan.liang@intel.com>,
	"Colin King" <colin.king@canonical.com>,
	"Stephane Eranian" <eranian@google.com>,
	"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jin Yao" <yao.jin@linux.intel.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH RFC 0/2] ignore LBR-related MSRs
Date: Wed, 6 Dec 2017 17:23:01 +0100	[thread overview]
Message-ID: <20171206162301.GA13877@krava> (raw)
In-Reply-To: <1512560585-27263-1-git-send-email-jan.dakinevich@virtuozzo.com>

On Wed, Dec 06, 2017 at 02:43:01PM +0300, Jan Dakinevich wrote:
> w2k16 essentials fails to boot if underlying hypervisor lacks of support for 
> LBR MSRs. To workaround the issue, it suggessted to ignore these MSRs (but not 
> all).
> 
> The information, which MSRs are supported for specific platform is taken from
> perf, it is the subject of the first patch. The second patch adds ignoring for
> these MSRs to pmu_intel code of KVM.
> 
> TODO: use MSR load/store areas to make full support of LBR debug.
> 
> Jan Dakinevich (2):
>   perf/x86/intel: make reusable LBR initialization code
>   KVM: x86/vPMU: ignore access to LBR-related MSRs
> 
>  arch/x86/events/core.c            |   8 +-
>  arch/x86/events/intel/core.c      |  59 +++------
>  arch/x86/events/intel/lbr.c       | 272 +++++++++++++++++++++++++-------------
>  arch/x86/events/perf_event.h      |  27 +---
>  arch/x86/include/asm/kvm_host.h   |   2 +
>  arch/x86/include/asm/perf_event.h |  11 ++
>  arch/x86/kvm/pmu_intel.c          |  33 +++++
>  7 files changed, 250 insertions(+), 162 deletions(-)

unrelated, but while looking on this, dont we miss task_ctx_data
allocation for child context? like in attached change

jirka


---
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 494eca1bc760..7c5de1160545 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10699,6 +10699,7 @@ const struct perf_event_attr *perf_event_attrs(struct perf_event *event)
 	      struct perf_event_context *child_ctx)
 {
 	enum perf_event_state parent_state = parent_event->state;
+	void *task_ctx_data = NULL;
 	struct perf_event *child_event;
 	unsigned long flags;
 
@@ -10719,6 +10720,19 @@ const struct perf_event_attr *perf_event_attrs(struct perf_event *event)
 	if (IS_ERR(child_event))
 		return child_event;
 
+
+	if ((child_event->attach_state & PERF_ATTACH_TASK_DATA) &&
+	    !child_ctx->task_ctx_data) {
+		struct pmu *pmu = child_event->pmu;
+
+		task_ctx_data = kzalloc(pmu->task_ctx_size, GFP_KERNEL);
+		if (!task_ctx_data) {
+			free_event(child_event);
+			return NULL;
+		}
+		child_ctx->task_ctx_data = task_ctx_data;
+	}
+
 	/*
 	 * is_orphaned_event() and list_add_tail(&parent_event->child_list)
 	 * must be under the same lock in order to serialize against
@@ -10729,6 +10743,7 @@ const struct perf_event_attr *perf_event_attrs(struct perf_event *event)
 	if (is_orphaned_event(parent_event) ||
 	    !atomic_long_inc_not_zero(&parent_event->refcount)) {
 		mutex_unlock(&parent_event->child_mutex);
+		/* task_ctx_data is freed with child_ctx */
 		free_event(child_event);
 		return NULL;
 	}

  parent reply	other threads:[~2017-12-06 16:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 11:43 [PATCH RFC 0/2] ignore LBR-related MSRs Jan Dakinevich
2017-12-06 11:43 ` Jan Dakinevich
2017-12-06 11:43 ` [PATCH RFC 1/2] perf/x86/intel: make reusable LBR initialization code Jan Dakinevich
2017-12-06 11:43   ` Jan Dakinevich
2017-12-06 12:51   ` Peter Zijlstra
2017-12-06 12:51     ` Peter Zijlstra
2017-12-06 11:43 ` [PATCH RFC 2/2] KVM: x86/vPMU: ignore access to LBR-related MSRs Jan Dakinevich
2017-12-06 11:43   ` Jan Dakinevich
2017-12-06 12:52   ` Peter Zijlstra
2017-12-06 15:57   ` Andi Kleen
2017-12-06 17:02     ` Jan Dakinevich
2017-12-06 17:55       ` Andi Kleen
2017-12-06 15:06 ` [PATCH RFC 0/2] ignore " Konrad Rzeszutek Wilk
2017-12-06 15:06   ` Konrad Rzeszutek Wilk
2017-12-06 16:39   ` Jan Dakinevich
2017-12-06 16:39     ` Jan Dakinevich
2017-12-06 16:45     ` Denis V. Lunev
2017-12-06 16:45       ` Denis V. Lunev
2017-12-06 16:23 ` Jiri Olsa [this message]
2017-12-06 16:23   ` Jiri Olsa
2017-12-20 16:26 ` Jan Dakinevich
2017-12-20 16:26   ` Jan Dakinevich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171206162301.GA13877@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=colin.king@canonical.com \
    --cc=den@virtuozzo.com \
    --cc=eranian@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=jan.dakinevich@virtuozzo.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rkagan@virtuozzo.com \
    --cc=rkrcmar@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.