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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 B93EFC433ED for ; Wed, 12 May 2021 19:36:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 852A561289 for ; Wed, 12 May 2021 19:36:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381059AbhELTdR (ORCPT ); Wed, 12 May 2021 15:33:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347610AbhELR3C (ORCPT ); Wed, 12 May 2021 13:29:02 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 983B8C061760 for ; Wed, 12 May 2021 10:27:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=n2kSoXVjaG6r/aRDrddKurJtkE5bpmO12SFICV7/2rE=; b=ZCckaik/4Prk5oi4ppy8WJzuW4 nMhmnAJ6FhRh+cGcStqFfzAxzUYoLKu7uWpd6N0+p+m6Ol9szTYKuoPRhBS3HHp4wbb2n45QYWavW NrBKSL15dNcdwdd8tEaK1m/BAa94fJ71hw4hCVLBIK6yxSUCqcII+5YPaGKv2YFN92QLBdgN6PbrN Y7m4ECNGxX2KjnGxg2eLznHogcNf5Vou9OW54nIPIoKVIMUr90N0Vda8SFRUB+sUtHvmcRfhYyPD1 onFNWEGt73nEjCm0n4w8+HSa7kAE+YnicCAtpcoWNn37s+VRqe5qfB03G/J76CmNYIltOLAIHKwCd vCEBpQ3w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lgsdm-003RZC-JK; Wed, 12 May 2021 17:27:24 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 8F7313001E1; Wed, 12 May 2021 19:27:16 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4BBF020B6C70F; Wed, 12 May 2021 19:27:16 +0200 (CEST) Date: Wed, 12 May 2021 19:27:16 +0200 From: Peter Zijlstra To: Kajol Jain Cc: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, maddy@linux.vnet.ibm.com, santosh@fossix.org, aneesh.kumar@linux.ibm.com, vaibhav@linux.ibm.com, dan.j.williams@intel.com, ira.weiny@intel.com, atrajeev@linux.vnet.ibm.com, tglx@linutronix.de Subject: Re: [RFC 1/4] drivers/nvdimm: Add perf interface to expose nvdimm performance stats Message-ID: References: <20210512163824.255370-1-kjain@linux.ibm.com> <20210512163824.255370-2-kjain@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210512163824.255370-2-kjain@linux.ibm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 12, 2021 at 10:08:21PM +0530, Kajol Jain wrote: > +static void nvdimm_pmu_read(struct perf_event *event) > +{ > + struct nvdimm_pmu *nd_pmu = to_nvdimm_pmu(event->pmu); > + > + /* jump to arch/platform specific callbacks if any */ > + if (nd_pmu && nd_pmu->read) > + nd_pmu->read(event, nd_pmu->dev); > +} > + > +static void nvdimm_pmu_del(struct perf_event *event, int flags) > +{ > + struct nvdimm_pmu *nd_pmu = to_nvdimm_pmu(event->pmu); > + > + /* jump to arch/platform specific callbacks if any */ > + if (nd_pmu && nd_pmu->del) > + nd_pmu->del(event, flags, nd_pmu->dev); > +} > + > +static int nvdimm_pmu_add(struct perf_event *event, int flags) > +{ > + struct nvdimm_pmu *nd_pmu = to_nvdimm_pmu(event->pmu); > + > + if (flags & PERF_EF_START) > + /* jump to arch/platform specific callbacks if any */ > + if (nd_pmu && nd_pmu->add) > + return nd_pmu->add(event, flags, nd_pmu->dev); > + return 0; > +} What's the value add here? Why can't you directly set driver pointers? I also don't really believe ->{add,del,read} can be optional and still have a sane driver.