* [Qemu-devel] [PATCH v2 0/2] BQL patches for the lm32 target
@ 2018-05-21 12:20 Michael Walle
2018-05-21 12:20 ` [Qemu-devel] [PATCH v2 1/2] lm32: take BQL before writing IP/IM register Michael Walle
2018-05-21 12:21 ` [Qemu-devel] [PATCH v2 2/2] target/lm32: hold BQL in gdbstub Michael Walle
0 siblings, 2 replies; 6+ messages in thread
From: Michael Walle @ 2018-05-21 12:20 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bennée, Paolo Bonzini, Michael Walle
Whoops, forget the include patch chunk for the second patch.
I'll send a pull request next week if there are no comments on the
patches.
since v1:
add missing #include
Michael Walle (2):
lm32: take BQL before writing IP/IM register
target/lm32: hold BQL in gdbstub
target/lm32/gdbstub.c | 5 +++++
target/lm32/op_helper.c | 4 ++++
2 files changed, 9 insertions(+)
--
2.11.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v2 1/2] lm32: take BQL before writing IP/IM register
2018-05-21 12:20 [Qemu-devel] [PATCH v2 0/2] BQL patches for the lm32 target Michael Walle
@ 2018-05-21 12:20 ` Michael Walle
2018-05-21 12:21 ` [Qemu-devel] [PATCH v2 2/2] target/lm32: hold BQL in gdbstub Michael Walle
1 sibling, 0 replies; 6+ messages in thread
From: Michael Walle @ 2018-05-21 12:20 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bennée, Paolo Bonzini, Michael Walle, qemu-stable
Writing to these registers may raise an interrupt request. Actually,
this prevents the milkymist board from starting.
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Walle <michael@walle.cc>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
---
target/lm32/op_helper.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/target/lm32/op_helper.c b/target/lm32/op_helper.c
index 577f8306e3..234d55e056 100644
--- a/target/lm32/op_helper.c
+++ b/target/lm32/op_helper.c
@@ -102,12 +102,16 @@ void HELPER(wcsr_dc)(CPULM32State *env, uint32_t dc)
void HELPER(wcsr_im)(CPULM32State *env, uint32_t im)
{
+ qemu_mutex_lock_iothread();
lm32_pic_set_im(env->pic_state, im);
+ qemu_mutex_unlock_iothread();
}
void HELPER(wcsr_ip)(CPULM32State *env, uint32_t im)
{
+ qemu_mutex_lock_iothread();
lm32_pic_set_ip(env->pic_state, im);
+ qemu_mutex_unlock_iothread();
}
void HELPER(wcsr_jtx)(CPULM32State *env, uint32_t jtx)
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v2 2/2] target/lm32: hold BQL in gdbstub
2018-05-21 12:20 [Qemu-devel] [PATCH v2 0/2] BQL patches for the lm32 target Michael Walle
2018-05-21 12:20 ` [Qemu-devel] [PATCH v2 1/2] lm32: take BQL before writing IP/IM register Michael Walle
@ 2018-05-21 12:21 ` Michael Walle
2018-05-21 12:25 ` Peter Maydell
1 sibling, 1 reply; 6+ messages in thread
From: Michael Walle @ 2018-05-21 12:21 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bennée, Paolo Bonzini, Michael Walle, qemu-stable
Changing the IP/IM registers may cause interrupts, so hold the BQL.
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Walle <michael@walle.cc>
---
target/lm32/gdbstub.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/target/lm32/gdbstub.c b/target/lm32/gdbstub.c
index cf929dd392..dac9418a2b 100644
--- a/target/lm32/gdbstub.c
+++ b/target/lm32/gdbstub.c
@@ -18,6 +18,7 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "qemu/osdep.h"
+#include "qemu/main-loop.h"
#include "qemu-common.h"
#include "cpu.h"
#include "exec/gdbstub.h"
@@ -82,10 +83,14 @@ int lm32_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
env->ie = tmp;
break;
case 37:
+ qemu_mutex_lock_iothread();
lm32_pic_set_im(env->pic_state, tmp);
+ qemu_mutex_unlock_iothread();
break;
case 38:
+ qemu_mutex_lock_iothread();
lm32_pic_set_ip(env->pic_state, tmp);
+ qemu_mutex_unlock_iothread();
break;
}
}
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/2] target/lm32: hold BQL in gdbstub
2018-05-21 12:21 ` [Qemu-devel] [PATCH v2 2/2] target/lm32: hold BQL in gdbstub Michael Walle
@ 2018-05-21 12:25 ` Peter Maydell
2018-05-21 12:29 ` Peter Maydell
2018-05-21 15:49 ` Michael Walle
0 siblings, 2 replies; 6+ messages in thread
From: Peter Maydell @ 2018-05-21 12:25 UTC (permalink / raw)
To: Michael Walle
Cc: QEMU Developers, Paolo Bonzini, Alex Bennée, qemu-stable
On 21 May 2018 at 13:21, Michael Walle <michael@walle.cc> wrote:
> Changing the IP/IM registers may cause interrupts, so hold the BQL.
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
> target/lm32/gdbstub.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/target/lm32/gdbstub.c b/target/lm32/gdbstub.c
> index cf929dd392..dac9418a2b 100644
> --- a/target/lm32/gdbstub.c
> +++ b/target/lm32/gdbstub.c
> @@ -18,6 +18,7 @@
> * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> */
> #include "qemu/osdep.h"
> +#include "qemu/main-loop.h"
> #include "qemu-common.h"
> #include "cpu.h"
> #include "exec/gdbstub.h"
> @@ -82,10 +83,14 @@ int lm32_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
> env->ie = tmp;
> break;
> case 37:
> + qemu_mutex_lock_iothread();
> lm32_pic_set_im(env->pic_state, tmp);
> + qemu_mutex_unlock_iothread();
> break;
> case 38:
> + qemu_mutex_lock_iothread();
> lm32_pic_set_ip(env->pic_state, tmp);
> + qemu_mutex_unlock_iothread();
> break;
> }
> }
Are you sure this is necessary? I would have expected the gdbstub to
be operating under the qemu lock anyway.
thanks
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/2] target/lm32: hold BQL in gdbstub
2018-05-21 12:25 ` Peter Maydell
@ 2018-05-21 12:29 ` Peter Maydell
2018-05-21 15:49 ` Michael Walle
1 sibling, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2018-05-21 12:29 UTC (permalink / raw)
To: Michael Walle
Cc: QEMU Developers, Paolo Bonzini, Alex Bennée, qemu-stable
On 21 May 2018 at 13:25, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 21 May 2018 at 13:21, Michael Walle <michael@walle.cc> wrote:
>> Changing the IP/IM registers may cause interrupts, so hold the BQL.
>>
>> Cc: qemu-stable@nongnu.org
>> Signed-off-by: Michael Walle <michael@walle.cc>
>> ---
>> target/lm32/gdbstub.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/target/lm32/gdbstub.c b/target/lm32/gdbstub.c
>> index cf929dd392..dac9418a2b 100644
>> --- a/target/lm32/gdbstub.c
>> +++ b/target/lm32/gdbstub.c
>> @@ -18,6 +18,7 @@
>> * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>> */
>> #include "qemu/osdep.h"
>> +#include "qemu/main-loop.h"
>> #include "qemu-common.h"
>> #include "cpu.h"
>> #include "exec/gdbstub.h"
>> @@ -82,10 +83,14 @@ int lm32_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
>> env->ie = tmp;
>> break;
>> case 37:
>> + qemu_mutex_lock_iothread();
>> lm32_pic_set_im(env->pic_state, tmp);
>> + qemu_mutex_unlock_iothread();
>> break;
>> case 38:
>> + qemu_mutex_lock_iothread();
>> lm32_pic_set_ip(env->pic_state, tmp);
>> + qemu_mutex_unlock_iothread();
>> break;
>> }
>> }
>
> Are you sure this is necessary? I would have expected the gdbstub to
> be operating under the qemu lock anyway.
...experimentation suggests that the gdbstub is called via
chardev write events which are triggered by glib_pollfds_poll(),
which is called by os_host_main_loop_wait() only when it holds
the iothread lock.
thanks
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/2] target/lm32: hold BQL in gdbstub
2018-05-21 12:25 ` Peter Maydell
2018-05-21 12:29 ` Peter Maydell
@ 2018-05-21 15:49 ` Michael Walle
1 sibling, 0 replies; 6+ messages in thread
From: Michael Walle @ 2018-05-21 15:49 UTC (permalink / raw)
To: Peter Maydell
Cc: QEMU Developers, Paolo Bonzini, Alex Bennée, qemu-stable
Am 2018-05-21 14:25, schrieb Peter Maydell:
> On 21 May 2018 at 13:21, Michael Walle <michael@walle.cc> wrote:
>> Changing the IP/IM registers may cause interrupts, so hold the BQL.
>>
>> Cc: qemu-stable@nongnu.org
>> Signed-off-by: Michael Walle <michael@walle.cc>
>> ---
>> target/lm32/gdbstub.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/target/lm32/gdbstub.c b/target/lm32/gdbstub.c
>> index cf929dd392..dac9418a2b 100644
>> --- a/target/lm32/gdbstub.c
>> +++ b/target/lm32/gdbstub.c
>> @@ -18,6 +18,7 @@
>> * License along with this library; if not, see
>> <http://www.gnu.org/licenses/>.
>> */
>> #include "qemu/osdep.h"
>> +#include "qemu/main-loop.h"
>> #include "qemu-common.h"
>> #include "cpu.h"
>> #include "exec/gdbstub.h"
>> @@ -82,10 +83,14 @@ int lm32_cpu_gdb_write_register(CPUState *cs,
>> uint8_t *mem_buf, int n)
>> env->ie = tmp;
>> break;
>> case 37:
>> + qemu_mutex_lock_iothread();
>> lm32_pic_set_im(env->pic_state, tmp);
>> + qemu_mutex_unlock_iothread();
>> break;
>> case 38:
>> + qemu_mutex_lock_iothread();
>> lm32_pic_set_ip(env->pic_state, tmp);
>> + qemu_mutex_unlock_iothread();
>> break;
>> }
>> }
>
> Are you sure this is necessary? I would have expected the gdbstub to
> be operating under the qemu lock anyway.
You're right. The gdbstub is already holding the lock. So i'll drop this
and send the pull request right now.
-michael
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-05-21 15:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-21 12:20 [Qemu-devel] [PATCH v2 0/2] BQL patches for the lm32 target Michael Walle
2018-05-21 12:20 ` [Qemu-devel] [PATCH v2 1/2] lm32: take BQL before writing IP/IM register Michael Walle
2018-05-21 12:21 ` [Qemu-devel] [PATCH v2 2/2] target/lm32: hold BQL in gdbstub Michael Walle
2018-05-21 12:25 ` Peter Maydell
2018-05-21 12:29 ` Peter Maydell
2018-05-21 15:49 ` Michael Walle
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.