[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 03/10] tcg: Use one-insn-per-tb accelerator property in cu
From: |
Peter Maydell |
Subject: |
Re: [PATCH v2 03/10] tcg: Use one-insn-per-tb accelerator property in curr_cflags() |
Date: |
Thu, 13 Apr 2023 17:24:21 +0100 |
On Mon, 3 Apr 2023 at 19:33, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 4/3/23 07:46, Peter Maydell wrote:
> > uint32_t curr_cflags(CPUState *cpu)
> > {
> > uint32_t cflags = cpu->tcg_cflags;
> > + TCGState *tcgstate = TCG_STATE(current_accel());
>
> As mentioned against the cover, this is a very hot path.
>
> We should try for something less expensive. Perhaps as simple as
>
> return cpu->tcg_cflags | tcg_cflags_global;
>
> where cpu->tcg_cflags is updated with cpu->singlestep_enabled.
I feel like that introduces atomicity issues. If I'm reading
the code right, curr_cflags() is called without any kind
of lock held. At the moment we get away with this because
'singlestep' is an int and is always going to be atomically
updated. If we make tcg_cflags_global a value which might have
multiple bits set or not set I'm not entirely sure what the
right way is to handle the reads and writes of it.
I think we can assume we have the iothread lock at any
point where we want to change either 'singlestep' or
the 'nochain' option, at least.
Any suggestions? I'm not very familiar with the
qemu atomic primitives...
thanks
-- PMM
- Re: [PATCH v2 05/10] bsd-user: Add '-one-insn-per-tb' option equivalent to '-singlestep', (continued)
- [PATCH v2 02/10] softmmu: Don't use 'singlestep' global in QMP and HMP commands, Peter Maydell, 2023/04/03
- [PATCH v2 06/10] Document that -singlestep command line option is deprecated, Peter Maydell, 2023/04/03
- [PATCH v2 08/10] hmp: Report 'one-insn-per-tb', not 'single step mode', in 'info status' output, Peter Maydell, 2023/04/03
- [PATCH v2 03/10] tcg: Use one-insn-per-tb accelerator property in curr_cflags(), Peter Maydell, 2023/04/03
- [PATCH v2 09/10] qapi/run-state.json: Fix missing newline at end of file, Peter Maydell, 2023/04/03
- [PATCH v2 10/10] hmp: Deprecate 'singlestep' member of StatusInfo, Peter Maydell, 2023/04/03
- Re: [PATCH v2 10/10] hmp: Deprecate 'singlestep' member of StatusInfo, Markus Armbruster, 2023/04/04
- Re: [PATCH v2 10/10] hmp: Deprecate 'singlestep' member of StatusInfo, Peter Maydell, 2023/04/04
- Re: [PATCH v2 10/10] hmp: Deprecate 'singlestep' member of StatusInfo, Markus Armbruster, 2023/04/04
- Re: [PATCH v2 10/10] hmp: Deprecate 'singlestep' member of StatusInfo, Peter Maydell, 2023/04/04
- Re: [PATCH v2 10/10] hmp: Deprecate 'singlestep' member of StatusInfo, Paolo Bonzini, 2023/04/04
- Re: [PATCH v2 10/10] hmp: Deprecate 'singlestep' member of StatusInfo, Dr. David Alan Gilbert, 2023/04/05