Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2952996imm; Thu, 24 May 2018 19:47:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZonC37whs6TLGTfWrMb5MRDsMWydlBrTuAu4soqb0WWDDovUP03Km6yLldRlGPs8XAz/LK5 X-Received: by 2002:a17:902:43a4:: with SMTP id j33-v6mr659665pld.118.1527216453893; Thu, 24 May 2018 19:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527216453; cv=none; d=google.com; s=arc-20160816; b=R46L+INjVGSEy9wgIOmvGrY6/HKVUiitnDhsSitTVCHxUzMZQ2V2psJ8Y7riERsHd/ FnhGo/wIj/o6zPVvk7pKFvOyqQaLgpeFNUERJT7SI8q39BRo6uLA9ckgvddoDVpWpYQp a9Xn7NP7+7W5UqVTwxeazALRTIKLLe3qtxcEE0RPcCMycewd4S5UJyAG7q67eKXZOry1 +dd4WI9VsAqAf5dlPeU7EpKjTvJtmhqlGUtFW324hNAaoZwE/32GImlgFxBh/8Lb3JMf pJbsCWlwKaEdIT7eD35x+LScC0dUA7wnE60NN6QOOm4scAFH2W03yMRKIyqiWONblt4i aC9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=MypO6T8qTZwVlHn7iZFdTbmR6AaydLcb/vDL90CAoR0=; b=EMLa/oz720YwF/CTsoDJRF/cpk0huCKggDYK4iQgkdafpKoNUl+R/oejw6TkJv8G6e bN5GzjJ2UaRW8WlKg/FkaH0TxOpx84gPHDRyXMaPGusxJZgjsg49Nf+fmJ2JnaYYjVbw aoSTP1n3e5yYQi4RdPhm877/TWL7yyMoOSt8Cbt8ZUsPUPyDwQiXYIGFQ3At038hzmmz yfS9a/jDrgF82Bsh72CR7+sU5fgxye2F6Su1Hft5plYK5psYFdD6CsaaR1aUSi8/YlsE rcZ7EdIyckXOd8qaE501ByakMuBkqRrvGkZwZOp+S7x5ca3kbGWqtQTZTKviu0GNDnET F6LA== ARC-Authentication-Results: i=1; mx.google.com; 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 l3-v6si22269710pld.96.2018.05.24.19.47.19; Thu, 24 May 2018 19:47:33 -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; 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 S969397AbeEXXtL (ORCPT + 99 others); Thu, 24 May 2018 19:49:11 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52246 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964788AbeEXXtK (ORCPT ); Thu, 24 May 2018 19:49:10 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 70F6E1529; Thu, 24 May 2018 16:49:10 -0700 (PDT) Received: from dupont (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3C8FB3F25D; Thu, 24 May 2018 16:49:09 -0700 (PDT) Date: Thu, 24 May 2018 18:49:08 -0500 From: Kim Phillips To: Mathieu Poirier Cc: Greg Kroah-Hartman , 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@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/6] coresight: allow to build as modules Message-Id: <20180524184908.3648cf67456510261a1afe16@arm.com> In-Reply-To: <20180522213906.GC25658@xps15> References: <20180517070643.GC13919@kroah.com> <20180518012024.22645-1-kim.phillips@arm.com> <20180518012024.22645-6-kim.phillips@arm.com> <20180522213906.GC25658@xps15> Organization: Arm X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 22 May 2018 15:39:06 -0600 Mathieu Poirier wrote: > On Thu, May 17, 2018 at 08:20:24PM -0500, Kim Phillips wrote: > > Allow to build coresight as modules. This greatly enhances developer > > efficiency by allowing the development to take place exclusively on the > > target, and without needing to reboot in between changes. > > > > - Kconfig bools become tristates, to allow =m > > > > - use -objs to denote merge object directives in Makefile, adds a > > coresight-core nomenclature for the base module. > > > > - Export core functions so as to be able to be used by > > non-core modules. > > > > - add a coresight_exit() that unregisters the coresight bus, add > > remove fns for most others. > > > > - fix up modules with ID tables for autoloading on boot > > > > Cc: Mathieu Poirier > > Cc: Alexander Shishkin > > Cc: Randy Dunlap > > Signed-off-by: Kim Phillips > > --- > > drivers/hwtracing/coresight/Kconfig | 48 +++++++++++++++---- > > drivers/hwtracing/coresight/Makefile | 28 +++++++---- > > .../hwtracing/coresight/coresight-cpu-debug.c | 2 + > > .../coresight/coresight-dynamic-replicator.c | 26 ++++++++-- > > drivers/hwtracing/coresight/coresight-etb10.c | 27 +++++++++-- > > .../hwtracing/coresight/coresight-etm-perf.c | 9 +++- > > .../coresight/coresight-etm3x-sysfs.c | 1 + > > drivers/hwtracing/coresight/coresight-etm3x.c | 32 +++++++++++-- > > .../coresight/coresight-etm4x-sysfs.c | 1 + > > drivers/hwtracing/coresight/coresight-etm4x.c | 33 +++++++++++-- > > .../hwtracing/coresight/coresight-funnel.c | 26 ++++++++-- > > drivers/hwtracing/coresight/coresight-priv.h | 1 - > > .../coresight/coresight-replicator.c | 28 +++++++++-- > > drivers/hwtracing/coresight/coresight-stm.c | 23 ++++++++- > > drivers/hwtracing/coresight/coresight-tmc.c | 18 ++++++- > > drivers/hwtracing/coresight/coresight-tpiu.c | 26 ++++++++-- > > drivers/hwtracing/coresight/coresight.c | 14 ++++++ > > 17 files changed, 299 insertions(+), 44 deletions(-) > > For the next revision please split the work based on files. If I read that literally, one file-by-one would break build bisectability. Do you mean split by source files depending on the logical modules they belong to, e.g., etm3x, etm4x, etb10, etc.? If so, I think it would look like the coresight-core would be first, followed by the rest, but I also think there are cross-dependencies. Hmm, OK, I'll have a look, but there's also one more thing: I think the Makefile obj '-core' nomenclature was to change the name of the module to not be the same as the core source file, so what do you think about renaming the core source file instead of the module name? e.g.: Instead of this: obj-$(CONFIG_CORESIGHT) += coresight-core.o coresight-core-objs := coresight.o \ of_coresight.o we have this: obj-$(CONFIG_CORESIGHT) += coresight.o coresight-objs := coresight-core.o \ of_coresight.o and e.g., instead of this: obj-$(CONFIG_CORESIGHT_SOURCE_ETM3X) += coresight-etm3x-core.o coresight-etm3x-core-objs := coresight-etm3x.o \ coresight-etm-cp14.o \ coresight-etm3x-sysfs.o we have this: obj-$(CONFIG_CORESIGHT_SOURCE_ETM3X) += coresight-etm3x.o coresight-etm3x-objs := coresight-etm3x-core.o \ coresight-etm-cp14.o \ coresight-etm3x-sysfs.o ? > > +static int __exit tmc_remove(struct amba_device *adev) > > +{ > > + struct tmc_drvdata *drvdata = dev_get_drvdata(&adev->dev); > > + > > + /* free ETB/ETF or ETR memory */ > > + tmc_read_unprepare(drvdata); > > + > > + misc_deregister(&drvdata->miscdev); > > + coresight_unregister(drvdata->csdev); > > + > > + return 0; > > +} > > + > > Right now I can remove the module for a TMC link or sink when part of an active > session, something I pointed out during an earlier revision. Right, I missed that :( So would the first thing tmc_remove does is this: if (drvdata->reading) return -EBUSY; work, or would we need to introduce a new sentinel? > I also think we need to deal with driver removal cases when the TMC buffer > (ETR or ETF) is being read from sysFS. OK, I thought the: struct file_operations tmc_fops = { .owner = THIS_MODULE, would prevent module unload whilst sysfs access was being performed, but I'll double check. Thanks, Kim