From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751270AbbJBEub (ORCPT ); Fri, 2 Oct 2015 00:50:31 -0400 Received: from mga01.intel.com ([192.55.52.88]:58944 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750709AbbJBEu3 (ORCPT ); Fri, 2 Oct 2015 00:50:29 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,621,1437462000"; d="scan'208";a="817659278" From: Alexander Shishkin To: Mathieu Poirier Cc: Greg KH , a.p.zijlstra@chello.nl, Arnaldo Carvalho de Melo , Ingo Molnar , Jon Corbet , Adrian Hunter , Chunyan Zhang , Mike Leach , Tor Jeremiassen , Al Grant , =?utf-8?Q?Pawe?= =?utf-8?Q?=C5=82?= Moll , "linux-arm-kernel\@lists.infradead.org" , linux-doc@vger.kernel.org, "linux-kernel\@vger.kernel.org" Subject: Re: [RFC PATCH 15/20] coresight: etm-perf: implementing 'setup_aux()' API In-Reply-To: References: <1442593594-10665-1-git-send-email-mathieu.poirier@linaro.org> <1442593594-10665-16-git-send-email-mathieu.poirier@linaro.org> <87bnckjfce.fsf@ashishki-desk.ger.corp.intel.com> User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Fri, 02 Oct 2015 07:50:25 +0300 Message-ID: <87si5t3mcu.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: > On 30 September 2015 at 05:50, Alexander Shishkin > wrote: >> Mathieu Poirier writes: >> >>> +static void *etm_setup_aux(int cpu, void **pages, >>> + int nr_pages, bool overwrite) >>> +{ >>> + struct coresight_device *csdev; >>> + >>> + if (cpu == -1) >>> + cpu = smp_processor_id(); >>> + >>> + csdev = per_cpu(csdev_sink, cpu); >>> + if (!csdev) >>> + return NULL; >>> + >>> + return sink_ops(csdev)->setup_aux(csdev, cpu, pages, >>> + nr_pages, overwrite); >> >> Is it guaranteed that this sink would always have .setup_aux()? > > A setup_aux() is vital to the design, both on Intel and ARM. I really > don't see how one could go without it. I can return NULL if it hasn't > been provided - that way the setup will fail without triggering a core > dump. It wasn't clear to me that the sink that ends up in csdev_sink will always be the one that does have .setup_aux(). And if it indeed doesn't, it's better to refuse to setup a buffer than crash. Regards, -- Alex