Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
b050b015
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b050b015
编写于
12月 23, 2009
作者:
M
Marcelo Tosatti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
KVM: use SRCU for dirty log
Signed-off-by:
N
Marcelo Tosatti
<
mtosatti@redhat.com
>
上级
bc6678a3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
41 addition
and
8 deletion
+41
-8
arch/x86/kvm/x86.c
arch/x86/kvm/x86.c
+41
-8
未找到文件。
arch/x86/kvm/x86.c
浏览文件 @
b050b015
...
@@ -2415,27 +2415,60 @@ static int kvm_vm_ioctl_reinject(struct kvm *kvm,
...
@@ -2415,27 +2415,60 @@ static int kvm_vm_ioctl_reinject(struct kvm *kvm,
int
kvm_vm_ioctl_get_dirty_log
(
struct
kvm
*
kvm
,
int
kvm_vm_ioctl_get_dirty_log
(
struct
kvm
*
kvm
,
struct
kvm_dirty_log
*
log
)
struct
kvm_dirty_log
*
log
)
{
{
int
r
;
int
r
,
n
,
i
;
int
n
;
struct
kvm_memory_slot
*
memslot
;
struct
kvm_memory_slot
*
memslot
;
int
is_dirty
=
0
;
unsigned
long
is_dirty
=
0
;
unsigned
long
*
dirty_bitmap
=
NULL
;
down_write
(
&
kvm
->
slots_lock
);
down_write
(
&
kvm
->
slots_lock
);
r
=
kvm_get_dirty_log
(
kvm
,
log
,
&
is_dirty
);
r
=
-
EINVAL
;
if
(
r
)
if
(
log
->
slot
>=
KVM_MEMORY_SLOTS
)
goto
out
;
memslot
=
&
kvm
->
memslots
->
memslots
[
log
->
slot
];
r
=
-
ENOENT
;
if
(
!
memslot
->
dirty_bitmap
)
goto
out
;
n
=
ALIGN
(
memslot
->
npages
,
BITS_PER_LONG
)
/
8
;
r
=
-
ENOMEM
;
dirty_bitmap
=
vmalloc
(
n
);
if
(
!
dirty_bitmap
)
goto
out
;
goto
out
;
memset
(
dirty_bitmap
,
0
,
n
);
for
(
i
=
0
;
!
is_dirty
&&
i
<
n
/
sizeof
(
long
);
i
++
)
is_dirty
=
memslot
->
dirty_bitmap
[
i
];
/* If nothing is dirty, don't bother messing with page tables. */
/* If nothing is dirty, don't bother messing with page tables. */
if
(
is_dirty
)
{
if
(
is_dirty
)
{
struct
kvm_memslots
*
slots
,
*
old_slots
;
spin_lock
(
&
kvm
->
mmu_lock
);
spin_lock
(
&
kvm
->
mmu_lock
);
kvm_mmu_slot_remove_write_access
(
kvm
,
log
->
slot
);
kvm_mmu_slot_remove_write_access
(
kvm
,
log
->
slot
);
spin_unlock
(
&
kvm
->
mmu_lock
);
spin_unlock
(
&
kvm
->
mmu_lock
);
memslot
=
&
kvm
->
memslots
->
memslots
[
log
->
slot
];
n
=
ALIGN
(
memslot
->
npages
,
BITS_PER_LONG
)
/
8
;
slots
=
kzalloc
(
sizeof
(
struct
kvm_memslots
),
GFP_KERNEL
);
memset
(
memslot
->
dirty_bitmap
,
0
,
n
);
if
(
!
slots
)
goto
out_free
;
memcpy
(
slots
,
kvm
->
memslots
,
sizeof
(
struct
kvm_memslots
));
slots
->
memslots
[
log
->
slot
].
dirty_bitmap
=
dirty_bitmap
;
old_slots
=
kvm
->
memslots
;
rcu_assign_pointer
(
kvm
->
memslots
,
slots
);
synchronize_srcu_expedited
(
&
kvm
->
srcu
);
dirty_bitmap
=
old_slots
->
memslots
[
log
->
slot
].
dirty_bitmap
;
kfree
(
old_slots
);
}
}
r
=
0
;
r
=
0
;
if
(
copy_to_user
(
log
->
dirty_bitmap
,
dirty_bitmap
,
n
))
r
=
-
EFAULT
;
out_free:
vfree
(
dirty_bitmap
);
out:
out:
up_write
(
&
kvm
->
slots_lock
);
up_write
(
&
kvm
->
slots_lock
);
return
r
;
return
r
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录