Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
79fac95e
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看板
提交
79fac95e
编写于
12月 23, 2009
作者:
M
Marcelo Tosatti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
KVM: convert slots_lock to a mutex
Signed-off-by:
N
Marcelo Tosatti
<
mtosatti@redhat.com
>
上级
f656ce01
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
39 addition
and
39 deletion
+39
-39
arch/ia64/kvm/kvm-ia64.c
arch/ia64/kvm/kvm-ia64.c
+2
-2
arch/powerpc/kvm/book3s.c
arch/powerpc/kvm/book3s.c
+2
-2
arch/x86/kvm/i8254.c
arch/x86/kvm/i8254.c
+1
-1
arch/x86/kvm/i8259.c
arch/x86/kvm/i8259.c
+2
-2
arch/x86/kvm/vmx.c
arch/x86/kvm/vmx.c
+4
-4
arch/x86/kvm/x86.c
arch/x86/kvm/x86.c
+8
-8
include/linux/kvm_host.h
include/linux/kvm_host.h
+1
-1
virt/kvm/coalesced_mmio.c
virt/kvm/coalesced_mmio.c
+7
-7
virt/kvm/eventfd.c
virt/kvm/eventfd.c
+5
-5
virt/kvm/ioapic.c
virt/kvm/ioapic.c
+2
-2
virt/kvm/kvm_main.c
virt/kvm/kvm_main.c
+5
-5
未找到文件。
arch/ia64/kvm/kvm-ia64.c
浏览文件 @
79fac95e
...
...
@@ -1834,7 +1834,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
struct
kvm_memory_slot
*
memslot
;
int
is_dirty
=
0
;
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
spin_lock
(
&
kvm
->
arch
.
dirty_log_lock
);
r
=
kvm_ia64_sync_dirty_log
(
kvm
,
log
);
...
...
@@ -1854,7 +1854,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
}
r
=
0
;
out:
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
spin_unlock
(
&
kvm
->
arch
.
dirty_log_lock
);
return
r
;
}
...
...
arch/powerpc/kvm/book3s.c
浏览文件 @
79fac95e
...
...
@@ -857,7 +857,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
int
is_dirty
=
0
;
int
r
,
n
;
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
r
=
kvm_get_dirty_log
(
kvm
,
log
,
&
is_dirty
);
if
(
r
)
...
...
@@ -879,7 +879,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
r
=
0
;
out:
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
return
r
;
}
...
...
arch/x86/kvm/i8254.c
浏览文件 @
79fac95e
...
...
@@ -605,7 +605,7 @@ static const struct kvm_io_device_ops speaker_dev_ops = {
.
write
=
speaker_ioport_write
,
};
/* Caller must h
ave writers lock on
slots_lock */
/* Caller must h
old
slots_lock */
struct
kvm_pit
*
kvm_create_pit
(
struct
kvm
*
kvm
,
u32
flags
)
{
struct
kvm_pit
*
pit
;
...
...
arch/x86/kvm/i8259.c
浏览文件 @
79fac95e
...
...
@@ -533,9 +533,9 @@ struct kvm_pic *kvm_create_pic(struct kvm *kvm)
* Initialize PIO device
*/
kvm_iodevice_init
(
&
s
->
dev
,
&
picdev_ops
);
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
ret
=
kvm_io_bus_register_dev
(
kvm
,
KVM_PIO_BUS
,
&
s
->
dev
);
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
if
(
ret
<
0
)
{
kfree
(
s
);
return
NULL
;
...
...
arch/x86/kvm/vmx.c
浏览文件 @
79fac95e
...
...
@@ -2223,7 +2223,7 @@ static int alloc_apic_access_page(struct kvm *kvm)
struct
kvm_userspace_memory_region
kvm_userspace_mem
;
int
r
=
0
;
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
if
(
kvm
->
arch
.
apic_access_page
)
goto
out
;
kvm_userspace_mem
.
slot
=
APIC_ACCESS_PAGE_PRIVATE_MEMSLOT
;
...
...
@@ -2236,7 +2236,7 @@ static int alloc_apic_access_page(struct kvm *kvm)
kvm
->
arch
.
apic_access_page
=
gfn_to_page
(
kvm
,
0xfee00
);
out:
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
return
r
;
}
...
...
@@ -2245,7 +2245,7 @@ static int alloc_identity_pagetable(struct kvm *kvm)
struct
kvm_userspace_memory_region
kvm_userspace_mem
;
int
r
=
0
;
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
if
(
kvm
->
arch
.
ept_identity_pagetable
)
goto
out
;
kvm_userspace_mem
.
slot
=
IDENTITY_PAGETABLE_PRIVATE_MEMSLOT
;
...
...
@@ -2260,7 +2260,7 @@ static int alloc_identity_pagetable(struct kvm *kvm)
kvm
->
arch
.
ept_identity_pagetable
=
gfn_to_page
(
kvm
,
kvm
->
arch
.
ept_identity_map_addr
>>
PAGE_SHIFT
);
out:
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
return
r
;
}
...
...
arch/x86/kvm/x86.c
浏览文件 @
79fac95e
...
...
@@ -2208,14 +2208,14 @@ static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm,
if
(
kvm_nr_mmu_pages
<
KVM_MIN_ALLOC_MMU_PAGES
)
return
-
EINVAL
;
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
spin_lock
(
&
kvm
->
mmu_lock
);
kvm_mmu_change_mmu_pages
(
kvm
,
kvm_nr_mmu_pages
);
kvm
->
arch
.
n_requested_mmu_pages
=
kvm_nr_mmu_pages
;
spin_unlock
(
&
kvm
->
mmu_lock
);
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
return
0
;
}
...
...
@@ -2292,7 +2292,7 @@ static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm,
if
(
!
aliases
)
goto
out
;
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
/* invalidate any gfn reference in case of deletion/shrinking */
memcpy
(
aliases
,
kvm
->
arch
.
aliases
,
sizeof
(
struct
kvm_mem_aliases
));
...
...
@@ -2328,7 +2328,7 @@ static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm,
r
=
0
;
out_unlock:
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
out:
return
r
;
}
...
...
@@ -2462,7 +2462,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
unsigned
long
is_dirty
=
0
;
unsigned
long
*
dirty_bitmap
=
NULL
;
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
r
=
-
EINVAL
;
if
(
log
->
slot
>=
KVM_MEMORY_SLOTS
)
...
...
@@ -2512,7 +2512,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
out_free:
vfree
(
dirty_bitmap
);
out:
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
return
r
;
}
...
...
@@ -2625,7 +2625,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
sizeof
(
struct
kvm_pit_config
)))
goto
out
;
create_pit:
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
r
=
-
EEXIST
;
if
(
kvm
->
arch
.
vpit
)
goto
create_pit_unlock
;
...
...
@@ -2634,7 +2634,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
if
(
kvm
->
arch
.
vpit
)
r
=
0
;
create_pit_unlock:
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
break
;
case
KVM_IRQ_LINE_STATUS
:
case
KVM_IRQ_LINE
:
{
...
...
include/linux/kvm_host.h
浏览文件 @
79fac95e
...
...
@@ -161,7 +161,7 @@ struct kvm_memslots {
struct
kvm
{
spinlock_t
mmu_lock
;
spinlock_t
requests_lock
;
struct
rw_semaphore
slots_lock
;
struct
mutex
slots_lock
;
struct
mm_struct
*
mm
;
/* userspace tied to this vm */
struct
kvm_memslots
*
memslots
;
struct
srcu_struct
srcu
;
...
...
virt/kvm/coalesced_mmio.c
浏览文件 @
79fac95e
...
...
@@ -110,9 +110,9 @@ int kvm_coalesced_mmio_init(struct kvm *kvm)
dev
->
kvm
=
kvm
;
kvm
->
coalesced_mmio_dev
=
dev
;
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
ret
=
kvm_io_bus_register_dev
(
kvm
,
KVM_MMIO_BUS
,
&
dev
->
dev
);
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
if
(
ret
<
0
)
goto
out_free_dev
;
...
...
@@ -140,16 +140,16 @@ int kvm_vm_ioctl_register_coalesced_mmio(struct kvm *kvm,
if
(
dev
==
NULL
)
return
-
EINVAL
;
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
if
(
dev
->
nb_zones
>=
KVM_COALESCED_MMIO_ZONE_MAX
)
{
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
return
-
ENOBUFS
;
}
dev
->
zone
[
dev
->
nb_zones
]
=
*
zone
;
dev
->
nb_zones
++
;
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
return
0
;
}
...
...
@@ -163,7 +163,7 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
if
(
dev
==
NULL
)
return
-
EINVAL
;
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
i
=
dev
->
nb_zones
;
while
(
i
)
{
...
...
@@ -181,7 +181,7 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
i
--
;
}
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
return
0
;
}
virt/kvm/eventfd.c
浏览文件 @
79fac95e
...
...
@@ -508,7 +508,7 @@ kvm_assign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
else
p
->
wildcard
=
true
;
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
/* Verify that there isnt a match already */
if
(
ioeventfd_check_collision
(
kvm
,
p
))
{
...
...
@@ -524,12 +524,12 @@ kvm_assign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
list_add_tail
(
&
p
->
list
,
&
kvm
->
ioeventfds
);
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
return
0
;
unlock_fail:
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
fail:
kfree
(
p
);
...
...
@@ -551,7 +551,7 @@ kvm_deassign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
if
(
IS_ERR
(
eventfd
))
return
PTR_ERR
(
eventfd
);
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
list_for_each_entry_safe
(
p
,
tmp
,
&
kvm
->
ioeventfds
,
list
)
{
bool
wildcard
=
!
(
args
->
flags
&
KVM_IOEVENTFD_FLAG_DATAMATCH
);
...
...
@@ -571,7 +571,7 @@ kvm_deassign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
break
;
}
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
eventfd_ctx_put
(
eventfd
);
...
...
virt/kvm/ioapic.c
浏览文件 @
79fac95e
...
...
@@ -372,9 +372,9 @@ int kvm_ioapic_init(struct kvm *kvm)
kvm_ioapic_reset
(
ioapic
);
kvm_iodevice_init
(
&
ioapic
->
dev
,
&
ioapic_mmio_ops
);
ioapic
->
kvm
=
kvm
;
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
ret
=
kvm_io_bus_register_dev
(
kvm
,
KVM_MMIO_BUS
,
&
ioapic
->
dev
);
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
if
(
ret
<
0
)
kfree
(
ioapic
);
...
...
virt/kvm/kvm_main.c
浏览文件 @
79fac95e
...
...
@@ -429,7 +429,7 @@ static struct kvm *kvm_create_vm(void)
kvm_eventfd_init
(
kvm
);
mutex_init
(
&
kvm
->
lock
);
mutex_init
(
&
kvm
->
irq_lock
);
init_rwsem
(
&
kvm
->
slots_lock
);
mutex_init
(
&
kvm
->
slots_lock
);
atomic_set
(
&
kvm
->
users_count
,
1
);
spin_lock
(
&
kvm_lock
);
list_add
(
&
kvm
->
vm_list
,
&
vm_list
);
...
...
@@ -763,9 +763,9 @@ int kvm_set_memory_region(struct kvm *kvm,
{
int
r
;
down_write
(
&
kvm
->
slots_lock
);
mutex_lock
(
&
kvm
->
slots_lock
);
r
=
__kvm_set_memory_region
(
kvm
,
mem
,
user_alloc
);
up_write
(
&
kvm
->
slots_lock
);
mutex_unlock
(
&
kvm
->
slots_lock
);
return
r
;
}
EXPORT_SYMBOL_GPL
(
kvm_set_memory_region
);
...
...
@@ -1997,7 +1997,7 @@ int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
return
-
EOPNOTSUPP
;
}
/* Caller must h
ave write lock on
slots_lock. */
/* Caller must h
old
slots_lock. */
int
kvm_io_bus_register_dev
(
struct
kvm
*
kvm
,
enum
kvm_bus
bus_idx
,
struct
kvm_io_device
*
dev
)
{
...
...
@@ -2019,7 +2019,7 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx,
return
0
;
}
/* Caller must h
ave write lock on
slots_lock. */
/* Caller must h
old
slots_lock. */
int
kvm_io_bus_unregister_dev
(
struct
kvm
*
kvm
,
enum
kvm_bus
bus_idx
,
struct
kvm_io_device
*
dev
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录