Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1459543rdg; Sat, 12 Aug 2023 02:01:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEF9eWQR3g00UoD57sGjgcfnOLIspEMf1mLKyivxkec6UF5XOP/0H0cWmKtiI8GbM12W15Q X-Received: by 2002:a05:6402:889:b0:523:17ad:c7d4 with SMTP id e9-20020a056402088900b0052317adc7d4mr3231580edy.39.1691830892663; Sat, 12 Aug 2023 02:01:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691830892; cv=none; d=google.com; s=arc-20160816; b=M+EeWfmaxX2pn7w43/Ti/yajcovmxH1NShiXuN+y7JKRUHx7NN1XIvfs/yXWtbGKDr lN7j4JUc/mcs5yFZyasb6ZViOGVfVd+hCmS8rXPyvjALC7e7bfMRQCHlX7u7atQijy9/ U+oKRIzx2FJHBE5dn8CzWbyr8yePXWy9S9r20oqYJ/BKttQfS4YPMhXn9LHUh3/zGK92 0WYn1j2bNllD63lB/ZQC16/fKg7splYIl+9fX16tpQ9jmevJHq2miTwGnjyZy3MSC3st cTqS/91eU3oIFz482oAhmfrG/atX0R/jWM5BgkOFdVp51K8aSVf0ydBbV9y+4UFp3kNL sbSQ== 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=tYiahCfwL788xtKXnm5S6matFetXvA4gAseS3bmDCd0=; fh=yJzUIAXk3G9GFZhd7AEi53Yh6JaeRXiXWLsFmPRnLKo=; b=XT4HjVlBd/vAZPpGOddr/qU/tWHP5vrtd1Det6A8cEFuH074VjcY+06b3x6mF/xyPD rQk+axMo5pvOCHiP88j66vrVK+qVud1EsTsqAx5+cHriQzMbNcq/XQKfBZAq1XO+Dzl9 2bGg7SnORz997uJTJLcDEmDNP9s9V/DXhICvFxerReUr/WJ7Fa6KixrAxJWh3EzPhBlT dPvIwWmoQkXTyYJYu6JicYvRsC4dd/Dy3wx4JS5/r3zgDJWltsJWHaSCjz0ZrFX95zPd J1gEPzNqwajQHusVyN/Q3F2oA722TEGn/tpZX7E+979CpGphTdAXCmxHPvU7ixwRwF1L 316g== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a9-20020aa7cf09000000b0052196e1378csi4837020edy.17.2023.08.12.02.01.07; Sat, 12 Aug 2023 02:01:32 -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 S236573AbjHLIwL (ORCPT + 99 others); Sat, 12 Aug 2023 04:52:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235461AbjHLIwD (ORCPT ); Sat, 12 Aug 2023 04:52:03 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D80D2D44; Sat, 12 Aug 2023 01:52:06 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RNDpT48HjzNmnM; Sat, 12 Aug 2023 16:48:33 +0800 (CST) Received: from localhost.localdomain (10.67.174.95) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 12 Aug 2023 16:52:02 +0800 From: Yang Jihong To: , , , , , , , , , , , , , CC: Subject: [RFC v1 04/16] perf kwork: Add `kwork` and `src_type` to work_init() for struct kwork_class Date: Sat, 12 Aug 2023 08:49:05 +0000 Message-ID: <20230812084917.169338-5-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230812084917.169338-1-yangjihong1@huawei.com> References: <20230812084917.169338-1-yangjihong1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.95] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS 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 To support different types of reports, two parameters `struct perf_kwork * kwork` and `enum kwork_trace_type src_type` are added to work_init() of struct kwork_class for initialization in different scenarios. No functional change. Signed-off-by: Yang Jihong --- tools/perf/builtin-kwork.c | 16 +++++++++++----- tools/perf/util/kwork.h | 6 ++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c index de2fbb7c56c3..42ea59a957ae 100644 --- a/tools/perf/builtin-kwork.c +++ b/tools/perf/builtin-kwork.c @@ -398,7 +398,7 @@ static int work_push_atom(struct perf_kwork *kwork, struct kwork_work *work, key; BUG_ON(class->work_init == NULL); - class->work_init(class, &key, evsel, sample, machine); + class->work_init(kwork, class, &key, src_type, evsel, sample, machine); atom = atom_new(kwork, sample); if (atom == NULL) @@ -445,7 +445,7 @@ static struct kwork_atom *work_pop_atom(struct perf_kwork *kwork, struct kwork_work *work, key; BUG_ON(class->work_init == NULL); - class->work_init(class, &key, evsel, sample, machine); + class->work_init(kwork, class, &key, src_type, evsel, sample, machine); work = work_findnew(&class->work_root, &key, &kwork->cmp_id); if (ret_work != NULL) @@ -821,8 +821,10 @@ static int irq_class_init(struct kwork_class *class, return 0; } -static void irq_work_init(struct kwork_class *class, +static void irq_work_init(struct perf_kwork *kwork __maybe_unused, + struct kwork_class *class, struct kwork_work *work, + enum kwork_trace_type src_type __maybe_unused, struct evsel *evsel, struct perf_sample *sample, struct machine *machine __maybe_unused) @@ -940,8 +942,10 @@ static char *evsel__softirq_name(struct evsel *evsel, u64 num) return name; } -static void softirq_work_init(struct kwork_class *class, +static void softirq_work_init(struct perf_kwork *kwork __maybe_unused, + struct kwork_class *class, struct kwork_work *work, + enum kwork_trace_type src_type __maybe_unused, struct evsel *evsel, struct perf_sample *sample, struct machine *machine __maybe_unused) @@ -1031,8 +1035,10 @@ static int workqueue_class_init(struct kwork_class *class, return 0; } -static void workqueue_work_init(struct kwork_class *class, +static void workqueue_work_init(struct perf_kwork *kwork __maybe_unused, + struct kwork_class *class, struct kwork_work *work, + enum kwork_trace_type src_type __maybe_unused, struct evsel *evsel, struct perf_sample *sample, struct machine *machine) diff --git a/tools/perf/util/kwork.h b/tools/perf/util/kwork.h index 53b7327550b8..736c7a08fb19 100644 --- a/tools/perf/util/kwork.h +++ b/tools/perf/util/kwork.h @@ -91,6 +91,7 @@ struct kwork_atom_page { DECLARE_BITMAP(bitmap, NR_ATOM_PER_PAGE); }; +struct perf_kwork; struct kwork_class; struct kwork_work { /* @@ -142,8 +143,10 @@ struct kwork_class { int (*class_init)(struct kwork_class *class, struct perf_session *session); - void (*work_init)(struct kwork_class *class, + void (*work_init)(struct perf_kwork *kwork, + struct kwork_class *class, struct kwork_work *work, + enum kwork_trace_type src_type, struct evsel *evsel, struct perf_sample *sample, struct machine *machine); @@ -152,7 +155,6 @@ struct kwork_class { char *buf, int len); }; -struct perf_kwork; struct trace_kwork_handler { int (*raise_event)(struct perf_kwork *kwork, struct kwork_class *class, struct evsel *evsel, -- 2.30.GIT