Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 : #include "aicpusd_cust_dump_process.h"
11 :
12 : #include <string.h>
13 : #include <sched.h>
14 : #include <semaphore.h>
15 : #include "aicpusd_drv_manager.h"
16 : #include "aicpusd_util.h"
17 : #include "aicpusd_info.h"
18 : #include "aicpusd_proc_mgr_sys_operator_agent.h"
19 : #include "aicpusd_interface_process.h"
20 : #include "dump_task.h"
21 : #include "aicpusd_send_platform_Info_to_custom.h"
22 :
23 : namespace AicpuSchedule {
24 : namespace {
25 : // aicpusd 与 custaicpusd 是同样的groupid
26 : constexpr const uint32_t DATA_DUMP_GRUOP_ID = 31U;
27 : constexpr const uint32_t DATA_DUMP_THREAD_INDEX = 0U;
28 : constexpr const int32_t DATA_DUMP_TIMEOUT_INTERVAL = 3000;
29 : constexpr const uint32_t SLEEP_USECS = 50000U;
30 : constexpr const uint64_t DATA_DUMP_EVENT_MASK = (1ULL << static_cast<uint32_t>(EVENT_CCPU_CTRL_MSG));
31 : };
32 3 : AicpuSdLoadPlatformInfoProcess &AicpuSdLoadPlatformInfoProcess::GetInstance()
33 : {
34 : static AicpuSdLoadPlatformInfoProcess instance;
35 3 : return instance;
36 : }
37 1 : int32_t AicpuSdLoadPlatformInfoProcess::SendLoadPlatformInfoMessageToCustSync(const uint8_t * const msg, const uint32_t len) const
38 : {
39 : UNUSED(msg);
40 : UNUSED(len);
41 1 : return AICPU_SCHEDULE_OK;
42 : }
43 1 : void AicpuSdLoadPlatformInfoProcess::LoadPlatformInfoSemPost()
44 : {
45 : UNUSED(loadPlatformInfoProcessSem_);
46 1 : return;
47 : }
48 1 : int32_t AicpuSdLoadPlatformInfoProcess::SendMsgToMain(const void * const msg, const uint32_t len)
49 : {
50 : UNUSED(msg);
51 : UNUSED(len);
52 1 : sem_init(&loadPlatformInfoProcessSem_, 0, 0U);
53 1 : sem_destroy(&loadPlatformInfoProcessSem_);
54 1 : return AICPU_SCHEDULE_OK;
55 : }
56 1 : AicpuSdCustDumpProcess::~AicpuSdCustDumpProcess()
57 : {
58 1 : UnitCustDataDumpProcess();
59 1 : }
60 :
61 12 : AicpuSdCustDumpProcess &AicpuSdCustDumpProcess::GetInstance()
62 : {
63 12 : static AicpuSdCustDumpProcess instance;
64 12 : return instance;
65 : }
66 :
67 1 : AicpuSdCustDumpProcess::AicpuSdCustDumpProcess()
68 1 : : deviceId_(0U), runningFlag_(true), initFlag_(false)
69 : {
70 1 : }
71 :
72 1 : int32_t AicpuSdCustDumpProcess::InitCustDumpProcess(
73 : const uint32_t deviceId, const aicpu::AicpuRunMode runMode)
74 : {
75 1 : initFlag_ = false;
76 : UNUSED(deviceId);
77 : UNUSED(runMode);
78 1 : return 0;
79 : }
80 :
81 1 : int32_t AicpuSdCustDumpProcess::SetDataDumpThreadAffinity() const
82 : {
83 1 : return 0;
84 : }
85 :
86 1 : void AicpuSdCustDumpProcess::StartProcessEvent()
87 : {
88 1 : }
89 :
90 1 : void AicpuSdCustDumpProcess::LoopProcessEvent()
91 : {
92 1 : }
93 :
94 1 : int32_t AicpuSdCustDumpProcess::ProcessMessage(const int32_t timeout)
95 : {
96 : UNUSED(timeout);
97 1 : return 0;
98 : }
99 :
100 2 : void AicpuSdCustDumpProcess::UnitCustDataDumpProcess()
101 : {
102 2 : }
103 :
104 1 : int32_t AicpuSdCustDumpProcess::DoCustDatadumpTask(const event_info &drvEventInfo) const
105 : {
106 : UNUSED(drvEventInfo);
107 1 : return AICPU_SCHEDULE_OK;
108 : }
109 1 : int32_t AicpuSdCustDumpProcess::DoUdfDatadumpTask(const event_info &drvEventInfo) const
110 : {
111 : UNUSED(drvEventInfo);
112 1 : return AICPU_SCHEDULE_OK;
113 : }
114 1 : int32_t AicpuSdCustDumpProcess::DatadumpTaskProcess(const event_info &drvEventInfo) const
115 : {
116 : UNUSED(drvEventInfo);
117 1 : return AICPU_SCHEDULE_OK;
118 : }
119 1 : int32_t AicpuSdCustDumpProcess::DoUdfDatadumpSubmitEventSync(const char_t * const msg,
120 : const uint32_t len, struct event_proc_result &rsp) const
121 : {
122 : UNUSED(msg);
123 : UNUSED(len);
124 : UNUSED(rsp);
125 1 : return AICPU_SCHEDULE_OK;
126 : }
127 1 : bool AicpuSdCustDumpProcess::IsValidUdf(const int32_t sendPid) const
128 : {
129 : UNUSED(sendPid);
130 1 : return true;
131 : }
132 :
133 1 : bool AicpuSdCustDumpProcess::IsValidCustAicpu(const int32_t sendPid) const
134 : {
135 : UNUSED(sendPid);
136 1 : return true;
137 : }
138 : }
139 1 : int32_t CreateDatadumpThread(const struct TsdSubEventInfo * const msg)
140 : {
141 : UNUSED(msg);
142 1 : return AicpuSchedule::AICPU_SCHEDULE_OK;
143 : }
|