libwd/0057-uadk-optimize-wd_sched_rr_instance.patch
Yang Shen aa2d7cce3f libwd: backport for uadk from 2.3.24 to 2.3.27
Update some patch for uadk from mainline.
To get more infomation, please visit the homepage:
https://github.com/Linaro/uadk

Signed-off-by: Yang Shen <shenyang39@huawei.com>
2022-02-21 06:32:14 +00:00

66 lines
2.2 KiB
Diff

From 1da22fb07ffeabe82310b8619563fd5971214e18 Mon Sep 17 00:00:00 2001
From: Wenkai Lin <linwenkai6@hisilicon.com>
Date: Tue, 15 Feb 2022 11:49:54 +0800
Subject: [PATCH 61/64] uadk: optimize wd_sched_rr_instance
Schedule ctx numa number and schedule type number should
also be printed, the error information is more usefull
if when it has a comparison.
Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
---
wd_sched.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/wd_sched.c b/wd_sched.c
index aeaf11b..ef90233 100644
--- a/wd_sched.c
+++ b/wd_sched.c
@@ -129,7 +129,7 @@ static bool sched_key_valid(struct wd_sched_ctx *ctx,
{
if (key->numa_id >= ctx->numa_num || key->mode >= SCHED_MODE_BUTT ||
key->type >= ctx->type_num) {
- WD_ERR("ERROR: %s key error - numa:%d, mode:%u, type%u!\n",
+ WD_ERR("ERROR: %s key error - numa: %d, mode: %u, type: %u!\n",
__FUNCTION__, key->numa_id, key->mode, key->type);
return false;
}
@@ -372,18 +372,28 @@ int wd_sched_rr_instance(const struct wd_sched *sched,
mode = param->mode;
sched_ctx = (struct wd_sched_ctx *)sched->h_sched_ctx;
- if ((numa_id >= sched_ctx->numa_num) || (numa_id < 0) ||
- (mode >= SCHED_MODE_BUTT) ||
- (type >= sched_ctx->type_num)) {
- WD_ERR("ERROR: %s para err: numa_id=%d, mode=%u, type=%u!\n",
- __FUNCTION__, numa_id, mode, type);
+ if (numa_id >= sched_ctx->numa_num || numa_id < 0) {
+ WD_ERR("ERROR: %s para err: numa_id = %d, numa_num = %u\n",
+ __FUNCTION__, numa_id, sched_ctx->numa_num);
+ return -WD_EINVAL;
+ }
+
+ if (type >= sched_ctx->type_num) {
+ WD_ERR("ERROR: %s para err: type = %u, type_num = %u\n",
+ __FUNCTION__, type, sched_ctx->type_num);
+ return -WD_EINVAL;
+ }
+
+ if (mode >= SCHED_MODE_BUTT) {
+ WD_ERR("ERROR: %s para err: mode = %u, mode_num = %d!\n",
+ __FUNCTION__, mode, SCHED_MODE_BUTT);
return -WD_EINVAL;
}
sched_info = sched_ctx->sched_info;
if (!sched_info[numa_id].ctx_region[mode]) {
- WD_ERR("ERROR: %s para err: ctx_region:numa_id=%d, mode=%u is NULL!\n",
+ WD_ERR("ERROR: %s ctx_region of numa_id = %d, mode = %u is NULL!\n",
__FUNCTION__, numa_id, mode);
return -WD_EINVAL;
}
--
2.25.1