Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp521099imm; Wed, 6 Jun 2018 01:25:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKAxFdYXYc3IWreGYmBcfXeBJ8PsTQG8Gfn49hbiHmicUFf7fGpRdHLIYThyLSfBycEPmZi X-Received: by 2002:a17:902:8a4:: with SMTP id 33-v6mr2237058pll.343.1528273534767; Wed, 06 Jun 2018 01:25:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528273534; cv=none; d=google.com; s=arc-20160816; b=fyPuU2yQ7qqQ/0lohu5rwejhO2ziPNhK5asbaRGHefGXoPdKz5t35TWGzYtpB5vAWW x+g6jSXvqP74uyHpIHTGuxREGbL/D6Q3Kl6fg5Dn2irqKGJvZCoMmtSV3bN2zpMZSnEI gNZ8XdX2A4u0Pt5ZeWcuVybodAwTBqLudTKEYf2VDX5MJiEli7AZ9Nodh6es7GdFa/mU 2+iFqudC7CrvpL4zkTZnqAFBqZGERRoHX8P2dVgWXheBlnzMDanBHH73ndOCJ1Q6BXUp a/BybkA2gtutjT/gaRfiu6E3v6hGWQwoPsbwJaOOmwYqUvW4FUGNmhjht5VoWDydAEQO S1DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=LglH400yJvyCNAmsKiwi1WlkdTVbFmjN7V1hurNmtOA=; b=wwqJfxRicXDZ1iYpSzKC72k/bJ28dfjmrbcxTN/ZrO9gwRjI4GwJwNEL4C6WYB7JdJ a5Z5QDycR6PeY4aa3LxFPnDOzfIUmgVzruKuoynsDGRiLj6liZIU7bpiELyfToW+XM/o JLknhqXANT2IjIyAq821btGPEhITtW+WwT9iaJndr8RHeITWfZVx/Sn4U+l0tBHMvkag ie5br0YIXIy9hq6JRODwSrs+5AeZUBZdotbLnqqXLNxMVhsj3RhXNw5/1YgRkdod6I+g vIojDnI20ujuB3j30JBtlnHxHgwCeGwBvyYYPqAqDTgi4dSu0yrtm2kElQN9qNpXGIxu q1Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PVEJVB1f; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16-v6si48459559pfm.151.2018.06.06.01.25.20; Wed, 06 Jun 2018 01:25:34 -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; dkim=pass header.i=@kernel.org header.s=default header.b=PVEJVB1f; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932443AbeFFIYt (ORCPT + 99 others); Wed, 6 Jun 2018 04:24:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:43898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932329AbeFFIYs (ORCPT ); Wed, 6 Jun 2018 04:24:48 -0400 Received: from localhost (unknown [37.173.63.40]) (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 92164204EE; Wed, 6 Jun 2018 08:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528273487; bh=I89xVrkwIPkM+xmNcnUQo06OOcB55psJrZXuSiDZ1Z0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PVEJVB1fM5ScYO3TEeqldC28GZAGsbPpzc7VecM3GL0Vt4JmYecFUpXFvG75W/RrD ztkqlYlawvBWM0AHKsPZtiWMjOM96OTefoQY7XgTKdFPDszLPrvK+1Obwd8WFhCCE0 v/rx+bJrvkFgQcnnMWc2ZOslVBIK+z1jQeb9tr6k= Date: Wed, 6 Jun 2018 10:24:22 +0200 From: Greg Kroah-Hartman To: Kim Phillips Cc: Mathieu Poirier , Leo Yan , Suzuki K Poulose , Alexander Shishkin , Alex Williamson , Andrew Morton , David Howells , Eric Auger , Eric Biederman , Gargi Sharma , Geert Uytterhoeven , Kefeng Wang , Kirill Tkhai , Mike Rapoport , Oleg Nesterov , Pavel Tatashin , Rik van Riel , Robin Murphy , Russell King , Thierry Reding , Todd Kjos , Randy Dunlap , linux-arm-kernel , Linux Kernel Mailing List Subject: Re: [PATCH v4 05/14] coresight: get/put module in coresight_build/release_path Message-ID: <20180606082422.GB19727@kroah.com> References: <20180605210710.22227-1-kim.phillips@arm.com> <20180605210710.22227-6-kim.phillips@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180605210710.22227-6-kim.phillips@arm.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 05, 2018 at 04:07:01PM -0500, Kim Phillips wrote: > Increment the refcnt for driver modules in current use by calling > module_get in coresight_build_path and module_put in release_path. > > This prevents driver modules from being unloaded when they are in use, > either in sysfs or perf mode. Why does it matter? Shouldn't you be allowed to remove any module at any point in time, much like a networking driver? > > Cc: Mathieu Poirier > Cc: Leo Yan > Cc: Alexander Shishkin > Cc: Randy Dunlap > Cc: Suzuki K Poulose > Cc: Greg Kroah-Hartman > Cc: Russell King > Signed-off-by: Kim Phillips > --- > drivers/hwtracing/coresight/coresight.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c > index 338f1719641c..1c941351f1d1 100644 > --- a/drivers/hwtracing/coresight/coresight.c > +++ b/drivers/hwtracing/coresight/coresight.c > @@ -465,6 +465,12 @@ static int _coresight_build_path(struct coresight_device *csdev, > > node->csdev = csdev; > list_add(&node->link, path); > + > + if (!try_module_get(csdev->dev.parent->driver->owner)) { What is to keep parent->driver from going away right here? What keeps parent around? This feels very fragile to me, I don't see any locking anywhere around this code path to try to keep things in place. thanks, greg k-h