430 Star 1.6K Fork 1.7K

GVPopenEuler/kernel

[openEuler 20.03] 昇腾CPU MPAM 和 SMMU MPAM特性

已完成
需求
创建于  
2021-09-13 11:59

1. MPAM 驱动 resctlfs 增加 rmid 的 write 接口,支持动态配置分区rmid

引入需求原因:resctlfs 中 group 的rmid可能从其它模块分配,CPU 侧的MPAM驱动需要支持用户动态配置rmid

修改:增加 mpam resctrl文件系统分区 rmid 的可写接口 resctrl_group_rmid_write
当配置新的rmid到指定分区时,进行一系列的检查,当配置的rmid合法并且分区是 可配置的时候,修改分区为新的rmid,释放已有的rmid,然后将新的rmid配置到分 区包含所有进程的task_struct ,将分区包含的所有CPU对应的rmid更新为新的, 更新监控文件关联的 rmid 并将新的config重新刷新

2. 支持通过SVM驱动配置加速器mpamid 到SMMU驱动

引入需求原因:为了限制设备可用的总线带宽,需要配置设备对应的MPAMID到SMMU驱动中,加速器设备统一由SVM提供配置接口

修改:SMMU驱动增加MPAM的set/get配置接口,SVM驱动增加加速器的MPAM set/get 接口

2021/12/17 更新:

  1. 配置mpam到SMMU驱动需要和SVM模块解耦,所以revert掉了SVM部分的mpam相关接口
  2. 为arm64/mpam驱动增加 Device Tree 启动

2021/12/31 更新:
新增bugfix:修复mpam ACPI probe错误
The mpam init procedure failed when probe with ACPI:
[ 1.148657 ] ACPI MPAM: No CPU has cache with PPTT reference 0x72
[ 1.148658 ] ACPI MPAM: All CPUs must be online to probe mpam.
[ 1.148660 ] ACPI MPAM: discovery failed: -19
问题原因:DT启动时增加了统一的device_initcall入口,但是ACPI启动的方式需要保证在 cacheinfo_sysfs_init 之后初始化,所以这里初始化入口应该使用 device_initcall_sync 函数

2021/1/6 更新:
新增bugfix: 修复mpam dts启动,KASAN报 out of bounds 错误
[ 0.596145] BUG: KASAN: global-out-of-bounds in __of_match_node.part.0+0xe0/0x110
[ 0.596731] Read of size 1 at addr ffff2000099a8288 by task swapper/0/1
[ 0.597247]
[ 0.597372] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.90+ #34
[ 0.597858] Hardware name: linux,dummy-virt (DT)
[ 0.598243] Call trace:
[ 0.598443] dump_backtrace+0x0/0x360
[ 0.598734] show_stack+0x24/0x30
[ 0.599004] dump_stack+0xdc/0x128
[ 0.599323] print_address_description+0x184/0x278
[ 0.599771] kasan_report+0x204/0x330
[ 0.600117] __asan_report_load1_noabort+0x30/0x40
[ 0.600566] __of_match_node.part.0+0xe0/0x110
[ 0.600980] of_match_node+0x6c/0xa8
[ 0.601316] of_match_device+0x48/0x70
[ 0.601669] platform_match+0xa4/0x260
[ 0.602037] __driver_attach+0x68/0x128
[ 0.602397] bus_for_each_dev+0x118/0x198
[ 0.602773] driver_attach+0x48/0x60
[ 0.603112] bus_add_driver+0x330/0x658
[ 0.603472] driver_register+0x148/0x398
[ 0.603839] __platform_driver_register+0xd4/0x108
[ 0.604288] arm_mpam_driver_init+0x64/0x78
[ 0.604680] do_one_initcall+0xbc/0x488
[ 0.605039] kernel_init_freeable+0x604/0x6f8
[ 0.605447] kernel_init+0x18/0x130
[ 0.605775] ret_from_fork+0x10/0x18
[ 0.606130]
[ 0.606274] The buggy address belongs to the variable:
[ 0.606754] arm_mpam_of_device_ids+0xc8/0x380
[ 0.607168]
[ 0.607314] Memory state around the buggy address:
[ 0.607762] ffff2000099a8180: 00 00 00 fa fa fa fa fa 00 00 00 00 00 00 00 00
[ 0.608429] ffff2000099a8200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 0.609095] >ffff2000099a8280: 00 fa fa fa fa fa fa fa 05 fa fa fa fa fa fa fa
[ 0.609760] ^
[ 0.610101] ffff2000099a8300: 00 00 07 fa fa fa fa fa 00 04 fa fa fa fa fa fa
[ 0.610771] ffff2000099a8380: 00 00 00 06 fa fa fa fa 00 01 fa fa fa fa fa fa

