All of lore.kernel.org
 help / color / mirror / Atom feed
From: nleeder@codeaurora.org (Leeder, Neil)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] perf: qcom_l2_pmu: don't allow guest access
Date: Wed, 6 Dec 2017 16:19:24 -0500	[thread overview]
Message-ID: <bc650fac-702c-e554-43ca-9cd3cfed9696@codeaurora.org> (raw)
In-Reply-To: <20171206161149.ezlzzcuvxbot5tio@lakrids.cambridge.arm.com>

On 12/6/2017 11:11 AM, Mark Rutland wrote:
> On Wed, Dec 06, 2017 at 10:55:33AM -0500, Neil Leeder wrote:
>> Guests cannot access IMPDEF system registers, which are used
>> by this driver. Disable the driver if it's running in a guest VM.
>>
>> Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
>> ---
>>  drivers/perf/qcom_l2_pmu.c | 4 ++++
>>  1 file changed, 4 insertions(+)
> 
> Hi Neil,
> 
> I'm a little confused by this. Why is this hypervisor providing a
> QCOM8130 device to the guest that it cannot use?
> 
> Could you elaborate on what's going on?
> 
Hi Mark,

While there's an argument that the guest shouldn't be loading the driver
in the first place, we can't control everyone's guest configuration or what
their hypervisor does.

>>
>> diff --git a/drivers/perf/qcom_l2_pmu.c b/drivers/perf/qcom_l2_pmu.c
>> index 4fdc848..49dc954 100644
>> --- a/drivers/perf/qcom_l2_pmu.c
>> +++ b/drivers/perf/qcom_l2_pmu.c
>> @@ -1057,6 +1057,10 @@ static int __init register_l2_cache_pmu_driver(void)
>>  {
>>  	int err;
>>  
>> +	/* Don't enable driver if running as guest */
>> +	if (!is_hyp_mode_available())
>> +		return 0;
>> +
>>  	err = cpuhp_setup_state_multi(CPUHP_AP_PERF_ARM_QCOM_L2_ONLINE,
>>  				      "AP_PERF_ARM_QCOM_L2_ONLINE",
>>  				      l2cache_pmu_online_cpu,
>> -- 
>> Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies Inc.
>> Qualcomm Technologies, Inc. is a member of the Code Aurora Forum,
>> a Linux Foundation Collaborative Project.
>>

Neil
-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

WARNING: multiple messages have this Message-ID (diff)
From: "Leeder, Neil" <nleeder@codeaurora.org>
To: Mark Rutland <mark.rutland@arm.com>
Cc: nleeder@codeaurora.org, Will Deacon <will.deacon@arm.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Mark Langsdorf <mlangsdo@redhat.com>,
	Mark Salter <msalter@redhat.com>, Jon Masters <jcm@redhat.com>,
	Timur Tabi <timur@codeaurora.org>,
	Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH] perf: qcom_l2_pmu: don't allow guest access
Date: Wed, 6 Dec 2017 16:19:24 -0500	[thread overview]
Message-ID: <bc650fac-702c-e554-43ca-9cd3cfed9696@codeaurora.org> (raw)
In-Reply-To: <20171206161149.ezlzzcuvxbot5tio@lakrids.cambridge.arm.com>

On 12/6/2017 11:11 AM, Mark Rutland wrote:
> On Wed, Dec 06, 2017 at 10:55:33AM -0500, Neil Leeder wrote:
>> Guests cannot access IMPDEF system registers, which are used
>> by this driver. Disable the driver if it's running in a guest VM.
>>
>> Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
>> ---
>>  drivers/perf/qcom_l2_pmu.c | 4 ++++
>>  1 file changed, 4 insertions(+)
> 
> Hi Neil,
> 
> I'm a little confused by this. Why is this hypervisor providing a
> QCOM8130 device to the guest that it cannot use?
> 
> Could you elaborate on what's going on?
> 
Hi Mark,

While there's an argument that the guest shouldn't be loading the driver
in the first place, we can't control everyone's guest configuration or what
their hypervisor does.

>>
>> diff --git a/drivers/perf/qcom_l2_pmu.c b/drivers/perf/qcom_l2_pmu.c
>> index 4fdc848..49dc954 100644
>> --- a/drivers/perf/qcom_l2_pmu.c
>> +++ b/drivers/perf/qcom_l2_pmu.c
>> @@ -1057,6 +1057,10 @@ static int __init register_l2_cache_pmu_driver(void)
>>  {
>>  	int err;
>>  
>> +	/* Don't enable driver if running as guest */
>> +	if (!is_hyp_mode_available())
>> +		return 0;
>> +
>>  	err = cpuhp_setup_state_multi(CPUHP_AP_PERF_ARM_QCOM_L2_ONLINE,
>>  				      "AP_PERF_ARM_QCOM_L2_ONLINE",
>>  				      l2cache_pmu_online_cpu,
>> -- 
>> Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies Inc.
>> Qualcomm Technologies, Inc. is a member of the Code Aurora Forum,
>> a Linux Foundation Collaborative Project.
>>

Neil
-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

  reply	other threads:[~2017-12-06 21:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 15:55 [PATCH] perf: qcom_l2_pmu: don't allow guest access Neil Leeder
2017-12-06 15:55 ` Neil Leeder
2017-12-06 16:11 ` Mark Rutland
2017-12-06 16:11   ` Mark Rutland
2017-12-06 21:19   ` Leeder, Neil [this message]
2017-12-06 21:19     ` Leeder, Neil
2017-12-07 13:38     ` Will Deacon
2017-12-07 13:38       ` Will Deacon
2017-12-07 15:44       ` Leeder, Neil
2017-12-07 15:44         ` Leeder, Neil
2017-12-07 16:00         ` Will Deacon
2017-12-07 16:00           ` Will Deacon

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=bc650fac-702c-e554-43ca-9cd3cfed9696@codeaurora.org \
    --to=nleeder@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.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.