Message ID | 1461123261-15408-3-git-send-email-arei.gonglei@huawei.com |
---|---|
State | New |
Headers | show |
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 <arei.gonglei@huawei.com> > --- > 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 > >
> From: Fam Zheng [mailto:famz@redhat.com] > Sent: Friday, April 29, 2016 3:57 PM > To: Gonglei (Arei) > Cc: qemu-devel@nongnu.org; pbonzini@redhat.com; Huangpeng (Peter) > Subject: Re: [PATCH 2/3] exec: adjuest rcu_read_lock requiement > > 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/ > OK, thanks :) > > qemu_ram_set_idstr() as small as possible. > > Regards, -Gonglei
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. */ 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)
qemu_ram_unset_idstr() don't need rcu lock anymore, meanwhile adjuest the range of rcu lock in qemu_ram_set_idstr() as small as possible. Signed-off-by: Gonglei <arei.gonglei@huawei.com> --- exec.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)