mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: Will Deacon <will@kernel.org>, Qi Liu <liuqi115@huawei.com>
Cc: <zhangshaokun@hisilicon.com>, <mark.rutland@arm.com>,
	<wang.wanghaifeng@huawei.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linuxarm@huawei.com>
Subject: Re: [PATCH] drivers/perf: Fix kernel panic when rmmod PMU modules during perf sampling
Date: Thu, 16 Jul 2020 11:21:25 +0100	[thread overview]
Message-ID: <07cd8e16-6967-410a-4006-6c82b0263397@huawei.com> (raw)
In-Reply-To: <20200716094144.GC6771@willie-the-truck>

On 16/07/2020 10:41, Will Deacon wrote:
> On Thu, Jul 16, 2020 at 05:19:25PM +0800, Qi Liu wrote:
>> Kernel panic will also happen when users try to unbind PMU drivers with
>> device. This unbind issue could be solved by another patch latter.
>>
>>   drivers/perf/arm_smmuv3_pmu.c                 | 1 +
>>   drivers/perf/fsl_imx8_ddr_perf.c              | 1 +
>>   drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | 1 +
>>   drivers/perf/hisilicon/hisi_uncore_hha_pmu.c  | 1 +
>>   drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c  | 1 +
>>   5 files changed, 5 insertions(+)
>>
>> diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
>> index 48e28ef..90caba56 100644
>> --- a/drivers/perf/arm_smmuv3_pmu.c
>> +++ b/drivers/perf/arm_smmuv3_pmu.c
>> @@ -742,6 +742,7 @@ static int smmu_pmu_probe(struct platform_device *pdev)
>>   	platform_set_drvdata(pdev, smmu_pmu);
>>
>>   	smmu_pmu->pmu = (struct pmu) {
>> +		.module		= THIS_MODULE,
> 
> I thought platform_driver_register() did this automatically?
> 

Isn't that something different? The perf framework knows nothing of the 
platform_device/driver really, and just knows the event_source device 
which it creates. And so we also need to tell the perf framework about 
the module backing this pmu.

I think some relevant code is perf_try_init_event() -> 
try_module_get(pmu->module).

Thanks,
John


  reply	other threads:[~2020-07-16 10:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16  9:19 Qi Liu
2020-07-16  9:41 ` Will Deacon
2020-07-16 10:21   ` John Garry [this message]
2020-07-16 10:26   ` Robin Murphy
2020-07-16 10:30     ` Will Deacon
2020-07-16 10:36       ` John Garry
2020-07-16 10:44         ` Will Deacon
2020-07-16 11:09           ` John Garry
2020-07-16 12: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=07cd8e16-6967-410a-4006-6c82b0263397@huawei.com \
    --to=john.garry@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=liuqi115@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=wang.wanghaifeng@huawei.com \
    --cc=will@kernel.org \
    --cc=zhangshaokun@hisilicon.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®