Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp216843rwe; Fri, 14 Apr 2023 01:25:18 -0700 (PDT) X-Google-Smtp-Source: AKy350YadOFcsXLeZyCL/kpjPCIRkIviy6ModKvzPQoB8gUihMLVm8Px6RCsRG7ur/L20WYJw/aD X-Received: by 2002:a17:90b:1a90:b0:247:1129:cbcc with SMTP id ng16-20020a17090b1a9000b002471129cbccmr4802991pjb.27.1681460718092; Fri, 14 Apr 2023 01:25:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681460718; cv=none; d=google.com; s=arc-20160816; b=EGkosXzGmxW0fSmxTXYlyYjyBTN/MQIZPNVTXDMlTQgRfIltn7NtXRYMGXQXhzkF9e nHMQy+IIkShUhv5Oa6nQBwgUNShr8Czftx0QvwhctA/5HBt5yPeOSEPuB6cRAf9haVVE LXMElU/lenGJ0ijLE/qMzPJ1eG0D9gnhvmTIZrdxO0tyC7QH2tZzBosHTJUXQWUEhtFL 2OVWCvXqNcnTMrwlUUmvcfMGRMTMC8s2y5Zr4+TjSbIjq2iNRkNNmfPJnKCMQP/vslAa uK4+ZPMSyY7NlO1k1US746hnQDhpioez8d52uCOZQnzMI70K0Km5INg6wuHmndQbtko/ umVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4/OedsHNECWMdb1O/5CmBXIMhKWxTMAD8xpCzvQiWk4=; b=FWLneGnjwl0r2pQD08u7+BNkt+bhTmeBtPhcdla882Sbzyq5rAjHtWUJzaG24O0/1F sd4ByHYWSzO6xKM0/Skwk8/pPkgUBRcqwJHV7TacnS+GB9fsyophAXZUXWJiPytLdRGE vmpiDj6v/wmu+V5sdUvISRls/X25n4X3o6shOFBOblrEe3Qy74mUyQ942XhJEvVCYLA4 A1w0/Mm8N0CEIzZ5v/3YVVSvgoMddCIWE8gw+TuOJ8bBw2QBLqb0ZGeziHWbZ1crhWin XlVIRJFfW2rjySPvBW8kry8BPzZoU5bjC2fLt2DNGx6T9fdLWVbW9W7anGp0+/RFllwD ho2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=cJt80wV5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a17090ad78b00b00246e9abad4bsi6747253pju.85.2023.04.14.01.25.06; Fri, 14 Apr 2023 01:25:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=cJt80wV5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229876AbjDNIXf (ORCPT + 99 others); Fri, 14 Apr 2023 04:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229836AbjDNIX2 (ORCPT ); Fri, 14 Apr 2023 04:23:28 -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 D646E1BC9; Fri, 14 Apr 2023 01:23:26 -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=4/OedsHNECWMdb1O/5CmBXIMhKWxTMAD8xpCzvQiWk4=; b=cJt80wV5U63xn0tju0Jh0AUTJp AW758NvMDPN4Eh2BgK4wm+ZoWVv7qdmVGZ2/4ZXuB6mHDoMACsiJfOlyVp3ZDgra439Vn/DR+wzMY GUKXVlFDW+LuV1S61mOEQVTYdXdwkM+2rN1CMvRIjwhtLZTnlXuUrl6yr9fkfX79nD3bD2nY86Rji PxYrYjrNcb6vNav4NU3sjbKOCk23dY4MnRGB90RFbCNk1Yzn5OUVrjfWCLFZzLYLMQOEUU3WcAox7 PC/XwRv88/y5GK/P4jno8z/sfwzPbwH3lHDJs1lFQFa6/K1LhOrMCo1busLSiZpK1d9k+9YTN57Mo HG1G36nQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pnEfg-00FWn9-0h; Fri, 14 Apr 2023 08:22:42 +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 (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 2598430002F; Fri, 14 Apr 2023 10:20:39 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0BC1520248CE4; Fri, 14 Apr 2023 10:20:39 +0200 (CEST) Date: Fri, 14 Apr 2023 10:20:39 +0200 From: Peter Zijlstra To: Jonathan Cameron Cc: Liang Kan , linux-cxl@vger.kernel.org, mark.rutland@arm.com, will@kernel.org, mingo@redhat.com, acme@kernel.org, dan.j.williams@intel.com, linuxarm@huawei.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Davidlohr Bueso , Dave Jiang Subject: Re: [PATCH v6 1/5] perf: Allow a PMU to have a parent Message-ID: <20230414082039.GT4253@hirez.programming.kicks-ass.net> References: <20230413142617.15995-1-Jonathan.Cameron@huawei.com> <20230413142617.15995-2-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230413142617.15995-2-Jonathan.Cameron@huawei.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 13, 2023 at 03:26:13PM +0100, Jonathan Cameron wrote: > Some PMUs have well defined parents such as PCI devices. > As the device_initialize() and device_add() are all within > pmu_dev_alloc() which is called from perf_pmu_register() > there is no opportunity to set the parent from within a driver. > > Add a struct device *parent field to struct pmu and use that > to set the parent. > > Signed-off-by: Jonathan Cameron > Reviewed-by: Dan Williams > Reviewed-by: Greg Kroah-Hartman Acked-by: Peter Zijlstra (Intel) > --- > v6: No change > v5: Move to head of series as may merge as part of: > https://lore.kernel.org/all/20230404134225.13408-1-Jonathan.Cameron@huawei.com/ > --- > include/linux/perf_event.h | 1 + > kernel/events/core.c | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h > index d5628a7b5eaa..b99db1eda72c 100644 > --- a/include/linux/perf_event.h > +++ b/include/linux/perf_event.h > @@ -303,6 +303,7 @@ struct pmu { > > struct module *module; > struct device *dev; > + struct device *parent; > const struct attribute_group **attr_groups; > const struct attribute_group **attr_update; > const char *name; > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 435815d3be3f..32079a332480 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -11367,6 +11367,7 @@ static int pmu_dev_alloc(struct pmu *pmu) > > dev_set_drvdata(pmu->dev, pmu); > pmu->dev->bus = &pmu_bus; > + pmu->dev->parent = pmu->parent; > pmu->dev->release = pmu_dev_release; > > ret = dev_set_name(pmu->dev, "%s", pmu->name); > -- > 2.37.2 >