原因是 arm_mpam_of_device_ids 数组没有加结束标志

2022/1/22 更新:
高版本GCC编译时报如下warning,因为有些函数的 __init 没有去除

  [...]
  WARNING: vmlinux.o(.text+0x2ed88): Section mismatch in reference from the
  function __mpam_device_create() to the function .init.text:mpam_device_alloc()
  The function __mpam_device_create() references
  the function __init mpam_device_alloc().
  This is often because __mpam_device_create lacks a __init
  annotation or the annotation of mpam_device_alloc is wrong.

  WARNING: vmlinux.o(.text.unlikely+0xa5c): Section mismatch in reference from
  the function mpam_resctrl_init() to the function .init.text:mpam_init_padding()
  The function mpam_resctrl_init() references
  the function __init mpam_init_padding().
  This is often because mpam_resctrl_init lacks a __init
  annotation or the annotation of mpam_init_padding is wrong.

  WARNING: vmlinux.o(.text.unlikely+0x5a9c): Section mismatch in reference from
  the function resctrl_group_init() to the function .init.text:resctrl_group_setup_root()
  The function resctrl_group_init() references
  the function __init resctrl_group_setup_root().
  This is often because resctrl_group_init lacks a __init
  annotation or the annotation of resctrl_group_setup_root is wrong.
  [...]

评论 (5)

wangxingang5 创建了需求 4年前
wangxingang5 关联仓库设置为openEuler/kernel 4年前
openeuler-ci-bot 添加了
 
sig/Kernel
标签
4年前
展开全部操作日志
wangxingang5 修改了描述 4年前

Hi, @jentlestea

请分析下该特性,和现有方案是否兼容。

Xie XiuQi 里程碑设置为openEuler-20.03-LTS-SP3-Kernel 4年前
Xie XiuQi 关联分支设置为openEuler-1.0-LTS 4年前
Xie XiuQi 修改了标题 4年前

第一条可以合入,且对原mpam接口的原有功能没有影响,rmid预留给用户可配可读,属于原有功能上的增强。

wangxingang5 任务状态新建 修改为已接纳 4年前
wangxingang5 任务状态已接纳 修改为新建 4年前
成坚 (CHENG Jian) 通过合并 Pull Request !365: release 4.19.90-2110.8.0任务状态新建 修改为已完成 4年前
wangxingang5 修改了描述 4年前

2021/12/16 更新:
配置mpam到SMMU驱动需要和SVM模块解耦,所以revert掉了SVM部分的mpam相关接口

wangxingang5 修改了描述 4年前
wangxingang5 修改了描述 4年前
wangxingang5 修改了标题 4年前
wangxingang5 修改了描述 3年前
wangxingang5 修改了描述 3年前

输入图片说明
初始化成功,resctrl基本功能正常

wangxingang5 修改了描述 3年前
wangxingang5 修改了描述 3年前
wangxingang5 修改了描述 3年前
wangxingang5 修改了描述 3年前

登录 后才可以发表评论

状态
负责人
项目
预计工期 (小时)
开始日期   -   截止日期
-
置顶选项
优先级
里程碑
分支
参与者(4)
5329419 openeuler ci bot 1632792936 Xie XiuQi-xiexiuqi WangShaoBo-jentlestea wangxingang5-wangxingang5
C
1
https://gitee.com/openeuler/kernel.git
git@gitee.com:openeuler/kernel.git
openeuler
kernel
kernel

搜索帮助