From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753192AbbJSNpx (ORCPT ); Mon, 19 Oct 2015 09:45:53 -0400 Received: from mga03.intel.com ([134.134.136.65]:65012 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752232AbbJSNpu (ORCPT ); Mon, 19 Oct 2015 09:45:50 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,702,1437462000"; d="scan'208";a="814373085" From: Alexander Shishkin To: Mathieu Poirier , gregkh@linuxfoundation.org, a.p.zijlstra@chello.nl, acme@kernel.org, mingo@redhat.com, corbet@lwn.net, nicolas.pitre@linaro.org Cc: adrian.hunter@intel.com, zhang.chunyan@linaro.org, mike.leach@arm.com, tor@ti.com, al.grant@arm.com, pawel.moll@arm.com, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org Subject: Re: [PATCH V2 19/30] coresight: etb10: implementing the setup_aux() API In-Reply-To: <1445192687-24112-20-git-send-email-mathieu.poirier@linaro.org> References: <1445192687-24112-1-git-send-email-mathieu.poirier@linaro.org> <1445192687-24112-20-git-send-email-mathieu.poirier@linaro.org> User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Mon, 19 Oct 2015 16:44:34 +0300 Message-ID: <87lhazgegt.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mathieu Poirier writes: > Adding an ETB10 specific auxiliary area setup operation to be > used by the perf framework when events are initialised. > > Part of this operation involves modeling the mmap'ed area based > on the specific ways a sink buffer gathers information. It really doesn't seem to be ETB10 specific at all. When you add more sinks, you'll probably end up copying this code every time. Furthermore, > +static void *etb_setup_aux(struct coresight_device *csdev, int cpu, > + void **pages, int nr_pages, bool overwrite) > +{ > + int node, pg; > + struct cs_buffers *buf; > + > + if (cpu == -1) > + cpu = smp_processor_id(); > + node = cpu_to_node(cpu); > + > + buf = kzalloc_node(offsetof(struct cs_buffers, addr[nr_pages]), > + GFP_KERNEL, node); > + if (!buf) > + return NULL; > + > + buf->snapshot = overwrite; > + buf->nr_pages = nr_pages; > + > + /* Record information about buffers */ > + for (pg = 0; pg < buf->nr_pages; pg++) > + buf->addr[pg] = pages[pg]; > + > + return buf; > +} > + this one is so generic that I'm tempted to move this into perf's ring_buffer code, because by the looks of it we'll need it pretty much in every setup_aux(). Regards, -- Alex