[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/3] exec: adjuest rcu_read_lock requiement
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH 2/3] exec: adjuest rcu_read_lock requiement |
Date: |
Fri, 29 Apr 2016 15:56:54 +0800 |
User-agent: |
Mutt/1.6.0 (2016-04-01) |
In the subject line, s/adjuest/adjust/ and s/requiement/requirement/.
On Wed, 04/20 11:34, Gonglei wrote:
> qemu_ram_unset_idstr() don't need rcu lock anymore,
s/don't/doesn't/
> meanwhile adjuest the range of rcu lock in
s/adjuest/adjust/ or just s/adjuest/make/
> qemu_ram_set_idstr() as small as possible.
>
> Signed-off-by: Gonglei <address@hidden>
> ---
> exec.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index 101f0f4..b0ecbcd 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1418,8 +1418,6 @@ void qemu_ram_set_idstr(RAMBlock *block, const char
> *name, DeviceState *dev)
> RAMBlock *new_block = block;
> RAMBlock *old_block;
>
> - rcu_read_lock();
> -
> assert(new_block);
> assert(!new_block->idstr[0]);
>
> @@ -1432,6 +1430,7 @@ void qemu_ram_set_idstr(RAMBlock *block, const char
> *name, DeviceState *dev)
> }
> pstrcat(new_block->idstr, sizeof(new_block->idstr), name);
>
> + rcu_read_lock();
> QLIST_FOREACH_RCU(old_block, &ram_list.blocks, next) {
> if (old_block != new_block &&
> !strcmp(old_block->idstr, new_block->idstr)) {
> @@ -1443,7 +1442,6 @@ void qemu_ram_set_idstr(RAMBlock *block, const char
> *name, DeviceState *dev)
> rcu_read_unlock();
> }
>
> -/* Called with iothread lock held. */
This still seems true to me, why removing?
> void qemu_ram_unset_idstr(RAMBlock *block)
> {
> /* FIXME: arch_init.c assumes that this is not called throughout
> @@ -1451,11 +1449,9 @@ void qemu_ram_unset_idstr(RAMBlock *block)
> * does not work anyway.
> */
>
> - rcu_read_lock();
> if (block) {
> memset(block->idstr, 0, sizeof(block->idstr));
> }
> - rcu_read_unlock();
> }
>
> static int memory_try_enable_merging(void *addr, size_t len)
> --
> 1.7.12.4
>
>