From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 635C7C433E2 for ; Thu, 16 Jul 2020 10:45:42 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2AE0920775 for ; Thu, 16 Jul 2020 10:45:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jYl/NkjQ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="wbHHfi8M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2AE0920775 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fSa9hSJTFMpDp+20UPxrl3RRJiLk6Zc4XV7XLpPHroI=; b=jYl/NkjQh1zEPfS2DSgneX1QE cvz9HHiH/g3WkAEGuxzoO1gXs7vipOq4/Bj7VeHc48QMR1F6sGlmdOEJkjqkuKKjTKEGJEOezXUZc fL8rxOl+Hu3RdpJcvprtT22gvOEnC2T9AhTePVlesBCJJzTddeYq5Ja0X+fLdoau5l28uvfAkFoTa rjT69N9wpLDvfjj1DHeu9moEolXh+qDguvDIbSyarUOcE3z59oPMEMK8l89yWlsRiQHKx/+NXauHw LfkVbIPRHK6Rcl8M4WDlJNBPDD9uyGaSVDlUz/T1tU20VzUoY4KlTlEMnZ+ICY1hOx8GqRFzHwkYe gNZWbXwSw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw1NO-0007Rm-RA; Thu, 16 Jul 2020 10:44:30 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw1NM-0007R6-Ep for linux-arm-kernel@lists.infradead.org; Thu, 16 Jul 2020 10:44:29 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1227E2074B; Thu, 16 Jul 2020 10:44:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594896267; bh=0hj6bf/11UNfcoH3gx2faowO8OLAqFEQtxN4gfhnb3o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wbHHfi8M+sTXzKWGMJ1PMbNftI15CwTZ/8V9oUY2K+skYR3sGQYv90gA0OTqY36jQ IcK4sJzuehQlvsslQpLrNSlE3iuBdZrsGxmSuZxdpdKrt/Zhxw12YGVHqeYILEfbY9 yysFshj96lAxN4lMd2gQtIdP/LUE64sEeQolxzyc= Date: Thu, 16 Jul 2020 11:44:22 +0100 From: Will Deacon To: John Garry Subject: Re: [PATCH] drivers/perf: Fix kernel panic when rmmod PMU modules during perf sampling Message-ID: <20200716104422.GF7036@willie-the-truck> References: <1594891165-8228-1-git-send-email-liuqi115@huawei.com> <20200716094144.GC6771@willie-the-truck> <20200716103058.GE7036@willie-the-truck> <66a8eb37-b91a-d228-4ea4-8601e5518b31@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <66a8eb37-b91a-d228-4ea4-8601e5518b31@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200716_064428_585419_41CD4880 X-CRM114-Status: GOOD ( 25.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, Robin Murphy , linux-kernel@vger.kernel.org, linuxarm@huawei.com, zhangshaokun@hisilicon.com, wang.wanghaifeng@huawei.com, Qi Liu , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jul 16, 2020 at 11:36:10AM +0100, John Garry wrote: > On 16/07/2020 11:30, Will Deacon wrote: > > On Thu, Jul 16, 2020 at 11:26:25AM +0100, Robin Murphy wrote: > > > On 2020-07-16 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? > > > For the platform device itself, yes, but this is for the PMU device - perf > > > needs to take a reference to the module, otherwise the platform device can > > > still be pulled out from under its feet. > > Urgh, gross. > > > > > I can't remember if we ever discussed making perf_pmu_register() do the same > > > trick as platform_device_register() and friends, but obviously it's a > > > possibility. > > Yeah, but I suppose this patch is the right thing to do for now. I'll queue > > it as a fix. > > > > Please also note what Qi Liu wrote about being able to unbind the driver and > cause the same issue. I don't know if you can about that issue also. I guess we have to throw in some '.suppress_bind_attrs = true,' lines as well, then? I'll queue this as-is, but happy to take a follow-up if somebody can test it. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel