未验证 提交 4199dd39 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!1734 arm64/mpam: mark partid non-exclusive if self-owned

Merge Pull Request from: @ci-robot 
 
PR sync from: Yu Liao <liaoyu15@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/A3IQ6VAPIMPO7GV5KNDVHA3OOE2U5KOX/ 
 
https://gitee.com/openeuler/kernel/issues/I7SVKK 
 
Link:https://gitee.com/openeuler/kernel/pulls/1734 

Reviewed-by: Wang ShaoBo <bobo.shaobowang@huawei.com> 
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
...@@ -919,7 +919,7 @@ static int is_rmid_remap_bmp_full(unsigned long *bmp) ...@@ -919,7 +919,7 @@ static int is_rmid_remap_bmp_full(unsigned long *bmp)
bitmap_full(bmp, rmid_remap_matrix.rows)); bitmap_full(bmp, rmid_remap_matrix.rows));
} }
static int rmid_remap_bmp_find_step_entry(int partid) static int rmid_remap_bmp_find_step_entry(int partid, bool exclusive)
{ {
int x, y; int x, y;
unsigned long **bmp; unsigned long **bmp;
...@@ -931,7 +931,7 @@ static int rmid_remap_bmp_find_step_entry(int partid) ...@@ -931,7 +931,7 @@ static int rmid_remap_bmp_find_step_entry(int partid)
/* step entry should be non-occupied and aligned */ /* step entry should be non-occupied and aligned */
bmp = __rmid_remap_bmp(partid); bmp = __rmid_remap_bmp(partid);
if (bmp) if (bmp)
return (is_rmid_remap_bmp_occ(*bmp) || return ((exclusive && is_rmid_remap_bmp_occ(*bmp)) ||
!__step_align(partid)) ? -ENOSPC : partid; !__step_align(partid)) ? -ENOSPC : partid;
for_each_rmid_transform_point_from(bmp, x, y, 0) { for_each_rmid_transform_point_from(bmp, x, y, 0) {
...@@ -1024,7 +1024,7 @@ static int rmid_to_partid_pmg(int rmid, int *partid, int *pmg) ...@@ -1024,7 +1024,7 @@ static int rmid_to_partid_pmg(int rmid, int *partid, int *pmg)
return 0; return 0;
} }
static int __rmid_alloc(int partid, int pmg) static int __rmid_alloc(int partid, int pmg, bool exclusive)
{ {
int x, y, step, ret, rmid; int x, y, step, ret, rmid;
bool checkpmg = false; bool checkpmg = false;
...@@ -1034,7 +1034,7 @@ static int __rmid_alloc(int partid, int pmg) ...@@ -1034,7 +1034,7 @@ static int __rmid_alloc(int partid, int pmg)
checkpmg = true; checkpmg = true;
/* traverse from first non-occupied and step-aligned entry */ /* traverse from first non-occupied and step-aligned entry */
ret = rmid_remap_bmp_find_step_entry(partid); ret = rmid_remap_bmp_find_step_entry(partid, exclusive);
if (ret < 0) if (ret < 0)
goto out; goto out;
partid = ret; partid = ret;
...@@ -1084,7 +1084,7 @@ static int __rmid_alloc(int partid, int pmg) ...@@ -1084,7 +1084,7 @@ static int __rmid_alloc(int partid, int pmg)
int rmid_alloc(int partid) int rmid_alloc(int partid)
{ {
return __rmid_alloc(partid, -1); return __rmid_alloc(partid, -1, false);
} }
void rmid_free(int rmid) void rmid_free(int rmid)
...@@ -1914,6 +1914,7 @@ static ssize_t resctrl_group_rmid_write(struct kernfs_open_file *of, ...@@ -1914,6 +1914,7 @@ static ssize_t resctrl_group_rmid_write(struct kernfs_open_file *of,
struct rdtgroup *rdtgrp; struct rdtgroup *rdtgrp;
int ret = 0; int ret = 0;
int partid; int partid;
bool exclusive;
int pmg; int pmg;
int rmid; int rmid;
int old_rmid; int old_rmid;
...@@ -1954,15 +1955,16 @@ static ssize_t resctrl_group_rmid_write(struct kernfs_open_file *of, ...@@ -1954,15 +1955,16 @@ static ssize_t resctrl_group_rmid_write(struct kernfs_open_file *of,
goto unlock; goto unlock;
} }
ret = __rmid_alloc(partid, pmg); old_rmid = rdtgrp->mon.rmid;
old_reqpartid = rdtgrp->closid.reqpartid;
exclusive = (partid == old_reqpartid) ? false : true;
ret = __rmid_alloc(partid, pmg, exclusive);
if (ret < 0) { if (ret < 0) {
rdt_last_cmd_puts("set rmid failed\n"); rdt_last_cmd_puts("set rmid failed\n");
goto unlock; goto unlock;
} }
old_rmid = rdtgrp->mon.rmid;
old_reqpartid = rdtgrp->closid.reqpartid;
/* /*
* we use intpartid as group control, use reqpartid for config * we use intpartid as group control, use reqpartid for config
* synchronization and monitor, only update the reqpartid * synchronization and monitor, only update the reqpartid
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册