Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
d5d1cf47
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
d5d1cf47
编写于
11月 26, 2021
作者:
P
Paolo Bonzini
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'kvm-5.16-fixes-pre-rc2' into HEAD
上级
3d627cc3
8ed716ca
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
42 addition
and
30 deletion
+42
-30
arch/x86/kvm/ioapic.h
arch/x86/kvm/ioapic.h
+0
-1
arch/x86/kvm/irq.h
arch/x86/kvm/irq.h
+0
-1
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/mmu.c
+3
-3
arch/x86/kvm/mmu/tdp_mmu.c
arch/x86/kvm/mmu/tdp_mmu.c
+6
-8
virt/kvm/kvm_main.c
virt/kvm/kvm_main.c
+33
-17
未找到文件。
arch/x86/kvm/ioapic.h
浏览文件 @
d5d1cf47
...
...
@@ -81,7 +81,6 @@ struct kvm_ioapic {
unsigned
long
irq_states
[
IOAPIC_NUM_PINS
];
struct
kvm_io_device
dev
;
struct
kvm
*
kvm
;
void
(
*
ack_notifier
)(
void
*
opaque
,
int
irq
);
spinlock_t
lock
;
struct
rtc_status
rtc_status
;
struct
delayed_work
eoi_inject
;
...
...
arch/x86/kvm/irq.h
浏览文件 @
d5d1cf47
...
...
@@ -56,7 +56,6 @@ struct kvm_pic {
struct
kvm_io_device
dev_master
;
struct
kvm_io_device
dev_slave
;
struct
kvm_io_device
dev_elcr
;
void
(
*
ack_notifier
)(
void
*
opaque
,
int
irq
);
unsigned
long
irq_states
[
PIC_NUM_PINS
];
};
...
...
arch/x86/kvm/mmu/mmu.c
浏览文件 @
d5d1cf47
...
...
@@ -1582,7 +1582,7 @@ bool kvm_unmap_gfn_range(struct kvm *kvm, struct kvm_gfn_range *range)
flush
=
kvm_handle_gfn_range
(
kvm
,
range
,
kvm_unmap_rmapp
);
if
(
is_tdp_mmu_enabled
(
kvm
))
flush
|
=
kvm_tdp_mmu_unmap_gfn_range
(
kvm
,
range
,
flush
);
flush
=
kvm_tdp_mmu_unmap_gfn_range
(
kvm
,
range
,
flush
);
return
flush
;
}
...
...
@@ -5854,7 +5854,7 @@ static bool kvm_mmu_zap_collapsible_spte(struct kvm *kvm,
void
kvm_mmu_zap_collapsible_sptes
(
struct
kvm
*
kvm
,
const
struct
kvm_memory_slot
*
slot
)
{
bool
flush
=
false
;
bool
flush
;
if
(
kvm_memslots_have_rmaps
(
kvm
))
{
write_lock
(
&
kvm
->
mmu_lock
);
...
...
@@ -5871,7 +5871,7 @@ void kvm_mmu_zap_collapsible_sptes(struct kvm *kvm,
if
(
is_tdp_mmu_enabled
(
kvm
))
{
read_lock
(
&
kvm
->
mmu_lock
);
flush
=
kvm_tdp_mmu_zap_collapsible_sptes
(
kvm
,
slot
,
f
lush
);
flush
=
kvm_tdp_mmu_zap_collapsible_sptes
(
kvm
,
slot
,
f
alse
);
if
(
flush
)
kvm_arch_flush_remote_tlbs_memslot
(
kvm
,
slot
);
read_unlock
(
&
kvm
->
mmu_lock
);
...
...
arch/x86/kvm/mmu/tdp_mmu.c
浏览文件 @
d5d1cf47
...
...
@@ -317,9 +317,6 @@ static void handle_removed_tdp_mmu_page(struct kvm *kvm, tdp_ptep_t pt,
struct
kvm_mmu_page
*
sp
=
sptep_to_sp
(
rcu_dereference
(
pt
));
int
level
=
sp
->
role
.
level
;
gfn_t
base_gfn
=
sp
->
gfn
;
u64
old_child_spte
;
u64
*
sptep
;
gfn_t
gfn
;
int
i
;
trace_kvm_mmu_prepare_zap_page
(
sp
);
...
...
@@ -327,8 +324,9 @@ static void handle_removed_tdp_mmu_page(struct kvm *kvm, tdp_ptep_t pt,
tdp_mmu_unlink_page
(
kvm
,
sp
,
shared
);
for
(
i
=
0
;
i
<
PT64_ENT_PER_PAGE
;
i
++
)
{
sptep
=
rcu_dereference
(
pt
)
+
i
;
gfn
=
base_gfn
+
i
*
KVM_PAGES_PER_HPAGE
(
level
);
u64
*
sptep
=
rcu_dereference
(
pt
)
+
i
;
gfn_t
gfn
=
base_gfn
+
i
*
KVM_PAGES_PER_HPAGE
(
level
);
u64
old_child_spte
;
if
(
shared
)
{
/*
...
...
@@ -374,7 +372,7 @@ static void handle_removed_tdp_mmu_page(struct kvm *kvm, tdp_ptep_t pt,
shared
);
}
kvm_flush_remote_tlbs_with_address
(
kvm
,
gfn
,
kvm_flush_remote_tlbs_with_address
(
kvm
,
base_
gfn
,
KVM_PAGES_PER_HPAGE
(
level
+
1
));
call_rcu
(
&
sp
->
rcu_head
,
tdp_mmu_free_sp_rcu_callback
);
...
...
@@ -1034,8 +1032,8 @@ bool kvm_tdp_mmu_unmap_gfn_range(struct kvm *kvm, struct kvm_gfn_range *range,
struct
kvm_mmu_page
*
root
;
for_each_tdp_mmu_root
(
kvm
,
root
,
range
->
slot
->
as_id
)
flush
|
=
zap_gfn_range
(
kvm
,
root
,
range
->
start
,
range
->
end
,
range
->
may_block
,
flush
,
false
);
flush
=
zap_gfn_range
(
kvm
,
root
,
range
->
start
,
range
->
end
,
range
->
may_block
,
flush
,
false
);
return
flush
;
}
...
...
virt/kvm/kvm_main.c
浏览文件 @
d5d1cf47
...
...
@@ -1531,11 +1531,10 @@ static struct kvm_memslots *kvm_dup_memslots(struct kvm_memslots *old,
static
int
kvm_set_memslot
(
struct
kvm
*
kvm
,
const
struct
kvm_userspace_memory_region
*
mem
,
struct
kvm_memory_slot
*
old
,
struct
kvm_memory_slot
*
new
,
int
as_id
,
enum
kvm_mr_change
change
)
{
struct
kvm_memory_slot
*
slot
;
struct
kvm_memory_slot
*
slot
,
old
;
struct
kvm_memslots
*
slots
;
int
r
;
...
...
@@ -1566,7 +1565,7 @@ static int kvm_set_memslot(struct kvm *kvm,
* Note, the INVALID flag needs to be in the appropriate entry
* in the freshly allocated memslots, not in @old or @new.
*/
slot
=
id_to_memslot
(
slots
,
old
->
id
);
slot
=
id_to_memslot
(
slots
,
new
->
id
);
slot
->
flags
|=
KVM_MEMSLOT_INVALID
;
/*
...
...
@@ -1597,6 +1596,26 @@ static int kvm_set_memslot(struct kvm *kvm,
kvm_copy_memslots
(
slots
,
__kvm_memslots
(
kvm
,
as_id
));
}
/*
* Make a full copy of the old memslot, the pointer will become stale
* when the memslots are re-sorted by update_memslots(), and the old
* memslot needs to be referenced after calling update_memslots(), e.g.
* to free its resources and for arch specific behavior. This needs to
* happen *after* (re)acquiring slots_arch_lock.
*/
slot
=
id_to_memslot
(
slots
,
new
->
id
);
if
(
slot
)
{
old
=
*
slot
;
}
else
{
WARN_ON_ONCE
(
change
!=
KVM_MR_CREATE
);
memset
(
&
old
,
0
,
sizeof
(
old
));
old
.
id
=
new
->
id
;
old
.
as_id
=
as_id
;
}
/* Copy the arch-specific data, again after (re)acquiring slots_arch_lock. */
memcpy
(
&
new
->
arch
,
&
old
.
arch
,
sizeof
(
old
.
arch
));
r
=
kvm_arch_prepare_memory_region
(
kvm
,
new
,
mem
,
change
);
if
(
r
)
goto
out_slots
;
...
...
@@ -1604,14 +1623,18 @@ static int kvm_set_memslot(struct kvm *kvm,
update_memslots
(
slots
,
new
,
change
);
slots
=
install_new_memslots
(
kvm
,
as_id
,
slots
);
kvm_arch_commit_memory_region
(
kvm
,
mem
,
old
,
new
,
change
);
kvm_arch_commit_memory_region
(
kvm
,
mem
,
&
old
,
new
,
change
);
/* Free the old memslot's metadata. Note, this is the full copy!!! */
if
(
change
==
KVM_MR_DELETE
)
kvm_free_memslot
(
kvm
,
&
old
);
kvfree
(
slots
);
return
0
;
out_slots:
if
(
change
==
KVM_MR_DELETE
||
change
==
KVM_MR_MOVE
)
{
slot
=
id_to_memslot
(
slots
,
old
->
id
);
slot
=
id_to_memslot
(
slots
,
new
->
id
);
slot
->
flags
&=
~
KVM_MEMSLOT_INVALID
;
slots
=
install_new_memslots
(
kvm
,
as_id
,
slots
);
}
else
{
...
...
@@ -1626,7 +1649,6 @@ static int kvm_delete_memslot(struct kvm *kvm,
struct
kvm_memory_slot
*
old
,
int
as_id
)
{
struct
kvm_memory_slot
new
;
int
r
;
if
(
!
old
->
npages
)
return
-
EINVAL
;
...
...
@@ -1639,12 +1661,7 @@ static int kvm_delete_memslot(struct kvm *kvm,
*/
new
.
as_id
=
as_id
;
r
=
kvm_set_memslot
(
kvm
,
mem
,
old
,
&
new
,
as_id
,
KVM_MR_DELETE
);
if
(
r
)
return
r
;
kvm_free_memslot
(
kvm
,
old
);
return
0
;
return
kvm_set_memslot
(
kvm
,
mem
,
&
new
,
as_id
,
KVM_MR_DELETE
);
}
/*
...
...
@@ -1672,7 +1689,8 @@ int __kvm_set_memory_region(struct kvm *kvm,
id
=
(
u16
)
mem
->
slot
;
/* General sanity checks */
if
(
mem
->
memory_size
&
(
PAGE_SIZE
-
1
))
if
((
mem
->
memory_size
&
(
PAGE_SIZE
-
1
))
||
(
mem
->
memory_size
!=
(
unsigned
long
)
mem
->
memory_size
))
return
-
EINVAL
;
if
(
mem
->
guest_phys_addr
&
(
PAGE_SIZE
-
1
))
return
-
EINVAL
;
...
...
@@ -1718,7 +1736,6 @@ int __kvm_set_memory_region(struct kvm *kvm,
if
(
!
old
.
npages
)
{
change
=
KVM_MR_CREATE
;
new
.
dirty_bitmap
=
NULL
;
memset
(
&
new
.
arch
,
0
,
sizeof
(
new
.
arch
));
}
else
{
/* Modify an existing slot. */
if
((
new
.
userspace_addr
!=
old
.
userspace_addr
)
||
(
new
.
npages
!=
old
.
npages
)
||
...
...
@@ -1732,9 +1749,8 @@ int __kvm_set_memory_region(struct kvm *kvm,
else
/* Nothing to change. */
return
0
;
/* Copy dirty_bitmap
and arch
from the current memslot. */
/* Copy dirty_bitmap from the current memslot. */
new
.
dirty_bitmap
=
old
.
dirty_bitmap
;
memcpy
(
&
new
.
arch
,
&
old
.
arch
,
sizeof
(
new
.
arch
));
}
if
((
change
==
KVM_MR_CREATE
)
||
(
change
==
KVM_MR_MOVE
))
{
...
...
@@ -1760,7 +1776,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
bitmap_set
(
new
.
dirty_bitmap
,
0
,
new
.
npages
);
}
r
=
kvm_set_memslot
(
kvm
,
mem
,
&
old
,
&
new
,
as_id
,
change
);
r
=
kvm_set_memslot
(
kvm
,
mem
,
&
new
,
as_id
,
change
);
if
(
r
)
goto
out_bitmap
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录