Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-04-12 Thread Alex Bennée
Bin Meng writes: > On Sat, Apr 2, 2022 at 7:20 PM Bin Meng wrote: >> >> On Tue, Mar 29, 2022 at 12:43 PM Bin Meng wrote: >> > >> > On Mon, Mar 28, 2022 at 5:10 PM Peter Maydell >> > wrote: >> > > >> > > On Mon, 28 Mar 2022 at 03:10, Bin Meng wrote: >> > > > IMHO it's too bad to just ignore

Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-04-08 Thread Alex Bennée
Bin Meng writes: > On Sat, Apr 2, 2022 at 7:20 PM Bin Meng wrote: >> >> On Tue, Mar 29, 2022 at 12:43 PM Bin Meng wrote: >> > >> > On Mon, Mar 28, 2022 at 5:10 PM Peter Maydell >> > wrote: >> > > >> > > On Mon, 28 Mar 2022 at 03:10, Bin Meng wrote: >> > > > IMHO it's too bad to just ignore

Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-04-07 Thread Bin Meng
On Sat, Apr 2, 2022 at 7:20 PM Bin Meng wrote: > > On Tue, Mar 29, 2022 at 12:43 PM Bin Meng wrote: > > > > On Mon, Mar 28, 2022 at 5:10 PM Peter Maydell > > wrote: > > > > > > On Mon, 28 Mar 2022 at 03:10, Bin Meng wrote: > > > > IMHO it's too bad to just ignore this bug forever. > > > > > >

Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-04-02 Thread Bin Meng
On Tue, Mar 29, 2022 at 12:43 PM Bin Meng wrote: > > On Mon, Mar 28, 2022 at 5:10 PM Peter Maydell > wrote: > > > > On Mon, 28 Mar 2022 at 03:10, Bin Meng wrote: > > > IMHO it's too bad to just ignore this bug forever. > > > > > > This is a valid use case. It's not about whether we intentionall

Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-03-28 Thread Bin Meng
On Mon, Mar 28, 2022 at 5:10 PM Peter Maydell wrote: > > On Mon, 28 Mar 2022 at 03:10, Bin Meng wrote: > > IMHO it's too bad to just ignore this bug forever. > > > > This is a valid use case. It's not about whether we intentionally want > > to inspect the GIC register value from gdb. The case is

Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-03-28 Thread Peter Maydell
On Mon, 28 Mar 2022 at 03:10, Bin Meng wrote: > IMHO it's too bad to just ignore this bug forever. > > This is a valid use case. It's not about whether we intentionally want > to inspect the GIC register value from gdb. The case is that when > single stepping the source codes it triggers the core

Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-03-27 Thread Bin Meng
On Thu, Mar 24, 2022 at 7:52 PM Peter Maydell wrote: > > On Thu, 24 Mar 2022 at 10:33, Alex Bennée wrote: > > I think we need to not use cpu_physical_memory_write (which is > > explicitly the system address space) but have a function that takes cpu > > so it can work out the correct address space

Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-03-24 Thread Peter Maydell
On Thu, 24 Mar 2022 at 10:33, Alex Bennée wrote: > I think we need to not use cpu_physical_memory_write (which is > explicitly the system address space) but have a function that takes cpu > so it can work out the correct address space to you > address_space_read/write. If null we could probably re

Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-03-24 Thread Alex Bennée
Bin Meng writes: > On Tue, Mar 22, 2022 at 11:56 PM Peter Maydell > wrote: >> >> On Tue, 22 Mar 2022 at 15:43, Bin Meng wrote: >> > >> > When accessing the per-CPU register bank of some devices (e.g.: GIC) >> > from the GDB stub context, a segfault occurs. This is due to current_cpu >> > is

Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-03-23 Thread Bin Meng
On Tue, Mar 22, 2022 at 11:56 PM Peter Maydell wrote: > > On Tue, 22 Mar 2022 at 15:43, Bin Meng wrote: > > > > When accessing the per-CPU register bank of some devices (e.g.: GIC) > > from the GDB stub context, a segfault occurs. This is due to current_cpu > > is not set, as the contect is not a

Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-03-22 Thread Peter Maydell
On Tue, 22 Mar 2022 at 18:59, Philippe Mathieu-Daudé wrote: > On 22/3/22 16:56, Peter Maydell wrote: > > This works, but I worry a bit that it might have unexpected > > side effects, and setting globals (even if thread-local) to > > cause side-effects elsewhere isn't ideal... > > Yeah, gdbstub is

Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-03-22 Thread Philippe Mathieu-Daudé
+Thomas On 22/3/22 16:56, Peter Maydell wrote: On Tue, 22 Mar 2022 at 15:43, Bin Meng wrote: When accessing the per-CPU register bank of some devices (e.g.: GIC) from the GDB stub context, a segfault occurs. This is due to current_cpu is not set, as the contect is not a guest CPU. Let's set

Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-03-22 Thread Peter Maydell
On Tue, 22 Mar 2022 at 15:43, Bin Meng wrote: > > When accessing the per-CPU register bank of some devices (e.g.: GIC) > from the GDB stub context, a segfault occurs. This is due to current_cpu > is not set, as the contect is not a guest CPU. > > Let's set current_cpu before doing the acutal memor

[PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-03-22 Thread Bin Meng
When accessing the per-CPU register bank of some devices (e.g.: GIC) from the GDB stub context, a segfault occurs. This is due to current_cpu is not set, as the contect is not a guest CPU. Let's set current_cpu before doing the acutal memory read write. Resolves: https://gitlab.com/qemu-project/q