Message ID | 20230330164556.31533-3-Jonathan.Cameron@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp5845vqo; Thu, 30 Mar 2023 10:05:22 -0700 (PDT) X-Google-Smtp-Source: AKy350atkSc1uvZ+gtE7E5RhIBJR9S2MKODwsoD3YwNXCoA5Ee0smid8wk4bKQ3ikzwmVOBYCChs X-Received: by 2002:a17:906:3449:b0:930:9197:24d1 with SMTP id d9-20020a170906344900b00930919724d1mr7097284ejb.6.1680195922329; Thu, 30 Mar 2023 10:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680195922; cv=none; d=google.com; s=arc-20160816; b=dM92A0uF+vgHdgGupzUEZH24hPX35XzVf2IBrOHbgagX3+zEXz4qlvQQdGAZ8HtfRd qQ24u8JVqs5UgHQIg3+p7j2L8XrJ/NUJB6Ar9Ke1BSAYSct1NxrjCaVUR30+9mb8IPT9 bX63c7b5T+EhBMjSsH3UZgLEflhj2y0Du32WVmYKS5NJdmSCXIMXCcXkTxDjO6pwIRD2 a+1a0I3wNRJu2rlSnw4QZyQIMSKnRCzQXCshoYODKwPvoFofDHcVqGbnCMXjQ3I2xUgl JI2qxOiujjp7Ah2DL5UECQMZTlnZkOanArHVDa+pDIJvaSzH7MXuCDncCh1u3W48goW9 3hIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=9T2i4qotjT4SKDy6R4tSKGzkCNQxqJwWrwYVMS7Q9iA=; b=Tu8Px3aB0iVRiXlWcADkgKQM9cmcAelD7toDKBhjgEAqyz9CdgV4V97BHKUNlqVuHE +gcwkVM6D6invTJZOA3YEKeh95o3/FQDO+NeYcZV1TJ1SqLHlF+I1nOduuSlEvQBqpw3 P+XpittL9AyHlGusBWm/w7DPAg5nQ5sRkjPJK9WVhMUpr2SYmVWwb8j1tuoy1zDNUseQ 8Izu2hQ2DMSxCoehrNzAo6sqcTYgajSYX3tTMZlxojobcSRXXLxdvYpAKnd6gOWPEpfe gGdNzZR+OUefMvcIUpJIrgc46XNt4n9SDpNG2DyfAJset22i804EIEAVq5UOmiKOeetE SCzg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r15-20020aa7c14f000000b004fd1ef9b95csi193852edp.598.2023.03.30.10.04.24; Thu, 30 Mar 2023 10:05:22 -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; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232524AbjC3Qr2 (ORCPT <rfc822;rua109.linux@gmail.com> + 99 others); Thu, 30 Mar 2023 12:47:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232274AbjC3Qqx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 30 Mar 2023 12:46:53 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F5A3CC3E; Thu, 30 Mar 2023 09:46:52 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4PnTnv3bXnz6J7n2; Fri, 31 Mar 2023 00:46:11 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 30 Mar 2023 17:46:49 +0100 From: Jonathan Cameron <Jonathan.Cameron@huawei.com> To: Liang Kan <kan.liang@linux.intel.com>, <linux-cxl@vger.kernel.org>, <peterz@infradead.org> CC: <mingo@redhat.com>, <acme@kernel.org>, <mark.rutland@arm.com>, <will@kernel.org>, <dan.j.williams@intel.com>, <linuxarm@huawei.com>, <linux-perf-users@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Davidlohr Bueso <dave@stgolabs.net>, Dave Jiang <dave.jiang@intel.com> Subject: [PATCH v4 2/5] perf: Allow a PMU to have a parent Date: Thu, 30 Mar 2023 17:45:53 +0100 Message-ID: <20230330164556.31533-3-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230330164556.31533-1-Jonathan.Cameron@huawei.com> References: <20230330164556.31533-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761813119517310526?= X-GMAIL-MSGID: =?utf-8?q?1761813119517310526?= |
Series |
CXL 3.0 Performance Monitoring Unit support
|
|
Commit Message
Jonathan Cameron
March 30, 2023, 4:45 p.m. UTC
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 <Jonathan.Cameron@huawei.com>
---
v4: No change
Note that this may first merge as part of a larger series I
plan to post next week that adds parents for many of the of the
other struct pmu instances. If so please drop this patch whilst
applying.
---
include/linux/perf_event.h | 1 +
kernel/events/core.c | 1 +
2 files changed, 2 insertions(+)
Comments
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 <Jonathan.Cameron@huawei.com> > --- > v4: No change > Note that this may first merge as part of a larger series I > plan to post next week that adds parents for many of the of the > other struct pmu instances. If so please drop this patch whilst > applying. Feel free to add my: Reviewed-by: Dan Williams <dan.j.williams@intel.com> ...whereever this gets applied, and yes it makes sense especially as more device attached PMUs are showing up.
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 fb3e436bcd4a..a84c282221f2 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);